User Profile Export by Segment
POST https://{{instance_url}}/users/export/segment
This endpoint allows you to export all the users within a segment. User data is exported as multiple files of user JSON objects separated by new lines (i.e. one JSON object per line).
Beginning April 2021, the
fields_to_exportfield in this API request will be required for all new accounts. The option to default to all field will be removed, and new customers will need to specify the specific fields they'd like to include in their export.
Request Parameters
Key | Requirement | Data Type | Details |
---|---|---|---|
segment_id | Required | String | Identifier for the segment to be exported |
callback_endpoint | Optional | String | Endpoint to post a download url to when the export is available |
fields_to_export | Required* | Array of Strings | Name of user data fields to export, you may also export custom attributes. *Beginning April 2021, new accounts must specify specific fields to export. |
output_format | Optional | String | When using your own S3 bucket, allows to specify file format as 'zip' or 'gzip'. Defaults to zip file format |
Components Used
Fields to Export
The following is a list of valid fields_to_export
. Using fields_to_export
to minimize the data returned can improve response time of this API endpoint:
apps
attributed_campaign
attributed_source
attributed_adgroup
attributed_ad
braze_id
campaigns_received
canvases_received
cards_clicked
country
created_at
custom_attributes
custom_events
devices
dob
email
email_subscribe
external_id
first_name
gender
home_city
language
last_coordinates
last_name
phone
purchases
push_subscribe
push_tokens
random_bucket
time_zone
total_revenue
uninstalled_at
user_aliases
Response
Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
{
"message": (required, string) the status of the export, returns 'success' when completed without errors,
"object_prefix": (required, string) the filename prefix that will be used for the JSON file produced by this export, e.g. 'bb8e2a91-c4aa-478b-b3f2-a4ee91731ad1-1464728599',
"url" : (optional, string) the URL where the segment export data can be downloaded if you do not have your own S3 credentials
}
Once made available, the URL will only be valid for a few hours. As such, we highly recommend that you add your own S3 credentials to Braze.
Sample User Export File Output
User export object (we will include the least data possible - if a field is missing from the object it should be assumed to be null, false, or empty):
{
"external_id" : (string),
"user_aliases" : [
{
"alias_name" : (string),
"alias_label" : (string)
}
],
"braze_id": (string),
"first_name" : (string),
"last_name" : (string),
"email" : (string),
"dob" : (string) date for the user's date of birth,
"home_city" : (string),
"country" : (string),
"phone" : (string),
"language" : (string) ISO-639 two letter code,
"time_zone" : (string),
"last_coordinates" : (array of float) [lon, lat],
"gender" : (string) "M" | "F",
"total_revenue" : (float),
"attributed_campaign" : (string),
"attributed_source" : (string),
"attributed_adgroup" : (string),
"attributed_ad" : (string),
"push_subscribe" : (string) "opted_in" | "subscribed" | "unsubscribed",
"email_subscribe" : (string) "opted_in" | "subscribed" | "unsubscribed",
"custom_attributes" : (object) custom attribute key value pairs,
"custom_events" : [
{
"name" : (string),
"first" : (string) date,
"last" : (string) date,
"count" : (int)
},
...
],
"purchases" : [
{
"name" : (string),
"first" : (string) date,
"last" : (string) date,
"count" : (int)
},
...
],
"devices" : [
{
"model" : (string),
"os" : (string),
"carrier" : (string),
"idfv" : (string) only included for iOS devices,
"idfa" : (string) only included for iOS devices when IDFA collection is enabled,
"google_ad_id" : (string) only included for Android devices when Google Play Advertising Identifier collection is enabled,
"roku_ad_id" : (string) only included for Roku devices,
"windows_ad_id" : (string) only included for Windows devices,
"ad_tracking_enabled" : (bool)
},
...
],
"push_tokens" : [
{
"app" : (string) app name,
"platform" : (string),
"token" : (string)
},
...
],
"apps" : [
{
"name" : (string),
"platform" : (string),
"version" : (string),
"sessions" : (string),
"first_used" : (string) date,
"last_used" : (string) date
},
...
],
"campaigns_received" : [
{
"name" : (string),
"last_received" : (string) date,
"engaged" : {
"opened_email" : (bool),
"opened_push" : (bool),
"clicked_email" : (bool),
"clicked_in_app_message" : (bool)
},
"converted" : (bool),
"api_campaign_id" : (string),
"variation_name" : (optional, string) exists only if it is a multivariate campaign,
"variation_api_id" : (optional, string) exists only if it is a multivariate campaign,
"in_control" : (optional, bool) exists only if it is a multivariate campaign
},
...
],
"canvases_received": [
{
"name": (string),
"api_canvas_id": (string),
"last_received_message": (string) date,
"last_entered": (string) date,
"variation_name": (string),
"in_control": (bool),
"last_exited": (string) date,
"steps_received": [
{
"name": (string),
"api_canvas_step_id": (string),
"last_received": (string) date
},
{
"name": (string),
"api_canvas_step_id": (string),
"last_received": (string) date
},
{
"name": (string),
"api_canvas_step_id": (string),
"last_received": (string) date
}
]
},
...
],
"cards_clicked" : [
{
"name" : (string)
},
...
]
}
Request Body
{"segment_id"=>"segment_identifier", "callback_endpoint"=>"example_endpoint", "fields_to_export"=>["first_name", "email", "purchases"], "output_format"=>"zip"}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string | ||
Authorization | string |