{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/customer-io/main/json-schema/customer-io-anonymous-events-request-schema.json",
  "title": "anonymousEventsRequest",
  "description": "An event attributed to an unknown person. If you provide an `anonymous_id` with the event, you can associate the event with a person later (using the anonymous ID).",
  "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/anonymousEventsRequest",
  "x-scalar-ignore": true,
  "oneOf": [
    {
      "title": "Standard anonymous event",
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "anonymous_id": {
          "$ref": "#/$defs/anonymous_id"
        },
        "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",
            "page",
            "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 event data you can reference in Liquid or use to set customer attributes. You can include `from_address` and `reply_to`, but an event only triggers a campaign if you associate it with a person within 72 hours.",
          "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."
          },
          "properties": {
            "from_address": {
              "$ref": "#/$defs/from_address"
            },
            "reply_to": {
              "$ref": "#/$defs/reply_to_settable"
            }
          }
        }
      }
    },
    {
      "title": "Page view",
      "type": "object",
      "required": [
        "name",
        "type"
      ],
      "properties": {
        "anonymous_id": {
          "$ref": "#/$defs/anonymous_id"
        },
        "name": {
          "type": "string",
          "description": "The name of the event. In general, this should be the URL of the page a person visited, making it easy to segment your audience or trigger campaigns using this event. Make sure you trim leading and trailing spaces from this field."
        },
        "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": [
        "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."
    },
    "reply_to_settable": {
      "x-scalar-ignore": true,
      "type": "string",
      "description": "The address that receives replies for the message, if applicable."
    }
  }
}