Skip to main content
The examples below use draft invoices. In the default compliant mode, you cannot edit an invoice’s line items after issuing it. In non_compliant mode, you can edit issued invoices, including their line items. See Invoice compliance for details.

Update invoice line items

To add, replace, or remove line items while updating other invoice fields, call PATCH /receivables/{receivable_id}. The response for every invoice line item includes a stable id; use that ID when replacing or removing an existing item. The line_items object can contain add, replace, and remove operations in the same request. Each item in add and replace[].data uses the complete line item shape accepted by the replace line items endpoint. A replace operation keeps the existing line item’s ID.
Include at least one operation. Do not use the same line item ID more than once or in both replace and remove. The final invoice must contain at least one line item. Tesouro recalculates the totals from the resulting list and records the header and line-item changes in one history entry.

Replace all invoice line items

To replace the entire list in a separate request, send a PUT request to the /receivables/{receivable_id}/line-items endpoint. In the request body, use the data field to specify the invoice’s new line items. This endpoint is unchanged.
A successful request overwrites the invoice’s existing line items and replaces them with the newly defined array of line item objects.