<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Search for users by email with multiple emails in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/497710#M46997</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;POST &lt;A href="https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=X" target="_blank" rel="noopener"&gt;https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=X&lt;/A&gt; HTTP/1.1&lt;BR /&gt;Accept: application/json&lt;BR /&gt;Content-Type: application/json&lt;BR /&gt;Host: api.hubapi.com&lt;BR /&gt;Content-Length: 721&lt;BR /&gt;Expect: 100-continue&lt;BR /&gt;Connection: Keep-Alive&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"filterGroups": [&lt;BR /&gt;{&lt;BR /&gt;"filters": [&lt;BR /&gt;{&lt;BR /&gt;"value": "it@iii.com",&lt;BR /&gt;"propertyName": "hs_additional_emails",&lt;BR /&gt;"operator": "CONTAINS_TOKEN"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"sorts": [],&lt;BR /&gt;"limit": 100&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="emails.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/50629i6AEFCFCACEBF523A/image-size/large?v=v2&amp;amp;px=999" role="button" title="emails.png" alt="emails.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Sep 2021 19:56:26 GMT</pubDate>
    <dc:creator>JAnderson1</dc:creator>
    <dc:date>2021-09-20T19:56:26Z</dc:date>
    <item>
      <title>Search for users by email with multiple emails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/497710#M46997</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;POST &lt;A href="https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=X" target="_blank" rel="noopener"&gt;https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=X&lt;/A&gt; HTTP/1.1&lt;BR /&gt;Accept: application/json&lt;BR /&gt;Content-Type: application/json&lt;BR /&gt;Host: api.hubapi.com&lt;BR /&gt;Content-Length: 721&lt;BR /&gt;Expect: 100-continue&lt;BR /&gt;Connection: Keep-Alive&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"filterGroups": [&lt;BR /&gt;{&lt;BR /&gt;"filters": [&lt;BR /&gt;{&lt;BR /&gt;"value": "it@iii.com",&lt;BR /&gt;"propertyName": "hs_additional_emails",&lt;BR /&gt;"operator": "CONTAINS_TOKEN"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"sorts": [],&lt;BR /&gt;"limit": 100&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="emails.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/50629i6AEFCFCACEBF523A/image-size/large?v=v2&amp;amp;px=999" role="button" title="emails.png" alt="emails.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 19:56:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/497710#M46997</guid>
      <dc:creator>JAnderson1</dc:creator>
      <dc:date>2021-09-20T19:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Search for users by email with multiple emails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/497962#M47003</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/155529"&gt;@JAnderson1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I copied the solution of this &lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Search-Contacts-for-Secondary-Mail/td-p/358756" target="_blank" rel="noopener"&gt;post&lt;/A&gt;, 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.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
  "filterGroups": [
    {
      "filters": [
        {
          "value": "((email))",
          "propertyName": "hs_additional_emails",
          "operator": "CONTAINS_TOKEN"
        }
      ]
    },
    {
      "filters": [
        {
          "value": "((email))",
          "propertyName": "email",
          "operator": "EQ"
        }
      ]
    }
  ]
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 06:53:37 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/497962#M47003</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2021-09-21T06:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Search for users by email with multiple emails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/498414#M47041</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the JSON, but the contact fails to return:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;POST&amp;nbsp;&lt;A href="https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=X" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=X&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"filterGroups": [&lt;BR /&gt;{&lt;BR /&gt;"filters": [&lt;BR /&gt;{&lt;BR /&gt;"value": "EMAIL",&lt;BR /&gt;"propertyName": "hs_additional_emails",&lt;BR /&gt;"operator": "CONTAINS_TOKEN"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"filters": [&lt;BR /&gt;{&lt;BR /&gt;"value": "EMAIL",&lt;BR /&gt;"propertyName": "email",&lt;BR /&gt;"operator": "EQ"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 19:03:42 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/498414#M47041</guid>
      <dc:creator>JAnderson1</dc:creator>
      <dc:date>2021-09-21T19:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Search for users by email with multiple emails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/498418#M47042</link>
      <description>This is really odd. What programming language are you using? I tested the above body with Postman and was able to get the results.&lt;BR /&gt;Is your hapikey valid?</description>
      <pubDate>Tue, 21 Sep 2021 19:15:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/498418#M47042</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2021-09-21T19:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Search for users by email with multiple emails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/498455#M47044</link>
      <description>&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.hubspot.com/docs/api/crm/search" target="_blank"&gt;https://developers.hubspot.com/docs/api/crm/search&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;"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."&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;And when removing the extra filter in the 1st group in the curl example on the page, the JSON structure matches your recommended format:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;"curl &lt;A href="https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=YOUR_HUBSPOT_API_KEY" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=YOUR_HUBSPOT_API_KEY&lt;/A&gt; \&lt;BR /&gt;--request POST \&lt;BR /&gt;--header "Content-Type: application/json" \&lt;BR /&gt;--data '{&lt;BR /&gt;"filterGroups":[&lt;BR /&gt;{&lt;BR /&gt;"filters": [&lt;BR /&gt;{&lt;BR /&gt;"propertyName": "firstname",&lt;BR /&gt;"operator": "EQ",&lt;BR /&gt;"value": "Alice"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"filters": [&lt;BR /&gt;{&lt;BR /&gt;"propertyName": "enum1",&lt;BR /&gt;"operator": "HAS_PROPERTY"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}'"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you for your help, and have a great day. We can consider the matter closed.&lt;/DIV&gt;</description>
      <pubDate>Tue, 21 Sep 2021 20:03:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/498455#M47044</guid>
      <dc:creator>IMykhayliv</dc:creator>
      <dc:date>2021-09-21T20:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Search for users by email with multiple emails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/498457#M47045</link>
      <description>Awesome! Happy to help!</description>
      <pubDate>Tue, 21 Sep 2021 20:05:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/498457#M47045</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2021-09-21T20:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Search for users by email with multiple emails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/499039#M47075</link>
      <description>&lt;P&gt;Awesome, happy that you we're able to resolve it!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 17:29:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-for-users-by-email-with-multiple-emails/m-p/499039#M47075</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2021-09-22T17:29:25Z</dc:date>
    </item>
  </channel>
</rss>

