# Getting 400 on insert deals

**URL:** <https://community.hubspot.com/t/getting-400-on-insert-deals/73712>\
**Category:** APIs & Integrations\
**Created:** [January 25, 2023, 2:54pm UTC](https://community.hubspot.com/t/getting-400-on-insert-deals/73712 "2023-01-25T14:54:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MPrasad9](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@MPrasad9](https://community.hubspot.com/u/MPrasad9)\
**Post date:** [January 25, 2023, 2:54pm UTC](https://community.hubspot.com/t/getting-400-on-insert-deals/73712/1 "2023-01-25T14:54:59Z")

</div>

Hi, getting 400 error while inserting deals using v3 API. Can anyone help on this thanks.  
Error: {“status”:“error”,“message”:“Invalid input JSON on line 1, column 18: Cannot deserialize value of type `java.util.ArrayList\<com.hubspot.crmpublic.core.models.associations.PublicAssociationsForObject\>` from Object value (token `JsonToken.START_OBJECT`)”,“correlationId”:“5929f674-90e1-4797-a9ef-dc3a37d53b20”}

---

<div class="post-metadata">

**Author:** ![tominal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tominal/32/73018_2.png) [@tominal](https://community.hubspot.com/u/tominal)\
**Post date:** [January 25, 2023, 6:58pm UTC](https://community.hubspot.com/t/getting-400-on-insert-deals/73712/2 "2023-01-25T18:58:18Z")

</div>

Hey @MPrasad9

Are you able to reply with your JSON payload? You can redact some information if you need. We will need that to help diagnose your issue.

Regards,  
-T

---

<div class="post-metadata">

**Author:** ![MPrasad9](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@MPrasad9](https://community.hubspot.com/u/MPrasad9)\
**Post date:** [January 27, 2023, 1:43pm UTC](https://community.hubspot.com/t/getting-400-on-insert-deals/73712/3 "2023-01-27T13:43:49Z")

</div>

Hi @tominal , Below is the payload which we sent

{  
“associations”: {  
“company”: {  
“ids”: “2664404286”  
}  
},  
“properties”: {  
“amount”: 294,  
“createdate”: 1671067793063,  
“dealname”: "Urban Sync (Business to Enterprise) ",  
“expansion\_type”: “Uplift: BE \> EE”,  
“hubspot\_owner\_id”: “51651368”,  
“pipeline”: “788269”  
}  
}

---

<div class="post-metadata">

**Author:** ![MPrasad9](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@MPrasad9](https://community.hubspot.com/u/MPrasad9)\
**Post date:** [January 30, 2023, 6:15am UTC](https://community.hubspot.com/t/getting-400-on-insert-deals/73712/4 "2023-01-30T06:15:16Z")

</div>

Hi @tominal,

Below is the payload which we sent, can you check this thanks

{  
“associations”: {  
“company”: {  
“ids”: “2664404286”  
}  
},  
“properties”: {  
“amount”: 294,  
“createdate”: 1671067793063,  
“dealname”: "Urban Sync (Business to Enterprise) ",  
“expansion\_type”: “Uplift: BE \> EE”,  
“hubspot\_owner\_id”: “51651368”,  
“pipeline”: “788269”  
}  
}

---

<div class="post-metadata">

**Author:** ![tominal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tominal/32/73018_2.png) [@tominal](https://community.hubspot.com/u/tominal)\
**Post date:** [January 30, 2023, 8:24pm UTC](https://community.hubspot.com/t/getting-400-on-insert-deals/73712/5 "2023-01-30T20:24:49Z")

</div>

Hey @MPrasad9,

Apologies, I wrote up a response to this, but it must have been lost.

The gist of it was that you are not able to pass associations in your POST request like that. You will have to follow the steps:

1. Insert your deal record which will return a Deal ID in the response
2. Use that Deal ID in a separate POST request to the Associations API

Your deal payload would look like:

**/crm/v3/objects/deals**

```auto
{
 "properties": {
 "amount": 294,
 "createdate": 1671067793063,
 "dealname": "Urban Sync (Business to Enterprise) ",
 "expansion_type": "Uplift: BE > EE",
 "hubspot_owner_id": "51651368",
 "pipeline": "788269"
 }
}

```

And then your associations API request would look like:

**/crm/v3/associations/deals/companies/batch/create**

```auto
{
 "inputs": [
 {
 "from": {
 "id": "<INSERT DEAL ID HERE>"
 },
 "to": {
 "id": "2664404286"
 },
 "type": "deal_to_company"
 }
 ]
}

```

Hope that helps!

---

<div class="post-metadata">

**Author:** ![MPrasad9](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@MPrasad9](https://community.hubspot.com/u/MPrasad9)\
**Post date:** [February 1, 2023, 7:41am UTC](https://community.hubspot.com/t/getting-400-on-insert-deals/73712/6 "2023-02-01T07:41:07Z")

</div>

Hi @tominal , Thanks. Its very helpful
