# Start an export

`POST https://api.anyshop.io/v1/exports`

Prepared once the response is sent: poll the export until its status is ready, then download it. One export is prepared at a time, 5 a day per store. Unsold keys are never available through the API: export them from the dashboard, with a two-factor code and a password.

- Part of the [API reference](https://docs.anyshop.io/reference.md), [Exports](https://docs.anyshop.io/reference.md#exports).
- Scope: `exports:write`.
- Idempotent with Idempotency-Key.
- Works while the store is suspended.

## Body (application/json)

- `parts` (array of enums): Default: products, orders, customers, licenses, coupons and settings. Unsold keys are not available through the API. Values: `products`, `orders`, `customers`, `licenses`, `coupons`, `settings`, `files`. At least 1 items.

## Headers

- `Idempotency-Key` (string): Up to 255 characters. A retry with the same key and request gets the first answer, without running twice (24 hours).

## Returns

The **data_export** object.

## Errors

| Status | error.type | When |
| --- | --- | --- |
| 400 | `invalid_request` | The request is not valid; `error.param` names the field |
| 401 | `authentication` | No API key, or it is not valid |
| 403 | `permission` | The key does not have the scope this needs, or the store is suspended (store_suspended) |
| 404 | `not_found` | Not found in the key's store and mode |
| 409 | `conflict` | Conflicts with the object's state (type conflict), or an Idempotency-Key reused for another request (type idempotency, code idempotency_key_reused) |
| 429 | `rate_limited` | Too many requests; see Retry-After |

## Example

curl:

```bash
curl -X POST https://api.anyshop.io/v1/exports \
  -H "Authorization: Bearer $ANYSHOP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
```

Node:

```js
const response = await fetch("https://api.anyshop.io/v1/exports", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ANYSHOP_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({}),
});
const answer = await response.json();
```

Python:

```python
import os
import requests
import uuid

response = requests.post(
    "https://api.anyshop.io/v1/exports",
    headers={
        "Authorization": f"Bearer {os.environ['ANYSHOP_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={},
)
answer = response.json()
```

Answer (200):

```json
{
  "object": "data_export",
  "id": "dexp_01m3rw4h6j8l0n2p4r6t8v0x2z",
  "livemode": true,
  "status": "preparing",
  "parts": [
    "products"
  ],
  "counts": {},
  "size_bytes": null,
  "failure": null,
  "created_at": "2026-10-02T14:21:07.000Z",
  "ready_at": "2026-10-02T14:21:07.000Z",
  "expires_at": "2026-10-02T14:21:07.000Z",
  "download_url": null,
  "download_url_expires_at": "2026-10-02T14:21:07.000Z"
}
```

Answer (400):

```json
{
  "error": {
    "type": "invalid_request",
    "code": "invalid_body",
    "message": "The request is not valid; `error.param` names the field",
    "param": null
  }
}
```

Answer (409):

```json
{
  "error": {
    "type": "conflict",
    "code": "conflict",
    "message": "Conflicts with the object's state (type conflict), or an Idempotency-Key reused for another request (type idempotency, code idempotency_key_reused)",
    "param": null
  }
}
```

The IDs and keys in these examples are made up. Every schema is in the OpenAPI document, https://api.anyshop.io/v1/openapi.json.
