Set the revenue account, class and service period of an invoice line
curl --request PATCH \ --url https://example.com/api/v1/invoices/example/line-items/example/accounting \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "exception": true, "periodEnd": "2026-04-15", "periodStart": "2026-04-15", "revenueAccountId": "example", "teamId": "example" }'Sets the revenue account, the class (the team the accountants book the line under) and the service period (periodStart, periodEnd) of one line. The account and class change on an invoice in any status; the period on any but CANCELLED (409), and a change of only the period needs no active revenue account. It never changes the line’s quantity, rate or amount, or the invoice totals. A null clears a field and an omitted field is kept; a class sent as teamId is recorded as MANUAL; a period end before its start answers 400. The fields the workspace locks on a service line (lockedLineFields in the invoice settings; the description by default) keep what the service filled: changing one answers 409 FIELD_LOCKED unless the body carries exception: true, which applies the change, records the field in editedFields and writes it to the audit entry. The change is written to the invoice history under the caller. A workspace with no active revenue account answers 400 for an account or class, and an invoice recorded from another system has no lines to edit and answers 409. Requires the invoices.manage permission and the invoice to be in the caller’s invoice scope. Staff only: Customer tokens never reach it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Resource identifier (CUID2).
Resource identifier (CUID2).
Line item identifier (CUID2).
Line item identifier (CUID2).
Request Body
Section titled “Request Body”object
Send true to change a field the workspace locks on a service line (see lockedLineFields in the invoice settings): the change is then applied, the field is recorded as edited by hand and the audit entry carries it. Without it, changing a locked field is refused with 409 FIELD_LOCKED. A locked description is left as the service set it. Custom lines are never locked.
Example generated
{ "exception": true, "periodEnd": "2026-04-15", "periodStart": "2026-04-15", "revenueAccountId": "example", "teamId": "example"}Responses
Section titled “Responses”The updated line item.
object
A single line on an invoice. serviceId, service, revenueAccountId, revenueAccount, teamId, team, classSource and editedFields are staff-only: Customer MCP tokens, the portal, the public link and the PDF never carry them. Those surfaces carry listRate only when it is above rate.
object
Quantity times rate less discountPercent, rounded to the cent. The invoice subtotal is the sum of these net amounts.
Percentage taken off quantity times rate on this line; null for none. Never set on an invoice with an invoice-wide discount.
The locked fields of a service line (account, class, period, description) that were changed by hand with exception: true. Empty for a line nobody changed and for a Custom line. Staff only.
Invoice line item kind; null for free-form items.
The service’s standard hourly rate when the line was created. A client document shows it struck through only when it is above rate; null for a line with no standard rate.
A note the client sees under the description.
Zero-based sort position on the invoice.
Revenue account of the line. Staff only; null while unset.
The service the line was built from; null for a Custom line.
The team whose accounting class the line carries. Staff only; null while unset.
Example
{ "data": { "classSource": "RESOLVED" }}The body is invalid, or the caller’s role holds invoices.accounting_required and the line would be saved with an amount but without a revenue account (and a class, when the workspace requires one).
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Unauthorized.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Forbidden.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}The invoice or line item does not exist or is outside the caller’s scope, the line does not belong to that invoice, or the revenue account or team does not exist.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}The invoice was recorded from another system and has no lines, the period was changed on a CANCELLED invoice, or a locked account, class or service period of a service line was changed without exception: true (FIELD_LOCKED).
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Rate limit exceeded. Wait for Retry-After before retrying.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Headers
Section titled “Headers”Maximum requests in the current quota window.
Quota policy in requests and window seconds, for example 60;w=60.
Requests left in this quota window (zero when blocked).
Seconds until the current quota window resets, when available from the rate-limit store.
Seconds until another request may be attempted.
Chelsea is operated by Arepa Labs LLC