# Deals API / params not clear

**URL:** <https://community.hubspot.com/t/deals-api-params-not-clear/50535>\
**Category:** APIs & Integrations\
**Tags:** object, professional\
**Created:** [January 28, 2022, 10:20am UTC](https://community.hubspot.com/t/deals-api-params-not-clear/50535 "2022-01-28T10:20:39Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![WaydeChristie1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/waydechristie1/32/10224_2.png) [@WaydeChristie1](https://community.hubspot.com/u/WaydeChristie1)\
**Post date:** [February 1, 2022, 1:32am UTC](https://community.hubspot.com/t/deals-api-params-not-clear/50535/4 "2022-02-01T01:32:15Z")

</div>

Hi inouire,

To create a line item you need the CREATE endpoint here: [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/crm/line-items).

Here’s an example POST body:

`{"name": "1 year implementation consultation","hs_product_id": "191902","hs_recurring_billing_period": "24","recurringbillingfrequency": "monthly","quantity": "2","price": "6000.00"}`

Ideally the line item should include a reference to a Hubspot product ID (“hs\_product\_id”), as line-items are a subset of products.

When the line item has been created the API will return the line item object ID. You’ll need this ID to then associate the line item with a deal.

You associate the line item with the deal using the"Associate a line item with another object" endpoint here: [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/crm/line-items).

To do so, send a PUT request using this URL format:

[https://api.hubapi.com/crm/v3/objects/line\_items/{{yourline](https://api.hubapi.com/crm/v3/objects/line_items/%7Bline) item object id}}/associations/deal/{{your deal object ID}}/line\_item\_to\_deal (not including the curly brackets).

The “line\_item\_to\_deal” segment of the URL tells Hubspot how to associate the two objects. You can use this format for associating most objects. eg. Associating a deal to a contact uses this endpoint URL: [https://api.hubapi.com/crm/v3/objects/deals/](https://api.hubapi.com/crm/v3/objects/deals/){{deal ID}}/associations/contact/{{contactID}}/ **deal\_to\_contact**

You can also use the Associations API to **batch associate** multiple line items to a single deal - [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/crm/associations)

The endpoint URL you’ll need for that is:

[https://api.hubapi.com/crm/v3/associations/line\_items/deals/batch/create](https://api.hubapi.com/crm/v3/associations/line_items/deals/batch/create)

And this is the body you’ll need to POST:

`{ "inputs": [{ "from": { "id": "{{line item ID}}" }, "to": { "id": "{{deal ID}}" }, "type": "line_item_to_deal" }, { "from": { "id": "{{another line item ID}}" }, "to": { "id": "{{deal ID}}" }, "type": "line_item_to_deal" }]}`

Unfortunately there isn’t a way to create a line item and associate it with a deal in one step, like there used to be in the old API. Now it’s necessary to use object association methods, or the associations API.

Hope this helps.

---

_[View the full topic](https://community.hubspot.com/t/deals-api-params-not-clear/50535)._
