Skip to content

CMP REST API Reference

intermediate

The CMP REST API provides programmatic access to content, assets, campaigns, workflows, and publishing operations. All endpoints use JSON request and response bodies, require OAuth 2.0 authentication, and follow REST conventions.

Base URL: https://api.optimizely.com/v1/cmp

All requests require a Bearer token obtained via OAuth 2.0 client credentials flow.

Token endpoint: POST https://api.optimizely.com/oauth/token

ParameterTypeRequiredDescription
grant_typestringYesMust be client_credentials
client_idstringYesYour API client ID
client_secretstringYesYour API client secret
scopestringYesSpace-separated scopes: cmp:read, cmp:write, cmp:publish

Response:

FieldTypeDescription
access_tokenstringBearer token for API requests
token_typestringAlways Bearer
expires_inintegerToken lifetime in seconds (default: 3600)
TierRateBurst
Standard100 requests/minute20 requests/second
Enterprise500 requests/minute50 requests/second

Rate-limited responses return 429 with a Retry-After header (seconds).

GET /content

Returns a paginated list of content items with optional filters.

Query parameters:

ParameterTypeDefaultDescription
pageinteger1Page number
per_pageinteger25Items per page (max 100)
statusstringFilter by workflow status: draft, in_review, approved, published, archived
content_typestringFilter by content type slug
campaign_idstringFilter by campaign ID
assignee_idstringFilter by current assignee
created_afterISO 8601Items created after this timestamp
created_beforeISO 8601Items created before this timestamp
sortstringcreated_atSort field: created_at, updated_at, title
orderstringdescSort order: asc, desc

Response: 200 OK

FieldTypeDescription
itemsarrayArray of content item objects
pagination.pageintegerCurrent page number
pagination.per_pageintegerItems per page
pagination.totalintegerTotal items matching the filter
pagination.has_nextbooleanWhether more pages exist

GET /content/{id}

Returns a single content item with all fields, metadata, and workflow state.

Path parameters:

ParameterTypeDescription
idstringContent item ID

Response: 200 OK

FieldTypeDescription
idstringUnique content identifier
titlestringContent title
content_typestringContent type slug
statusstringCurrent workflow status
fieldsobjectContent fields as key-value pairs
campaign_idstringAssociated campaign ID (nullable)
assigneeobjectCurrent assignee user object
created_atISO 8601Creation timestamp
updated_atISO 8601Last modification timestamp
published_atISO 8601Publication timestamp (nullable)
versionintegerVersion number

POST /content

Request body:

FieldTypeRequiredDescription
titlestringYesContent title
content_typestringYesContent type slug
campaign_idstringNoCampaign to associate with
fieldsobjectNoField values matching the content type schema
template_idstringNoTemplate ID to pre-populate fields

Response: 201 Created — Returns the created content item object.

PATCH /content/{id}

Updates specified fields on a content item. Only include fields you want to change.

Request body: Same fields as create, all optional.

Response: 200 OK — Returns the updated content item object.

DELETE /content/{id}

Moves a content item to trash. Items in trash are permanently deleted after 30 days.

Response: 204 No Content

GET /assets

Query parameters:

ParameterTypeDefaultDescription
pageinteger1Page number
per_pageinteger25Items per page (max 100)
folder_idstringFilter by folder
tagsstringComma-separated tag names
typestringFilter by asset type: image, video, document, design
searchstringFull-text search across name, description, and tags

POST /assets

Content-Type: multipart/form-data

FieldTypeRequiredDescription
filebinaryYesThe file to upload
titlestringYesAsset title
descriptionstringNoAsset description
alt_textstringNoAlt text for images
folder_idstringNoTarget folder ID
tagsJSON arrayNoTag names as JSON string

Response: 201 Created for small files, 202 Accepted for files over 10 MB (async processing).

GET /assets/{id}

Response: 200 OK

FieldTypeDescription
idstringAsset identifier
titlestringAsset title
file_namestringOriginal file name
mime_typestringMIME type
file_sizeintegerSize in bytes
dimensionsobjectWidth and height for images/video
urlstringCDN URL for the asset
thumbnail_urlstringThumbnail URL
tagsarrayAssociated tags
folder_idstringParent folder ID
created_atISO 8601Upload timestamp

DELETE /assets/{id}

Response: 204 No Content

GET /campaigns

Query parameters:

ParameterTypeDefaultDescription
pageinteger1Page number
per_pageinteger25Items per page
statusstringFilter: planning, active, completed, archived

GET /campaigns/{id}

Returns campaign details including associated content items and progress metrics.

POST /campaigns

FieldTypeRequiredDescription
namestringYesCampaign name
descriptionstringNoCampaign description
start_dateISO 8601NoCampaign start date
end_dateISO 8601NoCampaign end date

Response: 201 Created

POST /content/{id}/publish

Triggers publishing to a configured channel. Content must be in approved status.

FieldTypeRequiredDescription
channel_idstringYesTarget publishing channel
schedule_atISO 8601NoSchedule publish for a future time
target_locationstringNoCMS content tree location (CMS channels only)

Response: 200 OK for immediate publish, 202 Accepted for scheduled.

GET /content/{id}/publish-status

Returns the publishing status for a content item across all channels.

FieldTypeDescription
channelsarrayStatus per channel
channels[].channel_idstringChannel identifier
channels[].statusstringpending, published, failed, scheduled
channels[].published_atISO 8601When content was published (nullable)
channels[].external_urlstringURL on the target platform (nullable)

GET /content/{id}/workflow

Returns the current workflow state and history for a content item.

POST /content/{id}/workflow/transition

Advances content to the next workflow stage.

FieldTypeRequiredDescription
actionstringYesapprove, reject, request_changes
commentstringNoReviewer comment

Response: 200 OK — Returns updated workflow state.

GET /webhooks

POST /webhooks

FieldTypeRequiredDescription
urlstringYesEndpoint URL to receive events
eventsarrayYesEvent types to subscribe to
secretstringNoSigning secret for payload verification
activebooleanNoWhether the webhook is enabled (default: true)

Response: 201 Created

All error responses follow a consistent structure:

FieldTypeDescription
error.codestringMachine-readable error code
error.messagestringHuman-readable description
error.detailsarrayField-level validation errors (when applicable)