# Read a session's transcript

`GET /o/{org}/p/{project}/sessions/{session}/messages`

The captured transcript as normalized events, filtered and sliced on the
server. A turn starts at each user message; `first`/`last` keep that many
turns, then `include`/`exclude` filter by role. Available once the run
has captured its transcript; before that the answer is `404`.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `org` | path | string | yes | The org's slug or id. A caller with no role in the org gets `404`. |
| `project` | path | string | yes | A Project's handle (name) or id, resolved inside `{org}` — OR the reserved sentinel `_` meaning "no Project" (a direct-repo / repo-less dispatch on `POST`; "no Project constraint, resolve by session id alone" everywhere else). A real handle that doesn't match the session's actual Project is `404`.  |
| `session` | path | string | yes | The session's full id (`execution_id`). |
| `include` | query | string | no | Comma-separated roles to keep. |
| `exclude` | query | string | no | Comma-separated roles to drop. Not with `include`. |
| `first` | query | integer | no | Keep the first N turns. Not with `last`. |
| `last` | query | integer | no | Keep the last N turns. Not with `first`. |

## Example request

```bash
curl "https://api.prix.dev/o/$RUSH_ORG/p/_/sessions/$SESSION_ID/messages" \
  -H "Authorization: Bearer $RUSH_API_KEY"
```

```typescript
const org = process.env.RUSH_ORG;
const sessionId = process.env.SESSION_ID;

const res = await fetch(`https://api.prix.dev/o/${org}/p/_/sessions/${sessionId}/messages`, {
  headers: {
    Authorization: `Bearer ${process.env.RUSH_API_KEY}`,
  },
});

console.log(res.status, await res.json());
```

```python
import os

import requests

org = os.environ["RUSH_ORG"]
session_id = os.environ["SESSION_ID"]

res = requests.get(
    f"https://api.prix.dev/o/{org}/p/_/sessions/{session_id}/messages",
    headers={"Authorization": f"Bearer {os.environ['RUSH_API_KEY']}"},
)

print(res.status_code, res.json())
```

## Responses

### 200

The transcript slice.

- `execution_id` (string, required)
- `agent` (string | null, required)
- `format` (string, required): The transcript format: `claude`, `codex`, `opencode`, `rush` or `opaque`.
- `event_count` (integer, required)
- `events` (array of SessionEvent, required)
  - `type` (string, required, one of `message`, `tool_use`, `tool_result`, `thinking`, `error`, `init`, `result`, `usage`, `attachment`, `hook`)
  - `agent` (string, required, one of `claude`, `codex`, `rush`, `opencode`, `opaque`)
  - `timestamp` (string, required)
  - `role` (string, optional, one of `user`, `assistant`)
  - `content` (string, optional)
  - `tool` (string, optional)
  - `callId` (string, optional): Links a tool_use to its tool_result.
  - `args` (object, optional)
  - `path` (string, optional)
  - `command` (string, optional)
  - `success` (boolean, optional)
  - `output` (string, optional)
  - `model` (string, optional)
  - `inputTokens` (integer, optional)
  - `outputTokens` (integer, optional)
  - `cacheReadTokens` (integer, optional)
  - `cacheCreationTokens` (integer, optional)
  - `mediaType` (string, optional)
  - `sizeBytes` (integer, optional)

### 400

A bad filter (an unknown role, `include` with `exclude`, or `first` with `last`).

### 401

No bearer, an unknown, revoked or expired one, or an API key on a route keys cannot call.

### 404

No such resource for the caller, including one that exists in an org the caller cannot see.

## Example response (200)

```json
{
  "execution_id": "3f9c2a71d04b8e65",
  "agent": "claude",
  "format": "claude",
  "event_count": 2,
  "events": [
    {
      "type": "message",
      "agent": "claude",
      "timestamp": "2026-10-06T15:02:14.120Z",
      "role": "user",
      "content": "Fix the flaky checkout test and open a PR."
    },
    {
      "type": "message",
      "agent": "claude",
      "timestamp": "2026-10-06T15:08:58.402Z",
      "role": "assistant",
      "content": "Pinned the clock in checkout.spec.ts and opened PR 412."
    }
  ]
}
```
