# Cloud sessions

> Headless cloud sessions: a cloud session that starts with no desktop app, for the assistant, the CLI, MCP and the apps. Each session runs on its own cloud machine of yours, with the cloud machines' limits and charges. A session is its person's alone: to anyone else it does not exist. Off unless `NEXUS_SESSIONS_API` is on: every route then answers 404.

## List sessions

`GET /v1/sessions`

Your headless cloud sessions in this organization, newest first (at most 50), each with its cloud machine.

Permission: `cloud.machines.use` (Every member).

### Responses

- `200` OK (application/json, SessionList)
  - `sessions` (array of Session, required)
    - `id` (string, required): `cs_` and 40 hex characters
    - `repo` (string, required): GitHub `owner/name`, lowercased
    - `agent` (string, required): `claude` or `codex`: a cloud session launches only these two agents today.
    - `model` (string | null, required): The agent's model name; null for its default.
    - `title` (string | null, required): The session's title; null when the start sent none.
    - `state` ("starting" | "running" | "stopped" | "failed", required): `starting`: the machine boots or sets the repository up, or the prompt waits for its host. `running`: the agent started. `stopped` and `failed` are final.
    - `threadId` (string | null, required): The session's id on its machine once the agent started (`t_<uuid>`).
    - `error` (string | null, required): Why it failed, or why the last message may not have reached it.
    - `startedBy` (SessionStartedBy, required): Who started a session. Absent on a start: you (`person`).
      - `kind` ("person" | "assistant_conversation" | "room" | "session", required)
      - `id` (string, required): A user id (yours, for `person`), an assistant conversation's id, a room's id, or a session of yours (`cs_…`).
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required)
    - `stoppedAt` (string (date-time) | null, required): When it stopped or failed.
    - `machine` (CloudMachine | null, required): Its cloud machine; null once the machine is deleted.
    - `fencingToken` (integer, required): The session's current fencing token: 0 until a runner first takes it, then raised by one on each take. [min 0]
    - `runner` (SessionRunner | null, required): The runner that took the session last, and its lease; null until one takes it.
- `404` `NEXUS_SESSIONS_API` is off.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` No provider account on this Gateway (`cloud_unavailable`); try again later.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 |  | `NEXUS_SESSIONS_API` is off. |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | No provider account on this Gateway (`cloud_unavailable`); try again later. |

### Example

```sh
curl "$NEXUS_URL/v1/sessions" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fsessions)

## Create session

`POST /v1/sessions`

Start a headless cloud session: a cloud session with no desktop app. Gateway creates your cloud machine for the session (as POST /v1/cloud/machines does, with its limits and charges), the machine clones `repo` and runs its `.agents/setup` at boot with the organization's Nexus GitHub App, and Gateway then starts the agent on the machine with `prompt` as its first message. The prompt never goes to the provider: Gateway sends it to the machine's host once the host is online. The agent runs on the Nexus route, charged to the organization, in `auto` permission mode. Send `idempotencyKey` (or an `Idempotency-Key` header): the session's id is derived from it, so a resend answers the same session. Read the session (GET) to see it move from `starting` to `running`. Off unless `NEXUS_SESSIONS_API` is on.

