Edit Assignment Values
const options = {
method: 'PATCH',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({values: {}, attachment_file_ids: {}})
};
fetch('https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns/{campaign_id}/assignments/{campaign_assignment_id}/values', 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}/values"
payload = {
"values": {},
"attachment_file_ids": {}
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)curl --request PATCH \
--url https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns/{campaign_id}/assignments/{campaign_assignment_id}/values \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"values": {},
"attachment_file_ids": {}
}
'{
"id": "<string>",
"assignment_id": "<string>",
"response_set_id": {},
"kpi_id": "<string>",
"value_numeric": {},
"value_text": {},
"value_date": {},
"option_id": {},
"submitted_at": "<string>",
"submitter_email": "<string>"
}Edit Assignment Values
Submit or update KPI values for a campaign-assignment
PATCH
/
v1
/
custom-kpi-datasets
/
{dataset_id}
/
campaigns
/
{campaign_id}
/
assignments
/
{campaign_assignment_id}
/
values
Edit Assignment Values
const options = {
method: 'PATCH',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({values: {}, attachment_file_ids: {}})
};
fetch('https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns/{campaign_id}/assignments/{campaign_assignment_id}/values', 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}/values"
payload = {
"values": {},
"attachment_file_ids": {}
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)curl --request PATCH \
--url https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns/{campaign_id}/assignments/{campaign_assignment_id}/values \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"values": {},
"attachment_file_ids": {}
}
'{
"id": "<string>",
"assignment_id": "<string>",
"response_set_id": {},
"kpi_id": "<string>",
"value_numeric": {},
"value_text": {},
"value_date": {},
"option_id": {},
"submitted_at": "<string>",
"submitter_email": "<string>"
}← Custom KPI
Submit or update KPI values for a specific campaign-assignment. The current user must either be the data owner or hold the
Cause: No values or attachments provided
custom_kpi::manage_config permission.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faPath Parameters
string
required
UUID of the parent dataset
string
required
UUID of the campaign
string
required
UUID of the campaign-assignment
Body Parameters
array[object]
required
KPI values to submit (max 100, no duplicate
Only send the value field matching the KPI’s
kpi_id). Each entry:| Field | Type | Description |
|---|---|---|
kpi_id | string | UUID of the KPI definition |
value_numeric | number | For number/percentage types (nullable) |
value_text | string | For text type (nullable) |
value_date | string | For date type, ISO date (nullable) |
option_id | string | For select type — UUID of the chosen option (nullable) |
value_type.array[string]
UUIDs of evidence files to attach. Replaces the current attachment pool — omit to leave attachments unchanged, send
[] to clear them.Response
Returns an array of saved KPI value objects (HTTP 200).string
Value UUID.
string
Assignment UUID this value belongs to.
string | null
Response set UUID (for public form submissions).
null for admin edits.string
KPI UUID this value answers.
number | null
Numeric value (for
number/percentage KPIs).string | null
Text value (for
text KPIs).string | null
Date value (for
date KPIs, ISO 8601 date).string | null
Selected option UUID (for
select KPIs).string
When this value was submitted (ISO 8601).
string
Email of the user who submitted the value.
Example
curl -X PATCH "https://api.dcycle.io/v1/custom-kpi-datasets/${DATASET_ID}/campaigns/${CAMPAIGN_ID}/assignments/${CA_ID}/values" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"values": [
{"kpi_id": "c3d4e5f6-a7b8-9012-cdef-123456789012", "value_numeric": 1250.5},
{"kpi_id": "d4e5f6a7-b8c9-0123-defa-234567890123", "option_id": "e5f6a7b8-c9d0-1234-efab-345678901234"}
]
}'
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
"Content-Type": "application/json",
}
dataset_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
campaign_id = "b2c3d4e5-f6a7-8901-bcde-f12345678901"
ca_id = "c3d4e5f6-a7b8-9012-cdef-123456789012"
response = requests.patch(
f"https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns/{campaign_id}/assignments/{ca_id}/values",
headers=headers,
json={
"values": [
{"kpi_id": "c3d4e5f6-a7b8-9012-cdef-123456789012", "value_numeric": 1250.5},
],
},
)
print(f"Saved {len(response.json())} values")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
'Content-Type': 'application/json',
};
const datasetId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
const campaignId = 'b2c3d4e5-f6a7-8901-bcde-f12345678901';
const caId = 'c3d4e5f6-a7b8-9012-cdef-123456789012';
axios.patch(
`https://api.dcycle.io/v1/custom-kpi-datasets/${datasetId}/campaigns/${campaignId}/assignments/${caId}/values`,
{
values: [
{ kpi_id: 'c3d4e5f6-a7b8-9012-cdef-123456789012', value_numeric: 1250.5 },
],
},
{ headers }
)
.then(response => console.log(`Saved ${response.data.length} values`));
Successful Response
[
{
"id": "e1f2a3b4-c5d6-7890-abcd-ef1234567890",
"assignment_id": "d4e5f6a7-b8c9-0123-defa-234567890123",
"response_set_id": null,
"kpi_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"value_numeric": 1250.5,
"value_text": null,
"value_date": null,
"option_id": null,
"submitted_at": "2025-06-20T14:30:00Z",
"submitter_email": "admin@company.com",
"submitter_user_id": "b9f1e2d3-0000-0000-0000-000000000001",
"created_at": "2025-06-20T14:30:00Z"
}
]
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"}
422 Validation Error
Cause: Duplicatekpi_id entries
{
"detail": [
{
"loc": ["body", "values"],
"msg": "Duplicate kpi_id entries are not allowed in a single submission",
"type": "value_error"
}
]
}
{
"detail": [
{
"loc": ["body", "__root__"],
"msg": "Provide at least one value or attachment to update.",
"type": "value_error"
}
]
}
Related Endpoints
Get Values
View submission history
Campaign Values
View all values across recipients
Was this page helpful?