{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ranla-ai/json-schema/ranla-ai-send-email-request-schema.json",
  "title": "SendEmailRequest",
  "description": "`subject` is required unless `template` is provided (subject comes from the published template).\nProvide `html` and/or `text`, or `template` (mutually exclusive). React Email is compiled\nclient-side by the Node SDK (`react` option) — do not send `react` to the HTTP API.\n",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ranla-ai-openapi.yml#/components/schemas/SendEmailRequest",
  "type": "object",
  "required": [
    "from",
    "to"
  ],
  "properties": {
    "from": {
      "oneOf": [
        {
          "type": "string",
          "format": "email"
        },
        {
          "type": "object",
          "required": [
            "email"
          ],
          "properties": {
            "email": {
              "type": "string",
              "format": "email"
            },
            "name": {
              "type": "string"
            }
          }
        }
      ]
    },
    "to": {
      "oneOf": [
        {
          "type": "string",
          "format": "email"
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "format": "email"
          }
        }
      ]
    },
    "subject": {
      "type": "string",
      "description": "Required unless using `template` (optional override when sending with a template)."
    },
    "html": {
      "type": "string"
    },
    "htmlBody": {
      "type": "string",
      "description": "Alias for html"
    },
    "html_body": {
      "type": "string",
      "description": "Alias for html"
    },
    "text": {
      "type": "string"
    },
    "textBody": {
      "type": "string",
      "description": "Alias for text"
    },
    "text_body": {
      "type": "string",
      "description": "Alias for text"
    },
    "plain_body": {
      "type": "string",
      "description": "Alias for text"
    },
    "template": {
      "$ref": "#/$defs/SendTemplateRef"
    },
    "reply_to": {
      "oneOf": [
        {
          "type": "string",
          "format": "email"
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "format": "email"
          }
        }
      ]
    },
    "replyTo": {
      "oneOf": [
        {
          "type": "string",
          "format": "email"
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "format": "email"
          }
        }
      ],
      "description": "Alias for reply_to"
    },
    "cc": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ]
    },
    "bcc": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ]
    },
    "tags": {
      "oneOf": [
        {
          "type": "array",
          "maxItems": 10,
          "items": {
            "$ref": "#/$defs/EmailTag"
          }
        },
        {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      ],
      "description": "Key/value tags stored with the email. Ranla derives a single tag for delivery metadata."
    },
    "tag": {
      "type": "string",
      "description": "Optional delivery tag override."
    },
    "headers": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Custom headers after server-side safety filtering."
    },
    "attachments": {
      "type": "array",
      "maxItems": 10,
      "description": "Not supported for batch sends or scheduled sends in v1.",
      "items": {
        "$ref": "#/$defs/EmailAttachment"
      }
    },
    "scheduled_at": {
      "type": "string",
      "format": "date-time",
      "description": "Schedule delivery for a future ISO 8601 timestamp. Returns status `scheduled`."
    },
    "scheduledAt": {
      "type": "string",
      "format": "date-time",
      "description": "Alias for scheduled_at."
    },
    "unsubscribe": {
      "type": "boolean",
      "description": "Opt in to managed unsubscribe for this send. Injects RFC 8058 `List-Unsubscribe`\nheaders and replaces `{{unsubscribe_url}}` in subject/html/text. When sending with\na template, inherits the template's `unsubscribe_enabled` setting unless overridden here.\n"
    },
    "category": {
      "type": "string",
      "enum": [
        "transactional",
        "product",
        "newsletter"
      ],
      "description": "Optional send-level category override. Defaults to the template's category when sending\nwith a template, otherwise `transactional`. Product and newsletter categories support\ncategory-scoped opt-out and auto-enable managed unsubscribe.\n"
    }
  },
  "$defs": {
    "EmailAttachment": {
      "type": "object",
      "required": [
        "name",
        "content_type",
        "data"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Filename sent to the recipient."
        },
        "filename": {
          "type": "string",
          "description": "Alias for name."
        },
        "content_type": {
          "type": "string"
        },
        "contentType": {
          "type": "string",
          "description": "Alias for content_type."
        },
        "data": {
          "type": "string",
          "format": "byte",
          "description": "Base64-encoded attachment content (10MB decoded max)."
        },
        "content": {
          "type": "string",
          "format": "byte",
          "description": "Alias for data (base64 string expected over HTTP)."
        },
        "content_id": {
          "type": "string",
          "description": "Optional Content-ID for inline attachments."
        },
        "contentId": {
          "type": "string",
          "description": "Alias for content_id."
        }
      }
    },
    "EmailTag": {
      "type": "object",
      "required": [
        "name",
        "value"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "SendTemplateRef": {
      "type": "object",
      "required": [
        "id"
      ],
      "description": "Reference a published template by UUID or alias. Mutually exclusive with html/text.",
      "properties": {
        "id": {
          "type": "string",
          "description": "Template UUID or alias"
        },
        "variables": {
          "type": "object",
          "additionalProperties": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          },
          "description": "Values for `{{variable}}` placeholders (HTML-escaped in html body)"
        }
      }
    }
  }
}