Documentation Index
Fetch the complete documentation index at: https://docs.tesouro.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Line item refers to any service or product added to a credit note, along with their descriptions, quantities, rates, and prices. Every credit note contains descriptions of all items purchased.
By default, the subtotal and total fields of line items are automatically calculated based on the unit_price, quantity, and tax fields, therefore, are read-only and appear only in the response schema.
Credit notes cannot add new line items or increase the unit quantity and price in line items. Instead, the organization should issue a new payable for the additional amount.
Add line items to a credit note
To add line items to a credit note, call the POST /payable-credit-notes/{credit_note_id}/line-items endpoint:
curl -X POST 'https://api.sandbox.tesouro.com/v1/payable-credit-notes/{credit_note_id}/line-items' \
-H 'X-Finops-Version: 2025-06-23' \
-H 'X-Organization-Id: ORGANIZATION_ID' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "Some product",
"description": "Description...",
"quantity": 1.22,
"tax": 1250,
"unit": "meter",
"unit_price": 1200,
}'
The successful response contains information about the created line item:
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "Some product",
"description": "Description...",
"quantity": 1.22,
"tax": 1250,
"unit": "meter",
"unit_price": 1200
}
List all line items of a credit note
To list all line items of a specific credit note, send a GET request to the /payable-credit-notes/{credit_note_id}/line-items endpoint:
curl GET 'https://api.sandbox.tesouro.com/v1/payable-credit-notes/{credit_note_id}/line-items' \
-H 'X-Finops-Version: 2025-06-23' \
-H 'X-Organization-Id: ORGANIZATION_ID' \
-H 'Authorization: Bearer ACCESS_TOKEN'
You will get a list of all line items present in the informed credit note:
{
"next_pagination_token": "string",
"prev_pagination_token": "string",
"data": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "Some product",
"description": "Description...",
"quantity": 1.22,
"tax": 1250,
"unit": "meter",
"unit_price": 1200
}
]
}
Update a specific line item
To update some information about a specific line item in a credit note, call PATCH /payable-credit-notes/{credit_note_id}/line-items/{line_item_id}:
curl -X PATCH 'https://api.sandbox.tesouro.com/v1/payable-credit-notes/{credit_note_id}/line-items/{line_item_id}' \
-H 'X-Finops-Version: 2025-06-23' \
-H 'X-Organization-Id: ORGANIZATION_ID' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "Some product",
"description": "Description...",
"quantity": 1.22,
"tax": 1250,
"unit": "meter",
"unit_price": 1200
}'
Remove a line item
To remove the line item from the payable, call DELETE /payable-credit-notes/{credit_note_id}/line-items/{line_item_id}:
curl -X DELETE 'https://api.sandbox.tesouro.com/v1/payable-credit-notes/{credit_note_id}/line-items/{line_item_id}`' \
-H 'X-Finops-Version: 2025-06-23' \
-H 'X-Organization-Id: ORGANIZATION_ID' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'