Line Items

In HubSpot, line items are individual instances of products. When a product is attached to a deal, it becomes a line item. You can create line items that are unique to an individual quote, but they will not be added to your product library. The line items endpoints allow you to manage this data and sync it between HubSpot and other systems.

Example use case: when creating a set of quotes for sales reps to send to potential buyers, you can use this API to create standalone line items per quote, as well as line items that are attached to existing products.

Create a line item

To create a line item, make a POST request to /crm/v3/objects/line_items. In the post body, include the line item's details, such as name, quantity, and price.

To create a line item based on an existing product (created through the products API or in HubSpot), include hs_product_id in the post body. 

You can also associate the line item with deals and quotes by including an associations array in the post body. For example, the post body below would create a line item named "New standalone line item" that's associated with a deal (ID: 12345) and a quote (ID: 67890).

// POST request to https://api.hubapi.com/crm/v3/objects/line_item { "properties": { "price": 10, "quantity": 1, "name": "New standalone line item" }, "associations": [ { "to": { "id": 12345 }, "types": [ { "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 20 } ] }, { "to": { "id": 67890 }, "types": [ { "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 68 } ] } ] }

Please note: 

  • The price specified within the properties field cannot be negative.
  • The line items Term property (hs_recurring_billing_period) accepts ISO-8601 period formats of PnYnMnD and PnW.

Retrieve a line item

You can retrieve line items individually or in bulk.

  • To retrieve a specific line item, make a GET request to /crm/v3/objects/line_items/{lineItemId} where lineItemId is the ID of the line item.
  • To retrieve all line items, make a GET request to /crm/v3/objects/line_items
In the request URL, you can include the following parameters:
Use this table to describe parameters / fields
ParameterDescription
properties

A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.

propertiesWithHistory

A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored.

Update a line item

To update a line item, make a PATCH request to /crm/v3/objects/line_items/{lineItemId}, where lineItemId is the ID of the line item.

In the post body, include the property values that you want to update. You cannot update associations through this method. Instead you'll need to use the associations API.

For example, your request body might look similar to the following:

// PATCH request to https://api.hubapi.com/crm/v3/objects/line_item/{lineItemId} { "properties": { "price": 25, "quantity": 3, "name": "Updated line item" }

Delete a line item

To delete a line item, make a DELETE request to /crm/v3/objects/line_items/{lineItemId}, where lineItemId is the ID of the line item.


Was this article helpful?
This form is used for documentation feedback only. Learn how to get help with HubSpot.