APIs & Integrations

Derek_Gervais
HubSpot Alumni
HubSpot Alumni

New API: Line Items

What's Happening?

Line items link products and the specific information about the sale of a product, to your deals within HubSpot. This could include information such as quantity or price of a product that is being ordered. Line items link products, along with specific information about the sale of a product, to your HubSpot deals.

What's Changing?

Nothing; this is an entirely new API! Check out the developer documentation here.

When is this happening?

The Line Items API is now live; integrators can begin using it immediately.

Feel free to reach out in the comments below with any questions/concerns!

8 Replies 8
arickp1
Participant | Elite Partner
Participant | Elite Partner

New API: Line Items

Hi, Derek!

 

I am also receiving the "Must have scope DEAL_LINE_ITEM_WRITE" error when I attempt to create a line item by using the endpoint described here: https://developers.hubspot.com/docs/methods/line-items/create-line-item

 

The "must have DEAL_LINE_ITEM_WRITE" error only happens when I use an OAuth token. If I use a HApiKey, it works fine. I did request "e-commerce" as one of the optional scopes when I created the access token used by the integration causing the error. I did notice that I do not actually see "e-commerce" as one of the scopes listed in the array when calling the endpoint for accessing the information about my OAuth token (https://api.hubapi.com/oauth/v1/access-tokens/{token}). We are using a Super Admin account to log into HubSpot when going through the OAuth process, so I'm not sure why the account wouldn't have permission to create line items, especially since it works when we use a HApiKey. We are experiencing this problem in HUB ID 1546852.

 

Also, I have a small bit of feedback: it looks like the "Update a line item" endpoint (https://developers.hubspot.com/docs/methods/line-items/update-line-item) returns HTTP status code 400 if the given object_id is invalid (i.e., no such line item exists). All other HubSpot endpoints return a 404 Not Found error when the given ID to update is invalid as a result of the object not existing. I like how the other endpoints separate 404 errors from 400 errors, since a 404 is more of a "warning"-type error that I don't necessarily need to bubble up as a fatal error in my integration, while a 400 error usually means that something's wrong with the JSON that we're sending, and should be treated as a fatal error. Just my two cents, thanks guys!

0 Upvotes
stewart1
Member

New API: Line Items

Hi Derek,
If we already have price data stored in a Deal and/or Product, we are using the Line Item only as a join. Especially as that's how it appears in the Web UI - displaying a Deal shows a little box with the Product in it.

Do I need to be creating a Line Item per Deal, or is per Product sufficient?

How does it work behind the scenes for the Web UI display?

Also, please confirm I still need to make a further "join hop" using the " CRM object properties API"?

Basically, all I'm trying to do is:

  1. For a given Deal, lookup the Product
  2. For a given Product, look up the Deals

We're talking about 40,000 Deals across 80 Products.

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

New API: Line Items

Hi @immanuel,

It's possible there are a couple of things going on. Can you give me the Hub ID of the portal you're trying to create line items in? Also are you using OAuth or hapikey authentication?

0 Upvotes
immanuel
Member

New API: Line Items

Hi Derek,

While trying to create a line item through API(https://developers.hubspot.com/docs/methods/line-items/create-line-item). Am getting this error. Can you please help me out. HubID:4594085

{
"status": "error",
"message": "Must have scope DEAL_LINE_ITEM_WRITE",
"correlationId": "f36f92bb-0858-4d6c-bd79-b5865af2e547",
"requestId": "b548139141da37db137e94299ceaea90"
}

0 Upvotes
immanuel
Member

New API: Line Items

Derek,

Is this error "DEAL_LINE_ITEM_WRITE" is due to the product am using?

Currently am using the developer account and the test application, where the product it says "Sales Free".

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

New API: Line Items

Hi @Erno_Pyykko,

By default, the response will only include the ID, a few system fields for the line item, and the hs_product_id property. You can get specific properties in the response by using the &properties= parameter in the URL, and that parameter can be included multiple times to get multiple properties.

0 Upvotes
ernopyykko
Top Contributor

New API: Line Items

Hey Derek,

Thanks for your help, got it working.

Regards,
Erno

ernopyykko
Top Contributor

New API: Line Items

Hey Derek,

I could be looking in the wrong place, but didn't find any references to the term or unite price of the line items in the products.

We're looking into using this information to update custom subscription properties on companies.

Is this something that is already available, or will be at some point?

0 Upvotes