{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/asap-cool/json-schema/asap-cool-email-message-view-schema.json",
  "title": "EmailMessageView",
  "description": "One journal entry, as served by the list and detail endpoints.\n\nThe rendered bodies are deliberately absent: they are large, they hold\nrecipient PII, and a listing has no use for them. `has_body` tells a client\nwhether `GET /v1/emails/{id}/preview` will return something.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/asap-cool-emails-api-openapi.yml#/components/schemas/EmailMessageView",
  "type": "object",
  "required": [
    "id",
    "template",
    "status",
    "to_email",
    "subject",
    "locale",
    "has_body",
    "created_at"
  ],
  "properties": {
    "booking_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Linked calendar booking."
    },
    "contact_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Linked contact."
    },
    "created_at": {
      "type": "string",
      "description": "When the entry was opened (the listing's sort key), RFC 3339."
    },
    "delivered_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "When the provider confirmed delivery, RFC 3339."
    },
    "document_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Linked invoice document."
    },
    "envelope_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Linked signature envelope."
    },
    "failure_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Why the dispatch failed, when it did."
    },
    "has_body": {
      "type": "boolean",
      "description": "Whether the stored bodies are still available for preview (they are\ndropped by the retention purge)."
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Journal entry id."
    },
    "locale": {
      "type": "string",
      "description": "Interface-chrome locale the message was rendered with."
    },
    "provider_message_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Provider message id — the support handle for a delivery investigation."
    },
    "reply_to": {
      "type": [
        "string",
        "null"
      ],
      "description": "`Reply-To`, when the send overrode it."
    },
    "sender_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "`From` display name, when the send overrode it."
    },
    "sent_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "When the provider accepted the message, RFC 3339."
    },
    "status": {
      "type": "string",
      "description": "Lifecycle status (`queued`/`sent`/`delivered`/`bounced`/…)."
    },
    "subject": {
      "type": "string",
      "description": "Rendered subject."
    },
    "template": {
      "type": "string",
      "description": "Render-template discriminator (`quote_sent`, `reminder`, …)."
    },
    "to_email": {
      "type": "string",
      "description": "Recipient address."
    }
  }
}