---
title: "Get a run"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get a run

Path: cloudraker.run API

`GET /_run/{id}`

Run object, or SSE with Last-Event-ID replay.

## Authentication

- `bearer`, http, header `Authorization`

## Path parameters

- `id` (`getRunById.path.id`; string, required)

## Header parameters

- `Accept` (`getRunById.header.Accept`; string, optional) — `text/event-stream` streams the run.
  - one of `"application/json"`, `"text/event-stream"`
- `Last-Event-ID` (`getRunById.header.Last-Event-ID`; integer, optional) — Resume the stream after this `seq`.

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://your-org.cloudraker.run/_run/<id>' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://your-org.cloudraker.run/_run/<id>';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://your-org.cloudraker.run/_run/<id>"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

The run object, or the event stream from `Last-Event-ID`.

#### Body (application/json)

- `id` (`getRunById.response.200.id`; string, required)
  - example `"run_01K7Q3V9X2M4N6P8R0S2T4V6W8"`
- `agent` (`getRunById.response.200.agent`; string, required)
  - example `"hello"`
- `mode` (`getRunById.response.200.mode`; string, required)
  - one of `"zeroshot"`, `"turns"`, `"machine"`
- `status` (`getRunById.response.200.status`; string, required)
  - one of `"queued"`, `"running"`, `"waiting"`, `"completed"`, `"failed"`, `"cancelled"`, `"expired"`
- `turn` (`getRunById.response.200.turn`; integer, required)
- `deployment` (`getRunById.response.200.deployment`; object, required)
  - `sha` (`getRunById.response.200.deployment.sha`; string, optional)
  - `deployed_at` (`getRunById.response.200.deployment.deployed_at`; string, optional)
    - format `date-time`
- `created_at` (`getRunById.response.200.created_at`; string, required)
  - format `date-time`
- `updated_at` (`getRunById.response.200.updated_at`; string, required)
  - format `date-time`
- `last_seq` (`getRunById.response.200.last_seq`; integer, required)
- `metadata` (`getRunById.response.200.metadata`; map<string>, required) — Max 20 keys, string values, 1 KB in total. Echoed on every event and webhook. `end_user` scopes data store records.
- `stream_url` (`getRunById.response.200.stream_url`; string, required)
  - format `uri`
- `expires_at` (`getRunById.response.200.expires_at`; string | null, optional) — Set while a `turns` or `machine` run is `waiting`.
  - format `date-time`
- `read_token` (`getRunById.response.200.read_token`; string, optional) — `rrt_` token. Reads this run only. Present on the start answer.
- `result` (`getRunById.response.200.result`; unknown, optional) — The `done` payload after `run.completed`.
- `error` (`getRunById.response.200.error`; object | null, optional)
  - `code` (`getRunById.response.200.error.code`; string, optional)
  - `message` (`getRunById.response.200.error.message`; string, optional)
- `usage` (`getRunById.response.200.usage`; object, optional)
  - `input_tokens` (`getRunById.response.200.usage.input_tokens`; integer, optional)
  - `cached_input_tokens` (`getRunById.response.200.usage.cached_input_tokens`; integer, optional)
  - `output_tokens` (`getRunById.response.200.usage.output_tokens`; integer, optional)
  - `reasoning_tokens` (`getRunById.response.200.usage.reasoning_tokens`; integer, optional)
  - `model_steps` (`getRunById.response.200.usage.model_steps`; integer, optional)
  - `code_calls` (`getRunById.response.200.usage.code_calls`; integer, optional)
  - `code_cpu_ms` (`getRunById.response.200.usage.code_cpu_ms`; integer, optional)
  - `egress_requests` (`getRunById.response.200.usage.egress_requests`; integer, optional)
  - `egress_bytes` (`getRunById.response.200.usage.egress_bytes`; integer, optional)
  - `duration_ms` (`getRunById.response.200.usage.duration_ms`; integer, optional)
  - `credits` (`getRunById.response.200.usage.credits`; integer, optional)
  - `dynamic_worker_ids` (`getRunById.response.200.usage.dynamic_worker_ids`; integer, optional)
  - `inference` (`getRunById.response.200.usage.inference`; string, optional)
    - one of `"cloudraker"`, `"byok"`, `"gateway"`
  - `model_cost_usd` (`getRunById.response.200.usage.model_cost_usd`; number | null, optional) — Raw model cost in USD from the AI Gateway logs of CloudRaker inference. Null until a cost is known. Not credits.
  - `model_cost_complete` (`getRunById.response.200.usage.model_cost_complete`; boolean, optional) — False while a step cost is not known yet, or when a step has no reported cost (byok, custom gateway).
- `parent_run_id` (`getRunById.response.200.parent_run_id`; string, optional) — A child run only: the run that delegated the task.
- `root_run_id` (`getRunById.response.200.root_run_id`; string, optional) — A child run only: the first run of the run tree.
- `depth` (`getRunById.response.200.depth`; integer, optional) — A child run only: 1 for a child of the root run.
  - min 1
- `waiting_for` (`getRunById.response.200.waiting_for`; string, optional) — Set while the run waits for the reports of its child runs.
  - one of `"children"`
- `tree_credits` (`getRunById.response.200.tree_credits`; number, optional) — A run with child runs only: the credits of the run and of all its child runs.

##### Example

```json
{
  "id": "run_01K7Q3V9X2M4N6P8R0S2T4V6W8",
  "agent": "hello",
  "mode": "zeroshot",
  "status": "queued",
  "turn": 0,
  "deployment": {
    "sha": "string",
    "deployed_at": "2019-08-24T14:15:22Z"
  },
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "last_seq": 0,
  "metadata": {
    "property1": "string",
    "property2": "string"
  },
  "read_token": "string",
  "stream_url": "http://example.com",
  "result": null,
  "error": {
    "code": "string",
    "message": "string"
  },
  "usage": {
    "input_tokens": 0,
    "cached_input_tokens": 0,
    "output_tokens": 0,
    "reasoning_tokens": 0,
    "model_steps": 0,
    "code_calls": 0,
    "code_cpu_ms": 0,
    "egress_requests": 0,
    "egress_bytes": 0,
    "duration_ms": 0,
    "credits": 0,
    "dynamic_worker_ids": 0,
    "inference": "cloudraker",
    "model_cost_usd": 0,
    "model_cost_complete": true
  },
  "parent_run_id": "string",
  "root_run_id": "string",
  "depth": 1,
  "waiting_for": "children",
  "tree_credits": 0
}
```

#### Body (text/event-stream)

##### Example

```text
string
```

### 4XX

Error. See the `code` table in the guides.

#### Example

```json
{
  "error": {
    "code": "run_busy",
    "message": "string",
    "run_id": "string",
    "details": null
  }
}
```

- `error` (`getRunById.response.4XX.error`; object, required)
  - `code` (`getRunById.response.4XX.error.code`; string, required)
    - example `"run_busy"`
  - `message` (`getRunById.response.4XX.error.message`; string, required)
  - `run_id` (`getRunById.response.4XX.error.run_id`; string, optional)
  - `details` (`getRunById.response.4XX.error.details`; unknown, optional)


Source: https://docs.cloudraker.com/run/api/get-run-by-id/index.md
