{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vaquill-ai/json-schema/vaquill-ai-template-detail-schema.json",
  "title": "TemplateDetail",
  "description": "One template with everything needed to run it without guessing.\n\n`variables` is the reason this model exists at all, and `sections` is here\nfor the same reason a draft publishes them: a caller deciding WHICH template\nto run needs to read what it says, and the editor's own document model does\nnot cross this boundary in either direction.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vaquill-ai-drafting-api-openapi.yml#/components/schemas/TemplateDetail",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id",
      "description": "Public identifier, `tpl_` followed by 32 hex characters. Name it when starting a run."
    },
    "title": {
      "type": "string",
      "title": "Title",
      "description": "The template's display name."
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description",
      "description": "Free-text description of what the template is for."
    },
    "category": {
      "type": "string",
      "title": "Category",
      "description": "The template's category, as the customer classified it on upload."
    },
    "sourceFilename": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sourcefilename",
      "description": "Filename of the document this template was created from. Published because it is how a person recognizes which template a run used, months later."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "title": "Createdat",
      "description": "When the template was created (RFC 3339)."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "title": "Updatedat",
      "description": "When the template was last modified (RFC 3339)."
    },
    "variables": {
      "items": {
        "$ref": "#/$defs/TemplateVariable"
      },
      "type": "array",
      "title": "Variables",
      "description": "Every fillable span, in document order. The `id` of each is what `slotOverrides` on a run is keyed by."
    },
    "sections": {
      "items": {
        "$ref": "#/$defs/DraftSection"
      },
      "type": "array",
      "title": "Sections",
      "description": "The template body, section by section, with the placeholder text left in place. Send a replacement as `contentMarkdown`."
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "id",
    "title",
    "category",
    "createdAt",
    "updatedAt",
    "variables",
    "sections"
  ],
  "$defs": {
    "DraftSection": {
      "properties": {
        "heading": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Heading",
          "description": "The section's heading. Null for body text preceding the first heading, which is where a parties block or preamble lives."
        },
        "level": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Level",
          "description": "Heading depth, 1 to 6. Null when there is no heading."
        },
        "text": {
          "type": "string",
          "title": "Text",
          "description": "The text beneath this heading, as plain text."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "text"
      ],
      "title": "DraftSection",
      "description": "One heading and the text beneath it.\n\n`heading` is null for body text that precedes the first heading, which is\nwhere a parties block or a preamble lives. Dropping it because it has no\nheading would lose the first paragraph of most contracts."
    },
    "TemplateVariable": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id",
          "description": "The variable's `varId`, and the key to use in `slotOverrides` when you run this template. Stable across every run."
        },
        "name": {
          "type": "string",
          "title": "Name",
          "description": "The detected or authored name for this variable."
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Label",
          "description": "Display label, when one was set. Falls back to `name`."
        },
        "kind": {
          "type": "string",
          "title": "Kind",
          "description": "What sort of value belongs here: `party`, `date`, `money`, `jurisdiction`, `address`, `number`, `duration`, `text`, `other`. Drives how the extractor is constrained when it fills the slot."
        },
        "hint": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Hint",
          "description": "Guidance the extractor was given for this variable."
        },
        "defaultValue": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Defaultvalue",
          "description": "Value used when nothing is supplied or extracted."
        },
        "position": {
          "type": "integer",
          "title": "Position",
          "description": "Where this variable sits in the template body, counting from zero."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "name",
        "kind",
        "position"
      ],
      "title": "TemplateVariable",
      "description": "One fillable span the template declares.\n\nPublished because `slotOverrides` on a run is keyed by `id` and **nothing\nelse on this surface publishes one**. Before this model existed, the only\nway to learn a template's keys was to run it once and read the slots back\noff the finished run, which is a paid LLM call to discover a schema."
    }
  }
}