# Download export file

The export API allows you to download files extracted by your export request.

### API Description

## Download

> Download the extraction file of an export request.\
> \</br>\</br>Status of the export must be \`SUCCESS\` to call this API. See \<a href="/operations/export\_view">view export API\</a> to get the current status of your export.\
> \</br>\</br>The link to the JSON file that you can found under the \`Location\` section of the response header will expire after 20 minutes. You will need to call this API again to generate a new file.<br>

```json
{"openapi":"3.1.0","info":{"title":"Batch - REST API","version":"2.9"},"tags":[{"name":"Exports"}],"servers":[{"url":"https://api.batch.com/{version}","description":"production","variables":{"version":{"default":"2.10","description":"Version of the API"}}}],"security":[{"rest_key":[]}],"components":{"securitySchemes":{"rest_key":{"type":"http","scheme":"bearer","description":"## API Key Authentication\n\nAuthentication is required in order to interact with Batch's APIs.\n\nBatch implements authentication using API Keys, that we call the \"REST API Key\".\nYou can find it on your dashboard.\n\nPlease make sure that you keep this key secret. You should never use it in client apps to call APIs from there as it would\neasily be extractable.\n\n### How to authenticate\n\nIn order to authenticate your requests, add your REST API Key in the `Authorization` header and prefix it by `Bearer`. Example: `Authorization: Bearer bcd38d9rfb38ra28`.\n"}},"parameters":{"HeaderProjectKey":{"in":"header","name":"X-Batch-Project","description":"The unique project key, identifying a project on the Batch platform","schema":{"type":"string"},"required":true}},"responses":{"307":{"description":"The resource requested can be found under the `Location` section of the response header.","headers":{"Location":{"description":"URI where the requested resource can be downloaded.","schema":{"type":"string","format":"uri"}}}},"400":{"description":"The request is malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The Rest API Key is not valid for this project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Batch's services are under maintenance. Please try again later","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error_message","error_code"],"properties":{"error_message":{"description":"A human readable error message","type":"string"},"error_code":{"description":"Error code","type":"string"}}}}},"paths":{"/exports/download":{"get":{"operationId":"export_download","summary":"Download","description":"Download the extraction file of an export request.\n</br></br>Status of the export must be `SUCCESS` to call this API. See <a href=\"/operations/export_view\">view export API</a> to get the current status of your export.\n</br></br>The link to the JSON file that you can found under the `Location` section of the response header will expire after 20 minutes. You will need to call this API again to generate a new file.\n","tags":["Exports"],"parameters":[{"$ref":"#/components/parameters/HeaderProjectKey"},{"name":"id","in":"query","description":"ID of the file to be downloaded.","required":true,"schema":{"type":"string"}}],"responses":{"307":{"$ref":"#/components/responses/307"},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"409":{"$ref":"#/components/responses/409"},"429":{"$ref":"#/components/responses/429"},"500":{"$ref":"#/components/responses/500"},"503":{"$ref":"#/components/responses/503"}}}}}}
```

#### Route

The Project Export API exposes a GET endpoint that allows to download result files:

`/exports/download`

#### Headers and authentication

See [Overview → Using Project APIs](https://doc.batch.com/developer/api/cep/..#request-headers-and-authentication).

#### Success

Batch will respond with an HTTP status code: 307. The download link is located under the location section of the response header.

> The link to the file will expire after 20 minutes. You will need to call again the API to generate a new file.

#### Failure

If the POST data does not meet the API requirements you will receive an actionable error message. Contact us at <support@batch.com> if you need further support.

See the list of potential failures in the API Description.
