View export request

The export API allows you to retrieve a specific export request with its ID.

API Description

View

get

Get information about an export request.

Authorizations
Query parameters
idstringrequired

Export request id received when creating an export request.

Header parameters
X-Batch-Projectstringrequired

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

Example: project_0664hxvwffvbpn278gxdyhsadddqgna6
Responses
application/json
any ofoptional
get
GET /2.4/exports/view HTTP/1.1
Host: api.batch.com
Authorization: Bearer YOUR_SECRET_TOKEN
X-Batch-Project: text
Accept: */*
{
  "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"
    ]
  }
}

Route

The Project Export API exposes a GET endpoint that allows to get information about an export request:

https://api.batch.com/2.4/exports/view

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

{
    "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"
        }
    ]
}

The response includes all the extraction files available for download if any (in the files field). The files can be downloaded via the provided URL in the url field (see Download export API). Depending on the amount of data extracted, a request may have multiple output JSON files with a maximum size of 100MB.

Some information are only available when the status field is SUCCESS. 5 values are possible for request status:

  • CREATED: for export request created and not yet PENDING

  • PENDING: for export request ready-to-execute

  • RUNNING: for export request being executed

  • SUCCESS: for export request completed with success

  • ERROR: for export request terminated with an error

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.

Last updated

Was this helpful?