Help Needed: Retrieving Old Primary Record ID from Merged Contacts Using HubSpot REST API

Hello community!

When two or more contacts are merged, HubSpot creates a new RecordId and the others RecordIds are stored in

hs_merged_object_ids property.
However, is there any endpoint available in the REST API to return what was the primary RecordId before merging them?

@softcialdev you can retrieve it via the propertiesWithHistory param using the hs_object_id company property

curl --request GET \
 --url 'https://api.hubapi.com/crm/v3/objects/companies/{companyId}?propertiesWithHistory=hs_object_id&archived=false' \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN'