---
title: "Preview"
method: POST
path: "/clinic/document-templates/preview"
tags: ["clinic", "document-templates"]
---

# Preview

`POST /clinic/document-templates/preview`

## Request

- Base URL: `https://api.projectindi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.projectindi.com/clinic/document-templates/preview`
- Auth: none declared

The real pipeline on a built-in synthetic note, never a client's. Nothing is saved.

## Request body

- PreviewRequest
  - `definition` TemplateDefinition, required
    - `kind` 'session_note' | 'referral', required
    - `header` TemplateHeader
      - `image` string, nullable
      - `merge` string[]
    - `sections` union[], required
      - union
        - MergeSection: Filled from the database, deterministically. Never shown to the writer.
          - `id` string, required
          - `title` string, required
          - `kind` 'merge', required
          - `fields` string[], required
        - NarrativeSection: Prose written by the writer. `repeat` makes it one titled block per topic.
          - `id` string, required
          - `title` string, required
          - `kind` 'narrative', required
          - `instruction` string, required
          - `when_missing` 'not_discussed' | 'hide'
          - `repeat` boolean
          - `example` string, nullable
        - ListSection: Bullets written by the writer. No `repeat`: a list already has n items.
          - `id` string, required
          - `title` string, required
          - `kind` 'list', required
          - `instruction` string, required
          - `when_missing` 'not_discussed' | 'hide'
          - `example` string, nullable
        - ClinicianSection: Left blank for a person. Finalise is blocked until it is filled.
          - `id` string, required
          - `title` string, required
          - `kind` 'clinician', required
          - `hint` string, nullable
        - ImageSection: A fixed picture from the template: a body chart, a rating scale.
          - `id` string, required
          - `title` string, required
          - `kind` 'image', required
          - `image` string, required
        - MediaSection: Photos the clinician picks from the session's attachments; never the model.
          - `id` string, required
          - `title` string, required
          - `kind` 'media', required
  - `sample_id` string, nullable

## Response `200`

Successful Response

