---
title: POST /events
slug: content-marketing-platform/api/post-events
docTags: 
createdAt: 2026-10-01T18:51:26.265Z
---

{
  "id": "DPj-R9yz-rUv6vfXmrk6_",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.cmp.optimizely.com/v3/events",
    "servers": [
      {
        "url": "https://api.cmp.optimizely.com/v3/events",
        "description": "v3 version of Optimizely CMP Open API"
      }
    ],
    "name": "POST /events",
    "description": "<p>Experimental Create an event.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "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 new event",
          "customType": "EventCreateRequest",
          "schema": [
            {
              "name": "title",
              "kind": "required",
              "type": "string",
              "description": "Title of the event",
              "example": "The awesome event"
            },
            {
              "name": "description",
              "kind": "optional",
              "type": "string",
              "description": "Description of the event",
              "example": "This awesome event is created to celebrate our clients"
            },
            {
              "name": "campaign_id",
              "kind": "optional",
              "type": "string",
              "description": "ID of the campaign under which the event is to be created",
              "example": "8p7f91i55722y04188a30cee6612"
            },
            {
              "name": "is_all_day",
              "kind": "required",
              "type": "boolean",
              "description": "Indicate if the event is all day long",
              "example": false
            },
            {
              "name": "start_date",
              "kind": "required",
              "type": "string<date-time>",
              "description": "<p>Start date and time of the event in ISO 8601 format: <code>YYYY-MM-DDTHH:MM:SSZ</code></p>",
              "example": "1996-09-09T12:18:00Z",
              "format": "date-time"
            },
            {
              "name": "end_date",
              "kind": "required",
              "type": "string<date-time>",
              "description": "<p>End date and time of the event in ISO 8601 format: <code>YYYY-MM-DDTHH:MM:SSZ</code></p>",
              "example": "2024-12-24T12:18:00Z",
              "format": "date-time"
            },
            {
              "name": "fields",
              "kind": "optional",
              "type": "object",
              "description": "List of fields to be associated with the event",
              "modelRef": "#/components/schemas/AssetTypeObjectField",
              "customType": "AssetTypeObjectField[]",
              "schema": [],
              "complexType": "allOf",
              "complexItems": [
                {
                  "name": "BaseObjectField",
                  "description": "",
                  "modelRef": "#/components/schemas/BaseObjectField",
                  "schema": [
                    {
                      "name": "type",
                      "kind": "required",
                      "type": "string",
                      "description": "Type of the field",
                      "example": "checkbox"
                    },
                    {
                      "name": "values",
                      "kind": "required",
                      "type": "array",
                      "description": "Values for the campaign field",
                      "example": "",
                      "itemType": "undefined",
                      "customType": "undefined[]",
                      "itemExample": "",
                      "itemDefault": ""
                    },
                    {
                      "name": "id",
                      "kind": "required",
                      "type": "string",
                      "description": "Unique identifier of the field",
                      "example": "41aac313bda1e40b6cde7116fc24a"
                    }
                  ]
                },
                {
                  "name": "AssetTypeObjectFieldUpdatePayload",
                  "description": "",
                  "modelRef": "#/components/schemas/AssetTypeObjectFieldUpdatePayload",
                  "schema": [
                    {
                      "name": "type",
                      "kind": "required",
                      "type": "string",
                      "description": "Type of the field",
                      "example": "checkbox"
                    },
                    {
                      "name": "values",
                      "kind": "required",
                      "type": "array",
                      "description": "Payload for fields with attachments",
                      "example": "",
                      "itemType": "undefined",
                      "customType": "undefined[]",
                      "itemExample": "",
                      "itemDefault": ""
                    }
                  ]
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/EventCreateRequest",
          "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 event details",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "EventResponse",
            "schema": [
              {
                "name": "id",
                "kind": "required",
                "type": "string",
                "description": "Unique identifier of the event",
                "example": "674ea40a7a9cac80ff78c95c"
              },
              {
                "name": "title",
                "kind": "required",
                "type": "string",
                "description": "Title of the event",
                "example": "The awesome event"
              },
              {
                "name": "description",
                "kind": "required",
                "type": "string",
                "nullable": true,
                "description": "Description of the event",
                "example": "The awesome event's description"
              },
              {
                "name": "campaign_id",
                "kind": "required",
                "type": "string",
                "nullable": true,
                "description": "Unique identifier of the campaign associated with the event",
                "example": "66d953340019d7b86833ac6dg"
              },
              {
                "name": "start_date",
                "kind": "required",
                "type": "string",
                "description": "Start date of the event in ISO 8601 UTC format",
                "example": "2024-11-26T11:00:34Z"
              },
              {
                "name": "end_date",
                "kind": "required",
                "type": "string",
                "description": "End date of the event in ISO 8601 UTC format",
                "example": "2024-11-26T11:30:34Z"
              },
              {
                "name": "is_all_day",
                "kind": "required",
                "type": "boolean",
                "description": "Whether the event is a day long event or not",
                "example": false
              },
              {
                "name": "is_archived",
                "kind": "required",
                "type": "boolean",
                "description": "Whether the event is archived or not",
                "example": false
              },
              {
                "name": "created_by",
                "kind": "required",
                "type": "string",
                "description": "Unique identifier of the user who created the event",
                "example": "66d837c62373533177b59db3"
              },
              {
                "name": "reference_id",
                "kind": "required",
                "type": "string",
                "description": "Reference ID of the event",
                "example": "EVT-3"
              },
              {
                "name": "links",
                "kind": "required",
                "type": "object",
                "description": "Meta links",
                "example": "",
                "schema": [
                  {
                    "name": "self",
                    "kind": "required",
                    "type": "string",
                    "description": "URL of the event",
                    "example": "https://api.cmp.optimizely.com/v3/events/674ea40a7a9cac80ff78c95c"
                  },
                  {
                    "name": "campaign",
                    "kind": "required",
                    "type": "string",
                    "nullable": true,
                    "description": "URL of the campaign associated with the event",
                    "example": "https://api.cmp.optimizely.com/v3/campaigns/66d953340019d7b86833ac6d"
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/EventResponse",
            "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": "A3m0esmtus5rhgy6iornG",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.cmp.optimizely.com/v3/events \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"title\": \"The awesome event\",\n     \"is_all_day\": false,\n     \"start_date\": \"1996-09-09T12:18:00Z\",\n     \"end_date\": \"2024-12-24T12:18:00Z\",\n     \"fields\": {\n     \"type\": \"checkbox\",\n     \"values\": [],\n     \"id\": \"41aac313bda1e40b6cde7116fc24a\"\n     }\n     }'"
        },
        {
          "id": "nfMTrpwenaleXdLMI13xJ",
          "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   \"title\": \"The awesome event\",\n   \"is_all_day\": false,\n   \"start_date\": \"1996-09-09T12:18:00Z\",\n   \"end_date\": \"2024-12-24T12:18:00Z\",\n   \"fields\": {\n      \"type\": \"checkbox\",\n      \"values\": [],\n      \"id\": \"41aac313bda1e40b6cde7116fc24a\"\n   }\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/events\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "imwE9Pnn-Y3rmQMgex74P",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.cmp.optimizely.com/v3/events\")\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   \"title\": \"The awesome event\",\n   \"is_all_day\": false,\n   \"start_date\": \"1996-09-09T12:18:00Z\",\n   \"end_date\": \"2024-12-24T12:18:00Z\",\n   \"fields\": {\n      \"type\": \"checkbox\",\n      \"values\": [],\n      \"id\": \"41aac313bda1e40b6cde7116fc24a\"\n   }\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "KJUL0qfdfssCqtA6xiliJ",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.cmp.optimizely.com/v3/events\"\n\npayload = json.dumps({\n   \"title\": \"The awesome event\",\n   \"is_all_day\": False,\n   \"start_date\": \"1996-09-09T12:18:00Z\",\n   \"end_date\": \"2024-12-24T12:18:00Z\",\n   \"fields\": {\n      \"type\": \"checkbox\",\n      \"values\": [],\n      \"id\": \"41aac313bda1e40b6cde7116fc24a\"\n   }\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": "A3m0esmtus5rhgy6iornG"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-201",
          "language": "201",
          "code": "// Created event details\n{\n  \"id\": \"674ea40a7a9cac80ff78c95c\",\n  \"title\": \"The awesome event\",\n  \"description\": \"The awesome event's description\",\n  \"campaign_id\": \"66d953340019d7b86833ac6dg\",\n  \"start_date\": \"2024-11-26T11:00:34Z\",\n  \"end_date\": \"2024-11-26T11:30:34Z\",\n  \"is_all_day\": false,\n  \"is_archived\": false,\n  \"created_by\": \"66d837c62373533177b59db3\",\n  \"reference_id\": \"EVT-3\",\n  \"links\": {\n    \"self\": \"https://api.cmp.optimizely.com/v3/events/674ea40a7a9cac80ff78c95c\",\n    \"campaign\": \"https://api.cmp.optimizely.com/v3/campaigns/66d953340019d7b86833ac6d\"\n  }\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Client error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Authorization error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// Permission error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "response-4-404",
          "language": "404",
          "code": "// Not found error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "response-5-422",
          "language": "422",
          "code": "// Unprocessable entity error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-201"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}