# Create contact export

> Stores a copy of the contacts that match the filters (names, numbers, emails) for 24 hours, ready when the call returns; read the rows with get_contact_export. Sends nothing and changes no contact. Needs an Idempotency-Key header.

Last updated: 2026-10-25. Source: https://docs.smartchat.marketing/en/api/reference/contacts/create_contact_export/

Stores a copy of the contacts that match the filters (names, numbers, emails) for 24 hours, ready when the call returns; read the rows with get_contact_export. Sends nothing and changes no contact. Needs an Idempotency-Key header.

`POST /v1/contact-exports`

| | |
|---|---|
| Permission | `contacts:read` ([all permissions](https://docs.smartchat.marketing/en/api/permissions/)) |
| Risk | Write (no outside effect) |
| Idempotency-Key | Required ([how it works](https://docs.smartchat.marketing/en/concepts/idempotency/)) |
| Safe to repeat | Safe to repeat with the same Idempotency-Key: the first answer comes back and nothing is done twice. |
| Rate limit class | `bulk` (120 requests per minute per key) |
| Confirmation | None |
| MCP tool | [`export_contacts`](https://docs.smartchat.marketing/en/mcp/tools/export_contacts/) |
| Since version | 2026-10-25 |

## What it does

- Changes data in your account. It does not send messages to contacts.
- Safe to repeat with the same Idempotency-Key.

## Request

**Header**

| Name | Required | Description |
|---|---|---|
| `Authorization` | yes | `Bearer <key>` |
| `Idempotency-Key` | yes | A unique value for this operation, for example a UUID (1 to 255 visible ASCII characters). |

**Body** (JSON)

| Name | Type | Required | Description |
|---|---|---|---|
| `query` | string | no | Name, phone number or email, or part of it. Case does not matter. up to 100 characters |
| `tag` | string | no | Only contacts with this tag. Case does not matter. up to 60 characters |
| `optin_whatsapp` | string | no | Only contacts with this WhatsApp opt-in status. one of: `none`, `pending`, `confirmed`, `opted_out` |
| `created_after` | string | no | Only contacts created after this time (ISO 8601). up to 40 characters; format date-time |
| `created_before` | string | no | Only contacts created before this time (ISO 8601). up to 40 characters; format date-time |

## Examples

**curl**

```bash
curl -X POST "https://api.smartchat.marketing/v1/contact-exports" \
  -H "Authorization: Bearer $SMARTCHAT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "tag": "vip"
}'
```

**Python**

```python
import os
import uuid
import requests

response = requests.post(
    "https://api.smartchat.marketing/v1/contact-exports",
    headers={
        "Authorization": "Bearer " + os.environ["SMARTCHAT_API_KEY"],
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "tag": "vip",
    },
)
response.raise_for_status()
print(response.json())
```

**TypeScript**

```typescript
const response = await fetch("https://api.smartchat.marketing/v1/contact-exports", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SMARTCHAT_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "tag": "vip"
  }),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
```

Response (201):


```json
{
  "object": "contact_export",
  "id": "exp_4d5e6f7a8b9c40d1e2f3a4b5c6d7e8f9",
  "status": "completed",
  "row_count": 1,
  "truncated": false,
  "columns": [
    "id",
    "name",
    "phone",
    "email",
    "status",
    "tags",
    "created_at"
  ],
  "created_at": "2026-10-25T09:41:07Z",
  "expires_at": "2026-10-26T09:41:07Z"
}
```

## Response

Status 201. Every response has the headers `Request-Id`, `SmartChat-Version` and `X-RateLimit-*`.

| Name | Type | Description |
|---|---|---|
| `object` | string | Always "contact_export". always `contact_export` |
| `id` | string | Export ID. |
| `status` | string | State of the export. Exports are ready when the call returns. one of: `completed` |
| `row_count` | integer | Number of contacts in the export. 0 to 1000000 |
| `truncated` | boolean | True if more contacts matched than one export holds (50,000). Narrow the filters and export again. |
| `columns` | array of string | Fields of each row. up to 20 items |
| `created_at` | string | When the export was created. up to 40 characters; format date-time |
| `expires_at` | string | When the export is removed (24 hours after creation). up to 40 characters; format date-time |

## Errors

| Code | Status | When |
|---|---|---|
| [`bad_request`](https://docs.smartchat.marketing/en/errors/#bad_request) | 400 | The request could not be read. |
| [`idempotency_key_invalid`](https://docs.smartchat.marketing/en/errors/#idempotency_key_invalid) | 400 | The 'Idempotency-Key' header must be 1 to 255 visible ASCII characters. |
| [`idempotency_key_required`](https://docs.smartchat.marketing/en/errors/#idempotency_key_required) | 400 | This call needs an 'Idempotency-Key' header. |
| [`missing_parameter`](https://docs.smartchat.marketing/en/errors/#missing_parameter) | 400 | A required field is missing. |
| [`unknown_parameter`](https://docs.smartchat.marketing/en/errors/#unknown_parameter) | 400 | A field is not known. |
| [`api_key_expired`](https://docs.smartchat.marketing/en/errors/#api_key_expired) | 401 | This API key has expired. |
| [`api_key_invalid`](https://docs.smartchat.marketing/en/errors/#api_key_invalid) | 401 | This API key is not valid. |
| [`api_key_revoked`](https://docs.smartchat.marketing/en/errors/#api_key_revoked) | 401 | This API key was revoked. |
| [`authentication_required`](https://docs.smartchat.marketing/en/errors/#authentication_required) | 401 | No API key was sent. Send 'Authorization: Bearer <key>'. |
| [`account_blocked`](https://docs.smartchat.marketing/en/errors/#account_blocked) | 403 | This account is blocked. |
| [`insufficient_scope`](https://docs.smartchat.marketing/en/errors/#insufficient_scope) | 403 | This key lacks a required permission. |
| [`ip_not_allowed`](https://docs.smartchat.marketing/en/errors/#ip_not_allowed) | 403 | This IP address is not allowed for this key. |
| [`idempotency_in_progress`](https://docs.smartchat.marketing/en/errors/#idempotency_in_progress) | 409 | A request with this idempotency key is still running. |
| [`idempotency_key_reused`](https://docs.smartchat.marketing/en/errors/#idempotency_key_reused) | 422 | This idempotency key was already used with a different request. |
| [`validation_failed`](https://docs.smartchat.marketing/en/errors/#validation_failed) | 422 | A field is not valid. |
| [`rate_limited`](https://docs.smartchat.marketing/en/errors/#rate_limited) | 429 | Too many requests. Wait and try again. |
| [`internal_error`](https://docs.smartchat.marketing/en/errors/#internal_error) | 500 | Something went wrong on our side. |
| [`service_unavailable`](https://docs.smartchat.marketing/en/errors/#service_unavailable) | 503 | The service is temporarily unavailable. |

All errors use [one format](https://docs.smartchat.marketing/en/concepts/errors-overview/).
