Customer purchases
const url = 'https://api-admin.billz.ai/v1/customer-purchases-report-excel?Billz-Response-Channel=HTTP';const options = { method: 'POST', headers: { 'platform-id': '7d4a4c38-dd84-4902-b744-0488b80a4c01', 'Billz-Response-Channel': 'HTTP', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"shop_ids":["2339a738-a67f-48d2-bb60-8cf4ec54d6cd"],"start_date":"2026-08-01","end_date":"2026-08-31","with_customers":true,"currency":"UZS","fields":["created_at","customer_name","product_name","gross_sales"]}'};
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://api-admin.billz.ai/v1/customer-purchases-report-excel?Billz-Response-Channel=HTTP' \ --header 'Authorization: Bearer <token>' \ --header 'Billz-Response-Channel: HTTP' \ --header 'Content-Type: application/json' \ --header 'platform-id: 7d4a4c38-dd84-4902-b744-0488b80a4c01' \ --data '{ "shop_ids": [ "2339a738-a67f-48d2-bb60-8cf4ec54d6cd" ], "start_date": "2026-08-01", "end_date": "2026-08-31", "with_customers": true, "currency": "UZS", "fields": [ "created_at", "customer_name", "product_name", "gross_sales" ] }'Asynchronous method. The file is built in the background. The Billz-Response-Channel: HTTP header is required: only with it does the response carry a link to the finished file, with a wait of up to 100 seconds. Without the header the response is 200 {"message": "<correlation_id>"}, and the file can no longer be fetched through the API: the link is delivered as a notification to the BILLZ interface.
A line-by-line list of purchases: what was bought, by whom and when.
Error codes: 400 — input validation error; 404 — object not found; 408 — timed out waiting for the asynchronous result; 401, 403, 429, 500 — shared by all methods. Body formats and semantics: Response codes and errors.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Platform identifier. A static value is used for integrations.
HTTP — wait for the event processing result and return it in the HTTP response. Without the header the method returns only the correlation_id of the published event.
Query Parameters
Section titled “Query Parameters”Same as the Billz-Response-Channel header — for clients that cannot send a custom header. If both are passed, the header applies.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Start of the period, YYYY-MM-DD
End of the period, YYYY-MM-DD
Shops of the report; intersected with the list of shops available to the token
true — only purchases linked to a customer, false — all of them, anonymous ones included
Currency in which the amounts are shown
Price type: 0 — all, 1 — retail, 2 — free-price, 3 — wholesale
true — collapse the rows without a breakdown by shop
The file columns in the order they appear. Without fields the file has no data columns; the list of values is in Report export to Excel
Example
{ "shop_ids": [ "2339a738-a67f-48d2-bb60-8cf4ec54d6cd" ], "start_date": "2026-08-01", "end_date": "2026-08-31", "with_customers": true, "currency": "UZS", "fields": [ "created_at", "customer_name", "product_name", "gross_sales" ]}Responses
Section titled “Responses”Success. With the Billz-Response-Channel: HTTP header — the asynchronous response envelope with a link to the file, without it — {"message": "<correlation_id>"}.
Asynchronous response envelope. Returned when the Billz-Response-Channel: HTTP header is passed. The final HTTP code of the request is taken from the status_code field.
object
Customer session identifier
Event processing status (also the final HTTP response code)
object
Error code, empty string if there is no error
Error text, empty string if there is no error
Request identifier, matches the ID of the published event
Response event type, for example <event_type>.success
Operation result, if the method returns one
object
Response of an asynchronous method without the Billz-Response-Channel header — the event has been published.
object
Correlation_id of the published event
The asynchronous response envelope with a link to the finished file.
object
object
object
File name without the extension
Link to the finished file; it carries no extension, the content is .xlsx
Examplegenerated
{ "session_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "status_code": 1, "error": { "code": "example", "message": "example" }, "correlation_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "topic": "example", "data": {}}