> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/commerce-openapis/admin/bulk-voucher-codes/bulk-voucher-code-import-and-export/export-voucher-codes-to-excel.md).

# Export voucher codes to Excel

Starts an **asynchronous** Excel export of the voucher codes of a basket offer and returns a `cache_key` that is polled on **`GET /bulk_voucher_codes/excel_export_status/`** until the file is ready.

Any list filters (for example `status` or `code`) may be passed as additional query parameters and are applied to the exported queryset. In the resulting worksheet, the `code` column is titled `voucher_code` and the `user__email` column is titled `user_email`.

```json
{"openapi":"3.1.0","info":{"title":"Admin API","version":"1.0.0"},"tags":[{"name":"Bulk Voucher Code Import & Export","description":"Asynchronous spreadsheet import and export of voucher codes.\n\nImport codes (optionally pre-assigned to users by email) from an Excel/CSV file, and export the codes of a campaign to an Excel file. Both operations are asynchronous: the initial request returns a `cache_key` that is polled on a companion status endpoint until the result is ready."}],"servers":[{"description":"Omnitron Remote Proxy (external access — recommended)","url":"https://{omnitron_url}/api/remote/{channel_id}","variables":{"omnitron_url":{"default":"sandbox.akinon.com","description":"Omnitron server URL (e.g., {omnitron.akinon.com})"},"channel_id":{"default":"1","description":"The channel identifier the remote request is routed through"}}},{"description":"Commerce API Server (internal / direct access only)","url":"https://{commerce_url}/api/v1","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Internal commerce server URL, reachable only from within the Omnitron network"}}}],"security":[{"tokenAuth":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token credential sent in the Authorization header, in the form: `Token <your-token>`. Requires a staff (admin) account."}},"schemas":{"ExcelExportStatus":{"type":"object","description":"The status envelope of an asynchronous Excel export.","properties":{"cache_key":{"type":"string","format":"uuid","description":"The job key used to poll the export status."},"is_ready":{"type":"boolean","description":"Whether the export file is ready for download."},"url":{"type":["string","null"],"format":"uri","description":"The download URL of the generated file, present once `is_ready` is `true`."},"error_message":{"type":["string","null"],"description":"A human-readable error message when the export failed or was not found."}}},"Error":{"type":"object","description":"An error response.","properties":{"detail":{"type":"string","description":"A human-readable description of the error."}},"additionalProperties":true}},"responses":{"Unauthorized":{"description":"Authentication credentials were not provided or are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"The authenticated user does not have administrator privileges.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/bulk_voucher_codes/excel_export/":{"get":{"tags":["Bulk Voucher Code Import & Export"],"operationId":"exportBulkVoucherCodes","summary":"Export voucher codes to Excel","description":"Starts an **asynchronous** Excel export of the voucher codes of a basket offer and returns a `cache_key` that is polled on **`GET /bulk_voucher_codes/excel_export_status/`** until the file is ready.\n\nAny list filters (for example `status` or `code`) may be passed as additional query parameters and are applied to the exported queryset. In the resulting worksheet, the `code` column is titled `voucher_code` and the `user__email` column is titled `user_email`.","parameters":[{"name":"basket_offer","in":"query","required":true,"description":"The identifier of the basket offer whose codes are exported. When missing, the request is rejected with `404`.","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"The maximum number of codes to export. Non-numeric values fall back to the default.","schema":{"type":"integer","default":10}},{"name":"fields","in":"query","required":false,"explode":true,"description":"The code fields to include as worksheet columns. May be repeated (`_fields` is accepted as an alias). Defaults to `code`, `status`, and `user__email`.","schema":{"type":"array","items":{"type":"string"},"default":["code","status","user__email"]}}],"responses":{"200":{"description":"The export job was queued.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExcelExportStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"The `basket_offer` query parameter was not provided."}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://apidocs.akinon.com/commerce-openapis/admin/bulk-voucher-codes/bulk-voucher-code-import-and-export/export-voucher-codes-to-excel.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
