List export requests

The export API allows you to list all export requests and get their status.

This information is an array of all requests we currently know of for your application. The output contains requests created in the last 3 months. Each object in the array contains exactly the same information as you would get if you made a GET request with the request id.

API Description

List

get

List export requests created.

Authorizations
AuthorizationstringRequired

API Key Authentication

Authentication is required in order to interact with Batch's APIs.

Batch implements authentication using API Keys, that we call the "REST API Key". You can find it on your dashboard.

Please make sure that you keep this key secret. You should never use it in client apps to call APIs from there as it would easily be extractable.

How to authenticate

In order to authenticate your requests, add your REST API Key in the Authorization header and prefix it by Bearer. Example: Authorization: Bearer bcd38d9rfb38ra28.

Query parameters
fromstringOptional

A cursor for pagination across multiple pages of results. Don’t include this parameter on the first call. Use the next_from value returned in a previous response to request subsequent results.

limitinteger · min: 1 · max: 100Optional

To change the page size of results.

Default: 10Example: 20
Header parameters
X-Batch-ProjectstringRequired

The unique project key, identifying a project on the Batch platform

Example: project_0664hxvwffvbpn278gxdyhsadddqgna6
Responses
200

If the GET to the API endpoint is successful you will receive an HTTP 200 confirmation and information about your export requests. This information is an array of all requests we currently know of for your project. The output contains requests created in the last 4 months.

application/json
get
/exports/list
GET /2.8/exports/list HTTP/1.1
Host: api.batch.com
Authorization: Bearer YOUR_SECRET_TOKEN
X-Batch-Project: text
Accept: */*
{
  "exports": [
    {
      "id": "export_063bc4w4x8e363yem6wfnxc5c13c0n46",
      "request_date": "2023-08-12T22:30:05Z",
      "completion_date": "2023-08-12T22:30:05Z",
      "start_date": "2023-08-12T22:30:05Z",
      "scope": "PROFILE_ATTRIBUTES",
      "status": "CREATED",
      "files": [
        {
          "id": "file_wbgjapsjscryqah0bcwrg1w5kv0dcfkj",
          "part": 1,
          "size": 2048,
          "url": "https://api.batch.com/2.4/exports/download?id=file_wbgjapsjscryqah0bcwrg1w5kv0dcfkj"
        }
      ],
      "request": {
        "export_type": "ATTRIBUTES",
        "attributes": [
          "$email_address",
          "$email_marketing",
          "$sms_marketing",
          "firstname",
          "is_premium"
        ],
        "identifiers": [
          "custom_id",
          "installation_ids"
        ],
        "filter": {
          "segment": "MY-SEGMENT-CODE"
        }
      }
    }
  ],
  "count": 25,
  "has_more": true,
  "next_from": "MjAyNC0wMS0wMVQwMDowMDowMFo="
}

Request structure

Route

The Export API exposes a GET endpoint that allows you to list all export requests and get their status :

/exports/list

Headers and authentication

See Overview → Using Project APIs.

Responses

Success

If the GET to the API endpoint is successful you will receive an HTTP 200 confirmation and information about your export requests.

{
  "exports": [
    {
      "id": "export_nvctr8tgdjf7bppacxxt2aeemnjehfmw",
      "request_date": "2024-02-28T16:28:42Z",
      "scope": "PROFILE_ATTRIBUTES",
      "status": "SUCCESS",
      "request": {
        "export_type": "ATTRIBUTES",
        "attributes": [
          "$region",
          "$phone_number",
          "$timezone",
          "$email_marketing",
          "$sms_marketing",
          "$language",
          "$email_address"
        ],
        "identifiers": [
          "installation_ids",
          "custom_id"
        ]
      },
      "completion_date": "2024-02-28T16:28:48Z",
      "start_date": "2024-02-28T16:28:48Z",
      "files": [
        {
          "id": "file_etxhwckcfc05egew7y97bdjtc75p7g8b",
          "part": 1,
          "size": 592752,
          "url": "https://api.batch.com/2.4/exports/download?id=file_etxhwckcfc05egew7y97bdjtc75p7g8b"
        }
      ]
    }
  ],
  "count": 10,
  "has_more": true,
  "next_from": "ZXhwb3J0X2dnNnN5d2RzcGg2eG00Nm1lZHNtMDRyZ3gyd2FiMDA1QDIwMjQtMDItMjdUMTQ6MTg6NTBa"
}

Some information are only available when the status field is SUCCESS.

If your export request returns no data, the files array will be empty.

Pagination infos:

  • next_from can be used for the next call to list to retrieve the next page

  • count is the number of items in the current page

Failure

If the GET 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.

Last updated