Permission: `cloud.machines.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `x-nexus-github-token` | header | string | no | Your own GitHub token. Gateway asks GitHub with it whether you may read `repo`. Used for that check only, never kept, and never sent to the machine. Without it, Gateway uses your own `github` connection (connect it with `POST /v1/connections/github/oauth`). |
| `x-nexus-github-account` | header | string | no | The id of your linked GitHub account when you have more than one. |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

- `repo` (string): The GitHub repository, `owner/name` (a github.com URL also works). Required for now.
- `projectId` (string): Reserved for projects: refused for now (`project_id_unsupported`).
- `agent` (string): A coding agent that runs in cloud sessions: `claude` or `codex`, and `opencode` when the Gateway turns it on. Absent, empty or `auto`: the model picks it (open-weight models run on `opencode`, Anthropic models on `claude`, OpenAI models on `codex`). Another agent is refused with `invalid_agent`.
- `model` (string): A catalog model (`GET /v1/models`) or the agent's own model name; absent for the agent's default. Required when `agent` is absent. With `agent`, a catalog model that another agent runs is refused with `agent_model_mismatch`.
- `prompt` (string, required): The session's first message, 1 to 100000 characters.
- `title` (string): The session's title, kept on one line, at most 200 characters.
- `idempotencyKey` (string): Names the session: a resend with the same body answers the same session. Else the `Idempotency-Key` header's.
- `startedBy` (SessionStartedBy): Who started a session. Absent on a start: you (`person`).
  - `kind` ("person" | "assistant_conversation" | "room" | "session", required)
  - `id` (string, required): A user id (yours, for `person`), an assistant conversation's id, a room's id, or a session of yours (`cs_…`).

### Responses

- `200` The session a start with this key made (application/json, Session)
  - `id` (string, required): `cs_` and 40 hex characters
  - `repo` (string, required): GitHub `owner/name`, lowercased
  - `agent` (string, required): `claude` or `codex`: a cloud session launches only these two agents today.
  - `model` (string | null, required): The agent's model name; null for its default.
  - `title` (string | null, required): The session's title; null when the start sent none.
  - `state` ("starting" | "running" | "stopped" | "failed", required): `starting`: the machine boots or sets the repository up, or the prompt waits for its host. `running`: the agent started. `stopped` and `failed` are final.
  - `threadId` (string | null, required): The session's id on its machine once the agent started (`t_<uuid>`).
  - `error` (string | null, required): Why it failed, or why the last message may not have reached it.
  - `startedBy` (SessionStartedBy, required): Who started a session. Absent on a start: you (`person`).
    - `kind` ("person" | "assistant_conversation" | "room" | "session", required)
    - `id` (string, required): A user id (yours, for `person`), an assistant conversation's id, a room's id, or a session of yours (`cs_…`).
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required)
  - `stoppedAt` (string (date-time) | null, required): When it stopped or failed.
  - `machine` (CloudMachine | null, required): Its cloud machine; null once the machine is deleted.
  - `fencingToken` (integer, required): The session's current fencing token: 0 until a runner first takes it, then raised by one on each take. [min 0]
  - `runner` (SessionRunner | null, required): The runner that took the session last, and its lease; null until one takes it.
- `201` Created: the machine starts, and the prompt waits for its host (application/json, Session)
  - `id` (string, required): `cs_` and 40 hex characters
  - `repo` (string, required): GitHub `owner/name`, lowercased
  - `agent` (string, required): `claude` or `codex`: a cloud session launches only these two agents today.
  - `model` (string | null, required): The agent's model name; null for its default.
  - `title` (string | null, required): The session's title; null when the start sent none.
  - `state` ("starting" | "running" | "stopped" | "failed", required): `starting`: the machine boots or sets the repository up, or the prompt waits for its host. `running`: the agent started. `stopped` and `failed` are final.
  - `threadId` (string | null, required): The session's id on its machine once the agent started (`t_<uuid>`).
  - `error` (string | null, required): Why it failed, or why the last message may not have reached it.
  - `startedBy` (SessionStartedBy, required): Who started a session. Absent on a start: you (`person`).
    - `kind` ("person" | "assistant_conversation" | "room" | "session", required)
    - `id` (string, required): A user id (yours, for `person`), an assistant conversation's id, a room's id, or a session of yours (`cs_…`).
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required)
  - `stoppedAt` (string (date-time) | null, required): When it stopped or failed.
  - `machine` (CloudMachine | null, required): Its cloud machine; null once the machine is deleted.
  - `fencingToken` (integer, required): The session's current fencing token: 0 until a runner first takes it, then raised by one on each take. [min 0]
  - `runner` (SessionRunner | null, required): The runner that took the session last, and its lease; null until one takes it.
- `400` A field is wrong: `invalid_repo` (not GitHub `owner/name`), `invalid_agent` (not an agent this Gateway runs in cloud sessions), `invalid_model`, `model_required` (no agent and no model), `unknown_model`, `model_coming_soon` or `unsupported_cloud_model` (no cloud agent runs the model), `agent_model_mismatch` (the model runs on another agent; `error.nexus` names `agent`, `model` and `modelAgent`), `invalid_prompt`, `invalid_started_by`, `idempotency_key_required`, or `project_id_unsupported` (`projectId` is reserved).
- `402` Nothing covers 15 minutes of the machine's cloud compute (`budget_exceeded`), or the organization is past due (`payment_past_due`).
- `403` Cloud machines are disabled (`cloud_not_enabled`), the organization disallows the GitHub connection (`connector_disabled`), or it needs reconnecting (`connection_expired`).
- `404` `NEXUS_SESSIONS_API` is off.
- `409` No `x-nexus-github-token` header and no `github` connection of your own (`github_connection_required`, with `error.nexus.connect` set to `github`): connect your GitHub account, then start again. Or the machine may not set the repository up (`repo_setup_unavailable`): you cannot read it, or the organization's Nexus GitHub App does not reach it.
- `422` This key names another session (`idempotency_key_reused`); send a new key.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `502` The cloud provider failed or did not answer (`cloud_provider_error`); try again.
- `503` No provider account on this Gateway (`cloud_unavailable`); try again later.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | A field is wrong: `invalid_repo` (not GitHub `owner/name`), `invalid_agent` (not an agent this Gateway runs in cloud sessions), `invalid_model`, `model_required` (no agent and no model), `unknown_model`, `model_coming_soon` or `unsupported_cloud_model` (no cloud agent runs the model), `agent_model_mismatch` (the model runs on another agent; `error.nexus` names `agent`, `model` and `modelAgent`), `invalid_prompt`, `invalid_started_by`, `idempotency_key_required`, or `project_id_unsupported` (`projectId` is reserved). |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 402 | `budget_exceeded` | Nothing covers 15 minutes of the machine's cloud compute (`budget_exceeded`), or the organization is past due (`payment_past_due`). |
| 403 | `role_required` | Your role does not have this permission |
| 404 |  | `NEXUS_SESSIONS_API` is off. |
| 409 |  | No `x-nexus-github-token` header and no `github` connection of your own (`github_connection_required`, with `error.nexus.connect` set to `github`): connect your GitHub account, then start again. Or the machine may not set the repository up (`repo_setup_unavailable`): you cannot read it, or the organization's Nexus GitHub App does not reach it. |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 |  | This key names another session (`idempotency_key_reused`); send a new key. |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 502 |  | The cloud provider failed or did not answer (`cloud_provider_error`); try again. |
| 503 |  | No provider account on this Gateway (`cloud_unavailable`); try again later. |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/sessions" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "<prompt>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fsessions)

## Get session

`GET /v1/sessions/{id}`

Your session: its state, its id on the machine once it started, its lineage and its cloud machine.

Permission: `cloud.machines.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The session's id (`cs_…`), as POST /v1/sessions answered it |

