{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/conduyt-com/json-schema/conduyt-com-email-template-create-schema.json",
  "title": "EmailTemplateCreate",
  "description": "Two shapes. Built from the editor's blocks (or plain): name, channel and body are required, bodyHtml optional,\nbodyMode \"blocks\" or omitted. Pasted HTML (email only): name, channel \"email\", bodyMode \"html\" and html are\nrequired; body is optional (it defaults to the HTML's visible text).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/conduyt-com-email-templates-api-openapi.yml#/components/schemas/EmailTemplateCreate",
  "oneOf": [
    {
      "$ref": "#/$defs/EmailTemplateCreateBlocks"
    },
    {
      "$ref": "#/$defs/EmailTemplateCreateHtml"
    }
  ],
  "$defs": {
    "EmailTemplateCreateBlocks": {
      "type": "object",
      "required": [
        "name",
        "channel",
        "body"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "channel": {
          "type": "string",
          "enum": [
            "sms",
            "email"
          ]
        },
        "subject": {
          "type": "string"
        },
        "body": {
          "type": "string"
        },
        "bodyHtml": {
          "type": "string"
        },
        "bodyMode": {
          "type": "string",
          "enum": [
            "blocks"
          ],
          "description": "Email only. \"blocks\" = built from the editor blocks: send the builder bodyHtml. Omitted = bodyHtml stored as sent."
        },
        "category": {
          "type": "string"
        },
        "isActive": {
          "type": "boolean",
          "default": true
        }
      },
      "not": {
        "required": [
          "html"
        ]
      }
    },
    "EmailTemplateCreateHtml": {
      "type": "object",
      "required": [
        "name",
        "channel",
        "bodyMode",
        "html"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "channel": {
          "type": "string",
          "enum": [
            "email"
          ]
        },
        "subject": {
          "type": "string"
        },
        "body": {
          "type": "string",
          "description": "Optional; defaults to the HTML's visible text."
        },
        "bodyHtml": {
          "type": "string",
          "description": "Optional; only its builder markers (blocks, metadata) are read and kept."
        },
        "bodyMode": {
          "type": "string",
          "enum": [
            "html"
          ]
        },
        "html": {
          "type": "string",
          "maxLength": 102400,
          "description": "Your own email HTML. Up to 100 KB (UTF-8 bytes; Gmail clips emails over 102 KB); no <script>. Merge fields like {{contact.firstName}} work inside it. Outlook's conditional comments (<!--[if mso]> … <![endif]-->, <!--[if !mso]><!--> … <!--<![endif]-->) and the VML / Office elements inside them are kept with their content sanitised (scripts, frames, event handlers and javascript:/data: URLs removed), while a conditional comment that cannot be read safely (html_conditional_comment) or VML outside an Outlook-only block (html_office_markup) is refused with a 400 that names it."
        },
        "category": {
          "type": "string"
        },
        "isActive": {
          "type": "boolean",
          "default": true
        }
      }
    }
  }
}