Change several customers
const url = 'https://example.com/customers/bulk';const options = { method: 'POST', headers: { cookie: '__Host-bottle.session_token=<__Host-bottle.session_token>', 'Content-Type': 'application/json' }, body: '{"customerIds":["019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f"],"change":{"action":"kind","kind":"commercial"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/customers/bulk \ --header 'Content-Type: application/json' \ --cookie __Host-bottle.session_token=<__Host-bottle.session_token> \ --data '{ "customerIds": [ "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f" ], "change": { "action": "kind", "kind": "commercial" } }'One change made to every customer named: trade or consumer, payment terms, stopping new orders while unpaid, the chosen or excluded list for the surcharge, the language of their emails, or archiving. Each is done by the same rules as editing it alone. One that is archived, missing or already that way is left as it is and listed as skipped; the rest still go. To move many onto a price list, use POST /customers/rate-set.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
Make each a trade (commercial) or consumer (domestic) customer.
object
How each pays: prepaid, on account (with how many days, null for the business default) or cash on delivery.
object
Whether new orders stop while each has an overdue invoice.
object
Put each on the chosen or excluded list for the business surcharge, or take them off with null.
object
The language emails to each are written in.
A language: en-GB English, ar Arabic, ur Urdu, pa Punjabi (Gurmukhi), hi Hindi, bn Bengali, gu Gujarati, zh-Hans Chinese (Simplified), pl Polish, ro Romanian, es Spanish, fr French, de German.
object
Take each off the customer list. Past orders and invoices keep them. Already archived ones are skipped.
Responses
Section titled “Responses”What was changed and what was skipped
object
object
UUID v7
object
UUID v7
Example
{ "done": [ { "customerId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f" } ], "skipped": [ { "customerId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "reason": "not_found" } ]}Not signed in
object
Example
{ "error": "not_found", "message": "Customer not found"}Not a member of that tenant
object
Example
{ "error": "not_found", "message": "Customer not found"}Validation failed
object
object
Example
{ "error": "validation", "issues": [ { "path": "email", "message": "Invalid email" } ]}