Recommended flow
- Create a Box API key with
box api-key createor in the dashboard. - Create a box with
POST /boxes, or resume/fork an existing box when the user is continuing prior work. - Poll
GET /boxes/{boxId}until the box isreadyoridle. - Queue work with
POST /boxes/{boxId}/prompt. - Read
GET /boxes/{boxId}/eventswhile work is running. - Use
POST /boxes/{boxId}/desktopwhen the user or your support team needs live computer-use visibility. - Stop/archive, resume, fork, or delete the box according to your retention policy.
host and lux, package installs, or your own scripts, is driven through POST /boxes/{boxId}/commands. For high-frequency or streaming control, run your own daemon in the box; see the daemon pattern.
Base URL
Authentication
Pass a Box API key as a bearer token on API requests:box api-key CLI command or in the Box dashboard. For key lifecycle guidance, see API Keys.
Updating PATCH /account/data-retention is the exception: it requires an interactive Box session and refuses API keys. Per-Box keys are restricted to their Box; use an account service key for account-wide reads.
Response envelope
Every v1 JSON response has an explicit success discriminator:Error model
HTTP status remains authoritative. Error bodies also use a structured JSON envelope:Idempotent box creation
POST /boxes and POST /boxes/{boxId}/fork each provision a new box that bills on success, so a lost response (timeout or 5xx after the box was already accepted) leaves you unsure whether to retry. Send an Idempotency-Key header with your own account-unique value (a UUID) to make create and fork safe to retry: the first request creates the box and binds it to the key; every retry with the same account, key, and request body returns that same box instead of a second, billable one.
Keys are retained for 24 hours, and are scoped to your account (two accounts can use the same key value with no collision). Omit the header to keep the default (non-idempotent) behavior. The header is optional on every SDK’s create and fork call (
Idempotency-Key / idempotencyKey); see Create box and Fork box.
Box lifecycle
A Box moves through these states:idle and running only reflect work queued through POST /boxes/{boxId}/prompt. Processes you run yourself, over SSH or the command endpoint, do not change the state: a box can show idle while your own agent works inside it.Providers, models, and reasoning
POST /boxes/{boxId}/prompt accepts the same providers Box uses in the dashboard. The API accepts codex and claude-code; claude is accepted as an alias for claude-code by the current backend, but claude-code is the canonical value to store in integrations.
Model ids come from the same catalog used by the dashboard model selector. If you omit model, Box uses the user’s saved dashboard default for that provider. Prefer the listed model ids for predictable behavior.
Use the dashboard’s provider setup page to configure credentials before prompting. If credentials are missing, the API returns
provider_not_configured with a setup URL.
Request examples
These are raw HTTP. Every one of them has a CLI, TypeScript and Python equivalent on the feature page it belongs to: Snapshots, Environments, Webhooks, Data retention, Desktop, Hosting. The CLI reference maps commands to endpoints. Set shared variables:202, and cannot be canceled:
GET /deletion-operations/{operationId} until status is completed. See Data retention and deletion.