{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/customer-io/json-schema/customer-io-newsletter-message-object-schema.json",
  "title": "newsletterMessageObject",
  "description": "Each object is a delivery of a one-time send.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/customer-io-newsletter-metrics-api-openapi.yml#/components/schemas/newsletterMessageObject",
  "x-scalar-ignore": true,
  "allOf": [
    {
      "$ref": "#/$defs/messageObjectBase"
    },
    {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/newsletterMessageType"
        }
      }
    }
  ],
  "$defs": {
    "action_id": {
      "x-scalar-ignore": true,
      "description": "The identifier for an action.",
      "type": "integer",
      "readOnly": true
    },
    "broadcast_id": {
      "x-scalar-ignore": true,
      "type": "integer",
      "description": "The identifier for a broadcast."
    },
    "campaign_id": {
      "x-scalar-ignore": true,
      "description": "The identifier for an automation.",
      "type": "integer"
    },
    "cio_id": {
      "x-scalar-ignore": true,
      "type": "string",
      "description": "A unique identifier set by Customer.io, used to reference a person if you want to update their identifiers."
    },
    "content_id": {
      "x-scalar-ignore": true,
      "description": "The identifier for a message in a one-time send. One-time sends can have multiple content IDs (for multi-language messages or A/B tests).",
      "type": "integer",
      "readOnly": true
    },
    "created": {
      "x-scalar-ignore": true,
      "type": "integer",
      "format": "unix timestamp",
      "description": "The date time when the referenced ID was created.",
      "readOnly": true
    },
    "customer_id": {
      "x-scalar-ignore": true,
      "type": [
        "string",
        "null"
      ],
      "description": "The ID of a customer profile, analogous to a \"person\" in the UI. If your workspace supports multiple identifiers (email and ID), this value can be null."
    },
    "customer_identifiers": {
      "x-scalar-ignore": true,
      "type": "object",
      "description": "Identifiers for the person in a response—`id`, `cio_id`, and `email`. Unset `id` or `email` values are `null`. We recommend this object over the less descriptive `customer_id`. This object doesn't include `phone`, even if your workspace uses phone numbers as an identifier; look for the person's `phone` attribute instead.",
      "required": [
        "email",
        "id",
        "cio_id"
      ],
      "properties": {
        "email": {
          "type": [
            "string",
            "null"
          ],
          "format": "email",
          "description": "A person's email address, if set."
        },
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "A person's unique ID, if set. This is the same as the `customer_id` if present."
        },
        "cio_id": {
          "$ref": "#/$defs/cio_id"
        }
      }
    },
    "deduplicate_id": {
      "x-scalar-ignore": true,
      "type": "string",
      "readOnly": true,
      "description": "An identifier in the format `id:timestamp` where the id is for the object you're working with (Automations, Deliveries, Exports, Identities, One-time sends, Segments, and Templates), and the timestamp is the last time the object was updated."
    },
    "messageMetrics": {
      "x-scalar-ignore": true,
      "type": "object",
      "description": "Metrics for an individual instance of a message; each item in the object represents the timestamp when a message achieved a particular metric. This object only contains metrics that have been recorded.",
      "properties": {
        "bounced": {
          "type": "integer",
          "description": "The timestamp when the message `bounced`."
        },
        "clicked": {
          "type": "integer",
          "description": "The timestamp when the message was `clicked`."
        },
        "human_clicked": {
          "type": "integer",
          "description": "The number of `clicked` messages excluding machine clicks. This metric is reliable starting April 20, 2025. [Learn more](/messaging/metrics/analytics/#delivery-metrics)."
        },
        "prefetch_clicked": {
          "type": "integer",
          "description": "The number of `clicked` messages attributed to machines. This metric is reliable starting April 20, 2025."
        },
        "converted": {
          "type": "integer",
          "description": "The timestamp when the message was `converted`."
        },
        "created": {
          "type": "integer",
          "description": "The timestamp when the message was `created`."
        },
        "delivered": {
          "type": "integer",
          "description": "The timestamp when the message was `delivered`."
        },
        "drafted": {
          "type": "integer",
          "description": "The timestamp when the message was `drafted`."
        },
        "dropped": {
          "type": "integer",
          "description": "The timestamp when the message was `dropped`."
        },
        "failed": {
          "type": "integer",
          "description": "The timestamp when the message `failed`."
        },
        "opened": {
          "type": "integer",
          "description": "The timestamp when the message was `opened`."
        },
        "human_opened": {
          "type": "integer",
          "description": "The number of `opened` messages excluding machine opens. This metric is reliable starting March 20, 2025. [Learn more](/messaging/metrics/analytics/#delivery-metrics)."
        },
        "prefetch_opened": {
          "type": "integer",
          "description": "The number of `opened` messages attributed to machines. This metric is reliable starting March 20, 2025."
        },
        "sent": {
          "type": "integer",
          "description": "The timestamp when the message was `sent`."
        },
        "spammed": {
          "type": "integer",
          "description": "The timestamp when the message was marked as spam."
        },
        "undeliverable": {
          "type": "integer",
          "description": "The timestamp when the message became `undeliverable`."
        },
        "unsubscribed": {
          "type": "integer",
          "description": "The timestamp when a person unsubscribed based on this message."
        }
      }
    },
    "messageObjectBase": {
      "x-scalar-ignore": true,
      "type": "object",
      "description": "Describes an individual message delivery. The object contains keys for all possible parents of the message (`newsletter_id`, `broadcast_id`, etc) but only the parents of the delivery are populated. Other parent IDs are null.",
      "properties": {
        "id": {
          "$ref": "#/$defs/message_id"
        },
        "deduplicate_id": {
          "$ref": "#/$defs/deduplicate_id"
        },
        "message_template_id": {
          "$ref": "#/$defs/message_template_id"
        },
        "customer_id": {
          "$ref": "#/$defs/customer_id"
        },
        "customer_identifiers": {
          "$ref": "#/$defs/customer_identifiers"
        },
        "recipient": {
          "$ref": "#/$defs/recipient"
        },
        "subject": {
          "$ref": "#/$defs/subject"
        },
        "metrics": {
          "$ref": "#/$defs/messageMetrics"
        },
        "created": {
          "$ref": "#/$defs/created"
        },
        "failure_message": {
          "type": [
            "string",
            "null"
          ],
          "description": "Explains why a message failed, if applicable."
        },
        "campaign_id": {
          "oneOf": [
            {
              "$ref": "#/$defs/campaign_id"
            },
            {
              "type": "null"
            }
          ]
        },
        "action_id": {
          "$ref": "#/$defs/action_id"
        },
        "parent_action_id": {
          "$ref": "#/$defs/parent_action_id"
        },
        "newsletter_id": {
          "oneOf": [
            {
              "$ref": "#/$defs/newsletter_id"
            },
            {
              "type": "null"
            }
          ]
        },
        "content_id": {
          "$ref": "#/$defs/content_id"
        },
        "broadcast_id": {
          "oneOf": [
            {
              "$ref": "#/$defs/broadcast_id"
            },
            {
              "type": "null"
            }
          ]
        },
        "trigger_event_id": {
          "$ref": "#/$defs/trigger_event_id"
        },
        "forgotten": {
          "type": "boolean",
          "description": "If true message contents are not retained by Customer.io."
        },
        "tracked_responses": {
          "type": "object",
          "description": "Tracked in-app survey responses, keyed by response option name. Present only when `get_tracked_responses` is `true`.",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "description": "The identifier for the tracked response."
              },
              "ts": {
                "type": "integer",
                "description": "A unix timestamp representing when the response was tracked."
              }
            }
          }
        }
      }
    },
    "message_id": {
      "x-scalar-ignore": true,
      "description": "The identifier for a delivery—the instance of a message intended for an individual recipient.",
      "type": "string",
      "readOnly": true
    },
    "message_template_id": {
      "x-scalar-ignore": true,
      "description": "The identifier of the message template used to create a message.",
      "type": "integer",
      "readOnly": true,
      "deprecated": true
    },
    "newsletterMessageType": {
      "x-scalar-ignore": true,
      "description": "Channel type for a one-time send or one-time send content variant.",
      "type": "string",
      "enum": [
        "email",
        "webhook",
        "twilio",
        "push",
        "in_app",
        "inbox"
      ],
      "readOnly": true
    },
    "newsletter_id": {
      "x-scalar-ignore": true,
      "description": "The identifier for a one-time send.",
      "type": "integer"
    },
    "parent_action_id": {
      "x-scalar-ignore": true,
      "type": "integer",
      "description": "The ID of the parent action, if the action occurred within an automation and has a parent (like a randomized split, etc).",
      "readOnly": true
    },
    "recipient": {
      "x-scalar-ignore": true,
      "description": "The recipient address for an action.",
      "type": "string"
    },
    "subject": {
      "x-scalar-ignore": true,
      "type": "string",
      "description": "The subject line for an `email` action."
    },
    "trigger_event_id": {
      "x-scalar-ignore": true,
      "type": "string",
      "description": "The id of the event that triggered an event-triggered automation (not an API-triggered broadcast)."
    }
  }
}