Skip to content

Customer export from selected segment

Use these methods to export selected customer data from any segment.

  1. POST – request data export. You’ll get the request status and exportId needed to download the data.
  2. 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

ParameterRequiredWhere to useDescription
x-api-keyyesheaderyour API key, which you’ll find in Settings > API.
Content-Type: application/jsonyesheaderIndicates the format in which the request is sent. Without this information, the API may not read your request correctly.

Request body

ParameterRequiredTypeWhere to useDescription
segmentIdyesInteger($int32)bodyID of the segment from which you want to export customer data. You’ll find the segment ID in ECDP > Customers > Segmentation > “ID” column.
systemAttributesnostringbodysystem attributes – includes an additional set of parameters >>> see table below.
customAttributesnostringbodycustomer attributes – includes an additional set of parameters >>> see table below.
consentsnostringbodyConsents 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#

ParameterRequiredTypeWhere to useDescription
namenostringbodyname of the system attribute https://help.expertsender.com/pl/ecdp/dodawanie-cech-klientow-i-zgod/.
allnobooleanbodyAllows export of all attributes. Enter true if you want to export all attributes. Otherwise, leave the field empty.

Custom attributes#

ParameterRequiredTypeWhere to useDescription
idnointeger($int32)bodyID of the customer attribute. These are attributes you create yourself in ECDP > Settings > Customers > Customer attributes.
namenostringbodyName of the attribute.
allnobooleanbodyAllows export of all attributes. Enter true if you want to export all attributes. Otherwise, leave the field empty.

Consents#

ParameterRequiredTypeWhere to useDescription
idnoInteger($int32)bodyConsent ID. You’ll find them in ECDP > Settings > Consents > Consents.
namenostringbodyName of the consent.
allnobooleanbodyAllows 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:

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

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

ParameterRequiredTypeWhere to useDescription
exportIdYes, for both endpointsintegerbodyExport 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:

  1. Queued – the request has been accepted and is waiting in the queue for processing.
  2. InProgress – the export is being processed.
  3. Finished – the export completed successfully. In the same response, you’ll get a link to the data file.
  4. Error – failed to export data from the specified segment.