{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sendraven-ai/json-schema/sendraven-ai-template-schema.json",
  "title": "Template",
  "description": "A template. Every field is always present, null when it has no value.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sendraven-ai-templates-api-openapi.yml#/components/schemas/Template",
  "type": "object",
  "required": [
    "id",
    "slug",
    "name",
    "subject",
    "html",
    "text",
    "variables",
    "created_at",
    "updated_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Not used by any endpoint; templates are addressed by slug."
    },
    "slug": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$",
      "description": "Unique within the workspace."
    },
    "name": {
      "type": "string"
    },
    "subject": {
      "type": "string",
      "description": "The subject line, with {{name}} placeholders."
    },
    "html": {
      "type": "string",
      "description": "The HTML body, with placeholders. Values substituted here are HTML-escaped."
    },
    "text": {
      "type": [
        "string",
        "null"
      ],
      "description": "The plain-text body; null when the template has none. An empty string counts as no text body when rendering."
    },
    "variables": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Every placeholder name in the subject and both bodies, sorted, without duplicates. All are required to render or send."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "null until the template is first updated."
    }
  }
}