# List exports

`GET /api/v1/exports`

List the exports of the account, the newest first, including the ones that failed or expired.

This endpoint also answers QUERY, with the same parameters sent in the request body. [How QUERY works](https://my.monicahq.com/docs/api/query-method).

## Query parameters

- `page` (integer, optional, defaults to 1): Which page to answer with.
- `per_page` (integer, optional, defaults to 25): How many records one page holds, between 1 and 100. A number outside the range is brought back into it rather than refused.

## Returns

A page of export objects, the newest first.

- `data` (array): The exports on this page. An empty list rather than an error when there are none.
- `data[]` (object): One export.
- `data[].type` (string): Always account_export. It names the kind of record, so a caller holding several kinds can tell them apart without looking at where they came from.
- `data[].id` (string): The id of this record, as a string even when it reads as a number. It is what every endpoint naming this record takes.
- `data[].attributes` (object): Everything the record holds.
- `data[].attributes.status` (string): Where the export stands: preparing, ready, failed or expired. The file is prepared in the background, and an email says when it is ready.
- `data[].attributes.vaults` (array): The vaults the file holds.
- `data[].attributes.vaults[]` (uuid): The id of one of those vaults. A vault deleted since the export was asked for is left out.
- `data[].attributes.size_in_bytes` (integer): The size of the file in bytes, or null until it is ready.
- `data[].attributes.ready_at` (timestamp): When the file was complete, as a count of seconds since 1970, or null until it is ready.
- `data[].attributes.expires_at` (timestamp): When the file is deleted, seven days after it was ready unless a newer export of the account is ready first, as a count of seconds since 1970, or null until it is ready. From that moment it can no longer be downloaded.
- `data[].attributes.created_at` (timestamp): When the export was asked for, as a count of seconds since 1970.
- `data[].links` (object): Where to find this record.
- `data[].links.self` (string): The absolute address this record is read from.
- `meta` (object): Where you are in the collection.
- `meta.page` (integer): The page this is, counting from 1.
- `meta.per_page` (integer): How many one page holds, which is the size that was asked for once it has been brought into the allowed range.
- `meta.total` (integer): How many exports there are in all, not how many are on this page.

## Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in `X-RateLimit-Remaining`.

## Request

```sh
curl https://my.monicahq.com/api/v1/exports \
  -H "Authorization: Bearer $MONICA_TOKEN"
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/exports', {
  headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->get('https://my.monicahq.com/api/v1/exports');
```

## Response

`200`

```json
{
    "data": [
        {
            "type": "account_export",
            "id": "e7a1d9c4-3b6f-4f2a-8d15-6c0b9e2a4f73",
            "attributes": {
                "status": "ready",
                "vaults": [
                    "9b2d4f6a-1e3c-4a5b-8c7d-0f1e2d3c4b5a",
                    "c4e6a8b0-2d4f-4a6b-9c8d-1e3f5a7b9c0d"
                ],
                "size_in_bytes": 18734522,
                "ready_at": 1792310700,
                "expires_at": 1792915500,
                "created_at": 1792310400
            },
            "links": {
                "self": "https://my.monicahq.com/api/v1/exports/e7a1d9c4-3b6f-4f2a-8d15-6c0b9e2a4f73"
            }
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 25,
        "total": 1
    }
}
```
