Can I retrieve HubSpot record Id from Salesforce Id?

Hello community members,

Can I get HubSpot record Id if I have Salesforce record ID(contact Id/Account Id) via API?

Thanks in advance!

Best,

Meenal

Hey, @MAgarwal5 :waving_hand: Thanks for the great question.

I have a few questions of my own:

  • Specifically, which property are you using? Is it Salesforce Account ID, for example?salesforceaccountid​
  • If so, have you considered using the Search API for this type of request? It’s not a perfect for every circumstance, but it might be useful in your project

An example Request might look like this:

https://api.hubapi.com/crm/v3/objects/contacts/search

Body:

{
 "filterGroups":[
 {
 "filters":[
 {
 "propertyName": "salesforceaccountid",
 "operator": "EQ",
 "value": "YOURID"
 }
 ]
 }
 ]
 }

Please let the community know if you have any follow-up questions.

Have fun building! — Jaycee

@MAgarwal5 yes you can as long as these fields are mapped in the integration. They are automatically created in HubSpot when the integration is installed but they are not automatically added to the field mappings. Once they are mapped, you can retrieve via API.

For more info on the HubSpot Salesforce integration - enroll in our free course here.

Thanks, @LaurenRyan :raising_hands: