{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postfleet-ai/json-schema/postfleet-ai-send-request-schema.json",
  "title": "SendRequest",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/postfleet-ai-openapi.json#/components/schemas/SendRequest",
  "type": "object",
  "properties": {
    "mailbox_id": {
      "type": "string",
      "minLength": 1,
      "description": "Mailbox to send from. A mailbox-bound key must match this."
    },
    "text": {
      "type": "string",
      "minLength": 1,
      "description": "Plain-text body. Required even when html is set."
    },
    "html": {
      "description": "Optional HTML body sent with the text part. Not accepted on drafts or on mailboxes that require approval.",
      "type": "string",
      "maxLength": 100000
    },
    "to": {
      "description": "One address, or an array of up to 10. A string must be exactly one address (commas are rejected). Required unless replying.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "minItems": 1,
          "maxItems": 10,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      ]
    },
    "subject": {
      "type": "string"
    },
    "reply_to_message_id": {
      "description": "Reply in-thread to an existing message; resolves `to`/`subject`/thread from the original.",
      "type": "string"
    },
    "client_id": {
      "description": "Idempotency key for duplicate protection. Must not start with `draft:` (reserved).",
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "pattern": "^(?!draft:)"
    },
    "attachments": {
      "description": "Optional files to attach. Each item is exactly one of base64 `content` or an HTTPS `url` (fetched at send time). Filename and content_type are optional. At most 20 files; 6 MB total inline, 30 MB total URL-backed. Bytes are not echoed on draft reads.",
      "maxItems": 20,
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "filename": {
                "description": "Basename only — no path separators. Derived from the URL path, or `attachment`, when omitted.",
                "type": "string",
                "minLength": 1,
                "maxLength": 255,
                "pattern": "^[^/\\0\\\\]+$"
              },
              "content": {
                "type": "string",
                "minLength": 1,
                "description": "File bytes, standard base64."
              },
              "content_type": {
                "description": "MIME type. Defaults to application/octet-stream, or the URL response Content-Type.",
                "type": "string",
                "maxLength": 127,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*\\/[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*$"
              }
            },
            "required": [
              "content"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "filename": {
                "description": "Basename only — no path separators. Derived from the URL path, or `attachment`, when omitted.",
                "type": "string",
                "minLength": 1,
                "maxLength": 255,
                "pattern": "^[^/\\0\\\\]+$"
              },
              "url": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2048,
                "description": "HTTPS URL fetched at send time. Not forwarded to the provider."
              },
              "content_type": {
                "description": "MIME type. Defaults to application/octet-stream, or the URL response Content-Type.",
                "type": "string",
                "maxLength": 127,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*\\/[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*$"
              }
            },
            "required": [
              "url"
            ],
            "additionalProperties": false
          }
        ]
      }
    }
  },
  "required": [
    "mailbox_id",
    "text"
  ],
  "additionalProperties": false
}