Export customers as CSV
const url = 'https://example.com/customers/export?includeArchived=true&owing=true&kind=commercial&marketing=email&surcharge=add&ordering=stopped&shop=confirmed&activity=returning&channel=email&purpose=all&tenantId=019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f';const options = { method: 'GET', headers: {cookie: '__Host-bottle.session_token=<__Host-bottle.session_token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://example.com/customers/export?includeArchived=true&owing=true&kind=commercial&marketing=email&surcharge=add&ordering=stopped&shop=confirmed&activity=returning&channel=email&purpose=all&tenantId=019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f' \ --cookie __Host-bottle.session_token=<__Host-bottle.session_token>The customers matching the same search and filters as GET /customers (all of them when none are given), as a CSV file streamed a page at a time.
purpose=all has every detail: name, legal name, email, phone, first delivery address, trade or consumer, payment terms, owed and overdue in pounds and pence, consent on each channel (Agreed, Withdrawn or Not asked), the date they became a customer, their last order and how many orders. purpose=marketing has only customers whose consent on channel is granted and who can be reached that way (an email that has not bounced, a phone number, a postal address), with only that contact, when and how they agreed, and their order dates.
UTF-8 with a byte order mark, so Excel opens it correctly, and CRLF line ends. Any text cell starting with =, +, -, @, a tab or a carriage return has a ' put in front so a spreadsheet does not run it. Erased and merged customers are left out.
Counted against the heavy allowance, and no more than 5 exports a minute per business (429 with Retry-After). The last line is End of file with the number of customers; a file that stops part way ends with a line saying it is not complete instead. Every export is recorded with who made it, the filters (a search only as having been used, never its words), the number of rows and how it ended: finished, failed or cancelled. Refused to Bottle staff in a support session.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Search trading name
Search trading name
Only customers whose consent on this channel is granted.
Only customers whose consent on this channel is granted.
Add: on the chosen list for the business surcharge. exclude: on the excluded list.
Add: on the chosen list for the business surcharge. exclude: on the excluded list.
Stopped: orders or deliveries are stopped now, for money owed. rule: set to stop while unpaid, owing or not.
Stopped: orders or deliveries are stopped now, for money owed. rule: set to stop while unpaid, owing or not.
Confirmed: at least one shop sign-in for this customer has a confirmed email. unconfirmed: has a shop sign-in, none confirmed. none: no shop sign-in.
Confirmed: at least one shop sign-in for this customer has a confirmed email. unconfirmed: has a shop sign-in, none confirmed. none: no shop sign-in.
For purpose=marketing: the channel the list is for. Only customers who granted it are included, with the contact details that channel needs.
For purpose=marketing: the channel the list is for. Only customers who granted it are included, with the contact details that channel needs.
all: every customer matching the filters, with every detail and their consent on each channel. marketing: only those who granted consent on channel, with only what that channel needs and when they agreed.
all: every customer matching the filters, with every detail and their consent on each channel. marketing: only those who granted consent on channel, with only what that channel needs and when they agreed.
The business, for a plain link that cannot send X-Tenant-Id (a browser download). The header wins when both are given; membership is checked either way.
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8fThe business, for a plain link that cannot send X-Tenant-Id (a browser download). The header wins when both are given; membership is checked either way.
Responses
Section titled “Responses”The CSV file
Not signed in
object
Example
{ "error": "not_found", "message": "Customer not found"}Not a member, missing the scope, or a support session
object
Example
{ "error": "not_found", "message": "Customer not found"}Validation failed
object
object
Example
{ "error": "validation", "issues": [ { "path": "email", "message": "Invalid email" } ]}Too many exports or heavy requests this minute
object
Example
{ "error": "not_found", "message": "Customer not found"}