> ## Documentation Index
> Fetch the complete documentation index at: https://developers.loyaltylion.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Customer exports

Export every customer in your program, or every customer matching a filter, as
one file. This replaces paging through [List Customers](/api-reference/v2/resources/customers/list-customers)
when you need the whole result set, such as a nightly sync to your own systems.

An export runs in the background. You create it, poll it until it completes,
then download the file.

<Info>
  Customer exports require a [program API
  key](/api-reference/authentication/api-keys) or
  [OAuth](/api-reference/authentication/oauth) with the `read_customers` scope.
  The site token and secret is not accepted.
</Info>

## Create an export

[Create a customer export](/api-reference/v2/resources/customers/exports/create-export)
takes the same filters as List Customers. An empty body exports every customer.

```bash theme={null}
curl \
  --request POST \
  --header 'Authorization: Bearer pat_e1c752f1b5cd8b743148a586e573b679' \
  --header 'Content-Type: application/json' \
  --url 'https://api.loyaltylion.com/v2/customers/exports' \
  --data '{ "updated_at_min": "2026-09-01T00:00:00Z" }'
```

The response is `202 Accepted` with the new export in status `pending`.

A program can have one export pending or processing at a time. A second request
returns `409` with the id of the export already running.

## Poll for progress

[Get a customer export](/api-reference/v2/resources/customers/exports/get-export)
returns the export's current state. Poll it every few seconds until the status
is `completed` or `failed`.

| Status       | Meaning                                                                                             |
| ------------ | --------------------------------------------------------------------------------------------------- |
| `pending`    | Queued and not yet started                                                                          |
| `processing` | Running. `progress.rows_processed` counts rows written so far; `progress.rows_total` is an estimate |
| `completed`  | The file is ready. The response includes `download_url`, `row_count` and `file_size`                |
| `expired`    | The file was deleted seven days after completion. Create a new export for a fresh file              |
| `failed`     | The export could not finish and will not be retried. Create a new export                            |

`rows_total` is an estimate taken when processing starts, and may be `null` if
none was available. `rows_processed` is exact.

## Download the file

A `completed` export carries a `download_url`. The link is signed and valid for
six hours from the response that returned it; read the export again for a fresh
link. The file itself is available for seven days after completion, after which
the export reports `expired`.

The file is [JSON Lines](https://jsonlines.org): one customer per line, in the
same shape as List Customers returns. It is not compressed.

```json theme={null}
{"id": 1468, "merchant_id": "8237", "email": "one@example.com", "points_approved": 120, ...}
{"id": 1469, "merchant_id": "8241", "email": "two@example.com", "points_approved": 0, ...}
```

Rows are ordered by `id` ascending.

## Find earlier exports

[List customer exports](/api-reference/v2/resources/customers/exports/list-exports)
returns the program's exports, newest first: anything still running, any whose
file is still downloadable, and any that failed in the last seven days.

<Tip>
  To keep a copy of your customers up to date, run one full export, then either
  run periodic exports with `updated_at_min` or subscribe to the
  [`customers/update`](/api-reference/v2/webhooks/events/customers-update)
  webhook for changes as they happen.
</Tip>
