# List the turns of a session

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

Every prompt in the session in order: the one that started it, then each follow-up in the
order they ran, then follow-ups still waiting in line (`queued`). A turn is `running` until
the session finishes it, then carries that status and its result. A turn that was still open
when the next began ends `interrupted`; a queued one that could not be delivered ends `failed`
with its `error_code`, and one whose message was removed ends `cancelled`. Cost and tokens are the session's, on GET …/sessions/{session}.

## 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`). |

## Example request

```bash
curl "https://api.phoenix.so/o/$RUSH_ORG/p/_/sessions/$SESSION_ID/turns" \
  -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.phoenix.so/o/${org}/p/_/sessions/${sessionId}/turns`, {
  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.phoenix.so/o/{org}/p/_/sessions/{session_id}/turns",
    headers={"Authorization": f"Bearer {os.environ['RUSH_API_KEY']}"},
)

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

## Responses

### 200

The session's turns.

- `turns` (array of Turn, required)
  - `id` (string, required)
  - `ordinal` (integer | null, required): 1 for the prompt that started the session, then one per follow-up in the order they ran. Null for a follow-up waiting in line (`queued`) or one that failed there: it takes its place when it starts.
  - `status` (string, required, one of `queued`, `running`, `completed`, `needs_review`, `failed`, `cancelled`, `expired`, `interrupted`): `queued` is a follow-up sent while a turn was running, waiting for its turn.
  - `prompt` (string | null, required)
  - `result` (any, required): The turn's answer, as GET …/sessions/{session}/result returned it when the turn ended.
  - `error_code` (string, optional): Why the turn failed: the run's failure code (`RUN_FAILED`, `HARNESS_EXITED`, `TOKEN_LIMIT_REACHED`, …), or for a queued follow-up that never ran, why (`ATTACHMENT_EXPIRED`, `TASK_TERMINAL`, `DELIVERY_RETRIES_EXHAUSTED` or the delivery refusal). A turn that ran and failed spent its run time, so resend only one that never ran. Absent when the turn did not fail, and on turns that ran and ended before migration 408.
  - `started_at` (string, required): When the turn started, or for a queued one when it was sent.
  - `ended_at` (string | null, required)
  - `input_tokens` (integer, optional): The turn's own tokens, as its harness reported them when it ended. Absent until then, and on a turn that reported none.
  - `output_tokens` (integer, optional)
  - `cache_read_tokens` (integer, optional)
  - `reasoning_tokens` (integer, optional)
  - `total_cost_usd` (number, optional): What the provider billed for this turn's model calls so far, from the ledger the session's `total_cost_usd` is settled from: each call counts toward the turn that had started last when the call was logged, so once the session has finished its turns add up to its `total_cost_usd`. `0` for a run on a person's own model account, which they pay the provider for. Absent on a turn that never started (`queued`, or failed or cancelled in the queue).

### 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 in an org the caller is not in or a Project that is private to someone else.

### 429

The account is over its request budget, 1,800 a minute shared by the person's API keys and console on every API host (`RATE_LIMITED`). The error names the limit. Wait `Retry-After` seconds.

## Example response (200)

```json
{
  "turns": [
    {
      "id": "1d4b7e92-6c3a-4f05-8a1e-b9d2c7f0e461",
      "ordinal": 1,
      "status": "completed",
      "prompt": "Fix the flaky checkout test and open a PR.",
      "result": {
        "text": "Pinned the clock in checkout.spec.ts and opened PR 412.",
        "structured": null,
        "schema_valid": null
      },
      "started_at": "2026-10-06T15:02:11.000Z",
      "ended_at": "2026-10-06T15:09:03.000Z"
    },
    {
      "id": "8f2c5a17-0b9e-4d63-a7f4-3e1d6b8c2a50",
      "ordinal": 2,
      "status": "running",
      "prompt": "Also add a test for the expired-coupon path.",
      "result": null,
      "started_at": "2026-10-06T15:12:40.000Z",
      "ended_at": null
    }
  ]
}
```
