# Retrieve a message export

`GET /v1/messages/exports/{id}`

Requires an API key with the `messages:read` scope. [About keys and scopes](/docs/api/authentication)

The export's progress: `queued`, `generating`, then `ready` or `failed`. A ready file is kept until `expiresAt`, after which the export reads `expired`. A failed export says why in `failureCode`: `EXPORT_TOO_LARGE` (narrow the filters) or `GENERATION_FAILED`.

## Path parameters

- `id` (string, required, uuid)

## Returns

Returns `200 OK` with a `MessageExport` in `data`. Otherwise returns an error; [Errors](/docs/api/errors) lists every code and which to retry.

- `id` (string, required, uuid)
- `status` (string, required, one of `queued`, `generating`, `ready`, `failed`, `expired`) — `queued`, `generating`, then `ready` or `failed`; `expired` once the file is deleted.
- `rowCount` (integer | null, required, min -9007199254740991, max 9007199254740991) — Rows in the file, once it is ready.
- `filters` (MessageExportFilters, required) — The filters the export was created with.
  - `status` (string, optional, one of `queued`, `sending`, `skipped`, `sent`, `failed`, `delivered`, `bounced`, `complained`) — Only messages in this status.
  - `channel` (string, optional, one of `email`, `push`) — Only messages on this channel.
  - `recipient` (string, optional, email, up to 320 characters) — The exact address the message went to.
  - `q` (string, optional, 1–100 characters) — Part of the recipient's email address or name, matched against the contact the message went to.
  - `messageType` (string, optional, one of `marketing`, `transactional`) — Only messages of this type, such as campaign or transactional.
  - `createdAfter` (string, optional, date-time) — Only messages accepted at or after this time (inclusive).
  - `createdBefore` (string, optional, date-time) — Only messages accepted before this time (exclusive).
- `createdAt` (string, required, date-time)
- `completedAt` (string | null, required, date-time)
- `expiresAt` (string | null, required, date-time) — When the file is deleted; the export then reads `expired`.
- `failureCode` (string | null, required) — `EXPORT_TOO_LARGE` or `GENERATION_FAILED` when `status` is `failed`.

## Example

```bash
curl https://api.kirora.io/v1/messages/exports/018f2a4e-6b1c-7d3e-9f40-37386ae05a6b \
  -H "Authorization: Bearer $KIRORA_API_KEY"
```

Response `200`:

```json
{
  "data": {
    "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
    "status": "queued",
    "rowCount": -9007199254740991,
    "filters": {},
    "createdAt": "2030-03-14T09:30:00Z",
    "completedAt": "2030-03-14T09:30:00Z",
    "expiresAt": "2030-03-14T09:30:00Z",
    "failureCode": "failureCode_example"
  }
}
```
