{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/getcourier-dev/json-schema/getcourier-dev-agent-message-schema.json",
  "title": "AgentMessage",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/getcourier-dev-openapi.json#/components/schemas/AgentMessage",
  "type": "object",
  "required": [
    "id",
    "received_at",
    "codes",
    "links",
    "untrusted",
    "marker"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "received_at": {
      "type": "string",
      "format": "date-time"
    },
    "from": {
      "type": [
        "string",
        "null"
      ],
      "format": "email",
      "description": "Sender address."
    },
    "from_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "Sender display name. Untrusted."
    },
    "subject": {
      "type": [
        "string",
        "null"
      ],
      "description": "Subject line. Untrusted."
    },
    "codes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Extracted verification codes, in full, for the read_token holder."
    },
    "links": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri"
      },
      "description": "Extracted links (magic links first). Untrusted."
    },
    "text": {
      "type": "string",
      "maxLength": 4000,
      "description": "Plain-text body, truncated to 4000 characters."
    },
    "auth": {
      "type": "object",
      "properties": {
        "verdict": {
          "type": "string"
        },
        "spf": {
          "type": "string"
        },
        "dkim": {
          "type": "string"
        },
        "dmarc": {
          "type": "string"
        }
      }
    },
    "untrusted": {
      "const": true
    },
    "marker": {
      "const": "UNTRUSTED EXTERNAL EMAIL"
    }
  }
}