### Responses

- `200` OK (application/json, Session)
  - `id` (string, required): `cs_` and 40 hex characters
  - `repo` (string, required): GitHub `owner/name`, lowercased
  - `agent` (string, required): `claude` or `codex`: a cloud session launches only these two agents today.
  - `model` (string | null, required): The agent's model name; null for its default.
  - `title` (string | null, required): The session's title; null when the start sent none.
  - `state` ("starting" | "running" | "stopped" | "failed", required): `starting`: the machine boots or sets the repository up, or the prompt waits for its host. `running`: the agent started. `stopped` and `failed` are final.
  - `threadId` (string | null, required): The session's id on its machine once the agent started (`t_<uuid>`).
  - `error` (string | null, required): Why it failed, or why the last message may not have reached it.
  - `startedBy` (SessionStartedBy, required): Who started a session. Absent on a start: you (`person`).
    - `kind` ("person" | "assistant_conversation" | "room" | "session", required)
    - `id` (string, required): A user id (yours, for `person`), an assistant conversation's id, a room's id, or a session of yours (`cs_…`).
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required)
  - `stoppedAt` (string (date-time) | null, required): When it stopped or failed.
  - `machine` (CloudMachine | null, required): Its cloud machine; null once the machine is deleted.
  - `fencingToken` (integer, required): The session's current fencing token: 0 until a runner first takes it, then raised by one on each take. [min 0]
  - `runner` (SessionRunner | null, required): The runner that took the session last, and its lease; null until one takes it.
- `404` No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` No provider account on this Gateway (`cloud_unavailable`); try again later.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off. |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | No provider account on this Gateway (`cloud_unavailable`); try again later. |

### Example

```sh
curl "$NEXUS_URL/v1/sessions/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fsessions%2F%7Bid%7D)

## Send session message

`POST /v1/sessions/{id}/messages`

