Skip to content

Update an invoice line item

PATCH
/invoices/{id}/line-items/{lineItemId}
Code sample: Shell / cURL
curl --request PATCH \
--url https://example.com/api/v1/invoices/example/line-items/example \
--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" }'

Updates a line item on an invoice that is still in DRAFT status, including its discount percentage, service, package, note, service period, revenue account and class team. A null clears the field; a discountPercent is refused with 409 DISCOUNT_CONFLICT while the invoice has an invoice-wide discount. 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. Money and content edits are refused once the invoice leaves DRAFT; a body carrying only periodStart, periodEnd (and exception) still applies to an issued invoice, except a CANCELLED one, exactly as the accounting endpoint does. To change only the revenue account and class on an invoice in any status, use PATCH /invoices/{id}/line-items/{lineItemId}/accounting. Requires the invoices.manage permission.

id
required

Resource identifier (CUID2).

string
>= 1 characters

Resource identifier (CUID2).

lineItemId
required

Line item identifier (CUID2).

string
>= 1 characters

Line item identifier (CUID2).

Media typeapplication/json
object
description
string
>= 1 characters
discountPercent

Percentage taken off quantity times rate on this line, above 0 and below 100 (two decimals); amount is net of it. Null removes it. A line discount and the invoice-wide discount never combine: sending one while the other is set is refused with 409 DISCOUNT_CONFLICT.

Any of:
number
> 0 < 100
exception

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.

boolean
kindId
Any of:
string
>= 1 characters
note

A note the client sees under the line description.

string | null
orderId
string | null
periodEnd

Last day of the service period the line bills (YYYY-MM-DD). The client sees it.

Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
periodStart

First day of the service period the line bills (YYYY-MM-DD). The client sees it.

Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
pricingOptionId

A package of serviceId. Fills the quantity from the package hours and adds its label to the description.

Any of:
string
>= 1 characters
quantity
number
> 0
rate
number
revenueAccountId

Revenue account of the line. Staff only: never shown to the client. Defaults from the service. Ignored while the workspace has no active revenue account.

Any of:
string
>= 1 characters
serviceId

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.

Any of:
string
>= 1 characters
teamId

The team whose accounting class the line carries. Staff only: never shown to the client. Sent here, the class is MANUAL; left out, it resolves from the service rule and the company’s team on the issue date. Ignored while the workspace has no active revenue account.

Any of:
string
>= 1 characters

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"
}

The updated line item.

Media typeapplication/json
object
data
required

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
amount
required

Quantity times rate less discountPercent, rounded to the cent. The invoice subtotal is the sum of these net amounts.

number
classSource
required

How the class was set: RESOLVED from the service rule and the company’s team, or MANUAL when a person picked it. Null while the class is unset. Staff only.

Any of:
string
Allowed values: RESOLVED MANUAL
description
required
string
discountPercent
required

Percentage taken off quantity times rate on this line; null for none. Never set on an invoice with an invoice-wide discount.

number | null
editedFields
required

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.

Array<string>
id
required
string
invoiceId
required
string
kindId
required

Invoice line item kind; null for free-form items.

string | null
listRate
required

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.

number | null
note
required

A note the client sees under the description.

string | null
orderId
required
string | null
periodEnd
required

Last day of the service period the line bills (YYYY-MM-DD); null when none.

Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
periodStart
required

First day of the service period the line bills (YYYY-MM-DD); null when none.

Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
position
required

Zero-based sort position on the invoice.

integer
>= -9007199254740991 <= 9007199254740991
quantity
required
number
rate
required
number
revenueAccount
required

The line’s revenue account. Staff only; null while unset.

Any of:
object
code
required
string
id
required
string
name
required
string
revenueAccountId
required

Revenue account of the line. Staff only; null while unset.

string | null
service
required

The service the line was built from; null for a Custom line.

Any of:
object
id
required
string
name
required
string
serviceId
required

The service the line was built from; null for a Custom line.

string | null
team
required

The line’s class team. Staff only; null while unset.

Any of:
object
accountingClassName
required

The class name accounting reads; null when the team has none.

string | null
id
required
string
name
required
string
teamId
required

The team whose accounting class the line carries. Staff only; null while unset.

string | null

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).

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

The invoice or line item does not exist, or the update names a service, package, order, line kind, revenue account or team that does not exist.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

The invoice left DRAFT status while the line was being edited, a period was sent for a CANCELLED invoice, 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).

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

The invoice is not in DRAFT status and the body changes more than the service period.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.