# Companies Batch Upsert API endpoint

**URL:** <https://community.hubspot.com/t/companies-batch-upsert-api-endpoint/127307>\
**Category:** APIs & Integrations\
**Tags:** companies\
**Created:** [March 4, 2025, 6:07pm UTC](https://community.hubspot.com/t/companies-batch-upsert-api-endpoint/127307 "2025-03-04T18:07:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fancyHS](https://avatars.discourse-cdn.com/v4/letter/f/b38774/32.png) [@fancyHS](https://community.hubspot.com/u/fancyHS)\
**Post date:** [March 4, 2025, 6:07pm UTC](https://community.hubspot.com/t/companies-batch-upsert-api-endpoint/127307/1 "2025-03-04T18:07:57Z")

</div>

Facing the below error, While using batch upsert api for compaines object using “domain” as unique identifier. Anyone facing the issue.

`Unable to perform update/upsert by non-unique 0-2 property domain in portal ID`

But documentation specified that, For companies, “domain” is the primary unique identifier

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Fcrm-companies-v3%2Fguide)**

---

<div class="post-metadata">

**Author:** ![fancyHS](https://avatars.discourse-cdn.com/v4/letter/f/b38774/32.png) [@fancyHS](https://community.hubspot.com/u/fancyHS)\
**Post date:** [March 5, 2025, 10:21am UTC](https://community.hubspot.com/t/companies-batch-upsert-api-endpoint/127307/2 "2025-03-05T10:21:31Z")

</div>

```lia-code-sample
curl --request POST \
 --url https://api.hubapi.com/crm/v3/objects/companies/batch/upsert \
 --header 'authorization: Bearer <Access_Token>' \
 --header 'content-type: application/json' \
 --data '{
 "inputs": [
 {
 "idProperty": "domain",
 "id": "test3.com",
 "properties": {
 "name": "test3"
 }
 }
 ]
}'

```

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [March 7, 2025, 6:31pm UTC](https://community.hubspot.com/t/companies-batch-upsert-api-endpoint/127307/3 "2025-03-07T18:31:56Z")

</div>

Hi @fancyHS,

Your logic in attempting this is correct. However, it looks like the “primary unique identifier” does not necessarily mean that the property itself actually is a unique property (it does not require unique values) - as it is possible to enter the same domain name for multiple company records. Certainly confusing.

Someone else recently asked about the Company upsert endpoint and I provided a suggestion on how to work around this limitation in this thread: [https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1119484/highlight/true#M80755](https://community.hubspot.com/t5/APIs-Integrations/Create-or-update-a-batch-of-contacts-by-unique-property-values/m-p/1119484/highlight/true#M80755)

I realize the solution is not ideal but hopefully helps explain the situation.
