---
title: "PUT /harness/sessions/{sessionId}"
description: Update a session
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).

Update session title or merge partial state. Uses optimistic concurrency — returns 409 if the session was concurrently modified (version mismatch).

## Request

#### Path parameters

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

#### Request body

- `title` (string) —

- `state` (object) —
Partial SessionState fields — shallow-merged into the current state

## Responses

### `200` OK

Session updated

Response shape:

- `id` (string (uuid)) —

- `title` (string) —

- `version` (integer) —
Monotonically increasing optimistic-concurrency counter

- `schemaVersion` (integer) —
Session state schema version (currently 1)

- `state` (object) —
Full session state snapshot persisted in Supabase

#### state properties

- `id` (string (uuid)) —

- `version` (integer) —

- `schemaVersion` (integer) —

- `userId` (string) —

- `organizationId` (string) —

- `messages` (object[]) —

- `pendingToolCalls` (object[]) —

- `completedToolCalls` (object[]) —

- `pendingJobs` (object[]) —

- `completedJobs` (object[]) —

- `artifacts` (object[]) —

- `versionVector` (object) —
Map of clientId → logical clock counter. Used for conflict detection in multi-client sync.

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

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

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

- `messageCount` (integer) —

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

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

- `lastActiveAt` (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`

### `409` Conflict

Version conflict — session was modified by another client, re-fetch and retry

Response shape: `object`

**curl**

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

**JavaScript**

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

**Python**

```python
import os, requests

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