---
title: POST /tasks/{task_id}/compose-contents
slug: content-marketing-platform/api/post-taskstaskidcompose-contents
docTags: 
createdAt: 2026-10-18T11:50:10.401Z
---

{
  "id": "KPuG_830vgs_IPJ4cSy8c",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents",
    "servers": [
      {
        "url": "https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents",
        "description": "v3 version of Optimizely CMP Open API"
      }
    ],
    "name": "POST /tasks/{task_id}/compose-contents",
    "description": "<p>Experimental Create a compose content in a task. The new content has no field values and the status <code>draft</code>. Returns 403 if Compose is not enabled for the organization, and 422 if the task is completed or archived.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "task_id",
          "type": "string",
          "example": "645cb61c966d0c591320f636",
          "description": "Unique identifier of the task"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Payload to create a compose content",
          "customType": "TaskComposeContentCreateRequest",
          "schema": [
            {
              "name": "schema_id",
              "kind": "required",
              "type": "string",
              "description": "<p>Content schema of the new compose content. Accepts the schema <code>api_id</code> or its internal <code>id</code>.</p>",
              "example": "blog_post"
            }
          ],
          "modelRef": "#/components/schemas/TaskComposeContentCreateRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "oauth2Flows": {
            "clientCredentials": {
              "tokenUrl": "https://accounts.cmp.optimizely.com/o/oauth2/v1/token",
              "scopes": {}
            },
            "authorizationCode": {
              "authorizationUrl": "https://accounts.cmp.optimizely.com/o/oauth2/v1/auth",
              "tokenUrl": "https://accounts.cmp.optimizely.com/o/oauth2/v1/token",
              "scopes": {
                "openid": "Grants the ability to receive a unique identifier for the user.",
                "profile": "Grants access to user profile information.",
                "offline_access": "Grants the ability to refresh access_token using the refresh token even when user is not present (not logged in)."
              }
            }
          },
          "requiredScopes": [
            "openid",
            "profile",
            "offline_access"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Created compose content",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "TaskComposeContentResponse",
            "schema": [
              {
                "name": "id",
                "kind": "required",
                "type": "string",
                "description": "Unique identifier of the compose content",
                "example": "db5lh0dh7f0s1otndpp0"
              },
              {
                "name": "content_schema_id",
                "kind": "required",
                "type": "string",
                "description": "Internal identifier of the content schema of the compose content",
                "example": "db5lfu5h7f0s1otndoug"
              },
              {
                "name": "status",
                "kind": "required",
                "type": "string<draft | changed | published | archived | >",
                "nullable": true,
                "description": "Status of the compose content",
                "example": "draft",
                "enum": [
                  "draft",
                  "changed",
                  "published",
                  "archived",
                  "null"
                ]
              },
              {
                "name": "version",
                "kind": "required",
                "type": "integer",
                "description": "Current version number of the compose content",
                "example": 1
              },
              {
                "name": "published_version",
                "kind": "required",
                "type": "integer",
                "nullable": true,
                "description": "<p>Version number that is currently published. <code>null</code> if the content was never published.</p>",
                "example": ""
              },
              {
                "name": "created_at",
                "kind": "required",
                "type": "string<date-time>",
                "description": "<p>Date and time on which the compose content was created, in ISO 8601 UTC format</p>",
                "example": "2026-10-11T09:36:01Z",
                "format": "date-time"
              },
              {
                "name": "updated_at",
                "kind": "required",
                "type": "string<date-time>",
                "description": "<p>Date and time of the most recent update of the compose content, in ISO 8601 UTC format</p>",
                "example": "2026-10-11T09:36:11Z",
                "format": "date-time"
              },
              {
                "name": "fields",
                "kind": "required",
                "type": "object",
                "description": "<p>Field values of the compose content, keyed by the field <code>api_id</code> of the content schema. Each value is an object keyed by locale code (for example <code>en-US</code>). Fields that are not localized are still keyed by the default locale. The value type depends on the field type in the content schema. Reference and embedded schema fields are returned as links only: <code>{\"meta\": {\"id\": \"...\", \"type\": \"link\", \"link_type\": \"content\"}}</code>.</p>",
                "example": "{\"title\":{\"en-US\":\"Hello from Open API\",\"de\":\"Hallo\"},\"is_featured\":{\"en-US\":true}}",
                "modelRef": "#/components/schemas/ComposeContentFields",
                "customType": "ComposeContentFields",
                "schema": []
              },
              {
                "name": "links",
                "kind": "required",
                "type": "object",
                "description": "Meta links",
                "example": "",
                "schema": [
                  {
                    "name": "self",
                    "kind": "required",
                    "type": "string",
                    "description": "URL of the compose content",
                    "example": "https://api.cmp.optimizely.com/v3/tasks/645cb61c966d0c591320f636/compose-contents/db5lh0dh7f0s1otndpp0"
                  },
                  {
                    "name": "task",
                    "kind": "required",
                    "type": "string",
                    "description": "URL of the task",
                    "example": "https://api.cmp.optimizely.com/v3/tasks/645cb61c966d0c591320f636"
                  },
                  {
                    "name": "content_schema",
                    "kind": "required",
                    "type": "string",
                    "nullable": true,
                    "description": "URL of the content schema",
                    "example": "https://api.cmp.optimizely.com/v3/compose/content-schemas/db5lfu5h7f0s1otndoug"
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/TaskComposeContentResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Client error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Unsupported arguments: a,b,c\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Authorization error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Unauthorized\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "Permission error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"You do not have the permission to perform this operation\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "Not found error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Resource not found\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "422",
        "description": "Unprocessable entity error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Resource cannot be processed\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "h_LzCFOaSA7F0O2kqEhrI",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"schema_id\": \"blog_post\"\n     }'"
        },
        {
          "id": "ULml3ObB5bAvTvYoV3gCD",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"schema_id\": \"blog_post\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "W2UOvLKx9Vm5jdTadvyJ_",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"schema_id\": \"blog_post\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "t4VOfBxj52hmJhvhWvMqO",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.cmp.optimizely.com/v3/tasks/{task_id}/compose-contents\"\n\npayload = json.dumps({\n   \"schema_id\": \"blog_post\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "h_LzCFOaSA7F0O2kqEhrI"
    },
    "results": {
      "languages": [
        {
          "id": "ggRy_WjjGgpaFddPgm2gk",
          "language": "201",
          "code": "// Created compose content\n{\n  \"id\": \"db5lh0dh7f0s1otndpp0\",\n  \"content_schema_id\": \"db5lfu5h7f0s1otndoug\",\n  \"status\": \"draft\",\n  \"version\": 1,\n  \"published_version\": 0,\n  \"created_at\": \"2026-10-11T09:36:01Z\",\n  \"updated_at\": \"2026-10-11T09:36:11Z\",\n  \"fields\": {},\n  \"links\": {\n    \"self\": \"https://api.cmp.optimizely.com/v3/tasks/645cb61c966d0c591320f636/compose-contents/db5lh0dh7f0s1otndpp0\",\n    \"task\": \"https://api.cmp.optimizely.com/v3/tasks/645cb61c966d0c591320f636\",\n    \"content_schema\": \"https://api.cmp.optimizely.com/v3/compose/content-schemas/db5lfu5h7f0s1otndoug\"\n  }\n}"
        },
        {
          "id": "dRS_Hb2xJ9i-phLAo2Rrf",
          "language": "400",
          "code": "// Client error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "_j1ZsjmioprBz7HOnt1up",
          "language": "401",
          "code": "// Authorization error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "_XKep9uVIChKTZmROXYmU",
          "language": "403",
          "code": "// Permission error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "WtSCdzEzEOk88TCuSd6jR",
          "language": "404",
          "code": "// Not found error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "ebhRrxc1yRbboHc6FZjvy",
          "language": "422",
          "code": "// Unprocessable entity error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "ggRy_WjjGgpaFddPgm2gk"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}