---
title: "POST /harness/sessions/{sessionId}/rollback"
description: Rollback to checkpoint
full: true
---

**Auth:** required. Send an `ivy_` API key (`Authorization: Bearer ivy_…` or `X-Ivy-Api-Key`), a Clerk session JWT (`Authorization: Bearer …`) or the Clerk `__session` cookie (browser sessions). See [Authentication](/docs/api/authentication).

Restore the session to the state captured in the specified checkpoint. The session version is incremented; subsequent messages are truncated.

## Request

#### Path parameters

- `sessionId` (string (uuid)) —
Session UUID (UUIDv7 — time-ordered)

#### Request body

- `checkpointId` (string) —
ID of the checkpoint to restore

## Responses

### `200` OK

Rollback applied

Response shape:

- `success` (boolean) —

- `sessionId` (string (uuid)) —

- `checkpointId` (string) —

- `restoredStep` (integer) —
Graph step number of the restored checkpoint

- `version` (integer) —
New session version after rollback

- `updatedAt` (string (date-time)) —

### `400` Bad Request

Invalid request

Response shape: `object`

### `401` Unauthorized

Authentication required

Response shape: `object`

### `404` Not Found

Resource not found

Response shape: `object`

**curl**

```bash
curl -X POST 'https://ivybiosciences.com/api/harness/sessions/{sessionId}/rollback' \
  -H "Authorization: Bearer $IVY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "checkpointId": ""
}'
```

**JavaScript**

```js
const res = await fetch('https://ivybiosciences.com/api/harness/sessions/{sessionId}/rollback', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.IVY_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "checkpointId": ""
}),
});
const data = await res.json();
```

**Python**

```python
import os, requests

res = requests.post(
    "https://ivybiosciences.com/api/harness/sessions/{sessionId}/rollback",
    headers={"Authorization": f"Bearer {os.environ['IVY_API_KEY']}"},
    json={
  "checkpointId": ""
},
)
data = res.json()
```
