{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rusender-ru/json-schema/rusender-ru-send-email-data-dto-schema.json",
  "title": "SendEmailDataDto",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rusender-ru-openapi.json#/components/schemas/SendEmailDataDto",
  "type": "object",
  "properties": {
    "from": {
      "description": "Отправитель. Адрес должен быть в домене ключа отправки.",
      "allOf": [
        {
          "$ref": "#/$defs/EmailContactDto"
        }
      ]
    },
    "to": {
      "maxItems": 50,
      "description": "Основные получатели: объект или массив. Всего в to, cc и bcc — до 50.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailContactDto"
      }
    },
    "cc": {
      "description": "Копии.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailContactDto"
      }
    },
    "bcc": {
      "description": "Скрытые копии.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailContactDto"
      }
    },
    "replyTo": {
      "maxItems": 5,
      "description": "Адреса Reply-To: объект или массив, до 5.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailContactDto"
      }
    },
    "subject": {
      "type": "string",
      "maxLength": 255,
      "description": "Тема; переменные подставляются."
    },
    "previewText": {
      "type": "string",
      "maxLength": 255,
      "description": "Текст превью в почтовых клиентах; переменные подставляются."
    },
    "html": {
      "type": "string",
      "maxLength": 4500000,
      "description": "HTML-версия. Взаимоисключается с шаблоном."
    },
    "text": {
      "type": "string",
      "maxLength": 4500000,
      "description": "Текстовая версия. Взаимоисключается с шаблоном."
    },
    "templateId": {
      "type": "integer",
      "description": "ID шаблона вместо html/text."
    },
    "templateAlias": {
      "type": "string",
      "description": "Алиас шаблона вместо html/text."
    },
    "variables": {
      "type": "object",
      "additionalProperties": true,
      "description": "Переменные для плейсхолдеров {{name}} в содержимом, теме и превью."
    },
    "headers": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Дополнительные заголовки. Системные (Message-ID, From, To, Reply-To, List-Unsubscribe и др.) запрещены."
    },
    "attachments": {
      "maxItems": 20,
      "description": "Вложения: до 20 файлов, до 15 МБ суммарно.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailAttachmentDto"
      }
    },
    "keyId": {
      "type": "integer",
      "description": "ID ключа отправки. Без него — ключ по умолчанию домена from."
    }
  },
  "required": [
    "from",
    "to",
    "subject"
  ],
  "$defs": {
    "EmailAttachmentDto": {
      "type": "object",
      "properties": {
        "fileName": {
          "type": "string",
          "description": "Имя файла для содержимого в base64."
        },
        "content": {
          "type": "string",
          "format": "byte",
          "description": "Содержимое файла в base64."
        },
        "fileId": {
          "type": "integer",
          "description": "ID файла, загруженного через /v1/public/files (вместо fileName и content)."
        }
      }
    },
    "EmailContactDto": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "description": "Адрес."
        },
        "name": {
          "type": "string",
          "maxLength": 255,
          "description": "Отображаемое имя."
        }
      },
      "required": [
        "email"
      ]
    }
  }
}