<?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 Re: Create or update a batch of contacts by unique property values API error in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1048107#M77036</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/834555"&gt;@i_am_sahil&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Apparently there was a mistake in the doc and actually you cannot use&amp;nbsp;&lt;SPAN&gt;"hs_object_id" in the upsert endpoint. This is because this endpoint would create a contact if the id does not match, but the "hs_object_id" cannot be modified nor created via APIs. Therefore, the record id can only be used for the batch update endpoint. The docs will be updated accordingly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That being said, you can use either the email property or a custom property (with a unique value) for the upsert endpoint.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Sep 2024 21:03:03 GMT</pubDate>
    <dc:creator>evaldas</dc:creator>
    <dc:date>2024-09-30T21:03:03Z</dc:date>
    <item>
      <title>Create or update a batch of contacts by unique property values API error</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1047925#M77021</link>
      <description>&lt;P data-unlink="true"&gt;I'm using the&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;&lt;A href="https://developers.hubspot.com/docs/api/crm/contacts" target="_blank" rel="noopener"&gt;Create or update a batch of contacts by unique property values&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;endpoint to batch upsert contact records.&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Here's what my request looks like. When I'm using the HubSpot ID of the record, I get a &lt;FONT color="#993300"&gt;400 Bad Request&lt;/FONT&gt; error. However, when I keep everything same and replace the HubSpot ID with a custom unique property that I created, it works like a charm!&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;The question is, how do I make it work using HubSpot's record ID as they're also unique?&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;STRONG&gt;Request&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"inputs"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"idProperty"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"hs_object_id"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"id"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;42068156885&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"properties"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"firstname"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"TEST"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"lastname"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"Record"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"email"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"testrecord@gmail.com"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"phone"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"+321234567"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"address"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"Nantes, Pays de la Loire, France"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"city"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"Nantes"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"jobtitle"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"Director"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"hs_linkedin_url"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;A href="https://www.linkedin.com/in/test" target="_blank" rel="noopener"&gt;https://www.linkedin.com/in/test&lt;/A&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"salutation"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"Mr"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"stage_rcrm"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"prospect"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;"updated_at"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"2024-09-30"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Response&lt;/STRONG&gt;&lt;/DIV&gt;&lt;PRE&gt;&lt;FONT color="#993300"&gt;&lt;SPAN&gt;{&lt;BR /&gt;"status": "error",&lt;BR /&gt;"message": "Unable to perform update/upsert by non-unique 0-1 property hs_object_id in portal ID 145356037",&lt;BR /&gt;"correlationId": "849976e2-8660-4214-91cf-2967fe8322a2",&lt;BR /&gt;"category": "VALIDATION_ERROR"&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;[PS: I have masked all personal information for obvious reasons.]&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 30 Sep 2024 16:15:54 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1047925#M77021</guid>
      <dc:creator>i_am_sahil</dc:creator>
      <dc:date>2024-09-30T16:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create or update a batch of contacts by unique property values API error</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1047956#M77027</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/834555"&gt;@i_am_sahil&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried leaving out the "idProperty": "hs_object_id" line?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to to the &lt;A href="https://developers.hubspot.com/docs/api/crm/contacts#retrieve-contacts-by-record-id-email-or-custom-unique-value-property" target="_blank" rel="noopener"&gt;CRM API documentation&lt;/A&gt;, "idProperty" is only required when you are using something other than the&amp;nbsp;"hs_object_id":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;By default, the&amp;nbsp;&lt;CODE&gt;id&lt;/CODE&gt;&amp;nbsp;values in the request refer to the record ID (&lt;CODE&gt;hs_object_id&lt;/CODE&gt;), so the&amp;nbsp;&lt;CODE&gt;idProperty&lt;/CODE&gt;&amp;nbsp;parameter is not required when retrieving by record ID. If you're using&amp;nbsp;&lt;CODE&gt;email&lt;/CODE&gt;&amp;nbsp;or a custom unique value property to retrieve contacts, you must include the&amp;nbsp;&lt;CODE&gt;idProperty&lt;/CODE&gt;&amp;nbsp;parameter.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 17:03:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1047956#M77027</guid>
      <dc:creator>evaldas</dc:creator>
      <dc:date>2024-09-30T17:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create or update a batch of contacts by unique property values API error</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1047986#M77032</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/53048"&gt;@evaldas&lt;/a&gt;&amp;nbsp;- I tried leaving out the "idProperty": "hs_object_id" line, and it still doesn't work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HubSpot's &lt;A href="https://developers.hubspot.com/docs/api/crm/contacts#upsert-contacts" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt; clearly states id can be used!&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="i_am_sahil_0-1727719792452.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/128149iFBB9D44CEF409BF7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="i_am_sahil_0-1727719792452.png" alt="i_am_sahil_0-1727719792452.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here's the error&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;FONT color="#993300"&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;&lt;SPAN&gt;"status"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"error"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;&lt;SPAN&gt;"message"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"Updates in a single batch must specify its unique property."&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;&lt;SPAN&gt;"correlationId"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"4b5ded01-a49c-4de1-bc39-a45ca38d4463"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;&lt;SPAN&gt;"category"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"VALIDATION_ERROR"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;&lt;SPAN&gt;}&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 30 Sep 2024 18:11:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1047986#M77032</guid>
      <dc:creator>i_am_sahil</dc:creator>
      <dc:date>2024-09-30T18:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create or update a batch of contacts by unique property values API error</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1048107#M77036</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/834555"&gt;@i_am_sahil&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Apparently there was a mistake in the doc and actually you cannot use&amp;nbsp;&lt;SPAN&gt;"hs_object_id" in the upsert endpoint. This is because this endpoint would create a contact if the id does not match, but the "hs_object_id" cannot be modified nor created via APIs. Therefore, the record id can only be used for the batch update endpoint. The docs will be updated accordingly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That being said, you can use either the email property or a custom property (with a unique value) for the upsert endpoint.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 21:03:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1048107#M77036</guid>
      <dc:creator>evaldas</dc:creator>
      <dc:date>2024-09-30T21:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create or update a batch of contacts by unique property values API error</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1119445#M80750</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/53048"&gt;@evaldas&lt;/a&gt;,&lt;BR /&gt;I'm facing a similar issue with the companies batch update endpoint.&amp;nbsp;&lt;BR /&gt;I still get '&lt;SPAN&gt;Unable to perform update/upsert by non-unique 0-2 property hs_object_id'.&lt;BR /&gt;[info] &lt;A href="https://api.hubapi.com/crm/v3/objects/companies/batch/update" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/companies/batch/update&lt;/A&gt; {'inputs': [{'idProperty': 'hs_object_id', 'id': '30752845452', 'properties': {...}}]}&lt;BR /&gt;Do you have any guidance?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 16:27:05 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1119445#M80750</guid>
      <dc:creator>TKeane1</dc:creator>
      <dc:date>2025-03-07T16:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create or update a batch of contacts by unique property values API error</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1119484#M80755</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/911407"&gt;@TKeane1&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similar to the Contacts endpoint, you cannot use the "&lt;SPAN&gt;hs_object_id" as "idProperty" because the API would try to create a value for that property, but&amp;nbsp;hs_object_id can only be generated by the system when a record is created.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, as far as I understand, it looks like there currently aren't any unique properties for the Company record. The "name" and "domain" properties are allowed to be duplicate values among records&amp;nbsp;and cannot serve as the idProperty for the upsert.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What I could suggest in your case is to create a &lt;A href="https://knowledge.hubspot.com/properties/create-and-edit-properties#create-a-custom-property" target="_blank" rel="noopener"&gt;Custom Property&lt;/A&gt; for the Company object, make sure you mark it to require unique values. Once you have that, you could create a workflow to copy the value of the object ID to your new custom property. Then use your custom property as the "idProperty" in the upsert endpoint.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;One limitation of this approach is that you will need to have that value populated for all the company records you will try to import. This means that the values in your custom property will not be a one-to-one match to the object ID in the long run.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope this helps!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 18:11:39 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1119484#M80755</guid>
      <dc:creator>evaldas</dc:creator>
      <dc:date>2025-03-07T18:11:39Z</dc:date>
    </item>
  </channel>
</rss>