Send the session's agent its next message. It waits for the machine's host, after the messages before it, and a sleeping machine wakes for it (with the wake's limits and charges). A message whose answer the host lost is not sent again: the session's `error` says so.

Permission: `cloud.machines.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The session's id (`cs_…`), as POST /v1/sessions answered it |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

- `text` (string, required): 1 to 100000 characters.

### Responses

- `202` Accepted: the message waits for the machine's host (application/json, Session)
  - `id` (string, required): `cs_` and 40 hex characters
  - `repo` (string, required): GitHub `owner/name`, lowercased
  - `agent` (string, required): `claude` or `codex`: a cloud session launches only these two agents today.
  - `model` (string | null, required): The agent's model name; null for its default.
  - `title` (string | null, required): The session's title; null when the start sent none.
  - `state` ("starting" | "running" | "stopped" | "failed", required): `starting`: the machine boots or sets the repository up, or the prompt waits for its host. `running`: the agent started. `stopped` and `failed` are final.
  - `threadId` (string | null, required): The session's id on its machine once the agent started (`t_<uuid>`).
  - `error` (string | null, required): Why it failed, or why the last message may not have reached it.
  - `startedBy` (SessionStartedBy, required): Who started a session. Absent on a start: you (`person`).
    - `kind` ("person" | "assistant_conversation" | "room" | "session", required)
    - `id` (string, required): A user id (yours, for `person`), an assistant conversation's id, a room's id, or a session of yours (`cs_…`).
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required)
  - `stoppedAt` (string (date-time) | null, required): When it stopped or failed.
  - `machine` (CloudMachine | null, required): Its cloud machine; null once the machine is deleted.
  - `fencingToken` (integer, required): The session's current fencing token: 0 until a runner first takes it, then raised by one on each take. [min 0]
  - `runner` (SessionRunner | null, required): The runner that took the session last, and its lease; null until one takes it.
- `400` `text` is blank or longer than 100000 characters (`invalid_text`).
- `404` No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
- `409` The session stopped or failed (`session_ended`).
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` No provider account on this Gateway (`cloud_unavailable`); try again later.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | `text` is blank or longer than 100000 characters (`invalid_text`). |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off. |
| 409 |  | The session stopped or failed (`session_ended`). |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | No provider account on this Gateway (`cloud_unavailable`); try again later. |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/sessions/<id>/messages" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "<text>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fsessions%2F%7Bid%7D%2Fmessages)

## Stop session

`POST /v1/sessions/{id}/stop`

Stop the session. Before its agent started, it ends now and its machine goes to sleep. After, Gateway asks the machine's host to stop the agent, and the session ends (`stopped`) once it did; the machine then sleeps when idle. A stop of an ended session changes nothing.

Permission: `cloud.machines.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The session's id (`cs_…`), as POST /v1/sessions answered it |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Responses

- `200` OK (application/json, Session)
  - `id` (string, required): `cs_` and 40 hex characters
  - `repo` (string, required): GitHub `owner/name`, lowercased
  - `agent` (string, required): `claude` or `codex`: a cloud session launches only these two agents today.
  - `model` (string | null, required): The agent's model name; null for its default.
  - `title` (string | null, required): The session's title; null when the start sent none.
  - `state` ("starting" | "running" | "stopped" | "failed", required): `starting`: the machine boots or sets the repository up, or the prompt waits for its host. `running`: the agent started. `stopped` and `failed` are final.
  - `threadId` (string | null, required): The session's id on its machine once the agent started (`t_<uuid>`).
  - `error` (string | null, required): Why it failed, or why the last message may not have reached it.
  - `startedBy` (SessionStartedBy, required): Who started a session. Absent on a start: you (`person`).
    - `kind` ("person" | "assistant_conversation" | "room" | "session", required)
    - `id` (string, required): A user id (yours, for `person`), an assistant conversation's id, a room's id, or a session of yours (`cs_…`).
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required)
  - `stoppedAt` (string (date-time) | null, required): When it stopped or failed.
  - `machine` (CloudMachine | null, required): Its cloud machine; null once the machine is deleted.
  - `fencingToken` (integer, required): The session's current fencing token: 0 until a runner first takes it, then raised by one on each take. [min 0]
  - `runner` (SessionRunner | null, required): The runner that took the session last, and its lease; null until one takes it.
- `404` No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` No provider account on this Gateway (`cloud_unavailable`); try again later.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off. |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | No provider account on this Gateway (`cloud_unavailable`); try again later. |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/sessions/<id>/stop" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fsessions%2F%7Bid%7D%2Fstop)

