Skip to content

Update an estimate line item

PATCH
/estimates/{id}/line-items/{lineItemId}
Code sample: Shell / cURL
curl --request PATCH \
--url https://example.com/api/v1/estimates/example/line-items/example \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "description": "example", "discountPercent": 1, "kind": "example", "position": 1, "quantity": 1, "rate": 1 }'

Updates a line item on a DRAFT estimate and recalculates its totals. A null discountPercent removes the line’s discount; one above 0 is refused with 409 DISCOUNT_CONFLICT while the estimate has an estimate-wide discount. Requires the estimates.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 estimate-wide discount never combine: sending one while the other is set is refused with 409 DISCOUNT_CONFLICT.

Any of:
number
> 0 < 100
kind
string | null
position
integer
>= -9007199254740991 <= 9007199254740991
quantity
number
> 0
rate
number

Example generated

{
"description": "example",
"discountPercent": 1,
"kind": "example",
"position": 1,
"quantity": 1,
"rate": 1
}

The updated line item.

Media typeapplication/json
object
data
required

A line item on an estimate.

object
amount
required

Quantity times rate less discountPercent, rounded to the cent.

number
description
required
string
discountPercent
required

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

number | null
estimateId
required
string
id
required
string
kind
required
string | null
orderId
required
string | null
position
required
integer
>= -9007199254740991 <= 9007199254740991
quantity
required
number
rate
required
number

Example generated

{
"data": {
"amount": 1,
"description": "example",
"discountPercent": 1,
"estimateId": "example",
"id": "example",
"kind": "example",
"orderId": "example",
"position": 1,
"quantity": 1,
"rate": 1
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
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"
}
}

Not found.

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

A discountPercent was sent while the estimate has an estimate-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"
}
}

Line items can only be modified on DRAFT estimates.

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.