---
title: "Restore the full conversation and document state for a previous session."
method: GET
path: "/v1/sessions/{session_id}/history"
tags: ["v1", "mcp", "sessions"]
---

# Restore the full conversation and document state for a previous session.

`GET /v1/sessions/{session_id}/history`

## Request

- Base URL: `https://api.superdocs.app`
- URL: `https://api.superdocs.app/v1/sessions/{session_id}/history`
- Auth: HTTP bearer

Returns complete message history (user and AI), final document HTML with chunk IDs preserved, attachment list, and editor actions (font, color, alignment changes). Use to continue editing a document you started in a prior session. The AI rehydrates with full context of all prior decisions, chunk IDs, and attachments. Pass include_document_html=false to skip the full document body when you only need the conversation.

## Path parameters

- `session_id` string, required

## Query parameters

- `focus_document_id` string, nullable: Durable id of the document to focus on restore (e.g. the file the user clicked in the Files view). When set, that document is shown in the editor and marked focused in the roster; omit to use the session's own last-focused document.
- `include_document_html` boolean: When false, omit the restored document's full HTML body (document_state.html_content) to keep your context small — agents that just need the conversation + metadata should set false. Default true (the web app needs the body to re-render the editor).

## Headers

- `authorization` string, nullable

## Response `200`

Successful Response

- EnhancedChatHistoryResponse: Conversation history with document state and restoration instructions.
  - `session_id` string, required: Session identifier.
  - `messages` object[], required: Ordered list of messages. Each item has: id (string), sender ('user' or 'ai'), content (string), timestamp (ISO 8601), turn_index (int), checkpoint_id (string or null — present on turns recorded after the revertability feature shipped; null for legacy turns where revert is unavailable).
  - `document_state` DocumentState: Current document state for session restoration.
    - `html_content` string, nullable: Full document HTML content with data-chunk-id attributes.
    - `document_id` string, nullable: Session-local id (slug) of the focused document. Identifies the document on restore so a restored tab stays in sync with edits made to it in other sessions.
    - `version_id` string, nullable: Document version identifier (UUID string).
    - `chunk_count` integer: Number of content sections in the document.
    - `last_modified` string, nullable: ISO 8601 timestamp of the last modification.
    - `attachments` object[], nullable: Session attachments. Each item has: id (string), filename (string), file_extension (string), processing_status ('ready', 'processing', or 'failed').
    - `page_setup` object, nullable: Source page geometry of the focused document (width_in, height_in, margin_in{top,right,bottom,left}, orientation) when known, else null. The editor renders the page at this geometry on restore; null ⇒ US-Letter + 1in default.
  - `editor_action` string: Client instruction: 'update' (load document_state HTML into editor), 'clear' (reset editor), or 'keep' (no change).
  - `restore_error` boolean, nullable: True ONLY when the document RESTORE itself failed transiently (its content load timed out or errored, typically under backend memory pressure) — as distinct from a genuine document-less session ('clear') or an intentional no-change ('keep'). editor_action stays 'keep' so the editor is left exactly as-is (never wrongly cleared); this flag lets the client offer a non-blocking retry instead of silently leaving the user on an empty editor. Null/absent on success and on the genuine no-document path.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/superdocs/apis/universal-document-ai-api.md) · [All operations](https://skmtc.dev/superdocs/apis/universal-document-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/superdocs/apis/universal-document-ai-api/revisions/37d03122940b?raw)
