{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sendar-app/json-schema/sendar-app-email-input-schema.json",
  "title": "EmailInput",
  "description": "Supply subject and nonempty html and/or text, OR templateId with variables. Template mode forbids inline subject/html/text. Variables require templateId. Sender must belong to an authorized verified domain.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sendar-app-openapi.json#/components/schemas/EmailInput",
  "type": "object",
  "required": [
    "from",
    "to"
  ],
  "properties": {
    "from": {
      "type": "string",
      "minLength": 1
    },
    "to": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      },
      "maxItems": 50
    },
    "subject": {
      "type": "string",
      "minLength": 1,
      "description": "Required unless templateId is set."
    },
    "html": {
      "type": [
        "string",
        "null"
      ]
    },
    "text": {
      "type": [
        "string",
        "null"
      ]
    },
    "templateId": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Send using a saved template. When set, subject, html, and text must be omitted — the template supplies them, with {{variable}} placeholders resolved from the variables object."
    },
    "variables": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      },
      "description": "Values for the template's placeholders. Checked strictly — a missing or unknown key fails the request. Only valid together with templateId."
    },
    "trackOpens": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Record when recipients open this email (adds an invisible tracking pixel to the HTML body). Omit to use the account default. Only applies to emails with an html body."
    },
    "trackClicks": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Record when recipients click links in this email (links are rewritten through a tracking redirect). Omit to use the account default. Only applies to emails with an html body."
    },
    "scheduledAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Growth and above. Up to 30 days in the future. A past timestamp sends immediately."
    },
    "attachments": {
      "type": "array",
      "maxItems": 5,
      "items": {
        "$ref": "#/$defs/AttachmentInput"
      },
      "description": "Up to five files; 1.3 MiB combined decoded bytes."
    }
  },
  "$defs": {
    "AttachmentInput": {
      "type": "object",
      "required": [
        "filename",
        "content"
      ],
      "properties": {
        "filename": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        },
        "content": {
          "type": "string",
          "minLength": 1,
          "description": "File content encoded as base64."
        },
        "contentType": {
          "type": "string"
        }
      }
    }
  }
}