{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/senderkit-com/json-schema/senderkit-com-template-send-schema.json",
  "title": "TemplateSend",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/senderkit-com-openapi.yaml#/components/schemas/TemplateSend",
  "type": "object",
  "required": [
    "template",
    "to"
  ],
  "properties": {
    "template": {
      "type": "string",
      "description": "Template slug to send."
    },
    "version": {
      "type": "integer",
      "minimum": 1,
      "description": "Optional explicit version pin. Defaults to the latest version in\ntest mode and the current published version in live mode.\n"
    },
    "channel": {
      "$ref": "#/$defs/Channel"
    },
    "to": {
      "type": "string",
      "description": "Recipient (email address, phone number, or device token)."
    },
    "vars": {
      "type": "object",
      "additionalProperties": true,
      "description": "Variables interpolated into the template."
    },
    "metadata": {
      "$ref": "#/$defs/Metadata"
    },
    "scheduledAt": {
      "type": "string",
      "format": "date-time",
      "description": "Optional ISO-8601 timestamp to schedule the send for later. Must be\nin the future and within 30 days. When provided, the send is\naccepted with `status: \"scheduled\"` and dispatched at that time.\n"
    },
    "cc": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "email"
      },
      "description": "Email-only. Cc recipients applied at send time."
    },
    "bcc": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "email"
      },
      "description": "Email-only. Bcc recipients applied at send time."
    },
    "replyTo": {
      "type": "string",
      "format": "email",
      "description": "Email-only. Reply-To address applied at send time."
    },
    "attachments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Attachment"
      },
      "description": "Email-only. Per-send attachments — not stored on the template."
    },
    "from": {
      "type": "string",
      "format": "email",
      "description": "Email-only. Optional From address override (bare address — put the\ndisplay name in `fromName`). Defaults to the provider connection's\naddress. On managed sending it is honored only when the address is\non the workspace's verified sending domain.\n"
    },
    "fromName": {
      "type": "string",
      "maxLength": 128,
      "description": "Email-only. Optional From display name override, rendered as\n`Name <address>`. Defaults to the provider connection's from name.\nMust not contain control characters or angle brackets.\n"
    }
  },
  "$defs": {
    "Attachment": {
      "type": "object",
      "required": [
        "filename",
        "contentType",
        "content"
      ],
      "properties": {
        "filename": {
          "type": "string",
          "maxLength": 255
        },
        "contentType": {
          "type": "string"
        },
        "content": {
          "type": "string",
          "format": "byte",
          "description": "Base64-encoded bytes."
        },
        "inline": {
          "type": "boolean",
          "default": false,
          "description": "When true, attachment is referenced from HTML via `cid:<contentId>`."
        },
        "contentId": {
          "type": "string",
          "description": "Required when `inline=true`."
        }
      },
      "description": "Up to 50 attachments per message, 10 MB total decoded size across all\nattachments. Larger messages are rejected with `attachment_too_large`.\n"
    },
    "Channel": {
      "type": "string",
      "enum": [
        "email",
        "sms",
        "push",
        "web-push"
      ]
    },
    "Metadata": {
      "type": "object",
      "description": "Caller-supplied tags/IDs. Values must be string, number, or boolean.",
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          }
        ]
      }
    }
  }
}