document_transition
Move documents through allowed lifecycle states to finalize drafts, record sent or paid status, void, archive, or restore them; invalid transitions are rejected.
Instructions
Move a document through its lifecycle.
finalized— Issue adraft: fix its number and totals.sent— Record that the document reached the customer.paid— Record that the document was paid in full.unpaid— Undomark_paid, returning the document tosent.void— Cancel a document that was issued.archived— Move a document out of the active list.restored— Bring an archived document back tofinalized.
Each transition is only valid from certain states and is refused with 409 otherwise. To actually email a document to its customer, use document_send — to: "sent" only records that it happened.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | The state to move the document to. - `finalized` — Issue a `draft`: fix its number and totals. - `sent` — Record that the document reached the customer. - `paid` — Record that the document was paid in full. - `unpaid` — Undo `mark_paid`, returning the document to `sent`. - `void` — Cancel a document that was issued. - `archived` — Move a document out of the active list. - `restored` — Bring an archived document back to `finalized`. | |
| document_id | Yes |