Rewind a chat session to before a specific user message — restores both the document and the conversation in one call.
Rewinds a chat session to the state immediately before a specific user message. The document, conversation history, and supporting context all snap back to that point. The text of the reverted message is returned (compose_text) so the caller can edit and resend it. Messages from the reverted turn forward are soft-archived: hidden from active reads but retained for audit. The original conversation is preserved server-side; the restored conversation becomes the active timeline. Rejects with 409 if the session has a chat job in progress or awaiting approval — wait for the job to settle before reverting. Returns 422 if the message predates the revertability feature.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Path Parameters
Body
Rewind a chat session to the state immediately before a specific user message.
Turn index of the user message to revert. The text of that message is returned in compose_text so the caller can re-edit and resend it. Every chat row at this turn or later is soft-archived (hidden from active reads but retained for audit).
x >= 0When true, compute the per-document revert diff WITHOUT committing or archiving anything — used to render a preview before the user confirms.
Optional identifier for the client window issuing the revert, used to coordinate concurrent reverts from multiple browser tabs.
Response
Successful Response
Result of a session revert: restored document state and compose-box prefill.
Session identifier.
Turn index that the active conversation now ends at (the AI reply preceding the reverted user message). -1 when the session is reset to its initial empty state (revert from the very first user message).
The text of the user message that was reverted. Clients should pre-fill the compose box with this so the user can edit and resend.
Number of chat rows soft-archived by this revert (turns hidden from the UI but retained for audit).
Restored document state. Null when the session is reset to empty.
Client instruction: 'update' to load the restored document, or 'clear' to reset the editor to empty.
Per-document (slug -> change-set) revert diff. Applying these merges the revert onto any concurrent live edits — a conflicting section is surfaced for you to resolve rather than replacing the whole document. On dry_run this is the preview; on a real revert it is what was committed.
Echoes the request's dry_run: when true nothing was committed/archived — this is a preview only.
The identifier of the pre-revert state. Revert is non-destructive — passing this back to POST /sessions/{id}/redo (with the same turn_index) restores it and un-archives the rolled-back turns, undoing the revert. Null on a dry-run or a first-message reset.

