Billing

Update a draft invoice

View as Markdown

PATCHhttps://paysuitett.com/api/v1/invoices/{id}

All fields are optional. Sending lines replaces every line. Omitting lines preserves and re-sends existing lines and their time links unchanged. Non-drafts return 409 CONFLICT. Unknown fields are rejected.

Access. Master key, or a personal key held by an owner/admin or accountant. The business must have the invoices service. Runs as the holder under their row-level security.

Path parameters

idstring · uuid
Invoice ID.

Body

A JSON object. Every field is optional.

customerIdstring · uuid
Customer in this business.
issueDatestring · date
Defaults to today's business date on creation.
dueDatestring · date
Defaults to issue date plus 30 days on creation; cannot precede issue date.
servicePeriodobject
{start, end}, YYYY-MM-DD, start ≤ end; null clears it.
qtyLabelstring
Quantity label; defaults to qty.Allowed:qtyhours
notesstring
Invoice notes; empty string clears them.
currencystring
Currency the customer is billed in (TTD, USD, ...); defaults to TTD, or the draft's. Line prices are in it.
exchangeRatenumber
TTD for one unit of a foreign currency, required with it (kept on PATCH when the currency stays). Each line's TTD amount, used in the books, is its amount × rate rounded to cents.
invoiceNumberstring
Drafts: a number to use instead of the next in sequence, up to 30 characters, unique in the business ignoring case (voided numbers included). It locks when the invoice is posted. Blank or null returns to the automatic number. Owner/Admin or Accountant only.
conversionFeePercentnumber
Foreign invoices: percentage taken off the TTD value booked (0 to under 100); null for none. On PATCH, omit all three books fields to keep the draft's.
conversionFeeTtdnumber
Foreign invoices: fixed TTD amount taken off the TTD value booked, after the percentage.
booksTotalnumber
Foreign invoices: the TTD total to book, typed instead of worked out (fees are then ignored). The document amounts don't change; the TTD amount is spread over the lines in proportion.
linesarray
Replaces all lines: {description, qty, unitPrice, section?, taxTreatment?, vatRatePercent?, timeSourceKey?, timeEntryIds?}. VAT defaults to the business's setup. taxTreatment: standard|zero_rated|exempt|out_of_scope; vatRatePercent: 0–25 (12.5 means 12.5%). Nonnegative quantities (up to four decimals, so exact tracked hours bill to the cent) and prices in the invoice currency. Time entry IDs are UUIDs; save_invoice_draft enforces ownership, hour caps, links and order.

Response

200 with a JSON body, as in the example.