> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corti.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create template

> 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).




## OpenAPI

````yaml /api-reference/auto-generated-openapi.yml post /documents/templates/
openapi: 3.0.0
info:
  title: Corti API
  version: 2.0.0
servers:
  - url: https://api.{environment}.corti.app/v2/
    variables:
      environment:
        default: eu
        enum:
          - us
          - eu
security:
  - AuthorizationHeader:
      - bearer
tags:
  - name: Interactions
  - name: Recordings
  - name: Transcripts
  - name: Facts
  - name: Codes
  - name: Languages
  - name: Guided Documents
  - name: Guided Templates
  - name: Guided Sections
  - name: Documents (Classic)
  - name: Templates (Classic)
paths:
  /documents/templates/:
    post:
      tags:
        - Guided Templates
      summary: Create template
      description: >
        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).
      operationId: guided_templates_create
      parameters:
        - $ref: '#/components/parameters/Tenant-Name'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GuidedTemplatesCreateRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GuidedTemplate'
        '400':
          $ref: '#/components/responses/BadRequest'
      x-codeSamples:
        - lang: csharp
          label: C# .NET SDK
          source: |
            using Corti;

            var client = new CortiClient(
                "TENANT_NAME",
                CortiClientEnvironment.Eu,
                new CortiClientAuth.ClientCredentials("client_id", "client_secret")
            );
            await client.Documents.Templates.CreateAsync(
                new GuidedTemplatesCreateFromInheritanceRequest
                {
                    Name = "name",
                    InheritFromId = "inheritFromId",
                }
            );
        - lang: javascript
          label: JavaScript SDK
          source: |
            import { CortiClient, CortiEnvironment } from "@corti/sdk";

            const client = new CortiClient({
                environment: CortiEnvironment.Eu,
                auth: {
                    clientId: "YOUR_CLIENT_ID",
                    clientSecret: "YOUR_CLIENT_SECRET"
                },
                tenantName: "YOUR_TENANT_NAME"
            });
            await client.documents.templates.create({
                name: "name",
                inheritFromId: "inheritFromId"
            });
        - lang: csharp
          label: Inherit from ID
          source: |
            using Corti;

            var client = new CortiClient(
                "TENANT_NAME",
                CortiClientEnvironment.Eu,
                new CortiClientAuth.ClientCredentials("client_id", "client_secret")
            );
            await client.Documents.Templates.CreateAsync(
                new GuidedTemplatesCreateFromInheritanceRequest
                {
                    Name = "<string>",
                    InheritFromId = "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                    Description = "<string>",
                    Languages = new List<string> { "<string>" },
                    Regions = new List<string> { "<string>" },
                    Specialties = new List<string> { "<string>" },
                    Labels = new List<GuidedLabel>
                    {
                        new GuidedLabel { Key = "<string>", Value = "<string>" }
                    },
                    Publish = true,
                }
            );
          x-fern-sdk-language-id: inherit-from-id
        - lang: csharp
          label: Create from scratch
          source: |
            using Corti;

            var client = new CortiClient(
                "TENANT_NAME",
                CortiClientEnvironment.Eu,
                new CortiClientAuth.ClientCredentials("client_id", "client_secret")
            );
            await client.Documents.Templates.CreateAsync(
                new GuidedTemplatesCreateFromScratchRequest
                {
                    Name = "<string>",
                    Description = "<string>",
                    Languages = new List<string> { "<string>" },
                    Regions = new List<string> { "<string>" },
                    Specialties = new List<string> { "<string>" },
                    Labels = new List<GuidedLabel>
                    {
                        new GuidedLabel { Key = "<string>", Value = "<string>" }
                    },
                    Publish = true,
                    Generation = new GuidedTemplatesVersionGeneration
                    {
                        Instructions = new GuidedTemplateInstructions { Prompt = "<string>" },
                        Sections = new List<GuidedTemplatesVersionSectionRequest>
                        {
                            new GuidedTemplatesVersionSectionRequest
                            {
                                SectionId = "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                                OrderIndex = 123,
                            }
                        }
                    }
                }
            );
          x-fern-sdk-language-id: create-from-scratch
        - lang: javascript
          label: Inherit from ID
          source: |
            import { CortiClient, CortiEnvironment } from "@corti/sdk";

            const client = new CortiClient({
              environment: CortiEnvironment.Eu,
              auth: {
                clientId: "YOUR_CLIENT_ID",
                clientSecret: "YOUR_CLIENT_SECRET"
              },
              tenantName: "YOUR_TENANT_NAME"
            });

            await client.documents.templates.create({
              name: "<string>",
              description: "<string>",
              languages: ["<string>"],
              regions: ["<string>"],
              specialties: ["<string>"],
              labels: [
                { key: "<string>", value: "<string>" }
              ],
              publish: true,
              inheritFromId: "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              generation: {
                instructions: { prompt: "<string>" },
                sections: [
                  { sectionId: "3c90c3cc-0d44-4b50-8888-8dd25736052a", orderIndex: 123 }
                ]
              }
            });
          x-fern-sdk-language-id: inherit-from-id
        - lang: javascript
          label: Create from scratch
          source: |
            import { CortiClient, CortiEnvironment } from "@corti/sdk";

            const client = new CortiClient({
              environment: CortiEnvironment.Eu,
              auth: {
                clientId: "YOUR_CLIENT_ID",
                clientSecret: "YOUR_CLIENT_SECRET"
              },
              tenantName: "YOUR_TENANT_NAME"
            });

            await client.documents.templates.create({
              name: "<string>",
              description: "<string>",
              languages: ["<string>"],
              regions: ["<string>"],
              specialties: ["<string>"],
              labels: [
                { key: "<string>", value: "<string>" }
              ],
              publish: true,
              generation: {
                instructions: { prompt: "<string>" },
                sections: [
                  { sectionId: "3c90c3cc-0d44-4b50-8888-8dd25736052a", orderIndex: 123 }
                ]
              }
            });
          x-fern-sdk-language-id: create-from-scratch
        - lang: bash
          label: Inherit from ID
          source: |-
            curl --request POST \
              --url https://api.{environment}.corti.app/v2/documents/templates \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --header 'Tenant-Name: <tenant-name>' \
              --data '{
              "name": "<string>",
              "inheritFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
              "description": "<string>",
              "languages": [
                "<string>"
              ],
              "regions": [
                "<string>"
              ],
              "specialties": [
                "<string>"
              ],
              "labels": [
                {
                  "key": "<string>",
                  "value": "<string>"
                }
              ],
              "publish": true
            }'
          x-fern-sdk-language-id: inherit-from-id
        - lang: bash
          label: Create from scratch
          source: |-
            curl --request POST \
              --url https://api.{environment}.corti.app/v2/documents/templates \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --header 'Tenant-Name: <tenant-name>' \
              --data '{
              "name": "<string>",
              "description": "<string>",
              "languages": [
                "<string>"
              ],
              "regions": [
                "<string>"
              ],
              "specialties": [
                "<string>"
              ],
              "labels": [
                {
                  "key": "<string>",
                  "value": "<string>"
                }
              ],
              "publish": true,
              "generation": {
                "instructions": {
                  "prompt": "<string>"
                },
                "sections": [
                  {
                    "sectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                    "orderIndex": 123
                  }
                ]
              }
            }'
          x-fern-sdk-language-id: create-from-scratch
        - lang: go
          label: Inherit from ID
          source: |
            package main

            import (
                "bytes"
                "encoding/json"
                "net/http"
            )

            func main() {
                body, _ := json.Marshal(map[string]interface{}{
                    "name": "<string>",
                    "inheritFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                    "description": "<string>",
                    "languages": []interface{}{
                        "<string>",
                    },
                    "regions": []interface{}{
                        "<string>",
                    },
                    "specialties": []interface{}{
                        "<string>",
                    },
                    "labels": []interface{}{
                        map[string]interface{}{
                            "key": "<string>",
                            "value": "<string>",
                        },
                    },
                    "publish": true,
                })

                req, _ := http.NewRequest("POST", "https://api.{environment}.corti.app/v2/documents/templates", bytes.NewBuffer(body))
                req.Header.Set("Authorization", "Bearer <token>")
                req.Header.Set("Content-Type", "application/json")
                req.Header.Set("Tenant-Name", "<tenant-name>")

                client := &http.Client{}
                resp, _ := client.Do(req)
                defer resp.Body.Close()
            }
          x-fern-sdk-language-id: inherit-from-id
        - lang: go
          label: Create from scratch
          source: |
            package main

            import (
                "bytes"
                "encoding/json"
                "net/http"
            )

            func main() {
                body, _ := json.Marshal(map[string]interface{}{
                    "name": "<string>",
                    "description": "<string>",
                    "languages": []interface{}{
                        "<string>",
                    },
                    "regions": []interface{}{
                        "<string>",
                    },
                    "specialties": []interface{}{
                        "<string>",
                    },
                    "labels": []interface{}{
                        map[string]interface{}{
                            "key": "<string>",
                            "value": "<string>",
                        },
                    },
                    "publish": true,
                    "generation": map[string]interface{}{
                        "instructions": map[string]interface{}{
                            "prompt": "<string>",
                        },
                        "sections": []interface{}{
                            map[string]interface{}{
                                "sectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                                "orderIndex": 123,
                            },
                        },
                    },
                })

                req, _ := http.NewRequest("POST", "https://api.{environment}.corti.app/v2/documents/templates", bytes.NewBuffer(body))
                req.Header.Set("Authorization", "Bearer <token>")
                req.Header.Set("Content-Type", "application/json")
                req.Header.Set("Tenant-Name", "<tenant-name>")

                client := &http.Client{}
                resp, _ := client.Do(req)
                defer resp.Body.Close()
            }
          x-fern-sdk-language-id: create-from-scratch
        - lang: java
          label: Inherit from ID
          source: |
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    String body = """
                        {
                          "name": "<string>",
                          "inheritFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                          "description": "<string>",
                          "languages": [
                            "<string>"
                          ],
                          "regions": [
                            "<string>"
                          ],
                          "specialties": [
                            "<string>"
                          ],
                          "labels": [
                            {
                              "key": "<string>",
                              "value": "<string>"
                            }
                          ],
                          "publish": true
                        }
                        """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.{environment}.corti.app/v2/documents/templates"))
                        .header("Authorization", "Bearer <token>")
                        .header("Content-Type", "application/json")
                        .header("Tenant-Name", "<tenant-name>")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpClient client = HttpClient.newHttpClient();
                    HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
                }
            }
          x-fern-sdk-language-id: inherit-from-id
        - lang: java
          label: Create from scratch
          source: |
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            public class Main {
                public static void main(String[] args) throws Exception {
                    String body = """
                        {
                          "name": "<string>",
                          "description": "<string>",
                          "languages": [
                            "<string>"
                          ],
                          "regions": [
                            "<string>"
                          ],
                          "specialties": [
                            "<string>"
                          ],
                          "labels": [
                            {
                              "key": "<string>",
                              "value": "<string>"
                            }
                          ],
                          "publish": true,
                          "generation": {
                            "instructions": {
                              "prompt": "<string>"
                            },
                            "sections": [
                              {
                                "sectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                                "orderIndex": 123
                              }
                            ]
                          }
                        }
                        """;

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.{environment}.corti.app/v2/documents/templates"))
                        .header("Authorization", "Bearer <token>")
                        .header("Content-Type", "application/json")
                        .header("Tenant-Name", "<tenant-name>")
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();

                    HttpClient client = HttpClient.newHttpClient();
                    HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
                }
            }
          x-fern-sdk-language-id: create-from-scratch
        - lang: php
          label: Inherit from ID
          source: |
            <?php

            $curl = curl_init();

            curl_setopt_array($curl, [
                CURLOPT_URL => "https://api.{environment}.corti.app/v2/documents/templates",
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_CUSTOMREQUEST => "POST",
                CURLOPT_POSTFIELDS => json_encode([
                    'name' => '<string>',
                    'inheritFromId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
                    'description' => '<string>',
                    'languages' => [
                        '<string>',
                    ],
                    'regions' => [
                        '<string>',
                    ],
                    'specialties' => [
                        '<string>',
                    ],
                    'labels' => [
                        [
                            'key' => '<string>',
                            'value' => '<string>',
                        ],
                    ],
                    'publish' => true,
                ]),
                CURLOPT_HTTPHEADER => [
                    "Authorization: Bearer <token>",
                    "Content-Type: application/json",
                    "Tenant-Name: <tenant-name>",
                ],
            ]);

            $response = curl_exec($curl);
            curl_close($curl);
          x-fern-sdk-language-id: inherit-from-id
        - lang: php
          label: Create from scratch
          source: |
            <?php

            $curl = curl_init();

            curl_setopt_array($curl, [
                CURLOPT_URL => "https://api.{environment}.corti.app/v2/documents/templates",
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_CUSTOMREQUEST => "POST",
                CURLOPT_POSTFIELDS => json_encode([
                    'name' => '<string>',
                    'description' => '<string>',
                    'languages' => [
                        '<string>',
                    ],
                    'regions' => [
                        '<string>',
                    ],
                    'specialties' => [
                        '<string>',
                    ],
                    'labels' => [
                        [
                            'key' => '<string>',
                            'value' => '<string>',
                        ],
                    ],
                    'publish' => true,
                    'generation' => [
                        'instructions' => [
                            'prompt' => '<string>',
                        ],
                        'sections' => [
                            [
                                'sectionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
                                'orderIndex' => 123,
                            ],
                        ],
                    ],
                ]),
                CURLOPT_HTTPHEADER => [
                    "Authorization: Bearer <token>",
                    "Content-Type: application/json",
                    "Tenant-Name: <tenant-name>",
                ],
            ]);

            $response = curl_exec($curl);
            curl_close($curl);
          x-fern-sdk-language-id: create-from-scratch
        - lang: python
          label: Inherit from ID
          source: |
            import requests

            url = "https://api.{environment}.corti.app/v2/documents/templates"
            headers = {
                "Authorization": "Bearer <token>",
                "Content-Type": "application/json",
                "Tenant-Name": "<tenant-name>",
            }
            payload = {
                "name": "<string>",
                "inheritFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "description": "<string>",
                "languages": [
                    "<string>"
                ],
                "regions": [
                    "<string>"
                ],
                "specialties": [
                    "<string>"
                ],
                "labels": [
                    {
                        "key": "<string>",
                        "value": "<string>"
                    }
                ],
                "publish": True
            }

            response = requests.post(url, json=payload, headers=headers)
          x-fern-sdk-language-id: inherit-from-id
        - lang: python
          label: Create from scratch
          source: |
            import requests

            url = "https://api.{environment}.corti.app/v2/documents/templates"
            headers = {
                "Authorization": "Bearer <token>",
                "Content-Type": "application/json",
                "Tenant-Name": "<tenant-name>",
            }
            payload = {
                "name": "<string>",
                "description": "<string>",
                "languages": [
                    "<string>"
                ],
                "regions": [
                    "<string>"
                ],
                "specialties": [
                    "<string>"
                ],
                "labels": [
                    {
                        "key": "<string>",
                        "value": "<string>"
                    }
                ],
                "publish": True,
                "generation": {
                    "instructions": {
                        "prompt": "<string>"
                    },
                    "sections": [
                        {
                            "sectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                            "orderIndex": 123
                        }
                    ]
                }
            }

            response = requests.post(url, json=payload, headers=headers)
          x-fern-sdk-language-id: create-from-scratch
components:
  parameters:
    Tenant-Name:
      name: Tenant-Name
      in: header
      description: >-
        Identifies a distinct entity within Corti's multi-tenant system. Ensures
        correct routing and authentication of the request.
      required: true
      example: base
      schema:
        type: string
        description: >-
          Identifies a distinct entity within Corti's multi-tenant system.
          Ensures correct routing and authentication of the request.
        example: base
  schemas:
    GuidedTemplatesCreateRequest:
      oneOf:
        - $ref: '#/components/schemas/GuidedTemplatesCreateFromInheritanceRequest'
          title: Inherit from existing template
        - $ref: '#/components/schemas/GuidedTemplatesCreateFromScratchRequest'
          title: Create from scratch
    GuidedTemplate:
      description: >
        Template as returned by single-resource endpoints (GET, POST, PATCH on

        `/documents/templates/{templateID}`). Extends `GuidedTemplateListItem`
        with the resolved

        `publishedVersion`.
      allOf:
        - $ref: '#/components/schemas/GuidedTemplateListItem'
        - type: object
          properties:
            publishedVersion:
              $ref: '#/components/schemas/GuidedTemplateVersion'
              description: >-
                The currently published version with inheritance fully resolved.
                Present when a version has been published.
    GuidedTemplatesCreateFromInheritanceRequest:
      description: >-
        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.
      allOf:
        - $ref: '#/components/schemas/GuidedTemplatesCreateBase'
        - type: object
          required:
            - inheritFromId
          properties:
            inheritFromId:
              type: string
              format: uuid
              description: >-
                Reference to the template to inherit instructions and sections
                from. Inherits from the published version of the referenced
                template.
            generation:
              type: object
              description: >-
                Partial overrides applied on top of the inherited template. All
                inner fields are optional. Any field omitted is inherited from
                the referenced template.
              properties:
                instructions:
                  $ref: '#/components/schemas/GuidedTemplateInstructionsPartial'
                sections:
                  type: array
                  items:
                    $ref: '#/components/schemas/GuidedTemplatesVersionSectionRequest'
    GuidedTemplatesCreateFromScratchRequest:
      description: >-
        Creates a template from scratch. The template fully specifies its own
        sections and optional template-level instructions.
      allOf:
        - $ref: '#/components/schemas/GuidedTemplatesCreateBase'
        - type: object
          required:
            - generation
          properties:
            generation:
              type: object
              properties:
                instructions:
                  $ref: '#/components/schemas/GuidedTemplateInstructions'
                sections:
                  type: array
                  items:
                    $ref: '#/components/schemas/GuidedTemplatesVersionSectionRequest'
    GuidedTemplateListItem:
      type: object
      description: >
        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.
      required:
        - id
        - name
        - languages
        - regions
        - specialties
        - labels
        - createdAt
        - updatedAt
      properties:
        id:
          description: The UUID of the template.
          type: string
          format: uuid
        inheritedFromId:
          description: >-
            Reference to the template to inherit template instructions and
            sections from. Inherits from published version by default.
          type: string
          format: uuid
          nullable: true
        autoGenerated:
          description: >-
            True if the template was auto-generated based on the
            section-composed POST /documents request.
          type: boolean
        source:
          description: >-
            Whether this template was created by the user, a project-related API
            Client or is a Corti standard resource.
          type: string
          enum:
            - user
            - corti
            - project
        name:
          type: string
          description: The name of this template. Not passed to the LLM.
        description:
          description: A description for this template. Not passed to the LLM.
          type: string
        languages:
          description: >-
            BCP 47 language tags this template has been tweaked for (e.g.
            `["fr", "de", "en-GB"]`). Empty means no language-specific tweaks.
          type: array
          items:
            type: string
        regions:
          description: >-
            ISO 3166-1 alpha-3 country codes this template has been tweaked for
            (e.g. `["BEL"]`). Empty means no region-specific tweaks.
          type: array
          items:
            type: string
        specialties:
          description: >-
            Clinical specialties this template has been tweaked for. Empty means
            no specialty-specific tweaks.
          type: array
          items:
            type: string
        labels:
          description: >-
            The available labels to use as query param filter in the LIST
            /templates endpoint.
          type: array
          items:
            $ref: '#/components/schemas/GuidedLabel'
        createdBy:
          description: The UUID of the creator of this template.
          type: string
          format: uuid
        createdAt:
          description: The original timestamp when the template was created.
          type: string
          format: date-time
        updatedAt:
          description: The original timestamp when the template was last updated.
          type: string
          format: date-time
        deletedAt:
          description: >-
            Present when the template has been deleted. GET by ID still returns
            the full resource with this field populated.
          type: string
          format: date-time
          nullable: true
    GuidedTemplateVersion:
      type: object
      description: >
        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).
      required:
        - id
        - versionNumber
        - generation
      properties:
        id:
          description: The UUID of the version.
          type: string
          format: uuid
        versionNumber:
          description: Starts at 0 and auto-increments.
          type: integer
        deletedAt:
          description: Present when the template version has been deleted.
          type: string
          format: date-time
          nullable: true
        generation:
          $ref: '#/components/schemas/GuidedTemplateGeneration'
    ErrorResponse:
      type: object
      required:
        - requestid
        - status
        - type
        - detail
      properties:
        requestid:
          type: string
        status:
          type: integer
        type:
          type: string
        detail:
          type: string
        validationErrors:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
    GuidedTemplatesCreateBase:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: The name of this template. Not passed to the LLM.
        description:
          description: A description for this template. Not passed to the LLM.
          type: string
        languages:
          type: array
          description: >-
            BCP 47 language tags this template has been tweaked for (e.g.
            `["fr", "de", "en-GB"]`).
          items:
            type: string
        regions:
          type: array
          description: >-
            ISO 3166-1 alpha-3 country codes this template has been tweaked for
            (e.g. `["BEL"]`).
          items:
            type: string
        specialties:
          type: array
          description: Clinical specialties this template has been tweaked for.
          items:
            type: string
        labels:
          type: array
          description: Labels work as query param filter in the LIST /templates endpoint.
          items:
            $ref: '#/components/schemas/GuidedLabel'
        publish:
          type: boolean
          default: true
          description: >-
            Defaults to true when omitted. Set this to false if you do not want
            the template to automatically show up in LIST templates.
    GuidedTemplateInstructionsPartial:
      type: object
      description: >-
        Partial form of GuidedTemplateInstructions used when inheriting from
        another template. Any field omitted is inherited.
      properties:
        prompt:
          type: string
          description: Override the inherited template-level prompt instructions.
    GuidedTemplatesVersionSectionRequest:
      type: object
      required:
        - sectionId
      properties:
        sectionId:
          type: string
          format: uuid
          description: The UUID of the section to include in the template version.
        orderIndex:
          type: integer
          description: Sets the order of this section within this template. Starts at 0.
    GuidedTemplateInstructions:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          description: >-
            Template-level prompt instructions that apply generally to all
            sections.
    GuidedLabel:
      type: object
      required:
        - key
        - value
      properties:
        key:
          type: string
        value:
          type: string
    GuidedTemplateGeneration:
      type: object
      description: >-
        Fully resolved template generation. Sections are expanded with their own
        inheritance applied.
      required:
        - instructions
      properties:
        instructions:
          $ref: '#/components/schemas/GuidedTemplateInstructions'
        sections:
          description: Fully resolved sections with inheritance applied.
          type: array
          items:
            $ref: '#/components/schemas/GuidedSection'
    GuidedSection:
      description: >
        Section as returned by single-resource endpoints (GET, POST, PATCH on

        `/documents/sections/{sectionID}`) and when embedded inside a resolved
        template

        version. Extends `GuidedSectionListItem` with the resolved
        `publishedVersion`.
      allOf:
        - $ref: '#/components/schemas/GuidedSectionListItem'
        - type: object
          properties:
            publishedVersion:
              $ref: '#/components/schemas/GuidedSectionVersion'
              description: >-
                The currently published version with section inheritance fully
                resolved. Present when a version has been published.
    GuidedSectionListItem:
      type: object
      description: >
        Section metadata as returned by the LIST /documents/sections endpoint.
        Does not

        include the resolved `publishedVersion` — use GET
        /documents/sections/{sectionID}

        to fetch a single section with its published version resolved.
      required:
        - id
        - name
        - languages
        - regions
        - specialties
        - labels
        - createdAt
        - updatedAt
      properties:
        id:
          description: The UUID of the section.
          type: string
          format: uuid
        inheritedFromId:
          description: >-
            Reference to the section to inherit generation configuration from.
            Inherits from published version by default.
          type: string
          format: uuid
          nullable: true
        autoGenerated:
          description: >-
            True if the section was auto-generated as part of an inline
            section-composed POST /documents request.
          type: boolean
        source:
          description: >-
            Whether this section was created by the user, a project-related API
            Client or is a Corti standard resource.
          type: string
          enum:
            - user
            - corti
            - project
        name:
          description: The name of the section.
          type: string
        languages:
          description: >-
            BCP 47 languages this section has been tweaked for. Empty means no
            language-specific tweaks.
          type: array
          items:
            type: string
        regions:
          description: >-
            ISO 3166-1 alpha-3 country codes this section has been tweaked for.
            Empty means no region-specific tweaks.
          type: array
          items:
            type: string
        specialties:
          description: >-
            Clinical specialties this section has been tweaked for. Empty means
            no specialty-specific tweaks.
          type: array
          items:
            type: string
        description:
          description: The description for the section.
          type: string
        labels:
          description: >-
            The labels available to use as query param filter in the LIST
            /sections endpoint.
          type: array
          items:
            $ref: '#/components/schemas/GuidedLabel'
        createdBy:
          description: The UUID of the creator of this section.
          type: string
          format: uuid
        createdAt:
          description: The original timestamp when the section was created.
          type: string
          format: date-time
        updatedAt:
          description: The original timestamp when the section was last updated.
          type: string
          format: date-time
        deletedAt:
          description: >-
            Present when the section has been deleted. GET by ID still returns
            the full resource with this field populated.
          type: string
          format: date-time
          nullable: true
    GuidedSectionVersion:
      type: object
      description: >
        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.
      required:
        - id
        - versionNumber
        - generation
      properties:
        id:
          description: The UUID of the section version.
          type: string
          format: uuid
        versionNumber:
          description: Starts at 0 and auto-increments.
          type: integer
        deletedAt:
          description: Present when the section version has been deleted.
          type: string
          format: date-time
          nullable: true
        generation:
          $ref: '#/components/schemas/GuidedSectionGeneration'
    GuidedSectionGeneration:
      type: object
      required:
        - heading
        - instructions
        - outputSchema
      properties:
        heading:
          type: string
          description: The heading of this section. Passed to the LLM.
        instructions:
          $ref: '#/components/schemas/GuidedSectionInstructions'
          description: The prompt instructions for this section.
        outputSchema:
          $ref: '#/components/schemas/GuidedOutputSchema'
    GuidedSectionInstructions:
      type: object
      required:
        - contentPrompt
      properties:
        contentPrompt:
          type: string
          description: >-
            The content prompt instructs the model what to include for
            synthesis. For `documentationMode: routed_parallel` this impacts
            what facts to route to this section.
        writingStylePrompt:
          type: string
          description: >-
            The writingStyle prompt instructs the model in what tone and style
            to output.
        miscPrompt:
          type: string
          description: >-
            Optional free-form prompt for any instructions that don't fit
            contentPrompt or writingStylePrompt.
    GuidedOutputSchema:
      oneOf:
        - $ref: '#/components/schemas/GuidedStringNode'
          title: String
          description: >-
            Outputs a string according to the optionally configurable schema
            requirements.
        - $ref: '#/components/schemas/GuidedNumberNode'
          title: Number
          description: >-
            Outputs a number. The model infers whether it should be an integer
            or float from context.
        - $ref: '#/components/schemas/GuidedBoolNode'
          title: Boolean
          description: Outputs a boolean true or false according to schema configuration.
        - $ref: '#/components/schemas/GuidedArrayNode'
          title: Array
          description: >-
            Outputs an array of items according to the optionally configurable
            schema requirements. Items can be configured as any type of node.
        - $ref: '#/components/schemas/GuidedObjectNode'
          title: Object
          description: >-
            The object output type offers advanced schema configuration with the
            ability to define for each field value any of the outputSchema
            types.
      discriminator:
        propertyName: type
        mapping:
          string:
            $ref: '#/components/schemas/GuidedStringNode'
          number:
            $ref: '#/components/schemas/GuidedNumberNode'
          boolean:
            $ref: '#/components/schemas/GuidedBoolNode'
          object:
            $ref: '#/components/schemas/GuidedObjectNode'
          array:
            $ref: '#/components/schemas/GuidedArrayNode'
    GuidedStringNode:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - string
        description:
          type: string
          description: >-
            Guide the LLM in what to output for this node. Supplements the
            section-level instructions.
        default:
          type: string
          nullable: true
          description: >-
            If nothing is outputted, this default is used. When `enum` is set,
            the default must be one of the enum values.
        enum:
          type: array
          description: Can be used to guide the LLM with specific values to output.
          items:
            type: string
        pattern:
          type: string
          nullable: true
          description: Can be used to constrain the LLM to output a specific pattern.
    GuidedNumberNode:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - number
        description:
          type: string
          description: >-
            Guide the LLM in what to output for this node. Supplements the
            section-level instructions.
        default:
          type: number
          nullable: true
          description: If nothing is outputted, this default is used.
        enum:
          type: array
          description: Can be used to guide the LLM with specific values to output.
          items:
            type: number
        minimum:
          type: number
          description: Use if a minimum value applies.
          nullable: true
        maximum:
          type: number
          description: Use if a maximum value applies.
          nullable: true
    GuidedBoolNode:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - boolean
        description:
          type: string
          description: >-
            Guide the LLM in what to output for this node. Supplements the
            section-level instructions.
        default:
          type: boolean
          description: If nothing is outputted, this default is used.
          nullable: true
    GuidedArrayNode:
      type: object
      required:
        - type
        - items
      properties:
        type:
          type: string
          enum:
            - array
        description:
          type: string
          description: >-
            Guide the LLM in what to output for this node. Supplements the
            section-level instructions.
        items:
          description: >-
            Must be another output schema node (string, number, boolean, array,
            or object).
          allOf:
            - $ref: '#/components/schemas/GuidedOutputSchema'
        itemFormat:
          type: string
          default: |
            - {item}
          description: >
            Format string used to render each array item in the generated
            output. Use the `{item}` placeholder for the item value.
          example: |
            - {item}
        minItems:
          type: integer
          minimum: 0
          description: Minimum number of array items to generate.
          nullable: true
        maxItems:
          type: integer
          minimum: 0
          description: Maximum number of array items to generate.
          nullable: true
        fallbackString:
          type: string
          nullable: true
          description: >
            Text rendered in place of the array when no items have relevant
            input/output.
    GuidedObjectNode:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - object
        description:
          type: string
          description: >-
            Guide the LLM in what to output for this node. Supplements the
            section-level instructions.
        fieldFormat:
          type: string
          default: |
            {key}: {value}
          description: >
            Free-form format string that controls how an object's fields are
            rendered into the final text output. Operates in one of two modes
            determined by which placeholders appear:


            **Subheading mode** (default: `"{key}: {value}\n"`): triggered when
            the format contains both `{key}` and `{value}`. Applied per field —
            each field becomes a key/value line. When a field has no relevant
            input/output and no `default` is set, the entire key/value line for
            that field is omitted from the rendered output.


            **Object mode** (e.g. `"{name} ({age})"`): triggered when `{key}`
            and `{value}` are absent. Placeholders must be actual field keys
            defined in `fields`. Applied once for the whole object, composing
            all fields into a single string. When a field has no relevant
            input/output and no `default` is set, its placeholder is replaced
            with an empty string (`""`).


            Validation rules: format must not be empty; if either `{key}` or
            `{value}` appears, both must be present; in subheading mode no extra
            placeholders are allowed; in object mode every placeholder must
            match a defined field key.
          example: |
            {key}: {value}
        fields:
          type: array
          description: Define what fields are possible to return in the object.
          items:
            $ref: '#/components/schemas/GuidedFieldDefinition'
        fallbackString:
          type: string
          nullable: true
          description: >
            Text rendered in place of the object when no field has relevant
            input/output and no field-level `default` is set.
    GuidedFieldDefinition:
      type: object
      required:
        - key
        - description
        - value
      properties:
        key:
          type: string
          description: Use to set a key to reference.
        description:
          type: string
          description: >-
            Guide the LLM in what to output for this node. Supplements the
            section-level instructions.
        value:
          description: >-
            Must be another output schema node (string, number, boolean, array,
            or object).
          allOf:
            - $ref: '#/components/schemas/GuidedOutputSchema'
        default:
          type: string
          nullable: true
          description: >-
            If nothing is outputted for this field, this default value is used
            in the rendered output.
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    AuthorizationHeader:
      type: http
      description: Input your token
      scheme: bearer

````