Save client
save_clientCreate or update a customer. Pass an id to update that customer; omit id to create a new one. Returns the new client id on create. Updating an existing customer with an opening date later than its own earliest invoice or receipt is refused, unwritten, with code confirm-required until the same call is repeated with confirm true. To create/update many at once, send an items array — one all-or-nothing transaction with a single ledger recompute; each item with an id updates, each without creates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Client id. Present → update that client; omit → create a new one. | |
| city | No | City. | |
| name | No | Display name / description of the client. | |
| No | Client email address. | ||
| items | No | Vector of client objects to create/update in one all-or-nothing batch. Preferred over repeated calls. Each item with an id updates; each without creates. | |
| hidden | No | Whether this client is hidden from lists. | |
| suburb | No | Suburb or district. | |
| address | No | Street address line 1. | |
| confirm | No | PROD-1950: required only to save an opening date that is LATER than the customer's own earliest invoice or receipt. Without it that one case is refused, unwritten, with code confirm-required plus earliesttransactiondate and transactionsbefore, so the caller can show what the date would exclude from the debtors balance and let the user override it. | |
| country | No | Client country (ISO code or name). | |
| starred | No | Whether this client is marked as a favourite. | |
| address2 | No | Street address line 2. | |
| archived | No | Whether this client is archived. Archiving is a status flag only: the server stores it and still returns archived clients on every list, report and total. The apps filter on it. | |
| vatnumber | No | VAT / tax registration number. | |
| postalcode | No | Postal or ZIP code. | |
| contactname | No | Name of the primary contact person. | |
| openingdate | No | Date the opening balance applies from (ISO 8601). | |
| contactemail | No | Email of the primary contact person. | |
| customercode | No | Your internal customer/account code for this client. | |
| contactnumber | No | Phone number of the primary contact person. | |
| openingbalance | No | Opening balance amount carried for this client at openingdate. | |
| registrationnumber | No | Business registration number. | |
| clearopeningbalance | No | Reserved, mirrors update_bank_account: when true the opening-date confirmation below is not asked. |