# API reference

Base URL: `https://api.phoenix.so`. OpenAPI document: https://getrush.ai/openapi.json

## Sessions

Start, list, read and steer sessions. A session is one agent run in its own sandbox.

- [List sessions](https://getrush.ai/docs/api/list-sessions.md): `GET /o/{org}/sessions`
- [Start a session](https://getrush.ai/docs/api/create-session.md): `POST /o/{org}/sessions`
- [Get one session](https://getrush.ai/docs/api/get-session.md): `GET /o/{org}/sessions/{session}`
- [Cancel a session](https://getrush.ai/docs/api/cancel-session.md): `POST /o/{org}/sessions/{session}/cancel`
- [Start a session (console, by Project)](https://getrush.ai/docs/api/create-project-session.md): `POST /o/{org}/p/{project}/sessions`
- [List the turns of a session](https://getrush.ai/docs/api/list-turns.md): `GET /o/{org}/p/{project}/sessions/{session}/turns`
- [Get one turn](https://getrush.ai/docs/api/get-turn.md): `GET /o/{org}/p/{project}/sessions/{session}/turns/{turn}`

## Events

Follow a session live over server-sent events, or read its log.

- [Follow a session live](https://getrush.ai/docs/api/stream-session.md): `GET /o/{org}/sessions/{session}/events`

## Messages

Read a session's transcript and tool calls, and send it follow-ups.

- [Read a session's transcript](https://getrush.ai/docs/api/get-session-messages.md): `GET /o/{org}/sessions/{session}/messages`
- [Send a follow-up](https://getrush.ai/docs/api/post-session-message.md): `POST /o/{org}/sessions/{session}/messages`

## Results & artifacts

The answer, changed files, captured transcript and files a session produced.

- [Download one artifact](https://getrush.ai/docs/api/get-session-artifact.md): `GET /o/{org}/sessions/{session}/artifacts/{name}`
- [List the files the session's pull request changed](https://getrush.ai/docs/api/get-session-changes.md): `GET /o/{org}/p/{project}/sessions/{session}/changes`
- [List the files a session produced](https://getrush.ai/docs/api/list-session-artifacts.md): `GET /o/{org}/p/{project}/sessions/{session}/artifacts`

## Secrets

Values a session uses without them appearing in a response. Every secret belongs to one Project and reaches every session in it.

- [List the org's Project secrets, without values.](https://getrush.ai/docs/api/list-secrets.md): `GET /o/{org}/secrets`
- [Save a secret. The value is sealed and never returned.](https://getrush.ai/docs/api/create-secret.md): `POST /o/{org}/secrets`
- [Replace a secret's value or note, or a sign-in's site.](https://getrush.ai/docs/api/update-secret.md): `PATCH /o/{org}/secrets/{secret}`
- [Delete a secret. A session that names it afterwards fails instead of starting without it.](https://getrush.ai/docs/api/delete-secret.md): `DELETE /o/{org}/secrets/{secret}`

## API keys

API keys for server-to-server calls, and the webhook each key delivers to.

- [List the org's API keys](https://getrush.ai/docs/api/list-api-keys.md): `GET /o/{org}/api-keys`
- [Create an API key](https://getrush.ai/docs/api/create-api-key.md): `POST /o/{org}/api-keys`
- [Set, change or remove the key's webhook](https://getrush.ai/docs/api/update-api-key-webhook.md): `PATCH /o/{org}/api-keys/{key}`
- [Revoke an API key](https://getrush.ai/docs/api/revoke-api-key.md): `DELETE /o/{org}/api-keys/{key}`
- [Rotate an API key's secret](https://getrush.ai/docs/api/rotate-api-key.md): `POST /o/{org}/api-keys/{key}/rotate`

## Agents & models

The harnesses, models, apps and MCP servers an org can run.

- [List the harnesses, models and connectors the org can run](https://getrush.ai/docs/api/get-agents-available.md): `GET /o/{org}/agents/available`

## Webhooks

Requests Rush sends to your server.

- [A run started with an API key finished a turn](https://getrush.ai/docs/api/run-finished.md): `webhook`

## Projects

Projects tie a repository to its runs and connectors.

- [List the org's Projects](https://getrush.ai/docs/api/list-projects.md): `GET /o/{org}/p`
- [Create a Project in this org, or import a template](https://getrush.ai/docs/api/create-project.md): `POST /o/{org}/p`
- [Get a Project by handle or id](https://getrush.ai/docs/api/get-project.md): `GET /o/{org}/p/{project}`
- [List automations across the org's Projects.](https://getrush.ai/docs/api/list-org-automations.md): `GET /o/{org}/automations`
- [List the Project's automations.](https://getrush.ai/docs/api/list-automations.md): `GET /o/{org}/p/{project}/automations`
- [Create an automation.](https://getrush.ai/docs/api/create-automation.md): `POST /o/{org}/p/{project}/automations`
- [Get one automation.](https://getrush.ai/docs/api/get-automation.md): `GET /o/{org}/p/{project}/automations/{automation}`
- [Edit an automation.](https://getrush.ai/docs/api/update-automation.md): `PATCH /o/{org}/p/{project}/automations/{automation}`
- [Delete an automation and its triggers.](https://getrush.ai/docs/api/delete-automation.md): `DELETE /o/{org}/p/{project}/automations/{automation}`
- [Add a trigger to an automation.](https://getrush.ai/docs/api/create-automation-trigger.md): `POST /o/{org}/p/{project}/automations/{automation}/triggers`
- [Edit a trigger.](https://getrush.ai/docs/api/update-automation-trigger.md): `PATCH /o/{org}/p/{project}/automations/{automation}/triggers/{trigger}`
- [Remove a trigger.](https://getrush.ai/docs/api/delete-automation-trigger.md): `DELETE /o/{org}/p/{project}/automations/{automation}/triggers/{trigger}`
- [Rotate a webhook trigger's secret.](https://getrush.ai/docs/api/rotate-automation-trigger-secret.md): `POST /o/{org}/p/{project}/automations/{automation}/triggers/{trigger}/secret`
- [Read one Community Project, with no credential](https://getrush.ai/docs/api/get-public-community-project.md): `GET /community/projects/{project}`
- [List Community Projects, with no credential](https://getrush.ai/docs/api/list-public-community-projects.md): `GET /community/projects`

## Billing

The caller's plan, usage, spend limit and Stripe sessions.

- [Get the caller's plan usage for the current period and the plan catalog.](https://getrush.ai/docs/api/get-org-billing.md): `GET /o/{org}/billing`

## GitHub

The GitHub App installations and repositories runs can use.

- [List the GitHub App installations the caller can use and their repositories.](https://getrush.ai/docs/api/get-github-connection.md): `GET /o/{org}/github`

## Saved agents

Reusable agent setups (harness, model, tools and connections), revisioned.

- [List saved agents you can use, newest first.](https://getrush.ai/docs/api/list-saved-agents.md): `GET /o/{org}/agents`
- [Save an agent.](https://getrush.ai/docs/api/create-saved-agent.md): `POST /o/{org}/agents`
- [Get a saved agent you can use.](https://getrush.ai/docs/api/get-saved-agent.md): `GET /o/{org}/agents/{agent}`
- [Edit a saved agent.](https://getrush.ai/docs/api/update-saved-agent.md): `PATCH /o/{org}/agents/{agent}`
- [Delete a saved agent.](https://getrush.ai/docs/api/delete-saved-agent.md): `DELETE /o/{org}/agents/{agent}`
- [List the accounts and MCP servers connected to one agent made from a template.](https://getrush.ai/docs/api/list-agent-connections.md): `GET /o/{org}/agents/{agent}/connections`
- [Start a sign-in that connects an account or MCP server to one agent.](https://getrush.ai/docs/api/create-agent-connection.md): `POST /o/{org}/agents/{agent}/connections`
- [Read one of an agent's connections, or the sign-in that makes it.](https://getrush.ai/docs/api/get-agent-connection.md): `GET /o/{org}/agents/{agent}/connections/{connection}`
- [Disconnect one of an agent's connections, or cancel its sign-in.](https://getrush.ai/docs/api/delete-agent-connection.md): `DELETE /o/{org}/agents/{agent}/connections/{connection}`
- [Read one agent listed in Community](https://getrush.ai/docs/api/get-community-agent.md): `GET /o/{org}/agents/community/{agent}`
- [List the agents companies listed in Community](https://getrush.ai/docs/api/list-community-agents.md): `GET /o/{org}/agents/community`
- [Read one Community agent, with no credential](https://getrush.ai/docs/api/get-public-community-agent.md): `GET /community/agents/{agent}`
- [List Community agents, with no credential](https://getrush.ai/docs/api/list-public-community-agents.md): `GET /community/agents`

## Attachments

Files uploaded to attach to a run.

- [Download one file the session was given](https://getrush.ai/docs/api/get-session-attachment.md): `GET /o/{org}/sessions/{session}/attachments/{id}`
- [Get an upload URL for each file of a session's input.](https://getrush.ai/docs/api/create-files.md): `POST /o/{org}/files`

## Devices

Your own computers, which a run you start can use with your approval.

- [Remove one of your computers and disconnect it.](https://getrush.ai/docs/api/remove-device.md): `DELETE /me/devices/{name}`
- [List your linked computers.](https://getrush.ai/docs/api/list-devices.md): `GET /me/devices`

## Session lifecycle

- Starting: `queued` (Accepted; waiting for a run slot.), `allocating` (Its sandbox is being prepared.)
- Working: `running` (The agent is working.)
- Turn ended: `completed` (The turn finished with an answer.), `paused` (A resumable session parked between turns; costs nothing.), `input_required` (The agent asked a question; send a follow-up.), `needs_review` (Finished without the proof it was asked for.)
- Stopped: `failed` (The run stopped on an error.), `cancelling` (You cancelled it; its sandbox is still being released.), `cancelled` (You cancelled it.), `expired` (A parked sandbox passed 7 idle days and was removed.)

## Authentication

Send `Authorization: Bearer <token>` on every request.

- `bearerAuth`: An API key (`rk_live_…`, from POST /o/{org}/api-keys), which acts as the member who created it, in its own org, on the routes marked `x-audience: public`; or a signed-in Phoenix ID session, as the console and the `rush` CLI send.

## Errors

Every error is JSON with a stable `code` and a `message`. Every code: https://getrush.ai/docs/api/errors.md

## Limits and concurrency

A key runs at most `max_concurrent` sessions at once (4 unless you set it when creating the key, up to 100). One more is created `queued` and starts, oldest first, when one of the key's slots frees (a parked sandbox holds none); it never holds up your other keys or the console.

A running session queues at most 20 follow-ups; one more answers `429` with `QUEUE_FULL`.

Past your account's first $1, a key's runs on Rush's models are paid from prepaid credits, and stop with `402` at $0. A spend limit set in Billing caps how much of the credits they use in a period.

## Pagination

List operations take `limit` (integer, default 50, at most 500) and `cursor`: pass the previous response's `next_cursor` to get the next page.
