---
title: "Generate Document"
method: POST
path: "/interactions/{id}/documents/"
tags: ["Documents (Classic)"]
---

# Generate Document

`POST /interactions/{id}/documents/`

This endpoint offers different ways to generate a document. Find guides to document generation [here](/textgen/documents-standard).

## Path parameters

- `id` string, uuid, required

## Headers

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

## Request body

- union
  - DocumentsCreateRequestWithTemplateKey
    - `context` DocumentsContext[], required — An array of context objects. Currently only accepts multiple objects when of type `transcript`. See [guide](/textgen/documents-standard#generate-document-from-transcript-as-input).
      - union
        - DocumentsContextWithFacts
          - `type` 'facts', required — The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`.
          - `data` FactsContext[], required — An array of facts. See [guide](/textgen/documents-standard##generate-document-from-facts-as-input).
            - `text` string, required — The text of the fact.
            - `group` string — The group to which the fact belongs.
            - `source` 'core' | 'system' | 'user'
        - DocumentsContextWithTranscript
          - `type` 'transcript', required — The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`.
          - `data` CommonTranscriptRequest, required
            - `channel` integer — The channel associated with this phrase/utterance.
            - `participant` integer — The identifier of the participant.
            - `speakerId` integer — Id to tag an identified speaker. Auto-increments.
            - `text` string, required — The spoken phrase or utterance extracted from the audio.
            - `start` integer — Start time in milliseconds for phrase/utterance.
            - `end` integer — End time in milliseconds for phrase/utterance.
        - DocumentsContextWithString
          - `type` 'string', required — The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`.
          - `data` string, required — String data can include any text to be reasoned over for document generation: Transcript text, facts, or other narrative information.
    - `templateKey` string, required — The key of the template referencing the sections for generating a document.
    - `name` string — An optional name for the document.
    - `outputLanguage` string, required — The language in which the document will be generated. Check [languages page](/stt/languages) for more.
    - `disableGuardrails` boolean — Set to true to disable guardrails during document generation, default is false.
    - `documentationMode` 'global_sequential' | 'routed_parallel' — Configures the approach and underlying system prompt that govern how the LLM generates documentation.
  - DocumentsCreateRequestWithTemplate
    - `context` DocumentsContext[], required — An array of context objects. Currently only accepts multiple objects when of type `transcript`. See [guide](/textgen/documents-standard#generate-document-from-transcript-as-input).
      - union
        - DocumentsContextWithFacts
          - `type` 'facts', required — The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`.
          - `data` FactsContext[], required — An array of facts. See [guide](/textgen/documents-standard##generate-document-from-facts-as-input).
            - `text` string, required — The text of the fact.
            - `group` string — The group to which the fact belongs.
            - `source` 'core' | 'system' | 'user'
        - DocumentsContextWithTranscript
          - `type` 'transcript', required — The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`.
          - `data` CommonTranscriptRequest, required
            - `channel` integer — The channel associated with this phrase/utterance.
            - `participant` integer — The identifier of the participant.
            - `speakerId` integer — Id to tag an identified speaker. Auto-increments.
            - `text` string, required — The spoken phrase or utterance extracted from the audio.
            - `start` integer — Start time in milliseconds for phrase/utterance.
            - `end` integer — End time in milliseconds for phrase/utterance.
        - DocumentsContextWithString
          - `type` 'string', required — The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`.
          - `data` string, required — String data can include any text to be reasoned over for document generation: Transcript text, facts, or other narrative information.
    - `template` union, required
      - DocumentsTemplateWithSections
        - `sections` DocumentsSectionOverride[], required
          - `key` string, required — The key that references the section to use for document generation.
          - `nameOverride` string — Overrides the section name used in document generation and response.
          - `writingStyleOverride` string — Overrides the section's default writing style with your custom prompt.
          - `formatRuleOverride` string — Overrides the section's default format rule with your custom prompt.
          - `additionalInstructionsOverride` string — Overrides and sets the section-level additional instructions with your custom prompt.
          - `contentOverride` string — Overrides the section's content prompt used for input assignment with documentationMode: routed_parallel, and section generation.
        - `description` string — A brief description of the document that can help give the LLM some context.
        - `additionalInstructionsOverride` string — Overrides and sets template-level additional instructions.
      - DocumentsTemplateWithSectionKeys
        - `sectionKeys` string[], required — An array of section keys.
        - `documentName` string — The name of the document.
        - `additionalInstructions` string — Any additional instructions to be considered during document generation.
    - `name` string — An optional name for the document.
    - `outputLanguage` string, required — The language in which the document will be generated. Check [languages page](/stt/languages) for more.
    - `disableGuardrails` boolean — Set to true to disable guardrails during document generation, default is false.
    - `documentationMode` 'global_sequential' | 'routed_parallel' — Configures the approach and underlying system prompt that govern how the LLM generates documentation.

## Response `201`

- DocumentsGetResponse
  - `id` string, uuid, required
  - `name` string, required — Name of the generated document
  - `templateRef` string, required — Reference for the used template
  - `isStream` boolean, required
  - `sections` DocumentsSection[], required — Individual document sections
    - `key` string, required — Document section key
    - `name` string, required — Name or heading of the document section within the generated document
    - `text` string, required — Contents of the document section within the generated document
    - `sort` integer, required — Order of the document section within the generated document
    - `createdAt` string, date-time, required — The original timestamp when the document section was created.
    - `updatedAt` string, date-time, required — The timestamp when the document section was last updated.
  - `createdAt` string, date-time, required — The original timestamp when the document was created.
  - `updatedAt` string, date-time, required — The timestamp when the document was last updated.
  - `outputLanguage` string, required — The language in which the document will be generated. Check https://docs.corti.ai/stt/languages for more.
  - `usageInfo` CommonUsageInfo, required — Credits consumed for this request.
    - `creditsConsumed` number, required

## Other responses

- `400` — RFC9457
- `403` — RFC9457
- `500` — RFC9457
- `504` — RFC9457

---

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