{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/thanks-io/json-schema/thanks-io-message-template-create-schema.json",
  "title": "message-template-create",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/thanks-io-message-templates-api-openapi.yml#/components/schemas/message-template-create",
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "enum": [
        "postcard",
        "postcard6x9",
        "postcard6x11",
        "letter",
        "windowlessletter",
        "notecard",
        "giftcard",
        "magnacard"
      ],
      "description": "Type of the message template"
    },
    "name": {
      "type": "string",
      "description": "Name of the message template"
    },
    "handwriting_style_id": {
      "type": "integer",
      "description": "Handwriting style ID for the message template"
    },
    "font_color": {
      "type": "string",
      "description": "Handwriting color to use"
    },
    "handwriting_realism": {
      "type": "boolean",
      "description": "Set to true to enable the realism effect for AI fonts."
    },
    "content": {
      "type": "string",
      "description": "Template body content."
    },
    "sub_account_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "ID of the sub-account to associate with this template."
    },
    "additional_pages": {
      "type": "string",
      "format": "uri",
      "description": "URL to additional pages to include with the cover letter. Only valid for letter templates."
    },
    "pdf_only_url": {
      "type": "string",
      "format": "uri",
      "description": "URL to PDF file to use for entire mailer. If this is specified, no cover letter is generated.  Valid for letter templates only. Providing this URL automatically sets skip_creative_generation to true. For windowed letter templates, leave the upper-left address area of page 1 blank and do not include a recipient address in the PDF; thanks.io prints each recipient's address there."
    },
    "custom_background_url": {
      "type": "string",
      "format": "uri",
      "description": "URL of a custom background image for the template. Only valid for postcard backs and the interior background of notecards and giftcards."
    },
    "qrcode_url": {
      "type": "string",
      "format": "uri",
      "description": "URL of the QR code image to use for the template."
    },
    "cc_emails": {
      "type": "array",
      "description": "List of email addresses to CC when a QR code is scanned",
      "items": {
        "type": "string",
        "format": "email"
      }
    },
    "giftcard_brand_code": {
      "type": "string",
      "description": "Brand code of the gift card. Required when type is giftcard."
    },
    "giftcard_amount": {
      "type": "integer",
      "description": "Amount of the gift card in cents. Required when type is giftcard. Use this field for public v2 requests instead of giftcard_amount_in_cents."
    },
    "landing_page_url": {
      "type": "string",
      "format": "uri",
      "description": "URL of the gated landing page (also known as a gating URL). Recipients must visit this page before they can redeem the gift card, letting you gate redemption behind an action such as booking a demo or completing a form. Only valid for giftcards."
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "type": {
            "const": "giftcard"
          }
        },
        "required": [
          "type"
        ]
      },
      "then": {
        "required": [
          "giftcard_brand_code",
          "giftcard_amount"
        ]
      }
    }
  ]
}