{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eusend-dev/json-schema/eusend-dev-email-schema.json",
  "title": "Email",
  "description": "A single message with its full delivery event history.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eusend-dev-openapi.json#/components/schemas/Email",
  "type": "object",
  "required": [
    "id",
    "from",
    "to",
    "subject",
    "status",
    "tags",
    "testMode",
    "createdAt",
    "events"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "from": {
      "type": "string"
    },
    "to": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "cc": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "bcc": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "replyTo": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "subject": {
      "type": "string"
    },
    "html": {
      "type": [
        "string",
        "null"
      ]
    },
    "text": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "scheduled",
        "canceled",
        "sending",
        "sent",
        "delivered",
        "bounced",
        "complained",
        "suppressed",
        "failed"
      ]
    },
    "tags": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "testMode": {
      "type": "boolean",
      "description": "True when sent with an `eu_test_` key; no mail left the system."
    },
    "templateId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "scheduledAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailEvent"
      }
    }
  },
  "$defs": {
    "EmailEvent": {
      "type": "object",
      "required": [
        "id",
        "type",
        "metadata",
        "createdAt"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "type": {
          "type": "string",
          "enum": [
            "sent",
            "delivered",
            "opened",
            "clicked",
            "bounced",
            "complained"
          ]
        },
        "metadata": {
          "type": "object",
          "additionalProperties": true
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}