Skip to content

Correct a balance entry

PATCH
/orders/{id}/balance-entries/{entryId}
Code sample: Shell / cURL
curl --request PATCH \
--url https://example.com/api/v1/orders/example/balance-entries/example \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "effectiveAt": "example", "hours": 1, "invoiceId": "example", "kind": "EXTRA_BLOCK", "linkedOrderId": "example", "note": "example" }'

Changes only the fields sent: kind, hours, effectiveAt, note, invoiceId and linkedOrderId. A credit, extra block, return or adjustment takes every field, and a kind change is limited to those four with the new kind’s sign rule. An overage forgiveness takes hours, effective date and note. Each half of an overage carried between orders (carry set) takes only a note, which is applied to both halves and audited on both orders; it is refused with 422 unless the caller can reach both orders. invoiceId links the entry to another issued invoice of the order’s client, or unlinks it with null. A deduction, a legacy release that holds an invoice and a voided entry cannot be edited, and the entry must belong to the order in the path. A body with no field is rejected with 400. Every change is audited with its previous and new value. Requires orders.edit and orders.unlock_audit (held by owners and admins), plus invoices.view when invoiceId is a string.

id
required

Order identifier (CUID2).

string
>= 1 characters

Order identifier (CUID2).

entryId
required

Balance entry identifier (CUID2).

string
>= 1 characters

Balance entry identifier (CUID2).

Media typeapplication/json

Only the fields sent change. A deduction, a legacy release and a voided entry cannot be edited; each half of a carried overage accepts only a note.

object
effectiveAt

ISO 8601 date the movement takes effect. A bare YYYY-MM-DD day is midnight in the workspace timezone.

string
hours

Signed hours; the kind’s sign rule applies.

number
invoiceId

An issued invoice of the order’s client to link instead of the current one; null unlinks it.

Any of:
string
>= 1 characters
kind

Moves the entry to another manual kind; the new kind’s sign rule applies.

string
Allowed values: EXTRA_BLOCK RETURN ADJUSTMENT
linkedOrderId

An earlier order of the same company an adjustment traces back to; null unlinks it.

Any of:
string
>= 1 characters
note

Null or empty clears the note.

string | null

The corrected entry.

Media typeapplication/json
object
data
required

A dated, signed movement on an order’s hour budget. Entries are voided, never deleted.

object
carry
required

Set on the two halves of an overage carried between orders; voiding one half voids the other.

Any of:
object
direction
required

in: overage carried into this order from order; out: this order’s overage carried into order.

string
Allowed values: in out
order
required
object
code
required
string | null
id
required
string
name
required
string
createdAt
required
string format: date-time
/^(?:(?:\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])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
createdByName
required
string | null
effectiveAt
required
string format: date-time
/^(?:(?:\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])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
hours
required

Signed hours; grants are positive, returns negative.

number
id
required
string
invoice
required

The invoice that granted the hours, when there is one.

Any of:
object
id
required
string
number
required
string
kind
required

CREDIT, EXTRA_BLOCK, RETURN, OVERAGE_FORGIVENESS, ADJUSTMENT, or OVERAGE_DEDUCTION (only created via POST /orders/{id}/overage-deductions or POST /orders/{id}/overage-carries).

string
linkedAdjustmentsWarning

Sent by a write that leaves linked adjustments out of step. Absent otherwise and on an older server.

object
furtherOrders
required

Orders linked further along the chain.

Array<object>
object
label
required
string
orderId
required
string | null
message
required
string
orders
required
Array<object>
object
adjustmentHours
required

The adjustment as it stands; null when the order is out of reach.

number | null
label
required
string
orderId
required

Null when the order is outside the caller’s reach.

string | null
reason
required

Why a person has to decide; null when suggestedHours is set.

string | null
suggestedHours
required

What it would become if a person confirms; null when left for a person.

number | null
linkedOrder
required

The earlier order an adjustment traces back to, when it has one.

Any of:
object
code
required
string | null
id
required
string
name
required
string
note
required
string | null
voidReason
required

Why the entry was voided; set on every void made through Chelsea or API.

string | null
voidedAt
required

Set when the entry was voided; a voided entry counts for nothing.

Any of:
string format: date-time
/^(?:(?:\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])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
voidedByName
required
string | null

Example

{
"data": {
"carry": {
"direction": "in"
}
}
}

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

The entry cannot be edited, a correction breaks its kind’s rules, or the invoice is not linkable.

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.