Skip to main content
POST
/
v1
/
custom-kpi-datasets
/
{dataset_id}
/
download_excel
Download Excel
const options = {
  method: 'POST',
  headers: {
    'x-api-key': '<x-api-key>',
    'x-organization-id': '<x-organization-id>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    selected_kpi_ids: ['<string>'],
    selected_campaign_ids: ['<string>'],
    language: '<string>'
  })
};

fetch('https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/download_excel', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
import requests

url = "https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/download_excel"

payload = {
    "selected_kpi_ids": ["<string>"],
    "selected_campaign_ids": ["<string>"],
    "language": "<string>"
}
headers = {
    "x-api-key": "<x-api-key>",
    "x-organization-id": "<x-organization-id>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
curl --request POST \
  --url https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/download_excel \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --header 'x-organization-id: <x-organization-id>' \
  --data '
{
  "selected_kpi_ids": [
    "<string>"
  ],
  "selected_campaign_ids": [
    "<string>"
  ],
  "language": "<string>"
}
'
{
  "message": "<string>",
  "queued": true,
  "processing_job_id": "<string>"
}

Download Excel

Queue an asynchronous Excel export of custom KPI values for a dataset. The export is processed in the background and you receive an email with the download link when ready.

Request

Headers

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Path Parameters

dataset_id
string
required
UUID of the dataset to export

Body Parameters

selected_kpi_ids
string[]
default:"[]"
KPI UUIDs to include in the export (max 100). Empty array exports all KPIs.
selected_campaign_ids
string[]
default:"[]"
Campaign UUIDs to include (max 100). Empty array exports all campaigns.
language
string
default:"es"
Export language: es (Spanish) or en (English)

Response (202 Accepted)

message
string
Confirmation message
queued
boolean
Always true — the export is processing asynchronously
processing_job_id
string
UUID of the processing job for tracking progress

Example

curl -X POST "https://api.dcycle.io/v1/custom-kpi-datasets/${DATASET_ID}/download_excel" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}" \
  -H "Content-Type: application/json" \
  -d '{
    "selected_kpi_ids": [],
    "selected_campaign_ids": [],
    "language": "en"
  }'
import requests
import os

response = requests.post(
    f"https://api.dcycle.io/v1/custom-kpi-datasets/{os.getenv('DATASET_ID')}/download_excel",
    headers={
        "x-api-key": os.getenv("DCYCLE_API_KEY"),
        "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
        "Content-Type": "application/json",
    },
    json={
        "selected_kpi_ids": [],
        "selected_campaign_ids": [],
        "language": "en",
    },
)

result = response.json()
print(f"Export queued — job ID: {result['processing_job_id']}")
const axios = require('axios');

const response = await axios.post(
  `https://api.dcycle.io/v1/custom-kpi-datasets/${process.env.DATASET_ID}/download_excel`,
  {
    selected_kpi_ids: [],
    selected_campaign_ids: [],
    language: 'en',
  },
  {
    headers: {
      'x-api-key': process.env.DCYCLE_API_KEY,
      'x-organization-id': process.env.DCYCLE_ORG_ID,
      'Content-Type': 'application/json',
    },
  }
);

console.log(`Export queued — job ID: ${response.data.processing_job_id}`);

Successful Response

{
  "message": "Custom KPI download queued. You will receive an email when ready.",
  "queued": true,
  "processing_job_id": "job-uuid"
}

Common Errors

401 Unauthorized

Cause: Missing or invalid API key
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}

403 Forbidden

Cause: The authenticated user is not a member of the organization
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}

404 Not Found

Cause: The dataset does not exist or belongs to another organization
{"detail": "Not Found"}

List Dataset Values

View values in the browser

Get Dataset

View dataset details