{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/customer-io/main/json-schema/customer-io-events-request-schema.json",
  "title": "eventsRequest",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/customer-io-track-events-api-openapi.yml#/components/schemas/eventsRequest",
  "x-scalar-ignore": true,
  "oneOf": [
    {
      "title": "Standard event",
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the event. This is how you'll reference the event in campaigns or segments."
        },
        "id": {
          "$ref": "#/$defs/dedupe_id"
        },
        "type": {
          "type": "string",
          "description": "Sets the event type. If your event isn't a `page` or `screen` type event, we automatically set this property to `event`.",
          "enum": [
            "event"
          ]
        },
        "timestamp": {
          "type": "integer",
          "format": "unix timestamp",
          "description": "The unix timestamp when the event took place. If you don't provide this value, we use the date-time when we receive the event.\n\n**NOTE**: Events with a timestamp in the past 72 hours can trigger campaigns.\n"
        },
        "data": {
          "type": "object",
          "description": "Additional information that you might want to reference in a message using liquid or use to set attributes on your customer (referenced by `customer_id`).",
          "additionalProperties": {
            "x-additionalPropertiesName": "liquid merge data",
            "description": "Insert key-values that you want to reference in your message here."
          },
          "properties": {
            "recipient": {
              "$ref": "#/$defs/recipient"
            },
            "from_address": {
              "$ref": "#/$defs/from_address"
            },
            "reply_to": {
              "$ref": "#/$defs/reply_to_settable"
            }
          }
        }
      }
    },
    {
      "title": "Page view",
      "type": "object",
      "required": [
        "name",
        "type"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the event. This is how you'll reference the event in campaigns or segments."
        },
        "id": {
          "$ref": "#/$defs/dedupe_id"
        },
        "type": {
          "type": "string",
          "description": "Indicates that the event represents a page view. See [\"page view\" events](/integrations/data-in/connections/javascript/legacy-js/events/#page-view-events), for more information.",
          "enum": [
            "page"
          ]
        },
        "timestamp": {
          "type": "integer",
          "format": "unix timestamp",
          "description": "The unix timestamp when the event took place. If you don't provide this value, we use the date-time when we receive the event.\n"
        },
        "data": {
          "type": "object",
          "description": "Additional information that you might want to reference in a message using liquid or use to set attributes on your customer (referenced by `customer_id`).",
          "additionalProperties": {
            "x-additionalPropertiesName": "liquid merge data",
            "description": "Insert key-values that you want to reference in messages or convert to attributes if/when you associate this event with a person."
          }
        }
      }
    },
    {
      "title": "Mobile screen view",
      "type": "object",
      "required": [
        "anonymous_id",
        "name",
        "type"
      ],
      "properties": {
        "anonymous_id": {
          "$ref": "#/$defs/anonymous_id"
        },
        "name": {
          "type": "string",
          "description": "The screen or deep link path the person viewed, so you can segment your audience or trigger campaigns from this event. Trim any leading and trailing spaces."
        },
        "id": {
          "$ref": "#/$defs/dedupe_id"
        },
        "type": {
          "type": "string",
          "description": "Indicates that the event represents a mobile screen view. You can also capture screen events directly with [our iOS SDK](/integrations/sdk/ios/track-events/#screen-view-events).",
          "enum": [
            "screen"
          ]
        },
        "timestamp": {
          "type": "integer",
          "format": "unix timestamp",
          "description": "The unix timestamp when the event took place. If you don't provide this value, we use the date-time when we receive the event.\n"
        },
        "data": {
          "type": "object",
          "description": "Additional information that you might want to reference in a message using liquid or use to set attributes on your customer (referenced by `customer_id`).",
          "additionalProperties": {
            "x-additionalPropertiesName": "liquid merge data",
            "description": "Insert key-values that you want to reference in messages or convert to attributes if/when you associate this event with a person."
          }
        }
      }
    }
  ],
  "$defs": {
    "anonymous_id": {
      "x-scalar-ignore": true,
      "type": "string",
      "description": "An identifier for an anonymous event, like a cookie. If set as an attribute on a person, any events bearing the same anonymous value are associated with this person. This value must be unique and is not reusable."
    },
    "dedupe_id": {
      "x-scalar-ignore": true,
      "type": "string",
      "format": "ulid",
      "description": "A [ULID](https://github.com/ulid/spec) we use to deduplicate events. If an event repeats a value we've already received, we ignore the duplicate. Our Python and Ruby libraries don't pass this ID."
    },
    "from_address": {
      "x-scalar-ignore": true,
      "type": "string",
      "format": "email",
      "description": "The address you want to trigger messages from, overriding the `from` field in emails triggered by the event."
    },
    "recipient": {
      "x-scalar-ignore": true,
      "description": "The recipient address for an action.",
      "type": "string"
    },
    "reply_to_settable": {
      "x-scalar-ignore": true,
      "type": "string",
      "description": "The address that receives replies for the message, if applicable."
    }
  }
}