Save variant
save_variantCreate or update a variant. Pass an id to update it; omit id to create a new one. Returns the new variant id on create. 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 | Variant id. Present → update that variant; omit → create a new one. | |
| sku | No | Stock-keeping unit / product code. | |
| cost | No | Cost price per unit. | |
| name | No | Display name / description of the variant. | |
| image | No | Variant image URL; pass "$delete" to remove the existing image. | |
| items | No | Vector of variant objects to create/update in one all-or-nothing batch. Preferred over repeated calls. Each item with an id updates; each without creates. | |
| notes | No | Free-text notes. | |
| price | No | Selling price per unit, in the record's currency. | |
| units | No | Unit of measure label (e.g. "each", "hour", "kg"). | |
| barcode | No | Barcode value for this variant. | |
| currency | No | ISO 4217 currency code (e.g. "ZAR", "USD"). Defaults to the business currency. | |
| productid | No | Parent product id this variant belongs to (see list_products). | |
| description | No | Variant description. | |
| salestaxids | No | Sales tax ids to link to this variant. | |
| costcurrency | No | ISO 4217 currency code for the cost price. | |
| salestaxexclusive | No | Whether the price excludes sales tax. |