### Queue an export

`POST /api/v1/exports`

Creates the job and returns immediately; a separate worker produces the file. The caller's authority scope is stamped onto the job server-side, so an export contains exactly what that manager's list view would show and nothing more.

- Authentication: manager session (JWT) or API token
- Permission: `prm_exports_create` (Create / delete export jobs)
- Risk: write
- Rate limit bucket: `t_heavy`
- Idempotent on `request_id`: retrying with the same id returns the original result

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `target_table` | body | string | yes | A dataset key from the datasets endpoint. |
| `format` | body | enum | no | csv or xlsx. Defaults to xlsx. |
| `params` | body | object | no | Dataset-specific filters, in the same shape that dataset's list endpoint accepts. |
| `request_id` | body | string | no | Optional idempotency key. Blank stays blank and means no deduplication at all — supply your own if a retry must not queue a second job. |

#### Request

```json
{
  "target_table": "users",
  "format": "xlsx",
  "params": { "enabled": true },
  "request_id": "9d41f0c2-6b17-4e58-93a2-8c0e5f7b1d34"
}
```

#### Response — 202 Accepted

```json
{
  "data": { "id": 3312 }
}
```

#### Errors

| Code | Status | When |
| --- | --- | --- |
| `ERR_VALIDATION` | 400 | an unknown target_table, or a format that is neither csv nor xlsx |
| `ERR_FORBIDDEN` | 403 | the caller may create exports but lacks the permission to VIEW that table |

#### Note

Exporting a table needs the permission to read it as well as the permission to export. The route's own gate is not enough, so a role with export rights but no subscriber-read right gets a 403 on target_table users. That is the check that stops an export from being a way around a list permission.

