Line items in payables
Overview
Line item refers to any service or product added to a payable, along with their descriptions, quantities, rates, and prices. Every payable 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.
When an item is processed via OCR, the line items quantity and unit price may be extracted in a way that leads to rounding discrepancies. In this case, the API may adjust its quantity and unit price to prevent rounding issues and ensure accurate calculations while keeping the total price unchanged, ensuring they align with the invoice. When it happens, the line item field ocr_set_quantity_to_one is set to true.
Example of an adjustment:
Before: Quantity: 2000, Price: 10€, Unit Price: 0.005€ (rounded to 0.01€ due to minor units)
After: Quantity: 1, Price: 10€, Unit Price: 10€
Add line items to a payable
To add line items to a payable, send a POST request to the /payables/{payable_id}/line_items endpoint:
The successful response contains information about the created line item:
List all line items of a payable
To list all line items of a specific payable, send a GET request to the /payables/{payable_id}/line_items endpoint:
You will get a list of all line items present in the informed payable:
Retrieve a line item
To retrieve information from a specific line item in a payable, send a GET request to the /payables/{payable_id}/line_items/{line_item_id} endpoint:
Update a specific line item
To update some information about a specific line item in a payable, send a PATCH request to the /payables/{payable_id}/line_items/{line_item_id} endpoint:
Replace all line items
You can also replace all line items of a specific payable at once by sending a PUT request to the /payables/{payable_id}/line_items endpoint:
This action removes all existing line items of a payable and recreates them with the new data. As a result, all line items get new id values.
Remove a line item
To remove the line item from the payable, send a DELETE request to the /payables/{payable_id}/line_items/{line_item_id} endpoint: