---
title: "Create template"
method: POST
path: "/documents/templates/"
tags: ["Guided Templates"]
---

# Create template

`POST /documents/templates/`

Creates a new template with an initial version. When `publish` is true (default),
the response includes the published version with full inheritance resolution applied
(template-level and section-level inheritance walked).

## Headers

- `Tenant-Name` string, required — Identifies a distinct entity within Corti's multi-tenant system. Ensures correct routing and authentication of the request.

## Request body

- union
  - GuidedTemplatesCreateFromInheritanceRequest — Creates a template that inherits from another template. Any fields omitted in `generation` are inherited from the referenced template's published version; any fields provided override the inherited values.
    - `name` string, required — The name of this template. Not passed to the LLM.
    - `description` string — A description for this template. Not passed to the LLM.
    - `languages` string[] — BCP 47 language tags this template has been tweaked for (e.g. `["fr", "de", "en-GB"]`).
    - `regions` string[] — ISO 3166-1 alpha-3 country codes this template has been tweaked for (e.g. `["BEL"]`).
    - `specialties` string[] — Clinical specialties this template has been tweaked for.
    - `labels` GuidedLabel[] — Labels work as query param filter in the LIST /templates endpoint.
      - `key` string, required
      - `value` string, required
    - `publish` boolean — Defaults to true when omitted. Set this to false if you do not want the template to automatically show up in LIST templates.
    - `inheritFromId` string, uuid, required — Reference to the template to inherit instructions and sections from. Inherits from the published version of the referenced template.
    - `generation` object — Partial overrides applied on top of the inherited template. All inner fields are optional. Any field omitted is inherited from the referenced template.
      - `instructions` GuidedTemplateInstructionsPartial — Partial form of GuidedTemplateInstructions used when inheriting from another template. Any field omitted is inherited.
        - `prompt` string — Override the inherited template-level prompt instructions.
      - `sections` GuidedTemplatesVersionSectionRequest[]
        - `sectionId` string, uuid, required — The UUID of the section to include in the template version.
        - `orderIndex` integer — Sets the order of this section within this template. Starts at 0.
  - GuidedTemplatesCreateFromScratchRequest — Creates a template from scratch. The template fully specifies its own sections and optional template-level instructions.
    - `name` string, required — The name of this template. Not passed to the LLM.
    - `description` string — A description for this template. Not passed to the LLM.
    - `languages` string[] — BCP 47 language tags this template has been tweaked for (e.g. `["fr", "de", "en-GB"]`).
    - `regions` string[] — ISO 3166-1 alpha-3 country codes this template has been tweaked for (e.g. `["BEL"]`).
    - `specialties` string[] — Clinical specialties this template has been tweaked for.
    - `labels` GuidedLabel[] — Labels work as query param filter in the LIST /templates endpoint.
      - `key` string, required
      - `value` string, required
    - `publish` boolean — Defaults to true when omitted. Set this to false if you do not want the template to automatically show up in LIST templates.
    - `generation` object, required
      - `instructions` GuidedTemplateInstructions
        - `prompt` string, required — Template-level prompt instructions that apply generally to all sections.
      - `sections` GuidedTemplatesVersionSectionRequest[]
        - `sectionId` string, uuid, required — The UUID of the section to include in the template version.
        - `orderIndex` integer — Sets the order of this section within this template. Starts at 0.

## Response `201`

Created

- GuidedTemplate — Template metadata as returned by the LIST /documents/templates endpoint. Does not include the resolved `publishedVersion` — use GET /documents/templates/{templateID} to fetch a single template with its published version resolved.
  - `id` string, uuid, required — The UUID of the template.
  - `inheritedFromId` string, uuid, nullable — Reference to the template to inherit template instructions and sections from. Inherits from published version by default.
  - `autoGenerated` boolean — True if the template was auto-generated based on the section-composed POST /documents request.
  - `source` 'user' | 'corti' | 'project' — Whether this template was created by the user, a project-related API Client or is a Corti standard resource.
  - `name` string, required — The name of this template. Not passed to the LLM.
  - `description` string — A description for this template. Not passed to the LLM.
  - `languages` string[], required — BCP 47 language tags this template has been tweaked for (e.g. `["fr", "de", "en-GB"]`). Empty means no language-specific tweaks.
  - `regions` string[], required — ISO 3166-1 alpha-3 country codes this template has been tweaked for (e.g. `["BEL"]`). Empty means no region-specific tweaks.
  - `specialties` string[], required — Clinical specialties this template has been tweaked for. Empty means no specialty-specific tweaks.
  - `labels` GuidedLabel[], required — The available labels to use as query param filter in the LIST /templates endpoint.
    - `key` string, required
    - `value` string, required
  - `createdBy` string, uuid — The UUID of the creator of this template.
  - `createdAt` string, date-time, required — The original timestamp when the template was created.
  - `updatedAt` string, date-time, required — The original timestamp when the template was last updated.
  - `deletedAt` string, date-time, nullable — Present when the template has been deleted. GET by ID still returns the full resource with this field populated.
  - `publishedVersion` GuidedTemplateVersion — Template version with fully resolved (inherited) values. Template-level and section-level inheritance chains are walked. Used in Template.publishedVersion on resource-level endpoints (GET/POST template).
    - `id` string, uuid, required — The UUID of the version.
    - `versionNumber` integer, required — Starts at 0 and auto-increments.
    - `deletedAt` string, date-time, nullable — Present when the template version has been deleted.
    - `generation` GuidedTemplateGeneration, required — Fully resolved template generation. Sections are expanded with their own inheritance applied.
      - `instructions` GuidedTemplateInstructions, required
        - `prompt` string, required — Template-level prompt instructions that apply generally to all sections.
      - `sections` GuidedSection[] — Fully resolved sections with inheritance applied.
        - `id` string, uuid, required — The UUID of the section.
        - `inheritedFromId` string, uuid, nullable — Reference to the section to inherit generation configuration from. Inherits from published version by default.
        - `autoGenerated` boolean — True if the section was auto-generated as part of an inline section-composed POST /documents request.
        - `source` 'user' | 'corti' | 'project' — Whether this section was created by the user, a project-related API Client or is a Corti standard resource.
        - `name` string, required — The name of the section.
        - `languages` string[], required — BCP 47 languages this section has been tweaked for. Empty means no language-specific tweaks.
        - `regions` string[], required — ISO 3166-1 alpha-3 country codes this section has been tweaked for. Empty means no region-specific tweaks.
        - `specialties` string[], required — Clinical specialties this section has been tweaked for. Empty means no specialty-specific tweaks.
        - `description` string — The description for the section.
        - `labels` GuidedLabel[], required — The labels available to use as query param filter in the LIST /sections endpoint.
          - `key` string, required
          - `value` string, required
        - `createdBy` string, uuid — The UUID of the creator of this section.
        - `createdAt` string, date-time, required — The original timestamp when the section was created.
        - `updatedAt` string, date-time, required — The original timestamp when the section was last updated.
        - `deletedAt` string, date-time, nullable — Present when the section has been deleted. GET by ID still returns the full resource with this field populated.
        - `publishedVersion` GuidedSectionVersion — A section version. When embedded inside a Section resource (e.g. GET /sections/:id), inheritance is fully resolved. When returned directly from version endpoints (GET/LIST/POST .../versions/...), contains raw authored values without inheritance.
          - `id` string, uuid, required — The UUID of the section version.
          - `versionNumber` integer, required — Starts at 0 and auto-increments.
          - `deletedAt` string, date-time, nullable — Present when the section version has been deleted.
          - `generation` GuidedSectionGeneration, required
            - `heading` string, required — The heading of this section. Passed to the LLM.
            - `instructions` GuidedSectionInstructions, required
              - …
            - `outputSchema` union, required
              - …

## Other responses

- `400` — Bad Request

---

[API](https://skmtc.net/corti/apis/admin-api.md) · [All operations](https://skmtc.net/corti/apis/admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/corti/admin-api/revisions/5d1895a1b3fc/schema)
