# API for accessing line item editor data

**URL:** <https://community.hubspot.com/t/api-for-accessing-line-item-editor-data/28139>\
**Category:** APIs & Integrations\
**Tags:** crm, object, sales\
**Created:** [November 18, 2020, 4:17am UTC](https://community.hubspot.com/t/api-for-accessing-line-item-editor-data/28139 "2020-11-18T04:17:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![testuser27](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/testuser27/32/35493_2.png) [@testuser27](https://community.hubspot.com/u/testuser27)\
**Post date:** [November 18, 2020, 4:17am UTC](https://community.hubspot.com/t/api-for-accessing-line-item-editor-data/28139/1 "2020-11-18T04:17:13Z")

</div>

Hello,  
I had one custom integraiton in which i need to associate product with deal and that is done by associating product with line item and that line item with deal but as of now i need to update quantity for line item that is associated with deal. So manually we can do this using line item editor of hubspot but i want to do this using api. I don’t want to update main line item but want to update only line item that is associated with particular deal.  
If anyone have ideal regarding this please help me as fast as possible.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [November 18, 2020, 9:51pm UTC](https://community.hubspot.com/t/api-for-accessing-line-item-editor-data/28139/2 "2020-11-18T21:51:50Z")

</div>

Hello @testuser27

Going to tag in a few people here to help!

@kjphilips , [@quentin\_lamamy](https://community.hubspot.com/t5/user/viewprofilepage/user-id/148828) could you all provide some advice here?

---

<div class="post-metadata">

**Author:** ![quentin\_lamamy](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/quentin_lamamy/32/20212_2.png) [@quentin\_lamamy](https://community.hubspot.com/u/quentin_lamamy)\
**Post date:** [November 19, 2020, 11:13am UTC](https://community.hubspot.com/t/api-for-accessing-line-item-editor-data/28139/3 "2020-11-19T11:13:43Z")

</div>

Thanks @dennisedson for tag

Hi @testuser27 Not sure to right understand , what are line item, which object do you want to link and with which one ?

 ![33610i7575612D979FF4F0.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/8/483c244e175a736fa9ea5ec82c459d8d7d5d9534.png)

---

<div class="post-metadata">

**Author:** ![testuser27](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/testuser27/32/35493_2.png) [@testuser27](https://community.hubspot.com/u/testuser27)\
**Post date:** [November 19, 2020, 11:26am UTC](https://community.hubspot.com/t/api-for-accessing-line-item-editor-data/28139/4 "2020-11-19T11:26:41Z")

</div>

Hello [@quentin\_lamamy](https://community.hubspot.com/t5/user/viewprofilepage/user-id/148828) ,  
We want to link product to deal. for this we created line item from product and that line item we have associated with deal which working fine but we want update quantity of line item which is associated with deal.  
Single line item could be associated with multiple deal and line items quantity would be very for each deal  
So can you please help me that how I can update associated line items quantity for particular deal.

---

<div class="post-metadata">

**Author:** ![quentin\_lamamy](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/quentin_lamamy/32/20212_2.png) [@quentin\_lamamy](https://community.hubspot.com/u/quentin_lamamy)\
**Post date:** [November 19, 2020, 11:38am UTC](https://community.hubspot.com/t/api-for-accessing-line-item-editor-data/28139/5 "2020-11-19T11:38:27Z")

</div>

I don’t know how work the product part of hs, but it should work like the other object. You should make a request to get all association of a deal, and update the line item associated to it

`GET /crm/v3/objects/deals/{dealId}/associations/{toObjectType}`

Loop on item and then update it with

`PATCH /crm/v3/objects/line_items/{lineItemId}`

 ![33610i7575612D979FF4F0.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/8/483c244e175a736fa9ea5ec82c459d8d7d5d9534.png)

---

<div class="post-metadata">

**Author:** ![testuser27](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/testuser27/32/35493_2.png) [@testuser27](https://community.hubspot.com/u/testuser27)\
**Post date:** [November 19, 2020, 12:03pm UTC](https://community.hubspot.com/t/api-for-accessing-line-item-editor-data/28139/6 "2020-11-19T12:03:22Z")

</div>

`PATCH /crm/v3/objects/line_items/{lineItemId}`

Can you please provide me json for this i’m getting inavlid json error. Below is my json

```lia-code-sample
[
 {
 "name": "description",
 "value": "An updated description for this line item. Updating the quantity."
 },
 {
 "name": "quantity",
 "value": "5"
 }
]

```

Can you please suggest me changes if i forget anything that’s needed to pass in JSON

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [November 19, 2020, 3:21pm UTC](https://community.hubspot.com/t/api-for-accessing-line-item-editor-data/28139/7 "2020-11-19T15:21:42Z")

</div>

Hey @testuser27 ,

the json should look like this

```lia-code-sample
{
 "properties": {
 "description": "An updated description for this line item. Updating the quantity.",
 "quantity": "5"
 }
}

```

---

<div class="post-metadata">

**Author:** ![CSilva6](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/csilva6/32/83480_2.png) [@CSilva6](https://community.hubspot.com/u/CSilva6)\
**Post date:** [August 10, 2022, 12:14pm UTC](https://community.hubspot.com/t/api-for-accessing-line-item-editor-data/28139/8 "2022-08-10T12:14:53Z")

</div>

Solução explicada para esse exemplo:

[https://api.hubapi.com/crm/v3/objects/deals](https://api.hubapi.com/crm/v3/objects/deals/) **DEALIDHERE**?hapikey= **APIKEYHERE** &associations=line\_items

Com essa chamada você consegue pegar um “deal” específico os “line\_items” associados, caso tenha. Se tiver, você vai encontrar uma estrutura de id e type relacionado a line\_items. O que interessa, é o id. Com esse ID você pode usar a seguinte url:

[https://api.hubapi.com/crm/v3/objects/line\_items](https://api.hubapi.com/crm/v3/objects/line_items/){lineItemId}?hapikey= **APIKEYHERE**  
Substituindo o valor {lineItemId} pelo ID da consulta anterior, essa url vai retornar as informações do line\_item específico.

 ![4964e667-7f31-4730-872d-e4266ca89f02.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/1/418385c448811384451b6462455863cf402305ba.jpeg)

 ![3c062c79-a2b1-444f-807a-b35b9bc62093.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/1/91644173231e0be8d3cd6d3e485002e3cb7bfc1f.jpeg)
