---
title: Update a Custom Event
slug: web-experimentation/api/update-a-custom-event
docTags: 
createdAt: 2026-10-02T13:15:18.296Z
---

{
  "id": "My_OQ9WBs1WaKYporciPn",
  "type": "api-oas-v2",
  "data": {
    "method": "PATCH",
    "url": "https://api.optimizely.com/v2/projects/{project_id}/custom_events/{event_id}",
    "servers": [
      {
        "url": "https://api.optimizely.com/v2/projects/{project_id}/custom_events/{event_id}"
      }
    ],
    "name": "Update a Custom Event",
    "description": "Update a Custom Event",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "project_id",
          "type": "integer<int64>",
          "description": "The project ID of the Project the Custom Event is stored in",
          "format": "int64"
        },
        {
          "kind": "required",
          "name": "event_id",
          "type": "integer<int64>",
          "description": "The Event ID of the Custom Event you'd like to change",
          "format": "int64"
        }
      ],
      "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": "A string in JSON format that includes all the fields you'd like to change for a Custom Event",
          "customType": "CustomEventUpdate",
          "schema": [
            {
              "name": "archived",
              "kind": "optional",
              "type": "boolean",
              "description": "Whether or not to archive this Event"
            },
            {
              "name": "category",
              "kind": "optional",
              "type": "string",
              "description": "",
              "modelRef": "#/components/schemas/EventCategories",
              "customType": "EventCategories",
              "schema": [
                {
                  "name": "name",
                  "kind": "optional",
                  "type": "string",
                  "description": ""
                }
              ]
            },
            {
              "name": "description",
              "kind": "optional",
              "type": "string",
              "description": "A description of this Event"
            },
            {
              "name": "key",
              "kind": "optional",
              "type": "string",
              "description": "Unique string identifier for this Event within the Project",
              "example": "loaded_new_app",
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_\\- .]+$"
            },
            {
              "name": "name",
              "kind": "optional",
              "type": "string",
              "description": "A human readable name for this Event",
              "example": "Loaded New App"
            }
          ],
          "modelRef": "#/components/schemas/CustomEventUpdate",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "apiKey",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        },
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "description": "<p>Write applications that authenticate with the REST API via OAuth 2.0. Or, to authenticate using a personal token, see <a href=\"https://docs.developers.optimizely.com/web/docs/personal-token\" target=\"_blank\">https://docs.developers.optimizely.com/web/docs/personal-token</a></p>",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://app.optimizely.com/oauth2/authorize",
              "tokenUrl": "https://app.optimizely.com/oauth2/token",
              "scopes": {
                "all": "Full access to your account"
              }
            }
          },
          "requiredScopes": [
            "read",
            "write"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Return the updated Event",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "CustomEvent",
            "schema": [
              {
                "name": "archived",
                "kind": "optional",
                "type": "boolean",
                "description": "Whether or not to archive this Event"
              },
              {
                "name": "category",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/EventCategories",
                "customType": "EventCategories",
                "schema": [
                  {
                    "name": "name",
                    "kind": "optional",
                    "type": "string",
                    "description": ""
                  }
                ]
              },
              {
                "name": "created",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "Creation date for this Event",
                "format": "date-time"
              },
              {
                "name": "description",
                "kind": "optional",
                "type": "string",
                "description": "A description of this Event"
              },
              {
                "name": "event_properties",
                "kind": "optional",
                "type": "array",
                "description": "<p>A set of user-defined data elements for the event. Metrics can filter on particular values of these properties.</p>",
                "modelRef": "#/components/schemas/EventProperty",
                "customType": "EventProperty[]",
                "schema": [
                  {
                    "name": "data_type",
                    "kind": "optional",
                    "type": "string<boolean | number | string>",
                    "description": "The type of data that can be accepted for this property.",
                    "enum": [
                      "boolean",
                      "number",
                      "string"
                    ]
                  },
                  {
                    "name": "name",
                    "kind": "optional",
                    "type": "string",
                    "description": "The name of the property."
                  }
                ]
              },
              {
                "name": "event_type",
                "kind": "optional",
                "type": "string<custom>",
                "description": "The type of this Event",
                "enum": [
                  "custom"
                ]
              },
              {
                "name": "id",
                "kind": "optional",
                "type": "integer<int64>",
                "readOnly": true,
                "description": "The unique identifier of the Event",
                "format": "int64"
              },
              {
                "name": "is_classic",
                "kind": "optional",
                "type": "boolean",
                "readOnly": true,
                "description": "<p>Whether or not this Event is a classic Event. If true, this Event is read-only</p>",
                "default": false
              },
              {
                "name": "is_editable",
                "kind": "optional",
                "type": "boolean",
                "readOnly": true,
                "description": "Whether or not this Event may be edited"
              },
              {
                "name": "key",
                "kind": "required",
                "type": "string",
                "description": "Unique string identifier for this Event within the Project",
                "example": "loaded_new_app",
                "maxLength": 64,
                "pattern": "^[a-zA-Z0-9_\\- .]+$"
              },
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "<p>A human readable name for this Event. If unspecified, defaults to the key</p>",
                "example": "Loaded New App"
              },
              {
                "name": "project_id",
                "kind": "optional",
                "type": "integer<int64>",
                "readOnly": true,
                "description": "The ID of this Event's parent Project",
                "example": 1000,
                "format": "int64"
              }
            ],
            "modelRef": "#/components/schemas/CustomEvent",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Invalid Project ID supplied",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Invalid credentials",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "You do not have permission to access the specified Event",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "Event not found",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "default",
        "description": "Unexpected error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "rxor7kt4Tk0VfTrjGouSK",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PATCH \\\n     --url https://api.optimizely.com/v2/projects/{project_id}/custom_events/{event_id} \\\n     --header 'accept: application/json'"
        },
        {
          "id": "3rOmIi0kVx0iOjoO6-ym7",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'PATCH',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.optimizely.com/v2/projects/{project_id}/custom_events/{event_id}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "5JeF5jzBPJA-hJ63i85Rv",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/v2/projects/{project_id}/custom_events/{event_id}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "HsEgxM4xRAoX1iq4YFDAi",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/v2/projects/{project_id}/custom_events/{event_id}\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"PATCH\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "rxor7kt4Tk0VfTrjGouSK"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Return the updated Event\n{\n  \"archived\": false,\n  \"category\": \"\",\n  \"created\": \"\",\n  \"description\": \"\",\n  \"event_properties\": [\n    {\n      \"data_type\": \"\",\n      \"name\": \"\"\n    }\n  ],\n  \"event_type\": \"\",\n  \"id\": \"\",\n  \"is_classic\": false,\n  \"is_editable\": false,\n  \"key\": \"loaded_new_app\",\n  \"name\": \"Loaded New App\",\n  \"project_id\": 1000\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Invalid Project ID supplied\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Invalid credentials\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// You do not have permission to access the specified Event\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-4-404",
          "language": "404",
          "code": "// Event not found\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-5-default",
          "language": "default",
          "code": "// Unexpected error\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}