Skip to main content
POST
/
v1
/
custom-kpi-datasets
/
{dataset_id}
/
campaigns
/
{campaign_id}
/
lock
Lock Campaign
const options = {
  method: 'POST',
  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}/lock', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "id": "<string>",
  "name": "<string>",
  "locked_at": "<string>",
  "period_start": "<string>",
  "period_end": "<string>",
  "deadline": "<string>",
  "created_at": {},
  "updated_at": {}
}

Lock Campaign

Lock a campaign, preventing any further value submissions from recipients. Locked campaigns keep all existing data but reject new or edited values.

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 to lock

Response

Returns the campaign with locked_at set to the current timestamp (HTTP 200).
id
string
Campaign UUID.
name
string
Campaign display name.
locked_at
string
Timestamp when the campaign was locked (ISO 8601). Now set.
period_start
string
Data collection period start date.
period_end
string
Data collection period end date.
deadline
string
Submission deadline.
created_at
datetime
Creation timestamp (ISO 8601).
updated_at
string | null
Last update timestamp (ISO 8601).

Example

curl -X POST "https://api.dcycle.io/v1/custom-kpi-datasets/${DATASET_ID}/campaigns/${CAMPAIGN_ID}/lock" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

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": "2025-06-20T16:00:00Z",
  "created_by": "c3d4e5f6-a7b8-9012-cdef-345678901234",
  "updated_by": "c3d4e5f6-a7b8-9012-cdef-345678901234",
  "created_at": "2025-06-15T10:00:00Z",
  "updated_at": "2025-06-20T16:00: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: Campaign not found
{
  "detail": "Campaign not found"
}

Unlock Campaign

Re-open for submissions

Get Campaign

View campaign status