POST /tasks/{task_id}/compose-contents
1 min
POST
https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents
Path Parameters
- task_idstringrequiredExampleDescription
Body Parameters
- bodyTaskComposeContentCreateRequestrequiredDescription
- schema_idstringrequiredExampleDescription
Responses
201
- TaskComposeContentResponse
- idstringrequiredExampleDescription
- content_schema_idstringrequiredExampleDescription
- statusstring<draft | changed | published | archived | >requiredExampleDescriptionAlloweddraftchangedpublishedarchivednull
- versionintegerrequiredExampleDescription
- published_versionintegerrequiredDescription
- created_atstring<date-time>requiredExampleDescriptionFormatdate-time
- updated_atstring<date-time>requiredExampleDescriptionFormatdate-time
- fieldsComposeContentFieldsrequiredExample
{ "title": { "en-US": "Hello from Open API", "de": "Hallo" }, "is_featured": { "en-US": true } }Description - linksobjectrequiredDescription
- selfstringrequiredExampleDescription
- taskstringrequiredExampleDescription
- content_schemastringrequiredExampleDescription
400
- ErrorExample
{ "message": "Unsupported arguments: a,b,c" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
401
- ErrorExample
{ "message": "Unauthorized" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
403
- ErrorExample
{ "message": "You do not have the permission to perform this operation" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
404
- ErrorExample
{ "message": "Resource not found" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
422
- ErrorExample
{ "message": "Resource cannot be processed" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
curl
curl --request POST \
--url https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"schema_id": "blog_post"
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"schema_id": "blog_post"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"schema_id": "blog_post"
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents"
payload = json.dumps({
"schema_id": "blog_post"
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Created compose content
{
"id": "db5lh0dh7f0s1otndpp0",
"content_schema_id": "db5lfu5h7f0s1otndoug",
"status": "draft",
"version": 1,
"published_version": 0,
"created_at": "2026-10-11T09:36:01Z",
"updated_at": "2026-10-11T09:36:11Z",
"fields": {},
"links": {
"self": "https://api.cmp.optimizely.com/v3/tasks/645cb61c966d0c591320f636/compose-contents/db5lh0dh7f0s1otndpp0",
"task": "https://api.cmp.optimizely.com/v3/tasks/645cb61c966d0c591320f636",
"content_schema": "https://api.cmp.optimizely.com/v3/compose/content-schemas/db5lfu5h7f0s1otndoug"
}
}400
// Client error
{
"message": "Not found",
"errors": ""
}401
// Authorization error
{
"message": "Not found",
"errors": ""
}403
// Permission error
{
"message": "Not found",
"errors": ""
}404
// Not found error
{
"message": "Not found",
"errors": ""
}422
// Unprocessable entity error
{
"message": "Not found",
"errors": ""
}