update_invoice
Update an existing invoice. Partial update: anything omitted keeps its stored value, BUT items and bill_to are REPLACED as a whole when sent (never merged) — to edit one line item, send the complete new items array. STATE MACHINE: draft → pending → paid, with cancelled reachable from draft or pending. Status "pending" publishes, "cancelled" cancels. Reverting to draft is rejected (400). Paid and cancelled invoices are immutable history — the API answers 409; do not retry, explain to the user. Publishing does NOT email the recipient. Totals are recomputed server-side. Requires the Invoices module enabled — on 403 "module is not enabled", do NOT retry; tell the user to contact Sweeppea support. DISPLAY RULE: never show InvoiceToken UUIDs; use InvoiceNumber when talking to the user.
update_invoice
When to use
Update an existing invoice. Partial update: anything omitted keeps its stored value, BUT items and bill_to are REPLACED as a whole when sent (never merged) — to edit one line item, send the complete new items array. STATE MACHINE: draft → pending → paid, with cancelled reachable from draft or pending. Status "pending" publishes, "cancelled" cancels. Reverting to draft is rejected (400). Paid and cancelled invoices are immutable history — the API answers 409; do not retry, explain to the user. Publishing does NOT email the recipient. Totals are recomputed server-side. Requires the Invoices module enabled — on 403 "module is not enabled", do NOT retry; tell the user to contact Sweeppea support. DISPLAY RULE: never show InvoiceToken UUIDs; use InvoiceNumber when talking to the user.
Pre-calls required
get_invoice— check the current Status before attempting a transition
Parameters to validate before calling
invoice_token(string, required) — The invoice token (UUID v4) of the invoice to editbill_to(object, optional) — FULL replacement of the recipient object, PascalCase keys: {"Name", "Email"} required; optional: Company, Phone, Address, City, State, ZipCode, Country, TaxId (optional)items(array, optional) — FULL replacement of the line items (max 60), PascalCase keys: [{"Description" (required), "Quantity", "Rate"}] (optional)title(string, optional) — Invoice title/concept (max 200 characters, optional)issue_date(string, optional) — Issue date YYYY-MM-DD (optional)due_date(string, optional) — Due date YYYY-MM-DD (optional)discount_amount(number, optional) — Flat discount amount, capped at the subtotal (optional)tax_enabled(boolean, optional) — Apply tax (optional)tax_label(string, optional) — Tax label (optional)tax_rate(number, optional) — range: 0–100 — Tax percentage 0-100 (optional)payment_method(string, optional) — one of:card,check,transfer— Payment method (optional). payment_instructions is cleared when method is "card"payment_instructions(string, optional) — Offline payment instructions for check/transfer (optional)notes_to_recipient(string, optional) — Notes to the recipient (max 3000 characters, optional)terms(string, optional) — Terms and conditions (max 3000 characters, optional)status(string, optional) — one of:pending,cancelled— Status transition (optional): "pending" publishes the draft, "cancelled" cancels. Reverting to draft is not allowed
Notes
State machine: draft → pending → paid, with cancelled reachable from draft or pending. Reverting to draft is rejected (400)
Paid and cancelled invoices are immutable history — the API answers 409; do not retry, explain to the user
Items and BillTo are REPLACED as a whole when sent — to edit one line item, send the complete new array
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | No | FULL replacement of the line items (max 60), PascalCase keys: [{"Description" (required), "Quantity", "Rate"}] (optional) | |
| terms | No | Terms and conditions (max 3000 characters, optional) | |
| title | No | Invoice title/concept (max 200 characters, optional) | |
| status | No | Status transition (optional): "pending" publishes the draft, "cancelled" cancels. Reverting to draft is not allowed | |
| bill_to | No | FULL replacement of the recipient object, PascalCase keys: {"Name", "Email"} required; optional: Company, Phone, Address, City, State, ZipCode, Country, TaxId (optional) | |
| due_date | No | Due date YYYY-MM-DD (optional) | |
| tax_rate | No | Tax percentage 0-100 (optional) | |
| tax_label | No | Tax label (optional) | |
| issue_date | No | Issue date YYYY-MM-DD (optional) | |
| tax_enabled | No | Apply tax (optional) | |
| invoice_token | Yes | The invoice token (UUID v4) of the invoice to edit | |
| payment_method | No | Payment method (optional). payment_instructions is cleared when method is "card" | |
| discount_amount | No | Flat discount amount, capped at the subtotal (optional) | |
| notes_to_recipient | No | Notes to the recipient (max 3000 characters, optional) | |
| payment_instructions | No | Offline payment instructions for check/transfer (optional) |