Next Commerce
Guides

API Exports

The Exports API allows you to generate and download bulk data exports from your store as CSV files. This is useful for reporting, analytics, reconciliation, and data migration workflows.

Exports are processed asynchronously. After creating an export, you'll need to poll for completion before downloading the file.

Export Flow

Creating and downloading an export is a 3-step process:

  1. Subscribe to the export.created webhook event to be notified when exports are ready.
  2. Create a new export using the exportsCreate endpoint with your desired type and date range.
  3. When you receive the export.created webhook, download the file using the exportsDownloadRetrieve endpoint.

Available Export Types

Use the exportsTypesRetrieve endpoint to list all available export types, or reference the table below.

TypeDescription
order_listOrders
order_line_itemsOrder Line Items
customer_listCustomers
transaction_listTransactions
dispute_listDisputes
subscription_listSubscriptions
subscription_line_itemsSubscription Line Items
open_cart_listOpen Carts
open_cart_line_itemsOpen Cart Line Items
return_listReturns
return_line_itemsReturn Line Items
fulfillment_listFulfillments
fulfillment_line_itemsFulfillment Line Items

Create an Export

To create a new export, send a POST request to the exportsCreate endpoint with the export type and date range.

POST/api/admin/exports/2024-04-01
{
  "type": "order_list", // export type
  "date_from": "2025-01-01T00:00:00Z", // start of date range
  "date_to": "2025-03-31T23:59:59Z" // end of date range
}

The response returns the export object with a pending status.

Create Export Response
{
  "id": 42,
  "created_at": "2025-04-01T12:00:00Z",
  "type": "order_list",
  "status": "pending",
  "date_from": "2025-01-01T00:00:00Z",
  "date_to": "2025-03-31T23:59:59Z",
  "url": "https://{store}.29next.store/api/admin/exports/42/"
}

Poll Export Status

After creating an export, poll the exportsRetrieve endpoint until the status changes from pending to available.

GET/api/admin/exports/{id}/2024-04-01
{
  "id": 42,
  "created_at": "2025-04-01T12:00:00Z",
  "type": "order_list",
  "status": "available", // export is ready to download
  "date_from": "2025-01-01T00:00:00Z",
  "date_to": "2025-03-31T23:59:59Z",
  "url": "https://{store}.29next.store/api/admin/exports/42/"
}

Avoid polling too frequently. Checking every couple of minutes is sufficient for pending exports. For a more efficient approach, subscribe to the export.created webhook event to be notified immediately when an export is available for download.

Download Export File

Once the export status is available, use the exportsDownloadRetrieve endpoint to get a download URL for the CSV file.

GET/api/admin/exports/{id}/download/2024-04-01
{
  "url": "https://example.com/media/{store}/export_csv/{file_name}.csv?signature" // signed download
}

Download URLs are temporary signed URLs. Fetch the file promptly after retrieving the URL. If the URL expires, request a new one from the download endpoint.

Export Webhooks

Subscribe to the export.created webhook event to be notified immediately when an export is available for download. The webhook payload includes the export object data, allowing you to proceed directly to downloading the file without additional API calls.

Using the export.created webhook is the recommended approach for automated export workflows. It eliminates the need for polling and ensures you download the file as soon as it's ready.

List Exports

Use the exportsList endpoint to retrieve previous exports with optional filtering by type and creation date.

GET/api/admin/exports/2024-04-01
{
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 42,
      "created_at": "2025-04-01T12:00:00Z",
      "type": "order_list",
      "status": "available",
      "date_from": "2025-01-01T00:00:00Z",
      "date_to": "2025-03-31T23:59:59Z",
      "url": "https://{store}.29next.store/api/admin/exports/42/"
    }
  ]
}

The list endpoint uses cursor-based pagination. Use the next and previous URLs in the response to navigate through results.

On this page