Add a line item to a draft invoice
curl --request POST \ --url https://example.com/api/v1/invoices/example/line-items \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "description": "example", "discountPercent": 1, "exception": true, "kindId": "example", "note": "example", "orderId": "example", "periodEnd": "2026-04-15", "periodStart": "2026-04-15", "pricingOptionId": "example", "quantity": 1, "rate": 1, "revenueAccountId": "example", "serviceId": "example", "teamId": "example" }'Adds a line item to an invoice that is still in DRAFT status. With a serviceId (and optionally a pricingOptionId package) the description is set from the service, a description sent is ignored while the description is locked, and an omitted quantity or rate takes the service default; without one the line is Custom and description, quantity and rate are required. discountPercent takes a percentage off quantity times rate (the line’s amount is net of it); it is refused with 409 DISCOUNT_CONFLICT while the invoice has an invoice-wide discount. note, periodStart/periodEnd, revenueAccountId and teamId may be set; a class sent as teamId is recorded as MANUAL. 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. Requires the invoices.manage permission.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Resource identifier (CUID2).
Resource identifier (CUID2).
Request Body
Section titled “Request Body”object
Line description. Required for a Custom line; with serviceId it is ignored while the workspace locks the description, unless exception is true.
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.
A note the client sees under the line description.
Quantity. Required for a Custom line; with serviceId it defaults from the service.
Unit rate. Required for a Custom line; with serviceId it defaults to the company rate in force on the issue date, else the service base hourly rate.
The service this line is built from. The description is then set from the service name (plus the package label); a description sent is ignored while the workspace locks the description, unless exception is true. Null or omitted makes a Custom line, whose every field is yours.
Example generated
{ "description": "example", "discountPercent": 1, "exception": true, "kindId": "example", "note": "example", "orderId": "example", "periodEnd": "2026-04-15", "periodStart": "2026-04-15", "pricingOptionId": "example", "quantity": 1, "rate": 1, "revenueAccountId": "example", "serviceId": "example", "teamId": "example"}Responses
Section titled “Responses”The created 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 does not exist, or the line names a service, package, order, line kind, revenue account or team that 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 left DRAFT status while the line was being added, a locked field of the service line was changed without exception: true (FIELD_LOCKED), or a discountPercent was sent while the invoice has an invoice-wide discount (DISCOUNT_CONFLICT).
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 is not in DRAFT status.
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