## Take session runner

`POST /v1/sessions/{id}/runner`

Take the session as its runner: the desktop app, nexus-host or a cloud machine that runs its agent. The runner gets the session's next fencing token and a lease of 60 seconds, which it renews every 20 seconds (POST /v1/sessions/{id}/runner/renew). Without `seenToken`, the take succeeds only when no runner's lease is live: the first take, or a takeover after the lease passed. With `seenToken` (the session's `fencingToken` as you read it), it is a handoff: it takes the session from whoever holds it, while that is still the session's token. Each take raises the token by one, so the runner it replaced gets 409 `lost_runner` on its next renewal or connector write. Of two takes at once, one wins and the other gets 409 `takeover_conflict`.

Permission: `cloud.machines.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The session's id (`cs_…`), as POST /v1/sessions answered it |

### Request body (application/json, required)

- `runnerId` (string, required): Who takes the session: a name of the runner's own, such as its device id. [min length 1; max length 200]
- `seenToken` (integer | null): The session's `fencingToken` as you read it: take the session over from its holder (a handoff) while that is still its token. [min 0]

### Responses

- `200` OK (application/json, SessionRunner)
  - `runnerId` (string, required): The runner, as it named itself when it took the session.
  - `fencingToken` (integer, required): The token the runner holds. Its connector writes inside the session send it in `x-nexus-fencing-token`. [min 1]
  - `leaseExpiresAt` (string (date-time), required): When the lease ends unless the runner renews it. After it, another runner may take the session without `seenToken`.
- `400` `invalid_runner_id` or `invalid_token`. (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `404` No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off. (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `409` `takeover_conflict`: another runner's lease is live and the take named no `seenToken`, or the token you saw is no longer the session's (`error.nexus.currentFencingToken`). `session_ended`: the session stopped or failed. (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` No provider account on this Gateway (`cloud_unavailable`); try again later. (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | `invalid_runner_id` or `invalid_token`. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off. |
| 409 |  | `takeover_conflict`: another runner's lease is live and the take named no `seenToken`, or the token you saw is no longer the session's (`error.nexus.currentFencingToken`). `session_ended`: the session stopped or failed. |
| 409 | `lost_runner` | Each take raises the token by one, so the runner it replaced gets 409 `lost_runner` on its next renewal or connector write |
| 409 | `takeover_conflict` | Of two takes at once, one wins and the other gets 409 `takeover_conflict` |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | No provider account on this Gateway (`cloud_unavailable`); try again later. |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/sessions/<id>/runner" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "runnerId": "<runnerId>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fsessions%2F%7Bid%7D%2Frunner)

## Renew session runner

`POST /v1/sessions/{id}/runner/renew`

Renew the runner's lease for 60 seconds more. Only the holder of the session's current fencing token renews; a lease that passed renews too while no other runner took the session. Send it without `Idempotency-Key`: a retry has the same effect while the token is current. A key, when sent, is kept and replayed as on any write.

Permission: `cloud.machines.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The session's id (`cs_…`), as POST /v1/sessions answered it |

### Request body (application/json, required)

- `fencingToken` (integer, required): The token the runner got when it took the session. [min 1]

### Responses

- `200` OK (application/json, SessionRunner)
  - `runnerId` (string, required): The runner, as it named itself when it took the session.
  - `fencingToken` (integer, required): The token the runner holds. Its connector writes inside the session send it in `x-nexus-fencing-token`. [min 1]
  - `leaseExpiresAt` (string (date-time), required): When the lease ends unless the runner renews it. After it, another runner may take the session without `seenToken`.
- `400` The body is not `{ fencingToken }`. (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `404` No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off. (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `409` `lost_runner`: another runner took the session, so stop running it and stop writing for it (`error.nexus.currentFencingToken`). `session_ended`: the session stopped or failed. (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` No provider account on this Gateway (`cloud_unavailable`); try again later. (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | The body is not `{ fencingToken }`. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off. |
| 409 |  | `lost_runner`: another runner took the session, so stop running it and stop writing for it (`error.nexus.currentFencingToken`). `session_ended`: the session stopped or failed. |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | No provider account on this Gateway (`cloud_unavailable`); try again later. |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/sessions/<id>/runner/renew" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fencingToken": 1
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fsessions%2F%7Bid%7D%2Frunner%2Frenew)
