{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/forward-email/main/json-schema/forward-email-message-schema.json",
  "title": "Message",
  "x-generated": "2026-10-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/forward-email-openapi.json#/components/schemas/Message",
  "type": "object",
  "required": [
    "id",
    "root_id",
    "folder_id",
    "folder_path",
    "thread_id",
    "header_message_id",
    "is_unread",
    "is_flagged",
    "is_deleted",
    "is_draft",
    "is_junk",
    "is_copied",
    "is_encrypted",
    "is_searchable",
    "is_expired",
    "has_attachment",
    "retention_date",
    "internal_date",
    "header_date",
    "subject",
    "flags",
    "labels",
    "size",
    "uid",
    "modseq",
    "transaction",
    "remote_address",
    "created_at",
    "updated_at",
    "object"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Message ID"
    },
    "root_id": {
      "type": "string",
      "description": "Root message ID for threading"
    },
    "folder_id": {
      "type": "string",
      "description": "Folder ID containing the message"
    },
    "folder_path": {
      "type": "string",
      "description": "Folder path containing the message"
    },
    "thread_id": {
      "type": "string",
      "description": "Thread ID for conversation grouping"
    },
    "header_message_id": {
      "type": "string",
      "description": "Message-ID header value"
    },
    "is_unread": {
      "type": "boolean",
      "description": "Whether message is unread"
    },
    "is_flagged": {
      "type": "boolean",
      "description": "Whether message is flagged"
    },
    "is_deleted": {
      "type": "boolean",
      "description": "Whether message is deleted"
    },
    "is_draft": {
      "type": "boolean",
      "description": "Whether message is a draft"
    },
    "is_junk": {
      "type": "boolean",
      "description": "Whether message is junk/spam"
    },
    "is_copied": {
      "type": "boolean",
      "description": "Whether message is copied"
    },
    "is_encrypted": {
      "type": "boolean",
      "description": "Whether message is encrypted (PGP/MIME or S/MIME)"
    },
    "is_searchable": {
      "type": "boolean",
      "description": "Whether message is searchable"
    },
    "is_expired": {
      "type": "boolean",
      "description": "Whether message is expired"
    },
    "has_attachment": {
      "type": "boolean",
      "description": "Whether message has attachments"
    },
    "retention_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Message retention date"
    },
    "internal_date": {
      "type": "string",
      "format": "date-time",
      "description": "Internal date (IMAP)"
    },
    "header_date": {
      "type": "string",
      "format": "date-time",
      "description": "Date from message headers"
    },
    "subject": {
      "type": "string",
      "description": "Message subject"
    },
    "flags": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "IMAP flags"
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "User-defined labels (lowercase, max 10)"
    },
    "size": {
      "type": "integer",
      "description": "Message size in bytes"
    },
    "uid": {
      "type": "integer",
      "description": "IMAP UID"
    },
    "modseq": {
      "type": "integer",
      "description": "Modification sequence"
    },
    "transaction": {
      "type": "string",
      "description": "Transaction type"
    },
    "remote_address": {
      "type": "string",
      "description": "Remote IP address"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Message creation timestamp"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Message last update timestamp"
    },
    "nodemailer": {
      "type": "object",
      "description": "Parsed message object (included by default, set ?nodemailer=false to exclude)"
    },
    "raw": {
      "type": "string",
      "description": "Raw message content (included by default, set ?raw=false to exclude)"
    },
    "object": {
      "type": "string",
      "enum": [
        "message"
      ]
    }
  }
}