Sitecore CDP Audience export REST API (v2)

Use the Audience export REST API to access the output of an audience export job.

After an export job finishes running, its output becomes available at presigned URLs. You can download the output of the export job by opening the URLs. You can access output URLs in two ways:

  • Retrieve the output URLs for the most recently finished export job.
  • First retrieve a list of all finished export jobs of the export, then retrieve the output URLs for any finished export job of your choice.

Note the following:

  • To use this REST API, you must authorize your API requests.
  • All API requests are made in your production environment.

For more information, see the official Sitecore CDP developer documentation.

Authorization

The Audience export REST API uses the OAuth 2.0 standard with JSON web tokens to authorize REST API requests.

Create an API key

  1. In the Sitecore Cloud Portal, open Sitecore CDP.
  2. Click Developer center > API keys > Create.
  3. Name your API key and select a feature. Then, click Save. The API key and the API secret display.
  4. Copy the API key and the API secret because you won't be able to view them again in Sitecore CDP. You'll use them to request an access token.

Request an access token

Run the following cURL command to request an access token. Replace the placeholder values with your API key and API secret.

  curl -X POST 'https://auth.sitecorecloud.io/oauth/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'client_id={YOUR_API_KEY}' \
  --data-urlencode 'client_secret={YOUR_API_SECRET}' \
  --data-urlencode 'grant_type=client_credentials' \
  --data-urlencode 'audience=https://api.sitecorecloud.io'

In the response, the access_token key contains the access token:

  {
    "access_token": "{YOUR_ACCESS_TOKEN}",
    "scope": "cdp.audience_exports:r",
    "expires_in": 86400,
    "token_type": "Bearer"
  }

Access tokens expire in 24 hours. If your requests unexpectedly return a response with status 401 Unauthorized, request a new access token by repeating this POST request.

We recommend that you cache the access token for 24 hours to avoid repeating this POST request while the access token is still valid.

Include the access token in the request header

You can now start making REST API requests. You must include the access token in the request header of every request. For example:

curl -X GET '{YOUR_BASE_URL}/v2/...' \
-H 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
-H 'Accept: application/json'
Download OpenAPI description
Overview
License Apache 2.0
Languages
Servers
Production server AP
https://api-engage-ap.sitecorecloud.io/
Production server EU
https://api-engage-eu.sitecorecloud.io/
Production server JP
https://api-engage-jpe.sitecorecloud.io/
Production server US
https://api-engage-us.sitecorecloud.io/

Most recent export job

Access output URLs for the most recently finished export job.

Operations

Any export job

You can access output URLs for any finished export job by making two API requests. First retrieve a list of all finished export jobs of an audience export, then retrieve the output URLs for the finished export job of your choice.

Operations