Skip to main content
GET
/
v1
/
custom-kpi-datasets
/
{dataset_id}
/
campaigns
/
{campaign_id}
/
assignments
/
{campaign_assignment_id}
/
versions
Assignment Versions
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/{campaign_id}/assignments/{campaign_assignment_id}/versions', 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/{campaign_id}/assignments/{campaign_assignment_id}/versions"

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/{campaign_id}/assignments/{campaign_assignment_id}/versions \
  --header 'x-api-key: <x-api-key>' \
  --header 'x-organization-id: <x-organization-id>'
{
  "items": {},
  "items[].transaction_id": 123,
  "items[].operation_type": 123,
  "items[].issued_at": "<string>",
  "items[].user_name": {},
  "items[].changeset": {},
  "total": 123,
  "page": 123
}

Assignment Versions

Retrieve a paginated audit trail of all changes made to a campaign assignment, including value edits, status changes, and who made each change.

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
campaign_id
string
required
UUID of the campaign
campaign_assignment_id
string
required
UUID of the campaign assignment

Query Parameters

page
integer
default:"1"
Page number
size
integer
default:"50"
Items per page (max 100)

Response

items
array[object]
List of version records
items[].transaction_id
integer
Unique transaction identifier
items[].operation_type
integer
Operation: 0 = create, 1 = update, 2 = delete
items[].issued_at
string
ISO 8601 timestamp of the change
items[].user_name
string | null
Name of the user who made the change
items[].changeset
object
Map of changed fields with [old_value, new_value] pairs
total
integer
Total number of versions
page
integer
Current page number

Example

curl "https://api.dcycle.io/v1/custom-kpi-datasets/${DATASET_ID}/campaigns/${CAMPAIGN_ID}/assignments/${ASSIGNMENT_ID}/versions" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os

response = requests.get(
    f"https://api.dcycle.io/v1/custom-kpi-datasets/{os.getenv('DATASET_ID')}"
    f"/campaigns/{os.getenv('CAMPAIGN_ID')}"
    f"/assignments/{os.getenv('ASSIGNMENT_ID')}/versions",
    headers={
        "x-api-key": os.getenv("DCYCLE_API_KEY"),
        "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
    },
)

data = response.json()
for version in data["items"]:
    print(f"{version['issued_at']} by {version['user_name']}: {version['changeset']}")
const axios = require('axios');

const response = await axios.get(
  `https://api.dcycle.io/v1/custom-kpi-datasets/${process.env.DATASET_ID}/campaigns/${process.env.CAMPAIGN_ID}/assignments/${process.env.ASSIGNMENT_ID}/versions`,
  {
    headers: {
      'x-api-key': process.env.DCYCLE_API_KEY,
      'x-organization-id': process.env.DCYCLE_ORG_ID,
    },
  }
);

response.data.items.forEach(v =>
  console.log(`${v.issued_at} by ${v.user_name}: ${JSON.stringify(v.changeset)}`)
);

Successful Response

{
  "items": [
    {
      "transaction_id": 54321,
      "end_transaction_id": null,
      "operation_type": 1,
      "issued_at": "2025-04-10T09:15:00Z",
      "user_name": "Carlos Lopez",
      "changeset": {
        "status": ["pending", "submitted"]
      }
    }
  ],
  "total": 1,
  "page": 1,
  "size": 50
}

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, campaign, or assignment does not exist or belongs to another organization
{"detail": "Not Found"}

Edit Assignment Values

Modify assignment values

Get Assignment Values

View current assignment values