Create Deal and link to contact

Hello

I am creating Deal suing API and it was creating but I need help on creating a deal with a link to contact as per the below documentation.

associations: [
{
to: {id: ‘101’},
types: [{associationCategory: ‘HUBSPOT_DEFINED’, associationTypeId: 2}]
}
]

can you please explain this part of the parameter?

for example, I need to link HubSpot to this contact to deal.

Hi BhargavB, i think you are refering to “associationTypeId”, in this case i’m not sure if you are trying to create first a deal and then associate it with a contact or create a contact and associated with a deal.

In this Hubspot documentation you can checkoput the Association type ID values, if the options is Deal to Object, in this case Contact you have to use “3” as a value otherwise If is Contact to Object, in this case Deal you have to use “4” as a value.

I hope this will help you with your doubt, all the best!!!

Hello @ESalas7
Thank you for the response.
if possible can you give me a example code for any of the languages it will really help.

Thank You