Save supplier
save_supplierCreate or update a supplier. Pass an id to update that supplier; omit id to create a new one. Returns the new supplier id on create. Updating an existing supplier with an opening date later than its own earliest bill or expense 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 | Supplier id. Present → update that supplier; omit → create a new one. | |
| city | No | City. | |
| name | No | Display name / description of the supplier. | |
| No | Supplier email address. | ||
| items | No | Vector of supplier objects to create/update in one all-or-nothing batch. Preferred over repeated calls. Each item with an id updates; each without creates. | |
| suburb | No | Suburb or district. | |
| address | No | Street address line 1. | |
| confirm | No | PROD-1951: required only to save an opening date that is LATER than the supplier's own earliest bill or expense. 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 creditors balance and let the user override it. | |
| country | No | Supplier country (ISO code or name). | |
| starred | No | Whether this supplier is marked as a favourite. | |
| address2 | No | Street address line 2. | |
| 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. | |
| contactnumber | No | Phone number of the primary contact person. | |
| openingbalance | No | Opening balance amount carried for this supplier at openingdate. | |
| registrationnumber | No | Business registration number. | |
| clearopeningbalance | No | Reserved, mirrors update_bank_account: when true the opening-date confirmation below is not asked. |