Create deal with company and contact associations (Create Deal API)




I am trying to create deal with company and contact association and getting error :
[status] => error
[message] => Invalid input JSON: Invalid JSON input: Unsupported java type [LONG] for field [associated_vids] for json type VALUE_STRING
[correlationId] => 191534ae-0d85-4f2e-8347-7e159ea6f93b
[requestId] => 6b90631d-79c7-40cd-9092-8668c5e516a1

My json array for creating deal is :

“associations”:{“associatedCompanyIds”:[“223609512”],“associatedVids”:[“1451”]},“properties”:[{“name”:“dealname”,“value”:“kaith Company New1 New Deal”},{“name”:“amount”,“value”:“245.82”},{“name”:“dealstage”,“value”:“appointmentscheduled”}]}

Is there any way to create deal with company / contact associations?

Thanks in advance for your help.


Hi @kaith

The associated IDs need to be passed as numbers, not strings, so all you should need to do is remove the quotes "" around the IDs.



Thanks for reply :slight_smile: it works !!!


@dadams Hi. I am trying to mass import a list of deals and need to associate them to companies that I have created. I am new to the API world and don’t know where to paste the code you provided above. I have created a developer portal and created my first app … where do I go next? Thanks


@Rafael_Fernandes the app in HubSpot is just a set of settings that would let you authenticate your system with a HubSpot account. Any actual code would need to be implemented outside of HubSpot.

The documentation for the endpoint mentioned in the post is here:



I am facing error “one or more associations were invalid” in create deal API :

{“status”:“error”,“message”:“one or more associations were invalid”,“correlationId”:“be4c53b3-fc4d-48f3-b667-c11f5f658f72”,“requestId”:“06104b71-cd19-4988-a201-a6dd49323dca”}

My json is :

{“associations”:{“associatedVids”:[60675]},“properties”:[{“name”:“dealname”,“value”:“Jan 05 | Lunch 11:45 AM | SmartData Food Zone”},{“name”:“amount”,“value”:26.82},{“name”:“dealstage”,“value”:“2a5db756-e6a4-4505-b620-ad179304378d”},{“name”:“pipeline”,“value”:“default”},{“name”:“dealtype”,“value”:“newbusiness”},{“name”:“discount_off”,“value”:0},{“name”:“discount_percent_off”,“value”:""},{“name”:“gm_percent”,“value”:26.98},{“name”:“quote_url”,“value”:“"},{“name”:“order_id”,“value”:1165},{“name”:“guests_actual”,“value”:""},{“name”:“quote_id”,“value”:"”}]}

Thanks in advance for your help.


That usually means that the ID specified doesn’t belong to a valid record. If you’ve previously used that vid it’s possible that the record was deleted.


Thanks @dadams … Got your point and issue. Thanks for your help … !!!