---
title: "POST /v1/sessions/{sessionId}/messages/sync"
description: Send a message and wait for the full reply — Runs one turn on a session you own and returns the complete result as JSON once the turn finishes…
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).

Runs one turn on a session you own and returns the complete result as JSON once the turn finishes, instead of streaming. Use it when you cannot consume Server-Sent Events.

The response has the same shape as the batch form of the execute operation: every event produced during the turn, plus the final session state. Long turns hold the request open until they complete.

## Request

#### Path parameters

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

#### Request body

- `content` (string) —
User message text.

- `clientId` (string) —
Client identifier for version vector tracking. Generated when omitted.

- `diagnostics` (any) —
Optional opt-in to include a per-turn diagnostic report in the result.

## Responses

### `200` OK

Turn finished

Response shape:

- `success` (boolean) —

- `events` (object[]) —

- `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)) —

### `400` Bad Request

Invalid request

Response shape: `object`

### `401` Unauthorized

Authentication required

Response shape: `object`

### `404` Not Found

Resource not found

Response shape: `object`

### `429` Too Many Requests

Rate limit exceeded

Response shape: `object`

### `500` Internal Server Error

The turn failed to execute

Response shape: `object`

**curl**

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

**JavaScript**

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

**Python**

```python
import os, requests

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