---
title: Log Endpoint
slug: experimentation-strategy/data-api/log-endpoint
docTags: 
createdAt: 2026-08-07T21:58:25.673Z
---

{
  "id": "kqdjhUpCSe-R8I5G79vrM",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://logx.optimizely.com/v1/events",
    "servers": [
      {
        "url": "https://logx.optimizely.com/v1/events"
      }
    ],
    "name": "Log Endpoint",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "<p>JSON object that holds an array of visitor objects that describe the visitor's experience during an Optimizely campaign.</p>",
          "customType": "EventBatch",
          "schema": [
            {
              "name": "account_id",
              "kind": "required",
              "type": "string",
              "description": "The Optimizely account to which these events should be attributed",
              "example": "1234"
            },
            {
              "name": "anonymize_ip",
              "kind": "optional",
              "type": "boolean",
              "description": "<p>Optimizely typically stores the client IP address for each request. If this flag is true, the last octet of the IP will be truncated before it is stored. If false, the entire IP address will be stored. This is most relevant for consumers of this API that are implemented in a web browser or mobile client context who are subject to policies or regulation restricting the storage of end-user identifying information. Note that this flag is independent of the IP anonymization setting in the Account and Project settings, which only controls how Optimizely clients set this flag. Also note that if this flag is set, care must be taken when using the IP filtering feature, as fully-qualified explicit IP addresses will not function as filters (anonymization occurs before events are filtered by IP).</p>",
              "default": true
            },
            {
              "name": "client_name",
              "kind": "optional",
              "type": "string",
              "description": "<p>A unique identifier for the system that generated this event. By convention, this should be something like \"organization_name/system_name\".</p>",
              "example": "acmecorp/offlineconversiontracker"
            },
            {
              "name": "client_version",
              "kind": "optional",
              "type": "string",
              "description": "A version identifier for the system that generated this event.",
              "example": "1.0.0"
            },
            {
              "name": "enrich_decisions",
              "kind": "optional",
              "type": "boolean",
              "description": "<p>If true, additional processing is performed on each event in the EventBatch that simplifies the data requirements to track conversion events. Optimizely records the complete history of decisions that have been sent for each visitor which are represented as events of type campaign_activated. When enrich_decisions is enabled on an EventBatch, each of its events will have the recorded decisions automatically linked based on the event’s visitor_id and timestamp. In turn, the decisions required in an EventBatch are only those associated to a campaign_activated event in the same EventBatch. Additionally, due to the stateful nature of enrich_decisions, a campaign_activated event only needs to be sent once per visitor_id and entity_id, as long as the associated decision has not changed.</p>",
              "default": false
            },
            {
              "name": "project_id",
              "kind": "optional",
              "type": "string",
              "description": "<p>The project_id needs only to be passed if you are using the Recommendations product.</p>",
              "example": "5678"
            },
            {
              "name": "visitors",
              "kind": "required",
              "type": "array",
              "description": "<p>An array of visitor objects that describe the visitor's experience during an Optimizely campaign.</p>",
              "modelRef": "#/components/schemas/Visitor",
              "customType": "Visitor[]",
              "schema": [
                {
                  "name": "attributes",
                  "kind": "optional",
                  "type": "array",
                  "description": "Attributes associated with this visitor at the time of this request",
                  "modelRef": "#/components/schemas/Attribute",
                  "customType": "Attribute[]",
                  "schema": [
                    {
                      "name": "entity_id",
                      "kind": "optional",
                      "type": "string",
                      "description": "<p>The ID of the entity corresponding to this Attribute. This is only required for custom attributes (type=\"custom\"), and invalid for other Attribute types.</p>",
                      "example": "1234"
                    },
                    {
                      "name": "key",
                      "kind": "optional",
                      "type": "string",
                      "description": "<p>The key (or API name) of the this Attribute. This is only required for custom attributes (type=\"custom\"), and optional for other Attribute types.</p>",
                      "example": "shoe_purchased"
                    },
                    {
                      "name": "type",
                      "kind": "required",
                      "type": "string",
                      "description": "<p>Describes what kind of Attribute this is (i.e., \"custom\", \"location\", etc.)</p>",
                      "example": "custom"
                    },
                    {
                      "name": "value",
                      "kind": "required",
                      "type": "",
                      "description": "<p>The value can be an arbitrary string, integer, number, or a boolean. A boolean, integer or number can also be sent as a string value prefixed by the unicode character U+E000 . For example the integer 123 can be sent as \"\\UE000123\".</p>",
                      "example": "nike zoom air"
                    }
                  ]
                },
                {
                  "name": "session_id",
                  "kind": "optional",
                  "type": "string",
                  "description": "<p>A unique identifier that identifies the session context, if any, for these events. If omitted, the Optimizely backend will calculate session-based results by inferring sessions by opening a session when an event is first received from a given visitor_id, and closing the session after 30 minutes with no events received for that visitor, with a maximum session size of 24 hours.</p>",
                  "example": "session_1231982382"
                },
                {
                  "name": "snapshots",
                  "kind": "required",
                  "type": "array",
                  "description": "<p>An array of events triggered for an experiment, and the decision snapshot when that event occurred. Events can occur within different decision snapshots.  Events occurring in different snapshots should be contained in different snapshot items.</p>",
                  "modelRef": "#/components/schemas/Snapshot",
                  "customType": "Snapshot[]",
                  "schema": [
                    {
                      "name": "decisions",
                      "kind": "optional",
                      "type": "array",
                      "description": "<p>The list of bucketing Decisions made for the visitor (i.e. which experiments and variations the visitor was exposed to) for the duration of the session thus far. If the <code>enrich_decisions</code> option is enabled, just the Decisions associated to <code>campaign_activated</code> event in same Snapshot are necessary.</p>",
                      "modelRef": "#/components/schemas/Decision",
                      "customType": "Decision[]",
                      "schema": [
                        {
                          "name": "campaign_id",
                          "kind": "required",
                          "type": "string",
                          "description": "The id of the campaign containing this experiment.",
                          "example": "4321"
                        },
                        {
                          "name": "experiment_id",
                          "kind": "required",
                          "type": "string",
                          "description": "<p>The id of the experiment the visitor was exposed to. For Personalization Campaigns, clients should explicitly send null as the experiment_id for visitors not bucketed into any Experiment, for the purpose of accurately computing Campaign reach.</p>",
                          "example": "1234"
                        },
                        {
                          "name": "is_campaign_holdback",
                          "kind": "optional",
                          "type": "boolean",
                          "description": "<p>If true, the chosen experience was held back at the campaign level. Required for Personalization, omit otherwise.</p>",
                          "example": false
                        },
                        {
                          "name": "variation_id",
                          "kind": "required",
                          "type": "string",
                          "description": "<p>The id of the variation the visitor was exposed to. For Personalization Campaigns, clients should explicitly send null as the variation_id for visitors not bucketed into any Experiment, for the purpose of accurately computing Campaign reach.</p>",
                          "example": "5678"
                        }
                      ]
                    },
                    {
                      "name": "events",
                      "kind": "required",
                      "type": "array",
                      "description": "<p>The list of Events that should be recorded by the Optimizely backend within the given visitor, session and account context.</p>",
                      "modelRef": "#/components/schemas/Event",
                      "customType": "Event[]",
                      "schema": [
                        {
                          "name": "entity_id",
                          "kind": "optional",
                          "type": "string",
                          "description": "The id of the entity corresponding to this event.",
                          "example": "1234"
                        },
                        {
                          "name": "key",
                          "kind": "optional",
                          "type": "string",
                          "description": "<p>The event key (aka API name) for this event.</p>",
                          "example": "my_event_name"
                        },
                        {
                          "name": "quantity",
                          "kind": "optional",
                          "type": "integer",
                          "description": "<p>An aggregatable \"count\" associated with this event; for example, a number of video views or items in a shopping cart.</p>",
                          "example": 4
                        },
                        {
                          "name": "revenue",
                          "kind": "optional",
                          "type": "integer<int64>",
                          "description": "<p>An aggregatable revenue amount associated with this event, in 1/100th of an arbitrary currency unit. For example, to represent $23.42, this field would be set to 2342.</p>",
                          "example": 2342,
                          "format": "int64"
                        },
                        {
                          "name": "tags",
                          "kind": "optional",
                          "type": "object",
                          "description": "<p>Arbitrary key value pairs attached to an event. The value can be a string, integer, number, or booean. A non-string type can also be sent as a string value prefixed by the unicode character U+E000. For example the integer 123 can be sent as \"\\UE000123\".</p>",
                          "example": "{\"duration\":22,\"video_title\":\"Funny Cats\"}",
                          "modelRef": "#/components/schemas/Tags",
                          "customType": "Tags",
                          "schema": []
                        },
                        {
                          "name": "timestamp",
                          "kind": "required",
                          "type": "integer",
                          "description": "<p>Timestamp at which the event was generated, time since the epoch in milliseconds.</p>",
                          "example": 1485989442742316000
                        },
                        {
                          "name": "type",
                          "kind": "optional",
                          "type": "string",
                          "description": "<p>the type of event.  For example, to indicate a 'decision_point' type should be 'campaign_activated'.</p>",
                          "example": "campaign_activated"
                        },
                        {
                          "name": "uuid",
                          "kind": "required",
                          "type": "string",
                          "description": "<p>A unique identifier for this Event. This may be generated by the client with a typical UUID-generating method. Used by Optimizely's backend to de-duplicate requests that are accidentally or erroneously replayed.</p>",
                          "example": "0255F96D-922B-433B-B474-5D87EC1AB122"
                        },
                        {
                          "name": "value",
                          "kind": "optional",
                          "type": "number",
                          "description": "<p>A scalar value associated with an event. This should be some non-revenue number.</p>",
                          "example": 1.234
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "visitor_id",
                  "kind": "required",
                  "type": "string",
                  "description": "A unique identifier for the visitor",
                  "example": "user_32912378471284"
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/EventBatch",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "204",
        "description": "The events were queued for recording by the Optimizely backend.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "The request is malformed or otherwise failed validation by the Optimizely backend.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "500",
        "description": "A server error occurred. The client should attempt to resend the events at a later time.",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "cTlVVic6rNweS8OAEn1SB",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://logx.optimizely.com/v1/events \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"account_id\": \"1234\",\n     \"anonymize_ip\": true,\n     \"visitors\": [\n     {\n     \"attributes\": [\n     {\n     \"type\": \"custom\",\n     \"value\": \"nike zoom air\"\n     }\n     ],\n     \"snapshots\": [\n     {\n     \"decisions\": [\n     {\n     \"campaign_id\": \"4321\",\n     \"experiment_id\": \"1234\",\n     \"variation_id\": \"5678\"\n     }\n     ],\n     \"events\": [\n     {\n     \"timestamp\": 1485989442742316000,\n     \"uuid\": \"0255F96D-922B-433B-B474-5D87EC1AB122\"\n     }\n     ]\n     }\n     ],\n     \"visitor_id\": \"user_32912378471284\"\n     }\n     ]\n     }'"
        },
        {
          "id": "a9GENmATxZB3hhR0-UVGc",
          "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   \"account_id\": \"1234\",\n   \"anonymize_ip\": true,\n   \"visitors\": [\n      {\n         \"attributes\": [\n            {\n               \"type\": \"custom\",\n               \"value\": \"nike zoom air\"\n            }\n         ],\n         \"snapshots\": [\n            {\n               \"decisions\": [\n                  {\n                     \"campaign_id\": \"4321\",\n                     \"experiment_id\": \"1234\",\n                     \"variation_id\": \"5678\"\n                  }\n               ],\n               \"events\": [\n                  {\n                     \"timestamp\": 1485989442742316000,\n                     \"uuid\": \"0255F96D-922B-433B-B474-5D87EC1AB122\"\n                  }\n               ]\n            }\n         ],\n         \"visitor_id\": \"user_32912378471284\"\n      }\n   ]\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://logx.optimizely.com/v1/events\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "CoHGxYN2x52-A-lsos0ih",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://logx.optimizely.com/v1/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   \"account_id\": \"1234\",\n   \"anonymize_ip\": true,\n   \"visitors\": [\n      {\n         \"attributes\": [\n            {\n               \"type\": \"custom\",\n               \"value\": \"nike zoom air\"\n            }\n         ],\n         \"snapshots\": [\n            {\n               \"decisions\": [\n                  {\n                     \"campaign_id\": \"4321\",\n                     \"experiment_id\": \"1234\",\n                     \"variation_id\": \"5678\"\n                  }\n               ],\n               \"events\": [\n                  {\n                     \"timestamp\": 1485989442742316000,\n                     \"uuid\": \"0255F96D-922B-433B-B474-5D87EC1AB122\"\n                  }\n               ]\n            }\n         ],\n         \"visitor_id\": \"user_32912378471284\"\n      }\n   ]\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "NZf8TV81dy8Y5kEXpavr1",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://logx.optimizely.com/v1/events\"\n\npayload = json.dumps({\n   \"account_id\": \"1234\",\n   \"anonymize_ip\": True,\n   \"visitors\": [\n      {\n         \"attributes\": [\n            {\n               \"type\": \"custom\",\n               \"value\": \"nike zoom air\"\n            }\n         ],\n         \"snapshots\": [\n            {\n               \"decisions\": [\n                  {\n                     \"campaign_id\": \"4321\",\n                     \"experiment_id\": \"1234\",\n                     \"variation_id\": \"5678\"\n                  }\n               ],\n               \"events\": [\n                  {\n                     \"timestamp\": 1485989442742316000,\n                     \"uuid\": \"0255F96D-922B-433B-B474-5D87EC1AB122\"\n                  }\n               ]\n            }\n         ],\n         \"visitor_id\": \"user_32912378471284\"\n      }\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": "cTlVVic6rNweS8OAEn1SB"
    },
    "results": {
      "languages": [
        {
          "id": "uRX4ZWPmr28gUw9gYq6cg",
          "language": "204",
          "code": "// The events were queued for recording by the Optimizely backend.\n"
        },
        {
          "id": "l1zvC1AnQe-K-zzS8irwc",
          "language": "400",
          "code": "// The request is malformed or otherwise failed validation by the Optimizely backend.\n"
        },
        {
          "id": "wWFHHzky0x16Z9f_NNVkN",
          "language": "500",
          "code": "// A server error occurred. The client should attempt to resend the events at a later time.\n"
        }
      ],
      "selectedLanguageId": "uRX4ZWPmr28gUw9gYq6cg"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}