Merge orders into this one
curl --request POST \ --url https://example.com/api/v1/orders/example/merge \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "addHours": { "additionalProperty": true }, "confirm": true, "sourceIds": [ "example" ] }'Moves every relation of each source order onto order {id} in one transaction, then deletes the sources. Duplicate project links, members and same-name activity types collapse into the kept order’s (time entries follow); each source’s bought hours enter the kept order’s ledger as one movement noted Merged from <code> · <name> unless addHours turns that source off because it repeats the same purchase, an extra block tied to the invoice that sold it when the kept order already has its own; the kept order keeps its type, name, code and dates, and lists the sources’ codes and imported ids as aliases. Logged as ORDER_MERGED in the change log and audited on every order. Cannot be undone. Every order must be of the same company and in the caller’s reach. A source with a subscription, an order waiting for its purchase to be paid, orders that differ in billability or budget unit, orders budgeted in tokens, an archived kept order, a source with an audited period and any date the merge would move into or out of locked time are refused. Requires the orders.edit and orders.delete permissions, since the source orders are deleted.
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
Whether each source’s purchased hours enter the kept order’s ledger. Turn a source off when it repeats the same purchase: its time, invoices and everything else still move. A source left out adds its hours. Keyed by source order id.
object
Must be true: the merge deletes the source orders and cannot be undone.
The orders merged into this one and then deleted, at most 9. All must belong to the same company.
Responses
Section titled “Responses”What the merge moved, and the kept order’s budget.
object
object
object
The hours the order was bought with.
object
The kept order’s budget after the merge.
object
Negative when the order is over budget.
object
Whether its purchased hours are added.
Rows of the merged order that collapse into the kept order’s own (projects, members, activity types by name) or end with it (budget alerts, notice dismissals, unlocked audit periods, a second intake or estimate link, carries between the merged orders, which are voided).
object
Rows that moved to the kept order, per relation.
object
The ledger movement that adds the merged order’s bought hours to the kept order: an extra block tied to the invoice that sold it, or an adjustment. Null for an order bought with no hours.
object
object
The hours the order was bought with.
Example
{ "data": { "sources": [ { "movement": { "kind": "ADJUSTMENT" } } ] }}Validation error. Parse failures include field paths and expectations.
Validation error with safe field paths and expected values; submitted values are never returned.
object
object
Stable machine-readable error code.
object
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 kept order or a source order is not found in reach.
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" }}Locked time or an audited period, or the orders changed while merging.
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" }}No source, too many orders, the kept order named as a source, or a refusal listed above.
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