List Campaigns
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns', 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}/campaigns"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"id": "<string>",
"name": "<string>",
"period_start": "<string>",
"period_end": "<string>",
"deadline": "<string>",
"locked_at": "<string>",
"recipient_count": 123,
"response_count": 123,
"completed_count": 123,
"recipients_preview": [
{}
]
}List Campaigns
List all campaigns within a dataset with aggregated stats
GET
/
v1
/
custom-kpi-datasets
/
{dataset_id}
/
campaigns
List Campaigns
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns', 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}/campaigns"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"id": "<string>",
"name": "<string>",
"period_start": "<string>",
"period_end": "<string>",
"deadline": "<string>",
"locked_at": "<string>",
"recipient_count": 123,
"response_count": 123,
"completed_count": 123,
"recipients_preview": [
{}
]
}← Custom KPI
Retrieve all campaigns within a dataset. Each campaign is enriched with aggregate counts: total recipients, responses received, and completed assignments.
Request
Headers
Path Parameters
Response
Returns an array of campaign objects with aggregate stats (HTTP 200).Example
curl -X GET "https://api.dcycle.io/v1/custom-kpi-datasets/${DATASET_ID}/campaigns" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
}
dataset_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
response = requests.get(
f"https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns",
headers=headers,
)
for c in response.json():
print(f"{c['name']}: {c['completed_count']}/{c['recipient_count']} complete")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
};
const datasetId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
axios.get(`https://api.dcycle.io/v1/custom-kpi-datasets/${datasetId}/campaigns`, { headers })
.then(response => {
response.data.forEach(c => console.log(`${c.name}: ${c.completed_count}/${c.recipient_count}`));
});
Successful Response
[
{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"dataset_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Q1 2025 Water Survey",
"period_start": "2025-01-01",
"period_end": "2025-03-31",
"deadline": "2025-04-15",
"locked_at": null,
"created_by": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"created_at": "2025-01-10T08:00:00Z",
"updated_at": null,
"recipient_count": 5,
"response_count": 12,
"completed_count": 3,
"recipients_preview": [
{"data_owner_user_id": null, "data_owner_email": "manager-a@example.com"},
{"data_owner_user_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "data_owner_email": "manager-b@example.com"}
]
}
]
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"}
Related Endpoints
Create Campaign
Create a new collection campaign
Get Campaign
View campaign details with recipients
Was this page helpful?