- Preview
  - `sample` SampleNote, required
    - `id` string, required
    - `title` string, required
    - `kind` 'session_note' | 'referral', required
    - `text` string, required
  - `content` DocumentContent, required: Sections in the template's order, every one present (hidden ones too). `body` is the clinician's markdown once they leave review for the editor; null while the draft is in review. From then on `sections` are the reviewed AI version, kept as the audit snapshot, and `body_seed_sha` is the sha256 of the markdown `start_edit` built, so *Back to review* is offered only while nothing has been typed.
    - `header` DocHeader
      - `image` string, nullable
      - `values` MergeValue[]
        - `field` 'child.full_name' | 'child.first_name' | 'child.dob' | 'child.age_at_session' | 'child.ndis_number' | 'child.medicare_number' | 'session.date' | 'clinician.full_name' | 'clinician.discipline' | 'clinician.provider_number' | 'clinic.name' | 'clinic.address' | 'clinic.phone', required
        - `label` string, required
        - `value` string, nullable, required
    - `sections` union[], required
      - union
        - DocMergeSection
          - `id` string, required
          - `title` string, required
          - `kind` 'merge', required
          - `values` MergeValue[], required
            - `field` 'child.full_name' | 'child.first_name' | 'child.dob' | 'child.age_at_session' | 'child.ndis_number' | 'child.medicare_number' | 'session.date' | 'clinician.full_name' | 'clinician.discipline' | 'clinician.provider_number' | 'clinic.name' | 'clinic.address' | 'clinic.phone', required
            - `label` string, required
            - `value` string, nullable, required
        - DocNarrativeSection: `statements` when `repeat` is false, `blocks` when it is true; the other is empty.
          - `id` string, required
          - `title` string, required
          - `kind` 'narrative', required
          - `repeat` boolean
          - `state` 'filled' | 'not_discussed' | 'hidden', required
          - `statements` DocStatement[]
            - `id` string, required
            - `text` string, required
            - `source_quotes` string[]
            - `review` Review
              - …
            - `origin` 'writer' | 'rewrite' | 'restored' | 'net' | 'clinician', required
          - `blocks` DocBlock[]
            - `id` string, required
            - `title` string, required
            - `title_quotes` string[]
            - `statements` DocStatement[], required
              - …
        - DocListSection
          - `id` string, required
          - `title` string, required
          - `kind` 'list', required
          - `state` 'filled' | 'not_discussed' | 'hidden', required
          - `statements` DocStatement[]
            - `id` string, required
            - `text` string, required
            - `source_quotes` string[]
            - `review` Review
              - …
            - `origin` 'writer' | 'rewrite' | 'restored' | 'net' | 'clinician', required
        - DocClinicianSection
          - `id` string, required
          - `title` string, required
          - `kind` 'clinician', required
          - `hint` string, nullable
          - `text` string, nullable
        - DocImageSection
          - `id` string, required
          - `title` string, required
          - `kind` 'image', required
          - `image` string, required
        - DocMediaSection: `document_ids` are `documents` rows attached to the source note.
          - `id` string, required
          - `title` string, required
          - `kind` 'media', required
          - `document_ids` string[]
    - `body` string, nullable
    - `body_seed_sha` string, nullable
  - `flags` union[], required
    - union
      - RemovedFlag: A statement that failed checks or review after its one rewrite.
        - `id` string, required
        - `type` 'removed', required
        - `section_id` string, required
        - `block_id` string, nullable
        - `text` string, required
        - `source_quotes` string[]
        - `reason` string, required
        - `caught_by` 'checks' | 'reviewer', required
        - `check` 'quote_present' | 'quote_substantive' | 'numbers' | 'proper_nouns' | 'repeat_title' | 'negation', nullable
        - `label` 'supported' | 'over_inferred' | 'contradicted' | 'unsupported', nullable
        - `status` 'open' | 'dismissed' | 'resolved'
      - UnverifiedFlag: A safeguarding or risk statement that still failed checks or review after its one rewrite. Unlike `removed`, it stays IN the document, carrying its failing review label: dropping a disclosure is the worse error (D34). A To check item ("Check this: <reason>") that doesn't block Finalise. Dismissing keeps the statement as written; editing or deleting it resolves the flag.
        - `id` string, required
        - `type` 'unverified', required
        - `section_id` string, required
        - `block_id` string, nullable
        - `statement_id` string, required
        - `reason` string, required
        - `caught_by` 'checks' | 'reviewer', required
        - `check` 'quote_present' | 'quote_substantive' | 'numbers' | 'proper_nouns' | 'repeat_title' | 'negation', nullable
        - `label` 'supported' | 'over_inferred' | 'contradicted' | 'unsupported', nullable
        - `status` 'open' | 'dismissed' | 'resolved'
      - UnplacedFlag: Note content that fits no section. Shown as "Not used from your note".
        - `id` string, required
        - `type` 'unplaced', required
        - `text` string, required
        - `status` 'open' | 'dismissed' | 'resolved'
      - ClinicianSectionFlag: A `clinician` section still empty. Recomputed on every write.
        - `id` string, required
        - `type` 'clinician_section_empty', required
        - `section_id` string, required
        - `status` 'open' | 'dismissed' | 'resolved'
      - MergeMissingFlag: A merge field with no value. A To check item that never blocks Finalise: finalising renders it as nothing. `section_id` is the merge section, or `header` for the letterhead.
        - `id` string, required
        - `type` 'merge_missing', required
        - `section_id` string, required
        - `field` 'child.full_name' | 'child.first_name' | 'child.dob' | 'child.age_at_session' | 'child.ndis_number' | 'child.medicare_number' | 'session.date' | 'clinician.full_name' | 'clinician.discipline' | 'clinician.provider_number' | 'clinic.name' | 'clinic.address' | 'clinic.phone', required
        - `label` string, required
        - `status` 'open' | 'dismissed' | 'resolved'
  - `asset_urls` object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/projectindi/apis/indi-agent-api-first-principles.md) - [All operations](https://skmtc.dev/projectindi/apis/indi-agent-api-first-principles/llms.txt) - [OpenAPI document](https://skmtc.dev/projectindi/apis/indi-agent-api-first-principles/revisions/25a7813e21fd?raw)
