Customer export from selected segment
Use these methods to export selected customer data from any segment.
- POST – request data export. You’ll get the request status and exportId needed to download the data.
- GET – download data. You’ll receive a link to download a CSV file or raw data file.
POST – request data export
To send a request using this method, it must include:
Endpoint
The endpoint (server address) for this request is https://api.ecdp.app/exports/customers
Request parameters#
Request header
Parameter | Required | Where to use | Description |
x-api-key | yes | header | your API key, which you’ll find in Settings > API. |
Content-Type: application/json | yes | header | Indicates the format in which the request is sent. Without this information, the API may not read your request correctly. |
Request body
Parameter | Required | Type | Where to use | Description |
segmentId | yes | Integer($int32) | body | ID of the segment from which you want to export customer data. You’ll find the segment ID in ECDP > Customers > Segmentation > “ID” column. |
systemAttributes | no | string | body | system attributes – includes an additional set of parameters >>> see table below. |
customAttributes | no | string | body | customer attributes – includes an additional set of parameters >>> see table below. |
consents | no | string | body | Consents granted by the customer – includes an additional set of parameters >>> see table below. |
The systemAttributes, customAttributes, and consents parameters aren’t required, but the request will be rejected if you don’t fill in at least one field.
The systemAttributes, customAttributes, and consents parameters have additional parameters that let you get detailed data about customers in the selected segment.
System attributes#
Parameter | Required | Type | Where to use | Description |
name | no | string | body | name of the system attribute https://help.expertsender.com/pl/ecdp/dodawanie-cech-klientow-i-zgod/. |
all | no | boolean | body | Allows export of all attributes. Enter true if you want to export all attributes. Otherwise, leave the field empty. |
Custom attributes#
Parameter | Required | Type | Where to use | Description |
id | no | integer($int32) | body | ID of the customer attribute. These are attributes you create yourself in ECDP > Settings > Customers > Customer attributes. |
name | no | string | body | Name of the attribute. |
all | no | boolean | body | Allows export of all attributes. Enter true if you want to export all attributes. Otherwise, leave the field empty. |
Consents#
Parameter | Required | Type | Where to use | Description |
id | no | Integer($int32) | body | Consent ID. You’ll find them in ECDP > Settings > Consents > Consents. |
name | no | string | body | Name of the consent. |
all | no | boolean | body | Allows export of all attributes. Enter true if you want to export all attributes. Otherwise, leave the field empty. |
How to handle duplicate fields
If you request all attributes (using ‘all: true’) and specify several specific attributes from the same group in your request, we’ll simply export all attributes. The system ignores redundant information to avoid duplicates.
Sample requests
Required request format: JSON
Example 1
You’re exporting customer data from segment ID 1, including all system attributes, customer attributes, and consents.
Request body:
{
"segmentId": 1,
"data": {
"customAttributes": [
{"all": true}
],
"systemAttributes": [
{"all": true}
],
"consents": [
{"all": true}
]
}
}
Example 2
You’re exporting customer data from segment ID 158, including:
- custom attribute named contest consent.
- system attribute named Email.
- system attribute with ID 4.
- consent with ID 6.
- consent named consent.
Request body:
{
"segmentId": 158,
"data": {
"customAttributes": [
{"name": "contest consent"}
],
"systemAttributes": [
{"name": "Email"},
{"id": 4}
],
"consents": [
{"id": 6},
{"name": "consent"}
]
}
}
Example 3
You’re exporting customer data from segment ID 12, including:
- all custom attributes.
- one system attribute named ID.
Request body:
{
"segmentId": 12,
"data": {
"customAttributes": [
{"all": true}
],
"systemAttributes": [
{"name": "ID"}
]
}
}
Responses#
200: Success
After sending the request, you’ll receive a response containing the exportId and export request status. The Queued status means the accepted request is waiting in the queue for processing.
Sample response:
{
"exportId": "12",
"status": "Queued"
}
401: Unauthorized
The request was missing an API key, or you’re requesting access to information you don’t have permissions for.
GET – check export results
To find out the export status, the request must include:
Endpoint#
When data export is complete, you can download the file in two ways. Choose the endpoint that better fits your needs:
- Standard CSV file for analysis
Endpoint: https://api.ecdp.app/exports/customers/{exportId}
Use this address if you want to download a CSV format file. This file contains column headers and is suitable for viewing data in MS Excel or Google Sheets, or for importing into systems that require standard CSV format.
- Raw data file for advertising platforms
Endpoint: https://api.ecdp.app/exports/{exportId}
This address lets you download a raw data file. This file is specially prepared for import into external tools – for example, to create Custom Audiences in advertising systems like Google Ads or Meta Ads (Facebook).
Request parameters
Parameter | Required | Type | Where to use | Description |
exportId | Yes, for both endpoints | integer | body | Export ID number that was returned in the response to the POST request. |
Responses
200: Success
After export completion, you’ll receive a response containing a download link for the file. The file is active for 24 hours from the moment it’s generated. After this time, the file is deleted from the server, and the next attempt to download it will result in an error.
Sample response:
{
"exportId": 12,
"status": "Finished",
"file_url": "https://api.dev.ecdp/exports/12?apiKey=ls22fChPm5orIuT2bDt9"
}
401: Unauthorized
The request was missing an API key, or you’re requesting access to information you don’t have permissions for.
Export statuses
The response can contain one of four statuses:
- Queued – the request has been accepted and is waiting in the queue for processing.
- InProgress – the export is being processed.
- Finished – the export completed successfully. In the same response, you’ll get a link to the data file.
- Error – failed to export data from the specified segment.