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. | |
| number | No | Main telephone (landline) number of the client, beside the contact person's contactnumber. Trimmed; a blank value on update clears it. | |
| 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. | |
| website | No | Client website, e.g. www.example.co.za. Trimmed; a blank string clears it, null leaves it unchanged. | |
| 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. | |
| contacts | No | The full list of contact people. It replaces the stored list: a person left out is removed. Leave the key out to keep the stored list; send [] to clear it. | |
| addresses | No | The full list of addresses. It replaces the stored list: an address left out is removed. Leave the key out to keep the stored list; send [] to clear it. | |
| vatnumber | No | VAT / tax registration number. | |
| postalcity | No | Postal address city. | |
| postalcode | No | Postal or ZIP code. | |
| contactname | No | Name of the primary contact person. | |
| creditlimit | No | Most this customer may owe, in base currency. Changing or clearing a stored limit needs the Extend credit over limit permission. | |
| 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. | |
| postalsuburb | No | Postal address suburb. | |
| contactnumber | No | Phone number of the primary contact person. | |
| postaladdress | No | Postal address line 1, e.g. a PO Box. | |
| openingbalance | No | Opening balance amount carried for this client at openingdate. | |
| postaladdress2 | No | Postal address line 2. | |
| documentaddress | No | Which address documents print: physical (default) or postal. | |
| clearcreditlimit | No | When true, removes the stored credit limit. | |
| postalpostalcode | No | Postal address postal code. | |
| registrationnumber | No | Business registration number. | |
| clearopeningbalance | No | Reserved, mirrors update_bank_account: when true the opening-date confirmation below is not asked. |