Scope requirements
Scope requirements
Scope requirements
Based on the endpoints you plan on using, you’ll need to authorize the following scopes:crm.objects.line_items.read: provides access to retrieve line item data.crm.objects.line_items.write: provides access to create and update line items.tax_rates.read: provides access to retrieve tax rates you’ve configured in your account.
Create a line item
To create a line item, make aPOST request to /crm/v3/objects/line_items. In the post body, include the line item’s details, such as name, quantity, and price. You may also want to include additional data in the request body:
- To create a line item based on an existing product (created through the products API or in HubSpot), include
hs_product_idin the post body. - To include the tax rate for your line item, include its ID as the
hs_tax_rate_group_idwithin thepropertiesfield of the request body. - You can also associate the line item with deals, quotes, invoices, payment links or subscriptions, by including an
associationsarray 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).
Retrieve a line item
You can retrieve line items individually or in bulk.- To retrieve a specific line item, make a
GETrequest to/crm/v3/objects/line_items/{lineItemId}wherelineItemIdis the ID of the line item. - To retrieve all line items, make a
GETrequest to/crm/v3/objects/line_items.
Update a line item
To update a line item, make aPATCH 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:
Delete a line item
To delete a line item, make aDELETE request to /crm/v3/objects/line_items/{lineItemId}, where lineItemId is the ID of the line item.
Line item properties
When managing your line item data, you may want to use some of the common properties in the table below. To get all line item properties, make aGET request to /crm/v3/properties/line_item. Learn more about using the properties API.
When line items are cloned (for example, when cloning a deal to a quote, or a quote to a new quote), properties with unique values (
hasUniqueValue: true) are not copied to the new line items. This is because uniqueness is enforced across all line items, and copying the value would cause a conflict. To set unique property values on cloned line items, update the line items after creation.Retrieve tax rates
You can apply a tax rate to individual line items (e.g., a MA Sales tax of 6.26%). Once you configure your tax rate library in your HubSpot account, you can then make aGET request to /tax-rates/v1/tax-rates to fetch all tax rates, or /tax-rates/v1/tax-rates/{taxRateId} to fetch a tax rate by its ID. Your app will need to authorize the tax_rates.read scope to make this request.
The resulting response will resemble the following:
Once you have the ID of the tax rate you want to apply, provide that
id for the hs_tax_rate_group_id within the properties field when creating a line item. Learn more about creating line items in the section above.