---
title: Get Event by ID
slug: feature-experimentation/api/get-event-by-id
docTags: 
createdAt: 2026-10-01T19:58:02.336Z
---

{
  "id": "pYt0AyDd25esrJVe6mlnM",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.optimizely.com/v2/events/{event_id}",
    "servers": [
      {
        "url": "https://api.optimizely.com/v2/events/{event_id}"
      }
    ],
    "name": "Get Event by ID",
    "description": "Get Event by ID",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "event_id",
          "type": "integer<int64>",
          "description": "The Event ID of the Event you want to get",
          "format": "int64"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [
        {
          "kind": "optional",
          "name": "include_classic",
          "type": "boolean",
          "description": "<p>Whether or not to return a classic Event if the specified event_id belongs to a classic Event. If this parameter is not provided it will default to false</p>"
        }
      ],
      "bodyDataParameters": [],
      "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 Event specified by ID",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Event",
            "schema": [
              {
                "name": "archived",
                "kind": "optional",
                "type": "boolean",
                "description": "Whether or not this Event is archived"
              },
              {
                "name": "category",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/EventCategories",
                "customType": "EventCategories",
                "schema": [
                  {
                    "name": "name",
                    "kind": "optional",
                    "type": "string",
                    "description": ""
                  }
                ]
              },
              {
                "name": "config",
                "kind": "optional",
                "type": "object",
                "description": "",
                "modelRef": "#/components/schemas/InPageEventConfig",
                "customType": "InPageEventConfig",
                "schema": [
                  {
                    "name": "selector",
                    "kind": "required",
                    "type": "string",
                    "description": "<p>CSS selector for the page element(s) that trigger an Event</p>",
                    "example": ".menu-options"
                  }
                ]
              },
              {
                "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 for this Event",
                "example": "Item added to cart"
              },
              {
                "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 | click | pageview | classic_custom | classic_click | classic_pageview | classic_engagement | classic_revenue | classic_mobile_tap | classic_mobile_view | classic_mobile_session_length | classic_mobile_num_session>",
                "description": "The type of this Event",
                "enum": [
                  "custom",
                  "click",
                  "pageview",
                  "classic_custom",
                  "classic_click",
                  "classic_pageview",
                  "classic_engagement",
                  "classic_revenue",
                  "classic_mobile_tap",
                  "classic_mobile_view",
                  "classic_mobile_session_length",
                  "classic_mobile_num_session"
                ]
              },
              {
                "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 this Event may be edited"
              },
              {
                "name": "key",
                "kind": "optional",
                "type": "string",
                "description": "Unique string identifier for this Event within the Project",
                "example": "add_to_cart",
                "maxLength": 64
              },
              {
                "name": "last_modified",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "The last time the Event was modified",
                "format": "date-time"
              },
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "A human readable name for this Event",
                "example": "Add to Cart"
              },
              {
                "name": "page_id",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "The Page ID associated with this Event",
                "example": 5000,
                "format": "int64"
              },
              {
                "name": "project_id",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "The ID of this Event's parent Project",
                "example": 1000,
                "format": "int64"
              }
            ],
            "modelRef": "#/components/schemas/Event",
            "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 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": "E3uXRdhIRk21JVgADKUFw",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://api.optimizely.com/v2/events/{event_id} \\\n     --header 'accept: application/json'"
        },
        {
          "id": "yTMWxC-I00bvwRzn5tsXg",
          "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: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.optimizely.com/v2/events/{event_id}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "Ioi2Hl3y6OFOvf-icCR00",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/v2/events/{event_id}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "CTD-VfU4TGoE-Cox5cd4l",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/v2/events/{event_id}\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "E3uXRdhIRk21JVgADKUFw"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Return Event specified by ID\n{\n  \"archived\": false,\n  \"category\": \"\",\n  \"config\": {\n    \"selector\": \".menu-options\"\n  },\n  \"created\": \"\",\n  \"description\": \"Item added to cart\",\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\": \"add_to_cart\",\n  \"last_modified\": \"\",\n  \"name\": \"Add to Cart\",\n  \"page_id\": 5000,\n  \"project_id\": 1000\n}"
        },
        {
          "id": "response-1-401",
          "language": "401",
          "code": "// Invalid credentials\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-2-403",
          "language": "403",
          "code": "// You do not have permission to access specified Event\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Event not found\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-4-default",
          "language": "default",
          "code": "// Unexpected error\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}