# Error: Cannot merge ObjectCoordinates

**URL:** <https://community.hubspot.com/t/error-cannot-merge-objectcoordinates/128870>\
**Category:** APIs & Integrations\
**Tags:** companies\
**Created:** [March 28, 2025, 1:41pm UTC](https://community.hubspot.com/t/error-cannot-merge-objectcoordinates/128870 "2025-03-28T13:41:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dneustadt](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@dneustadt](https://community.hubspot.com/u/dneustadt)\
**Post date:** [March 28, 2025, 1:41pm UTC](https://community.hubspot.com/t/error-cannot-merge-objectcoordinates/128870/1 "2025-03-28T13:41:17Z")

</div>

We’re trying to use [/crm/v3/objects/companies/merge](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fmerge) to merge multiple companies into a single one.  
The merge of the first company into the primary company succeeds:

```lia-code-sample
curl --request POST \
 --url https://api.hubapi.com/crm/v3/objects/companies/merge \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
 --header 'content-type: application/json' \
 --data '{
 "objectIdToMerge": "111111",
 "primaryObjectId": "123456"
}'

```

However, we then try to merge the second company into the primary company as well:

```lia-code-sample
curl --request POST \
 --url https://api.hubapi.com/crm/v3/objects/companies/merge \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
 --header 'content-type: application/json' \
 --data '{
 "objectIdToMerge": "222222",
 "primaryObjectId": "123456"
}'

```

This is when we receive an error code 400 response:

`{"status":"error","message":"Cannot merge ObjectCoordinates{portalId=xxxxxxx, objectTypeId=ObjectTypeId{legacyObjectType (truncated...)`

Is there a restriction regarding the number of companies that can be merged into a single one? I couldn’t find any information regarding such limitations and the error message is not exactly explanatory. I tried switching around the primary and secondary id, as well as using the last secondary id as the new primary id on each iteration, with no success.

---

<div class="post-metadata">

**Author:** ![dneustadt](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@dneustadt](https://community.hubspot.com/u/dneustadt)\
**Post date:** [March 28, 2025, 2:15pm UTC](https://community.hubspot.com/t/error-cannot-merge-objectcoordinates/128870/2 "2025-03-28T14:15:31Z")

</div>

I found this bit after creating the original post:  
_You cannot merge records if they’ve been included in a combined total of 250+ merges (e.g, Contact A and Contact B have been involved in 130 merges each)._  
However neither of our companies have been involved in as many merges. In fact the error can be reproduced with freshly created companies.

---

<div class="post-metadata">

**Author:** ![dneustadt](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@dneustadt](https://community.hubspot.com/u/dneustadt)\
**Post date:** [March 28, 2025, 3:13pm UTC](https://community.hubspot.com/t/error-cannot-merge-objectcoordinates/128870/3 "2025-03-28T15:13:14Z")

</div>

Here is a full dump of the error response contents:

```lia-code-sample
array(4) {
 ["status"]=>
 string(5) "error"
 ["message"]=>
 string(212) "Cannot merge ObjectCoordinates{portalId=xxxxxxx, objectTypeId=ObjectTypeId{legacyObjectType=COMPANY}, objectId=31467161499} because it has a forward reference to 31477630289. Only canonical objects can be merged."
 ["correlationId"]=>
 string(36) "aa7ec39f-acaf-4cbf-a764-491a4c5aedd7"
 ["category"]=>
 string(16) "VALIDATION_ERROR"
}

```

---

<div class="post-metadata">

**Author:** ![Bortami](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bortami/32/221350_2.png) [@Bortami](https://community.hubspot.com/u/Bortami)\
**Post date:** [March 28, 2025, 3:33pm UTC](https://community.hubspot.com/t/error-cannot-merge-objectcoordinates/128870/4 "2025-03-28T15:33:03Z")

</div>

HubSpot recently changed the way it treats merged records. Now, when two records are merged, a new third record with a new hs\_object\_id is created. You now need to use that new record id when you’re merging the second record, and repeat for each additional record to merge.

All other endpoints have forwarding so if you call the old id, they will forward to the new record, but the merge endpoint does not have this. You have to use the new record id.

And yes, you can only merge 250 records together.

---

<div class="post-metadata">

**Author:** ![dneustadt](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@dneustadt](https://community.hubspot.com/u/dneustadt)\
**Post date:** [March 28, 2025, 3:59pm UTC](https://community.hubspot.com/t/error-cannot-merge-objectcoordinates/128870/5 "2025-03-28T15:59:42Z")

</div>

That’s it. Thank you so much.
