I have a user with a secondary and a primary email. What API call do I use to find the user by primary or secondary email? This call fails to return any results. I tried both hs_additonal_emails and email as the field:
Hello again, Teun. We looked into it further, and we were able to resolve the issue - it turns out that, in line with the API, we needed to have multiple filter groups, with 1 filter each for the necessary OR comparison, as described below:
"When multiple filters are provided within a filterGroup, they will be combined using a logical AND operator. When multiple filterGroups are provided, they will be combined using a logical OR operator. The system supports a maximum of three filterGroups with up to three filters each."
And when removing the extra filter in the 1st group in the curl example on the page, the JSON structure matches your recommended format:
I copied the solution of this post, might help you out. I see that the code matches your code. But I tested this solution with Postman, and the described setup below should work. I could find my contact with my primary email but also with my secondary email.
Using the EQ operator when searching on the 'email' property won't return contacts based on their secondary emails; it'll only return contacts with a primary email that matches the search term.
What you might consider doing instead (or in combination) is using the CONTAINS_TOKEN operator and searching the 'hs_additional_emails' field. Here's an example body that should do the trick:
This is really odd. What programming language are you using? I tested the above body with Postman and was able to get the results. Is your hapikey valid?
Learn more about HubSpot by following me on LinkedIn or YouTube
✅ Did my answer solve your issue? Help the community by marking it as the solution.
Hello again, Teun. We looked into it further, and we were able to resolve the issue - it turns out that, in line with the API, we needed to have multiple filter groups, with 1 filter each for the necessary OR comparison, as described below:
"When multiple filters are provided within a filterGroup, they will be combined using a logical AND operator. When multiple filterGroups are provided, they will be combined using a logical OR operator. The system supports a maximum of three filterGroups with up to three filters each."
And when removing the extra filter in the 1st group in the curl example on the page, the JSON structure matches your recommended format: