# Download an export

`GET /api/v1/exports/{accountExport}/download`

Retrieve the file of an export that is ready.

The body is the file itself, one JSON document with a file name attached, so what you receive can be written straight to disk. It is not wrapped in data like the other answers here. Its top level holds version (2.0-preview.1), app_version, exported_at and account, and account holds the vaults with everything in them.

Only a key holding the sensitive fields scope can download the file, since it holds every sensitive value: any other key answers 403.

An export that is not ready, or whose expires_at has passed, answers 404. Each download is written to the log of the account.

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).

## Path parameters

- `accountExport` (uuid, required): The id of the export. One belonging to another account answers 404.

## Returns

The file, as JSON. An export of another account answers 404.

## 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/e7a1d9c4-3b6f-4f2a-8d15-6c0b9e2a4f73/download \
  -H "Authorization: Bearer $MONICA_TOKEN"
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/exports/e7a1d9c4-3b6f-4f2a-8d15-6c0b9e2a4f73/download', {
  headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->get('https://my.monicahq.com/api/v1/exports/e7a1d9c4-3b6f-4f2a-8d15-6c0b9e2a4f73/download');
```

## Response

`200`, with no body.
