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

# Find an SDK or CLI Call

> Find the Python, TypeScript, or CLI call for a sandbox task.

Python and TypeScript share method names unless a row says otherwise. The CLI has
top-level commands for the common calls; everything else is `boxrouter api GROUP OPERATION`. For a
full program, see the [quickstart](https://boxrouter.ai/docs/quickstart.md).

## Sandboxes

| Task | Python | TypeScript | CLI |
| - | - | - | - |
| [Create](https://boxrouter.ai/docs/sandboxes.md) | `client.sandboxes.create(...)` | `client.sandboxes.create({...})` | `boxrouter create` |
| [Check routing](https://boxrouter.ai/docs/routing.md) | `client.sandboxes.match(...)` | `client.sandboxes.match({...})` | `boxrouter match` |
| Read state | `client.sandboxes.get(id)`, then `box.state` | `client.sandboxes.get(id)`, then `box.state` | `boxrouter get ID` |
| Read again | `box.refresh()` | `await box.refresh()` | `boxrouter get ID` |
| List | `client.sandboxes.list(label=[...])` | `client.sandboxes.list({ label: [...] })` | `boxrouter api sandboxes list` |
| [Destroy](https://boxrouter.ai/docs/lifecycle.md) | `box.destroy()` | `box.destroy()` | `boxrouter destroy ID` |
| [Pause](https://boxrouter.ai/docs/pause-resume.md) | `box.pause()` | `box.pause()` | `boxrouter api sandboxes pause ID` |
| [Resume](https://boxrouter.ai/docs/pause-resume.md) | `box.resume()` | `box.resume()` | `boxrouter api sandboxes resume ID` |
| [Extend](https://boxrouter.ai/docs/pause-resume.md#extend-the-lifetime) | `box.extend(lifetime_seconds=1800)` | `box.extend({ lifetime_seconds: 1800 })` | `boxrouter api sandboxes extend ID` |
| [Open a preview](https://boxrouter.ai/docs/connect.md#open-a-preview) | `box.previews.open(3000)` | `box.previews.open(3000)` | `boxrouter preview ID 3000` |

`pause` and `resume` work only on a sandbox created with the `pause_resume` requirement, `extend` only with `resources.extendable_lifetime`, and `previews.open` only for a port the `previews` requirement named. On any other sandbox, the call fails with `not_named`.
`get` reads state and nothing else: a paused sandbox stays paused and its lifetime is not extended. Call `resume` to wake it.

## Commands

| Task | Python | TypeScript | CLI |
| - | - | - | - |
| [Run Bash](https://boxrouter.ai/docs/commands.md) | `box.exec(command)` | `box.exec(command)` | `boxrouter exec ID COMMAND` |
| [Start a background process](https://boxrouter.ai/docs/processes.md) | `box.processes.start(command)` | `box.processes.start(command)` | `boxrouter process start ID COMMAND` |
| [Open a terminal](https://boxrouter.ai/docs/connect.md) | `sandbox.open_terminal()` | `sandbox.openTerminal()` | `boxrouter terminal ID` |

## Files

| Task | Python | TypeScript | CLI |
| - | - | - | - |
| [Read bytes](https://boxrouter.ai/docs/files.md) | `box.files.read(path)` | `box.files.read(path)` | `boxrouter read ID --path PATH` |
| [Write bytes](https://boxrouter.ai/docs/files.md) | `box.files.write(path, data)` | `box.files.write(path, data)` | `boxrouter write ID --path PATH --body FILE` |
| [Upload a file to a Volume](https://boxrouter.ai/docs/volumes.md#move-files-in-and-out) | `client.volumes.upload(volume_id, local, path)` | `client.volumes.upload(volumeId, local, path)` | `boxrouter volumes put VOLUME_ID LOCAL PATH` |
| [Download a file from a Volume](https://boxrouter.ai/docs/volumes.md#move-files-in-and-out) | `client.volumes.download(volume_id, path, local)` | `client.volumes.download(volumeId, path, local)` | `boxrouter volumes get VOLUME_ID PATH LOCAL` |
| [List a directory](https://boxrouter.ai/docs/files.md#manage-directories) | `box.files.list(path)` | `box.files.list(path)` | `boxrouter api files list ID --path PATH` |
| [Make a directory](https://boxrouter.ai/docs/files.md#manage-directories) | `box.files.mkdir(path, parents=True)` | `box.files.mkdir(path, { parents: true })` | `boxrouter api files mkdir ID --body '{"path": "PATH", "parents": true}'` |
| [Test a path](https://boxrouter.ai/docs/files.md#manage-directories) | `box.files.exists(path)` | `box.files.exists(path)` | `boxrouter api files exists ID --path PATH` |
| [Remove a path](https://boxrouter.ai/docs/files.md#manage-directories) | `box.files.remove(path, recursive=True)` | `box.files.remove(path, { recursive: true })` | `boxrouter api files remove ID --body '{"path": "PATH", "recursive": true}'` |

`read` returns and `write` accepts `bytes` in Python and `Uint8Array` in TypeScript. The CLI prints read results to stdout. For writes, it reads the content from the local file named by `--body`.

## Names That Follow a Rule

| Topic | Python | TypeScript | CLI |
| - | - | - | - |
| Requirements that need no settings | `requirements=["pause_resume"]` | `requirements: ['pause_resume']` | `--require pause_resume` |
| Operations not listed | `client.api.GROUP.OPERATION(...)` | `client.api.GROUP.OPERATION(...)` | `boxrouter api GROUP OPERATION` |
| SDK method and option casing | `snake_case`, as in `save_volume` | `camelCase`, as in `saveVolume` | Not applicable |
| Command options `env`, `cwd`, `timeout_seconds` | Keyword arguments | A second argument | `--env`, `--cwd`, `--timeout-seconds` |
| Idempotency key | `idempotency_key=` | `idempotencyKey` in the options argument | `--idempotency-key` |
| Resends of a `retry: safe` error | `max_retries=` on the client (default 2) | `maxRetries` in the client options (default 2) | Always 2 |

The [API reference](https://boxrouter.ai/docs/api-overview.md) lists the operation groups. Request fields keep the API's `snake_case` in both SDKs, for example `timeout_seconds`. [Recover from Errors](https://boxrouter.ai/docs/errors.md) says when to set an idempotency key.

In TypeScript, await promise-returning methods and use `for await` for async generators; `get` returns the sandbox handle. In Python's `AsyncBoxRouter`, await `open_terminal()` and use `async for` with `terminal.output()`; `launch` also supports `async with`.

## Next Steps

> [card] [Use the Python SDK](https://boxrouter.ai/docs/python.md)
>
> Install and configure the Python SDK.

> [card] [Use the TypeScript SDK](https://boxrouter.ai/docs/typescript.md)
>
> Install and configure the TypeScript SDK.

> [card] [Use the CLI](https://boxrouter.ai/docs/cli.md)
>
> Install and use the CLI.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.