---
title: "Regenerate"
method: POST
path: "/clinic/documents/{document_id}/regenerate"
tags: ["clinic", "clinic-documents"]
---

# Regenerate

`POST /clinic/documents/{document_id}/regenerate`

## 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/documents/{document_id}/regenerate`
- Auth: none declared

A new `generating` row with a new id; the old draft or failed row goes (D5).

## Path parameters

- `document_id` string, uuid, required

## Response `202`

Successful Response

- DocumentView: The clinician's view: everything, working material included.
  - `view` 'clinician'
  - `id` string, required
  - `child_id` string, required
  - `organisation_id` string, required
  - `template` TemplateRef, required
    - `id` string, required
    - `version` integer, required
    - `name` string, required
    - `kind` 'session_note' | 'referral', required
  - `status` 'generating' | 'draft' | 'failed' | 'final', required
  - `content` DocumentContent: 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[]
    - 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'
  - `to_check_count` integer
  - `stale` boolean
  - `session_date` string, nullable
  - `author` Person, required
    - `user_id` string, required
    - `name` string, nullable
  - `finalised_by` Person
    - `user_id` string, required
    - `name` string, nullable
  - `finalised_at` string, nullable
  - `amends_id` string, nullable
  - `addenda` Addendum[]
    - `id` string, required
    - `text` string, required
    - `author` Person, required
      - `user_id` string, required
      - `name` string, nullable
    - `finalised_at` string, required
  - `source_notes` SourceNote[]
    - `child_note_id` string, required
    - `text` string, required
    - `session_date` string, required
    - `attachment_document_ids` string[]
  - `asset_urls` object
  - `can_edit` boolean
  - `can_amend` boolean
  - `created_at` string, required
  - `signature` Signature: The sign-off every rendering ends with: the signer (the finaliser, or a draft's author), their discipline on the client's care team, and the clinic. `signed_on` is the signer's local day; null until finalised.
    - `name` string, nullable
    - `title` string, nullable
    - `clinic` string, required
    - `signed_on` string, nullable

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