{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/modoboa/json-schema/modoboa-email-schema.json",
  "title": "Email",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/modoboa-webmail-api-openapi.yml#/components/schemas/Email",
  "type": "object",
  "properties": {
    "subject": {
      "type": "string"
    },
    "from_address": {
      "$ref": "#/$defs/EmailAddress"
    },
    "to": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailAddress"
      }
    },
    "cc": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailAddress"
      }
    },
    "bcc": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailAddress"
      }
    },
    "body": {
      "type": "string"
    },
    "body_format": {
      "type": "string"
    },
    "date": {
      "type": "string"
    },
    "date_full": {
      "type": "string"
    },
    "message_id": {
      "type": "string"
    },
    "in_reply_to": {
      "type": "string"
    },
    "references": {
      "type": "string"
    },
    "reply_to": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailAddress"
      }
    },
    "attachments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Attachment"
      },
      "readOnly": true
    },
    "remote_content_blocked": {
      "type": "boolean",
      "readOnly": true
    },
    "scheduled_datetime": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "attachments",
    "body",
    "date",
    "from_address",
    "remote_content_blocked",
    "subject",
    "to"
  ],
  "$defs": {
    "Attachment": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "partnum": {
          "type": "string"
        },
        "size": {
          "type": "integer"
        },
        "content_type": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "partnum"
      ]
    },
    "EmailAddress": {
      "type": "object",
      "description": "Email address serializer.",
      "properties": {
        "pk": {
          "type": "integer",
          "readOnly": true,
          "title": "ID"
        },
        "address": {
          "type": "string",
          "format": "email",
          "maxLength": 254
        },
        "type": {
          "$ref": "#/$defs/TypeE1dEnum"
        }
      },
      "required": [
        "address",
        "pk",
        "type"
      ]
    },
    "TypeE1dEnum": {
      "enum": [
        "home",
        "work",
        "other"
      ],
      "type": "string",
      "description": "* `home` - Home\n* `work` - Work\n* `other` - Other"
    }
  }
}