{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/callnode-io/json-schema/callnode-io-send-email-request-schema.json",
  "title": "SendEmailRequest",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/callnode-io-openapi.yml#/components/schemas/SendEmailRequest",
  "type": "object",
  "required": [
    "from",
    "to",
    "subject"
  ],
  "properties": {
    "from": {
      "type": "string",
      "description": "`Name <address>` or a bare address on one of your active sending domains."
    },
    "to": {
      "allOf": [
        {
          "$ref": "#/$defs/EmailAddressList"
        }
      ],
      "description": "Recipients. With cc and bcc, 50 at most."
    },
    "cc": {
      "$ref": "#/$defs/EmailAddressList"
    },
    "bcc": {
      "$ref": "#/$defs/EmailAddressList"
    },
    "subject": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "html": {
      "type": "string",
      "description": "The HTML part. `html` or `text` is required; 2 MB together."
    },
    "text": {
      "type": "string",
      "description": "The plain-text part."
    },
    "reply_to": {
      "allOf": [
        {
          "$ref": "#/$defs/EmailAddressList"
        }
      ],
      "description": "Where replies go: addresses on exactly the From domain (a subdomain counts as a different domain). A reply-to elsewhere answers 400 validation_error before anything is sent."
    },
    "headers": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Up to 10 custom headers. Names must start `X-` or `List-`, or be `In-Reply-To` / `References`."
    },
    "attachments": {
      "type": "array",
      "maxItems": 10,
      "description": "10 MB decoded in all. Executables and scripts are refused.",
      "items": {
        "type": "object",
        "required": [
          "filename",
          "content"
        ],
        "properties": {
          "filename": {
            "type": "string",
            "maxLength": 200
          },
          "content": {
            "type": "string",
            "description": "Base64 (a data URL is accepted)."
          },
          "content_type": {
            "type": "string"
          }
        }
      }
    },
    "tags": {
      "type": "array",
      "maxItems": 10,
      "description": "Returned on the message and in every webhook. Names starting `cn_` are reserved.",
      "items": {
        "type": "object",
        "required": [
          "name",
          "value"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,256}$"
          },
          "value": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,256}$"
          }
        }
      }
    },
    "statusWebhookUrl": {
      "type": "string",
      "format": "uri",
      "description": "Receives `email.delivered` / `email.delayed` / `email.bounced` / `email.complained` / `email.failed`, signed per attempt with this key's secret (X-Timestamp, X-Signature, X-Event-Source)."
    },
    "metadata": {
      "type": "object",
      "description": "Up to 4 KB, returned unchanged on the message and in every webhook."
    }
  },
  "$defs": {
    "EmailAddressList": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ],
      "description": "One address or a list. Each may be `Name <address>` or a bare address."
    }
  }
}