How to get created company id?

companies

#1

When you create a contact through POST /contacts/v1/contact then a company gets automatically created if you set property “company” in contact data. What I would like to get is the ID of the created company so I can associate contact with the company and also with the deal I create later on.

Is this possible?

Best,
Stjepan


#2

Hi @sbuljat ,

The company field on a contact record is just a single line text field, it does not have an associated object. In order to associate a contact with a company through the API you must use this endpoint.

When a contact is associated with a company object you will find the company vid listed in the associated-company property on the contact record.

Sebastian


#3

Hi Sebastian,

I know that I can associate a contact with the company but that is not what I had in mind.
When you create a contact with company field HubSpot tries to detect company out of that name and creates a record under Companies, for instance if you put “Hubspot” it will detect that as “HubSpot, Inc”. This is pretty cool because I don’t have to fill the necessary company fields.

What I did now is used endpoint for recently created companies and used that to get company id which I then associate with the deal. Works nicely :slight_smile:

Best,
Stjepan