Skip to main content
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));
{
  "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 specific campaign-assignment. The current user must either be the data owner or hold the custom_kpi::manage_config permission.

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

Body Parameters

values
array[object]
required
KPI values to submit (max 100, no duplicate kpi_id). Each entry:
FieldTypeDescription
kpi_idstringUUID of the KPI definition
value_numericnumberFor number/percentage types (nullable)
value_textstringFor text type (nullable)
value_datestringFor date type, ISO date (nullable)
option_idstringFor select type — UUID of the chosen option (nullable)
Only send the value field matching the KPI’s value_type.
attachment_file_ids
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).
id
string
Value UUID.
assignment_id
string
Assignment UUID this value belongs to.
response_set_id
string | null
Response set UUID (for public form submissions). null for admin edits.
kpi_id
string
KPI UUID this value answers.
value_numeric
number | null
Numeric value (for number/percentage KPIs).
value_text
string | null
Text value (for text KPIs).
value_date
string | null
Date value (for date KPIs, ISO 8601 date).
option_id
string | null
Selected option UUID (for select KPIs).
submitted_at
string
When this value was submitted (ISO 8601).
submitter_email
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"}
    ]
  }'

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: Duplicate kpi_id entries
{
  "detail": [
    {
      "loc": ["body", "values"],
      "msg": "Duplicate kpi_id entries are not allowed in a single submission",
      "type": "value_error"
    }
  ]
}
Cause: No values or attachments provided
{
  "detail": [
    {
      "loc": ["body", "__root__"],
      "msg": "Provide at least one value or attachment to update.",
      "type": "value_error"
    }
  ]
}

Get Values

View submission history

Campaign Values

View all values across recipients