There's a new version of the HubSpot API

As of November 30, 2022, HubSpot API keys are no longer a supported authentication method for accessing HubSpot APIs. Instead, you should use a private app access token or OAuth to authenticate API calls. Learn more about this change and how to migrate an API key integration to use a private app instead.

Line items overview

There's a new version of the Line items API. We've redesigned our line items API and it is out now in developer preview. Check out the new API

A line item represents a line in an order, containing details such as the product, quantity, and price for each line of an order.  Line items link products, along with specific information about the sale of a product, to your HubSpot deals.

Line item properties

As with other CRM objects, line items support custom properties. The properties for line items are managed through the CRM Object Properties API.

Products and hs_product_id

When creating a new line item, you must set the hs_product_id property. This property needs to be the objectId of a product object, and represents the product being sold.

Note: Line items created using the HubSpot sales tools may not always have a hs_product_id set. Products created from the deal line item editor will not be added to your product library and will therefore not have a hs_product_id. See the details in this knowledge doc for more information.

Associations

Line items can be associated with deals. Those associations are managed through the CRM Associations API.

Line items will have the following data. Note that the specific properties included for your line items may vary depending on which properties are actually set (properties with no value will never be included in a response) and which properties you are requesting. See the Contacts overview for more details about the property change source.

{
  "objectType": "LINE_ITEM",
  // String; The object type of this object, will always be 'LINE_ITEM' for line items.
  "portalId": 62515,
  // Integer; The Portal or Hub ID that this object belongs to.
  "objectId": 9845651,
  // Integer; The internal ID for this line item
  "properties": {
  // A dictionary of properties for the line item, keyed by the internal name of the property
    "quantity": {
    // String; The name of the property
      "versions": [
      // A list of historical values for the property. The current version is included in this list.
        {
          "name": "quantity",
          // String; The name of the property.
          "value": "25",
          // String; The value of the property for this version.
          "timestamp": 1525369755209,
          // Integer; A Unix timestamp in milliseconds representing when the property was updated.
          "source": "API",
          // String; The change source of the API. See the Contacts API overview for a list of possible sources
          "sourceVid": []
          // A list of integers representing contact VIDs. This will be populated if the property was updated as a result of a change to a contact record.
        }
      ],
      "value": "25",
      // String; The current value of the property.
      "timestamp": 1525369755209,
      // Integer; A Unix timestamp in milliseconds representing when the property was updated.
      "source": "API",
      // String; The change source of the API. See the Contacts API overview for a list of possible sources
      "sourceId": null
      // String or null; Additional details about the change source, may be null depending on the specific source.
    },
    "price": {
      "versions": [
        {
          "name": "price",
          "value": "27.50",
          "timestamp": 1525299376761,
          "source": "API",
          "sourceVid": []
        }
      ],
      "value": "27.50",
      "timestamp": 1525299376761,
      "source": "API",
      "sourceId": null
    },
    "name": {
      "versions": [
        {
          "name": "name",
          "value": "A custom name for the product for this line item.",
          "timestamp": 1525369755209,
          "source": "API",
          "sourceVid": []
        }
      ],
      "value": "A custom name for the product for this line item.",
      "timestamp": 1525369755209,
      "source": "API",
      "sourceId": null
    },
    "hs_product_id": {
      "versions": [
        {
          "name": "hs_product_id",
          "value": "1645342",
          "sourceVid": []
        }
      ],
      "value": "1645342",
      "timestamp": 0,
      "source": null,
      "sourceId": null
    }
  },
  "version": 1,
  // Integer; The current version of this line item. This is incremented each time the line item is updated.
  "isDeleted": false
  // Boolean; whether or not the line item is deleted. Deleted records will not be included unless you specifically request that deleted records be included.
}

Line Items API docs

Get all line items
Get a line item by ID
Get a group of line items by ID
Create a line item
Create a group of line items
Update a line item
Update a group of line items
Delete a line item
Delete a group of line items
Get a log of changes for line items

Docs for this section or API