POST - Export profile data
Profiles centralize data and events from multiple sources (Apps, Websites, APIs) in a single place based on the Custom ID.
The Profile API allows you to export profiles data. Use this endpoint to:
- Export profile native attributes
- Export profile custom attributes
- Export profile identifiers
- Export profile events
API Description
This API schema is available in the OpenAPI 3.1 format: View it online.
Lookback
Some kind of exports are logs of detailed events that happened. Those raw events are not kept forever and will stop being available to export after a while: this is documented in the "Lookback" duration for each event kind. Providing a from
parameter older than the lookback period will result in an error.
Exports that represent a snapshot of data (such as Profile Attributes) do not have this limitation.
Route
The Profile API exposes a POST endpoint that allows to create an export request:
https://api.batch.com/2.3/profiles/export
Headers and authentication
See Overview → Using Project APIs.
Profile Attributes
Use this to export custom and native attributes as well as the identifiers of your profiles.
Request structure
The body of the request must contain a valid JSON payload describing the export request to be executed.
Here is a how a complete JSON payload looks like:
{
"export_type": "ATTRIBUTES",
"attributes": [
"$email_address",
"$email_marketing",
"$phone_number",
"$sms_marketing",
"$region",
"$timezone",
"$language",
"first_name",
"is_premium"
],
"identifiers": [
"custom_id",
"installation_ids"
]
}
Let's see the parameters in detail.
Id | Description | |
---|---|---|
export_type | string - Required Type of the export. Must be `ATTRIBUTES`. E.g. {"export_type":"ATTRIBUTES"} | |
attributes | string - Optional Profile attributes to be exported. You have to specify the attribute you want to be exported. Any value that does not start with a `$` will be interpreted as a custom attribute. You can find a list of available native attributes on the OpenAPI documentation. E.g. {"attributes":["$region","$timezone","$language","first_name","is_premium"]} | |
identifiers | string - Optional Profile identifiers to be exported. You have to specify the identifier you want to be exported. E.g. {"identifiers":["custom_id"]} |
You must specify at least one of attributes
, identifiers
or both in your export request.
Profile Events
Use this to export events associated with your profiles.
Lookback
90 days
Request structure
The body of the request must contain a valid JSON payload describing the export request to be executed.
Here is a how a complete JSON payload looks like:
{
"export_type": "EVENTS",
"from": "2024-01-01T00:00:00Z",
"to": "now",
"events": [
"email_bounced",
"email_click",
"email_delivered",
"email_unsubscribed"
],
"identifiers": [
"custom_id"
]
}
Id | Description | |
---|---|---|
export_type | string - Required Type of the export. Must be `EVENTS`. E.g. {"export_type":"EVENTS"} | |
from | string - Required UTC date in a RFC 3339 format. Must not be older than the lookback period. E.g. "2024-01-01T00:00:00Z" | |
to | string - Required 'now' or UTC date in a RFC 3339 format E.g. "now" | |
events | string - Optional Events associated with a profile to be exported. You have to specify the events you want to be exported. You can find a list of available events on the OpenAPI documentation. E.g. {"events":["email_bounced","email_click","email_delivered"]} | |
identifiers | string - Optional Profile identifiers to be exported. You have to specify the identifier you want to be exported. E.g. {"identifiers":["custom_id"]} |
Responses
Success
If the POST to the API endpoint is successful you will receive an HTTP 202 confirmation and an export ID. This ID can be used to get status information about your export request using the Project Export API endpoints.
{
"id": "export_nvctr8tgdjf7bppacxxt2aeemnjehfmw"
}
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 specification.