---
title: "Update Document Content"
method: PUT
path: "/api/folders/documents/{document_id}/content"
tags: ["domains"]
---

# Update Document Content

`PUT /api/folders/documents/{document_id}/content`

## Request

- Base URL: `https://app.thinqos.com` (the document declares no server; this is the origin it was published from)
- URL: `https://app.thinqos.com/api/folders/documents/{document_id}/content`
- Auth: none declared

Save edited document text - the Documents editor's write path (TOS-2415).

See ``services/document_content.py`` for the full fan-out (history, persist,
re-vectorize, Mind refresh).

Personal docs: only the owner may edit. Shared docs: edit/admin rung.
Only ``document_kind='text'`` documents whose original (if any) is itself
text are editable; binary-derived documents 409.

## Path parameters

- `document_id` string, uuid, required

## Headers

- `x-impersonate-identity-id` string, nullable

## Request body

- UpdateDocumentContentRequest
  - `content` string, required
  - `expected_content_hash` string, nullable

## Response `200`

Successful Response

- DocumentContentSaveResponse
  - `id` string, uuid, required
  - `source_id` string, required
  - `title` string
  - `status` string, required
  - `chunk_count` integer, required
  - `indexed_at` string, date-time, nullable, required
  - `error_message` string, nullable, required
  - `scope` string, required
  - `library_id` string, uuid, nullable
  - `tags` string[]
  - `created_at` string, date-time, nullable, required
  - `modified_at` string, date-time, nullable
  - `size_bytes` integer, nullable
  - `has_original` boolean
  - `document_kind` string
  - `slug` string, nullable
  - `original_content_type` string, nullable
  - `original_filename` string, nullable
  - `title_source` string, nullable
  - `has_fit` boolean
  - `deleted_at` string, date-time, nullable
  - `mind_extraction` MindExtractionScopeResponse: How much of a document actually reached Mind extraction (TOS-2063). Historical metadata from the retired inline document extraction worker. Existing document responses retain this read-only record; current teaching uses provenance imprints and resumable episode state instead.
    - `episodes_taught` integer, required
    - `episodes_total` integer, required
    - `truncated` boolean, required
  - `source_time` SourceTime: When source content happened, was observed, and entered thinqOS.
    - `occurred_at` string, date-time, nullable
    - `observed_at` string, date-time, nullable
    - `recorded_at` string, date-time, nullable
    - `precision` 'instant' | 'day' | 'month' | 'year', nullable
    - `provenance` 'stated' | 'parsed_from_title' | 'parsed_from_body' | 'inferred' | 'unknown'
    - `timezone` string, nullable
    - `evidence` string, nullable
  - `published` boolean
  - `sync_excluded` boolean
  - `mind_mode` 'immediate' | 'first_save' | 'never'
  - `mind_refresh_status` 'current' | 'queued' | 'failed'
  - `full_text` string, nullable, required
  - `content_hash` string, nullable
  - `draft_content` string, nullable
  - `draft_saved_at` string, date-time, nullable
  - `draft_based_on_hash` string, nullable
  - `synced_to` DocumentSyncedTo: TOS-7114: the out sync that sends this document's folder to GitHub. ``path`` is the file's place in the repository, or ``None`` when the sync has no file for it (kept out of syncs, removed, or not sent yet). ``library_id`` is the folder the sync belongs to, which may be a folder above the document's own.
    - `sync_id` string, uuid, required
    - `library_id` string, uuid, required
    - `repo` string, required
    - `path` string, nullable
  - `imprints_refreshed` integer
  - `mind_refresh_failed` boolean
  - `version_number` integer

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/thinqos/apis/thinqos-api.md) · [All operations](https://skmtc.dev/thinqos/apis/thinqos-api/llms.txt) · [OpenAPI document](https://skmtc.dev/thinqos/apis/thinqos-api/revisions/5fdd1072e877?raw)
