> For the complete documentation index, see [llms.txt](https://doc.batch.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.batch.com/developer/api/mep/export/get-status.md).

# GET - Get request info

The Export API allows you to create export requests and get their status. This page documents the `request` endpoint.

### Request structure

#### Route

The Export API exposes a GET endpoint to get the status of a single Export request if created less than 6 months ago:

`https://api.batch.com/1.0/BATCH_API_KEY/export/request/REQUEST_ID`

Here is a valid cURL example:

```
curl -H "Content-Type: application/json" \
     -H "X-Authorization: BATCH_REST_API_KEY" \
     -X GET "https://api.batch.com/1.0/BATCH_API_KEY/export/request/REQUEST_ID"
```

The `REQUEST_ID` value is the token you get when creating the request.

The `BATCH_API_KEY` value is your **Live** Batch API key from the settings page of your app within the dashboard (⚙ Settings → General).

#### Headers

In order to authenticate with the API, you need to provide your **company REST API Key** as the value of the `X-Authorization` header.

### Responses

#### Success

If the POST to the API endpoint is successful you will receive an **HTTP 200** confirmation and the following information:

```json
{
  "id": "9aed764e-7a79-4197-b378-df82da994f78",
  "uri": "/1.0/BATCH_API_KEY/inapp-campaign/CAMPAIGN_TOKEN/events",
  "request_date": "2019-08-14T22:00:00",
  "file_url": "https://api.batch.com/1.0/API_KEY/export/request/REQUEST_ID/results/filename.csv",
  "status": "CREATED|PENDING|ERROR|SUCCESS|EXPIRED",
  "completion_date": "2019-08-14T22:00:00",
  "request" :  
  {
    "from": "2019-08-14T22:00:00",
    "to": "now",
    "events": ["push_sent", "push_open"],
    "ids": ["install_id", "custom_id", "advertising_id"],
  }
}
```

The `file_url` value contains a URL. That URL is a redirection to the CSV file containing the data you requested. To retrieve the download link, use the provided URL to make a second GET request passing the `X-Authorization` header.

Here is a valid cURL example:

```
curl -i -H "X-Authorization: BATCH_REST_API_KEY" \
     -X GET ""https://api.batch.com/1.0/API_KEY/export/request/REQUEST_ID/results/FILENAME.csv""
```

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

The `error_msg` field will give you information about what went wrong.

> The link to the csv file wil 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.

* `AUTHENTICATION_INVALID` (Http status code: 401, Error code: 10)
* `API_MISUSE` (Http status code: 403, Error code: 12)
* `ROUTE_NOT_FOUND` (HTTP status code: 404, Error code: 20)
* `MISSING_PARAMETER` (HTTP status code: 400, Error code: 30)
* `MALFORMED_PARAMETER` (HTTP status code: 400, Error code: 31)
* `SERVER_ERROR` (HTTP status code: 500, Error code: 1)
* `MAINTENANCE_ERROR` (HTTP status code: 503, Error code: 2)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.batch.com/developer/api/mep/export/get-status.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
