---
title: "Edit a message and rewind"
method: POST
path: "/v3/organizations/{orgId}/sessions/{sessionId}/rewind"
tags: ["Sessions"]
---

# Edit a message and rewind

`POST /v3/organizations/{orgId}/sessions/{sessionId}/rewind`

## Request

- Base URL: `https://api.reasonmachines.com`
- URL: `https://api.reasonmachines.com/v3/organizations/{orgId}/sessions/{sessionId}/rewind`
- Auth: HTTP bearer

Requires run. Replaces the named message with `content` and starts a new turn from it. A follow-up is named by its message_id or client_message_id; an opening prompt only by the client_message_id it was created with, since listSessionMessages does not list it. 404 rewind_message_not_found when the Session has no such message.

<sub>Scope: `run`</sub>

## Request body

- object
  - `message_id` string: The follow-up to rewind to, by its `id` from listSessionMessages. Give this or client_message_id.
  - `client_message_id` string: The message to rewind to, by the client_message_id it was sent with. This also names an opening prompt that was created with one; listSessionMessages does not list opening prompts.
  - `content` string, required: The edited message. It replaces that message, and the conversation after it is set aside.
  - `request_id` string, uuid: A caller-chosen id for this rewind, so a retried request returns the first rewind (`deduplicated` true) instead of rewinding twice. Omitted, every request rewinds.

## Response `200`

The rewind started.

- SessionRewindStarted
  - `ok` true, required: Always true on success.
  - `session_id` string, required: The Session that runs again from the edited message.
  - `deduplicated` boolean, required: True when this request_id was already applied and the first rewind is returned instead of starting another.

## Other responses

- `400`: Invalid request.
- `401`: Missing, invalid, or expired key.
- `403`: The key lacks the required scope or role.
- `404`: Resource not found.
- `409`: The Session's state does not allow this now; `error` says why (for example not_terminal while a turn runs).
- `413`: The request body or the message is too large (request_too_large, message_too_large).
- `429`: Too many requests. Retry after the number of seconds in the `Retry-After` response header.
- `503`: Product writes are disabled.

## Changes

- **2026-10-15** `52a86b8b91b0`: 1 info
  - added the media type `application/json` for the response with the status `200`
- **2026-10-15** `fad7b15a74a7`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/ara/apis/reason-api/changes/v3/organizations/:orgId/sessions/:sessionId/rewind/post.md)

---

[API](https://skmtc.dev/ara/apis/reason-api.md) - [All operations](https://skmtc.dev/ara/apis/reason-api/llms.txt) - [OpenAPI document](https://skmtc.dev/ara/apis/reason-api/revisions/e97c8704807c?raw)
