Skip to main content
PATCH
/
v1
/
custom-kpi-datasets
/
{dataset_id}
/
assignments
/
{assignment_id}
Update Assignment
const options = {
  method: 'PATCH',
  headers: {
    'x-api-key': '<x-api-key>',
    'x-organization-id': '<x-organization-id>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({data_owner_email: '<string>', data_owner_user_id: '<string>'})
};

fetch('https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/assignments/{assignment_id}', 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}/assignments/{assignment_id}"

payload = {
    "data_owner_email": "<string>",
    "data_owner_user_id": "<string>"
}
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}/assignments/{assignment_id} \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --header 'x-organization-id: <x-organization-id>' \
  --data '
{
  "data_owner_email": "<string>",
  "data_owner_user_id": "<string>"
}
'
{
  "id": "<string>",
  "dataset_id": "<string>",
  "organization_id": "<string>",
  "facility_id": {},
  "data_owner_user_id": {},
  "data_owner_email": "<string>",
  "created_at": {},
  "updated_at": {}
}

Update Assignment

Change the data owner details of an existing assignment. Only send the fields you want to change.
The organization_id and facility_id cannot be changed after creation. To reassign to a different org or facility, delete the assignment and create a new one.

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
assignment_id
string
required
UUID of the assignment to update

Body Parameters

All fields are optional.
data_owner_email
string
New data owner email address
data_owner_user_id
string
New Dcycle user UUID for the data owner

Response

Returns the updated assignment (HTTP 200).
id
string
Assignment UUID.
dataset_id
string
Parent dataset UUID.
organization_id
string
Organization UUID the assignment targets.
facility_id
string | null
Facility UUID if the assignment is facility-scoped.
data_owner_user_id
string | null
User UUID of the data owner (if they have a Dcycle account).
data_owner_email
string
Email address of the recipient.
created_at
datetime
Creation timestamp (ISO 8601).
updated_at
string | null
Last update timestamp (ISO 8601).

Example

curl -X PATCH "https://api.dcycle.io/v1/custom-kpi-datasets/${DATASET_ID}/assignments/${ASSIGNMENT_ID}" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}" \
  -H "Content-Type: application/json" \
  -d '{"data_owner_email": "new-manager@example.com"}'
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"
assignment_id = "d4e5f6a7-b8c9-0123-defa-234567890123"

response = requests.patch(
    f"https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/assignments/{assignment_id}",
    headers=headers,
    json={"data_owner_email": "new-manager@example.com"},
)

assignment = response.json()
print(f"Updated: {assignment['data_owner_email']}")
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 assignmentId = 'd4e5f6a7-b8c9-0123-defa-234567890123';

axios.patch(
  `https://api.dcycle.io/v1/custom-kpi-datasets/${datasetId}/assignments/${assignmentId}`,
  { data_owner_email: 'new-manager@example.com' },
  { headers }
)
.then(response => console.log(`Updated: ${response.data.data_owner_email}`));

Successful Response

{
  "id": "d4e5f6a7-b8c9-0123-defa-234567890123",
  "dataset_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "organization_id": "a8315ef3-dd50-43f8-b7ce-d839e68d51fa",
  "facility_id": null,
  "data_owner_user_id": null,
  "data_owner_email": "new-manager@example.com",
  "created_at": "2025-06-10T08:00:00Z",
  "updated_at": "2025-06-18T15: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"}

404 Not Found

Cause: Assignment not found
{
  "detail": "Assignment not found"
}

List Assignments

View all assignments

Delete Assignment

Remove an assignment