# Create an export

`POST https://api.cademi.com.br/api/v3/exports`

Operation ID: `exports.create` · API v3

Requests a data export. The file is generated asynchronously by an `export.generate` operation, whose ID is returned in `operation_id`; use the retrieve operation to follow the export status.

Each entry in `columns` must belong to the column catalog of the selected `resource`, and `filters` accepts the same keys as the users collection: `product_id`, `tag_id`, `showcase_id`, `delivery_id`, `access`, `type`, and `status`. Unknown columns or filters are rejected with a validation error.

Requesting personal data columns (`email`, `document`, or `phone`) also requires the `users.read_personal` permission. Without it, the request is rejected with `permission_denied` instead of silently omitting those columns.

The generated file is a UTF-8 CSV and is retained for 7 days.

Required permissions: `exports.create`.

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `columns` | array of string | yes |  |
| `filters` | object | no |  |
| `resource` | string, one of `users`, `user_activity` | yes |  |
| `user_id` | string | no | Public ID of the user whose activity is exported. Required when resource is user_activity. |

## Responses

### 202

The export was accepted for asynchronous generation. Returns the newly created export.

Body: `data`: Export.

Fields of Export:

| Field | Type | Required | Description |
|---|---|---|---|
| `columns` | array of string | yes |  |
| `consistency` | object | yes | Exports are point-in-time snapshots. Indicates the moment the data was captured. |
| `created_at` | string (date-time) | yes |  |
| `expires_at` | string or null (date-time) | yes |  |
| `failure_reason` | string or null | yes |  |
| `file_id` | string or null | yes | Public ID of the generated file, prefixed with file_. |
| `filters` | object | yes | Requested filters, using the same names as the filters of the list users operation. Every key is always present; filters that were not requested are null. |
| `id` | string | yes | Public ID of the export, prefixed with exp_. |
| `object` | string, one of `export` | yes |  |
| `operation_id` | string or null | yes | Public ID of the operation that generates the file, prefixed with op_. |
| `resource` | string or null, one of `users`, `user_activity` | yes |  |
| `status` | string, one of `queued`, `processing`, `completed`, `failed`, `expired` | yes |  |
| `total` | integer or null | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

Full schema: https://cademi.dev/openapi/v3.json
