Manage line items

Learn how to manage the items described in a payable.

Overview

Line item refers to any service or product added to a payable, along with their descriptions, quantities, rates, and prices. Every payable has descriptions of all items purchased.

Add line items to a payable

To add line items to a payable, call POST /payables/{payable_id}/line_items:

curl -X POST 'https://api.sandbox.monite.com/v1/payables/{payable_id}/line_items' \
  -H 'x-monite-version: 2023-03-14' \
  -H 'X-Monite-Entity-Id: ENTITY_ID' \
  -H 'Authorization: Bearer YOUR_PARTNER_TOKEN' \
  -d '{
  "name": "Ice cream",
  "description": "A delicious vanilla ice cream",
  "quantity": 1,
  "total": 1250,
  "tax": 50,
  "subtotal": 1200,
  "ledger_account_id": "7df884fd-8be8-4eba-b6ff-417b66efe033"
}'

The field ledger_account_idis optional and required only for account integration.

The successful response contains information about the created line item:

{
  "name": "Ice cream",
  "description": "A delicious vanilla ice cream",
  "quantity": 1,
  "total": 1250,
  "tax": 50,
  "subtotal": 1200,
  "ledger_account_id": "7df884fd-8be8-4eba-b6ff-417b66efe033",
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "tax_account_id": "dd13735f-ef3a-4312-8c37-835d70341375",
  "was_created_by_user_id": "ea837e28-509b-4b6a-a600-d54b6aa0b1f5",
  "payable_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

List all line items of a payable

To list all line items of a specific payable, call GET /payables/{payable_id}/line_items:

curl GET 'https://api.sandbox.monite.com/v1/payables/{payable_id}/line_items' \
  -H 'x-monite-version: 2023-03-14' \
  -H 'X-Monite-Entity-Id: ENTITY_ID' \
  -H 'Authorization: Bearer YOUR_PARTNER_TOKEN' 
  

You will get a list of all line items present in the informed payable:

{
  "data": [
    {
      "name": "Ice cream",
      "description": "A delicious vanilla ice cream",
      "quantity": 1,
      "total": 1250,
      "tax": 50,
      "subtotal": 1200,
      "ledger_account_id": "7df884fd-8be8-4eba-b6ff-417b66efe033",
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "tax_account_id": "dd13735f-ef3a-4312-8c37-835d70341375",
      "was_created_by_user_id": "ea837e28-509b-4b6a-a600-d54b6aa0b1f5",
      "payable_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    },
    {
      "name": "Cake",
      "description": "A chocolate cake",
      "quantity": 1,
      "total": 1250,
      "tax": 50,
      "subtotal": 1200,
      "ledger_account_id": "7df884fd-8be8-4eba-b6ff-417b66efe033",
      "id": "12188fc1-493d-48a7-aea8-382240dd7ce7",
      "tax_account_id": "dd13735f-ef3a-4312-8c37-835d70341375",
      "was_created_by_user_id": "ea837e28-509b-4b6a-a600-d54b6aa0b1f5",
      "payable_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    }
  ],
  "prev_pagination_token": null,
  "next_pagination_token": null
}

Retrieve a line item

To retrieve information from a specific line item in a payable, call GET /payables/{payable_id}/line_items/{line_item_id}:

curl -X GET 'https://api.sandbox.monite.com/v1/payables/{payable_id}/line_items/{line_item_id}' \
  -H 'x-monite-version: 2023-03-14' \
  -H 'X-Monite-Entity-Id: ENTITY_ID' \
  -H 'Authorization: Bearer YOUR_PARTNER_TOKEN' 

Update a line item

To update a specific line item in a payable, call PATCH /payables/{payable_id}/line_items/{line_item_id}:

curl -X PATCH 'https://api.sandbox.monite.com/v1/payables/{payable_id}/line_items/{line_item_id}' \
  -H 'x-monite-version: 2023-03-14' \
  -H 'X-Monite-Entity-Id: ENTITY_ID' \
  -H 'Authorization: Bearer YOUR_PARTNER_TOKEN' \
  -d '{"name": "Double ice cream"}'

Remove a line item

To remove the line item from the payable, call DELETE /payables/{payable_id}/line_items/{line_item_id}:

curl -X DELETE 'https://api.sandbox.monite.com/v1/payables/{payable_id}/line_items/{line_item_id}`' \
  -H 'x-monite-version: 2023-03-14' \
  -H 'X-Monite-Entity-Id: ENTITY_ID' \
  -H 'Authorization: Bearer YOUR_PARTNER_TOKEN'