Sandbox API
Workspace-authenticated sandbox and account routes at api.tachyonic.sh.
Base origin: https://api.tachyonic.sh. Management routes below use /v1.
The platform API also serves its existing /api/v1 routes.
Authentication
Send a workspace-bound key in x-api-key. Create keys in
Settings > API Keys, with only
the scopes the caller needs:
sandbox:readfor list, detail, events, usage, and file reads.sandbox:writefor create, exec, shell, file writes, resume, and delete.usage:readfor organization usage and workspace budget reads.budget:writeto change the workspace budget.
The service resolves the workspace from the key. A caller cannot select another workspace by sending identity headers. A revoked key fails its next request. See Authentication for device login and key handling.
This Python example reads the key in-process from an existing secret environment. It does not put the key in command arguments or a URL:
import json
import os
from urllib.request import Request, urlopen
request = Request(
"https://api.tachyonic.sh/v1/whoami",
headers={"x-api-key": os.environ["TACHYONIC_API_KEY"]},
)
with urlopen(request, timeout=30) as response:
identity = json.load(response)
print({name: identity[name] for name in ("org_id", "workspace_id", "scopes")})Sandbox routes
| Method | Path | Purpose |
|---|---|---|
POST | /v1/sandboxes | Create; returns a sandbox record |
GET | /v1/sandboxes | List the workspace's sandboxes |
GET | /v1/sandboxes/{id} | State, placement, digests, and usage |
DELETE | /v1/sandboxes/{id} | Stop and remove; the record remains |
POST | /v1/sandboxes/{id}/resume | Resume a paused sandbox when supported |
POST | /v1/sandboxes/{id}/exec | Run a command; server-sent output events |
GET | /v1/sandboxes/{id}/pty | Interactive terminal over WebSocket |
GET, PUT | /v1/sandboxes/{id}/files | Read or write a file |
GET | /v1/sandboxes/{id}/events | Lifecycle, command, and budget events |
GET | /v1/sandboxes/{id}/usage | Metered quantities and estimated cost |
Create
The create body accepts image, region, provider, isolation, cpu,
memory_mib, disk_gib, timeout in seconds, budget_usd, egress, env,
name, metadata, wait, and on_interruption where supported. Check pool
capabilities before requesting interruption behavior.
{
"image": "tachyonic.sh/base",
"isolation": "container",
"cpu": 1,
"memory_mib": 1024,
"timeout": 1800,
"egress": {"policy": "allowlist", "allow": ["api.example.com"]}
}Creation can require capacity to start. Use the returned record and readiness state before issuing commands. Container isolation shares the host kernel; an explicit isolation requirement is refused if matching capacity is unavailable.
Account routes
| Method | Path | Purpose |
|---|---|---|
GET | /v1/whoami | Organization, workspace, and scopes |
GET | /v1/keys | Accessible key metadata |
GET | /v1/usage?month=YYYY-MM | Organization cost, credits, and billable usage |
GET | /v1/budgets | Workspace budget and current spending |
PUT, DELETE | /v1/budgets/workspace | Set or remove a budget; requires budget:write |
GET | /v1/regions | Regions and available sandbox pools |
Budget updates use monthly_usd and an action of stop or alert.
Device-login keys cannot change budgets.
Errors
Sandbox errors carry a machine-readable code and message. Authentication errors can be refused before the sandbox handler is reached.
| HTTP | Meaning |
|---|---|
400 | Invalid request, size, or egress policy |
401 | Missing, invalid, expired, or revoked credential |
403 | Missing scope, plan limit, budget, or access restriction |
404 | No resource accessible in this workspace |
409 | Matching capacity unavailable |
429 | Concurrent sandbox limit reached |
503 | Sandboxes disabled or temporarily unavailable |
Use the CLI for the corresponding command and exit-code contract.