How to PATCH a line item?

Hello everyone,
I’m writing a code that will check and update a “price” value of an existing line item based on an according product’s price (f.e.: if product’s price was changed after creation of a line item, or some error ocured while creating it, and etc.). To do this, I’m sending a PATCH reqiest (with a JSON body contayning a new price) to the url:
https://api.hubapi.com/crm/v3/objects/line_items/{line_item_id}
But, unfortunately it doesn’t have any effect - despite getting 200 response, after running a GET request the “price” value still remains unchanged.
Can anyone help me to figure out the reason?
Thank you all in advance for your help.
P.S. - while I’m at it, might as well ask - how can i check whether a discount was applied to the deal using api, as this information doesn’t appear in a simple GET response?

Hey, @G_Gorgiladze :waving_hand: Thank for your question. I hope you got this resolved, but if not, here’s an example I made of updating the price of a line item via our API.

Steps:

  • I created a new Line Item and associated it to an existing deal
    Request

    curl --request POST \
     --url https://api.hubapi.com/crm/v3/objects/line_items \
     --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
     --header 'content-type: application/json' \
     --data '{
     "associations": [
     {
     "types": [
     {
     "associationCategory": "HUBSPOT_DEFINED",
     "associationTypeId": 20
     }
     ],
     "to": {
     "id": "13149364401"
     }
     }
     ],
     "properties": {
     "name": "Cat goggles",
     "price": "6000.00",
     "quantity": "1",
     "recurringbillingfrequency": "monthly",
     "hs_recurring_billing_period": "P24M"
     }
    }'​
    

    Response

    HTTP 201
    
    {
     "id": "8612992048",
     "properties": {
     "amount": "6000.00",
     "createdate": "2024-03-12T16:57:36.572Z",
     "hs_acv": "72000.00",
     "hs_arr": "72000.00",
     "hs_lastmodifieddate": "2024-03-12T16:57:36.572Z",
     "hs_margin": "6000.00",
     "hs_margin_acv": "72000.00",
     "hs_margin_arr": "72000.00",
     "hs_margin_mrr": "6000.00",
     "hs_margin_tcv": "144000.00",
     "hs_mrr": "6000.00",
     "hs_object_id": "8612992048",
     "hs_object_source": "INTEGRATION",
     "hs_object_source_id": "959085",
     "hs_object_source_label": "INTEGRATION",
     "hs_position_on_quote": "0",
     "hs_post_tax_amount": "6000.00",
     "hs_pre_discount_amount": "6000.00",
     "hs_recurring_billing_number_of_payments": "24",
     "hs_recurring_billing_period": "P24M",
     "hs_recurring_billing_terms": "FIXED",
     "hs_tcv": "144000.00",
     "hs_term_in_months": "24",
     "hs_total_discount": "0.00",
     "name": "Cat goggles",
     "price": "6000.00",
     "quantity": "1",
     "recurringbillingfrequency": "monthly"
     },
     "createdAt": "2024-03-12T16:57:36.572Z",
     "updatedAt": "2024-03-12T16:57:36.572Z",
     "archived": false
    }
    

  • I made a Patch request to update the price
    Request

    curl --request PATCH \
     --url https://api.hubapi.com/crm/v3/objects/line_items/8612992048 \
     --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
     --header 'content-type: application/json' \
     --data '{
     "properties": {
     "price": "8888.00"
     }
    }'​
    

    Response

    HTTP 200
    
    {
     "id": "8612992048",
     "properties": {
     "amount": "8888.00",
     "createdate": "2024-03-12T16:57:36.572Z",
     "hs_acv": "106656.00",
     "hs_arr": "106656.00",
     "hs_lastmodifieddate": "2024-03-12T17:00:37.473Z",
     "hs_margin": "8888.00",
     "hs_margin_acv": "106656.00",
     "hs_margin_arr": "106656.00",
     "hs_margin_mrr": "8888.00",
     "hs_margin_tcv": "213312.00",
     "hs_mrr": "8888.00",
     "hs_object_id": "8612992048",
     "hs_post_tax_amount": "8888.00",
     "hs_pre_discount_amount": "8888.00",
     "hs_tcv": "213312.00",
     "hs_term_in_months": "24",
     "hs_total_discount": "0.00",
     "price": "8888.00",
     "quantity": "1",
     "recurringbillingfrequency": "monthly"
     },
     "createdAt": "2024-03-12T16:57:36.572Z",
     "updatedAt": "2024-03-12T17:00:37.473Z",
     "archived": false
    }
    

  • Verified the price change via a Get request (to be thorough)
    Request

    curl --request GET \
     --url 'https://api.hubapi.com/crm/v3/objects/line_items/8612992048?properties=price&archived=false' \
     --header 'authorization: Bearer YOUR_ACCESS_TOKEN'
    

    Response

    HTTP 200
    
    {
     "id": "8612992048",
     "properties": {
     "createdate": "2024-03-12T16:57:36.572Z",
     "hs_lastmodifieddate": "2024-03-12T17:00:37.473Z",
     "hs_object_id": "8612992048",
     "price": "8888.00"
     },
     "createdAt": "2024-03-12T16:57:36.572Z",
     "updatedAt": "2024-03-12T17:00:37.473Z",
     "archived": false
    }
    

    I hope this helps get you moving forward! — Jaycee