PLATINUM DOCS

CLI

The pt command. Manage sandboxes, templates, volumes, apps, and webhooks from your terminal.

The Platinum CLI is the pt command. It creates sandboxes, builds templates, and manages volumes, apps, and webhooks. Use it for interactive work, scripts, and CI.

npm install -g @platinum-dev/cli
pt init
pt sandbox create -t pt-base

Authenticate

pt login mints an API key in your browser and passes it to the CLI. The CLI stores the API key in your OS keychain. Without a keychain, it uses ~/.config/platinum/credentials.

CommandWhat it does
pt initFirst-run setup. Logs in if needed and prints next steps. Idempotent.
pt loginBrowser flow: approve in the dashboard, and the key returns to the CLI. --no-browser pastes a key instead. --token pt_live_… skips the browser.
pt logoutRemove stored credentials for the current profile.
pt configure --token pt_live_… [--region r]Set an API key and defaults without prompts. Verifies the key before it saves.
pt whoamiShow user, org, role, key source, and enabled features.

In CI, set the API key in the environment. The environment wins over stored credentials and never touches disk.

export PLATINUM_API_KEY=pt_live_…

Mint scoped API keys for automation: pt key create --name ci --scope sandboxes:read --expires-in 30. See API keys.

Global flags and environment variables

Every command accepts these flags, before or after the subcommand.

FlagMeaning
-o, --output table|json|yamlOutput format (default table).
-q, --quietMinimal output — pt sandbox create -q prints only the id.
--profile <name>Named profile to use.
--api-url <url>Override the API base URL.
--no-inputNever prompt (CI).
--debugLog HTTP to stderr.
Env varMeaning
PLATINUM_API_KEYAPI key. Wins over stored credentials (PT_TOKEN also honored).
PLATINUM_PROFILEProfile to use.
PLATINUM_API_URLAPI base URL (PT_API_URL also honored).
PLATINUM_OUTPUTDefault output format.
PLATINUM_REGIONDefault region.
PLATINUM_WEB_URLDashboard origin for pt login and pt open.

Precedence everywhere: flag > env > profile > default. Tables honor NO_COLOR.

Switch profiles

Non-secret settings live in ~/.config/platinum/config.toml as named profiles. Each profile carries its own org-scoped API key. Use one profile per org to switch accounts.

CommandWhat it does
pt config getResolved settings for the current profile.
pt config listList profiles (default marked).
pt config use <profile>Switch the default profile.
pt config set <key> <value>Set url | web | region | output per profile.
pt login --profile staging --api-url https://api.staging.example.com
pt config use staging

Manage sandboxes

See Sandboxes, Exec, Filesystem, Snapshots, and Networking.

Create, inspect, and control

Run commands and move files

Snapshot and clone

CommandWhat it does
pt sandbox snapshot <id>Point-in-time disk snapshot of a running sandbox.
pt sandbox snapshots <id>List its snapshots.
pt sandbox snapshot-rm <id> <snap>Delete one snapshot.
pt sandbox restore <id> [--snapshot id] [--no-wait] [--timeout s]Roll a sandbox back to a snapshot (latest by default). Waits for running.
pt sandbox fork <id>Fork a running sandbox into a new one.
pt sandbox clone <id> [--snapshot id]New sandbox from the latest (or a given) snapshot.
pt sandbox backup <id>Back up a running sandbox's filesystem off-host.
pt sandbox restore-from-backup <id>Cold-boot the sandbox from its latest backup.

Build templates

See Templates.

CommandWhat it does
pt template build <name> --image <ref> [--entrypoint cmd]Build from an image.
pt template build <name> --repo <url> [--ref r] [--subdir d] [--dockerfile f] [--token t]Build from a git repo's Dockerfile. Requires the apps feature for your org.
pt template list / get <id>List / show templates.
pt template update <id> [--version v] [--cpu N] [--ram MB] [--disk GB] [--entrypoint cmd]Update version or sandbox defaults. Rebuild to change the image.
pt template rm <id>Delete.

Build flags: --cpu, --ram, and --disk set the template's sandbox defaults. --size-mb caps the rootfs. --region pins the build. --wait blocks until ready (--timeout, default 1800 s).

Manage volumes

pt volume is feature-gated per org. If the API reports the feature is not enabled, it is not available for your org yet. See Volumes.

CommandWhat it does
pt volume create --size <GB> [--mount-path p] [--sandbox id] [--host id]Create a volume. Pin to a sandbox (hot-attaches if running) or a host.
pt volume attach <id> --sandbox <id> [--mount-path p]Attach a volume to a running sandbox on the same host.
pt volume detach <id>Detach a volume from its sandbox.
pt volume list / get <id> / rm <id>List / show / delete.

Deploy apps

pt app is feature-gated per org. Apps deploy an image behind a public URL — on-demand, with releases and rollback.

CommandWhat it does
pt app create <slug> --image <ref> --port <n> [--health-path /] [--env K=V,…] [--cpu N] [--ram MB] [--region r]Create an app from an image. Git-source apps: pt api POST /v1/apps.
pt app deploy <id>Trigger a new deployment.
pt app deployments <id>Release history.
pt app rollback <id> [--release n]Roll back (default: the previous release).
pt app logs <id>Recent logs.
pt app open <id>Open the app URL in the browser.
pt app start|stop|restart <id>Lifecycle.
pt app list / get <id> / rm <id>List / show / delete.

Manage keys and webhooks

See API keys and Webhooks.

View billing and audit

See Billing and Audit log. Both read org-scoped data. Limits and the audit log are owner/admin only.

CommandWhat it does
pt billing accountShow the org account — plan, credits, status.
pt billing usageCurrent billing-period usage.
pt billing ledger [--limit n]Credit ledger entries — top-ups and charges.
pt billing limitsShow usage limits.
pt billing limits [--limit USD] [--alert USD]Set the monthly limit or alert threshold. Empty string clears one.
pt audit list [--action prefix] [--actor id] [--status s] [--limit n]List audit-log events (owner/admin only). Filter by action prefix, actor, or status.

Wire up an AI agent

pt mcp runs a stdio MCP server and adds it to your coding agent's config. See AI agents for the tool list and scoping.

CommandWhat it does
pt mcp init <claude|cursor|windsurf>Merge the server into the agent's MCP config (backs up to .bak; writes no token).
pt mcp config [--with-token]Print the config snippet. --with-token embeds a plaintext key for clients that cannot read the keychain.
pt mcp start [--readonly] [--permissions <groups>] [--sandbox <id>]Run the server on stdio. Agents launch this; you rarely run it by hand.

Call any endpoint

pt api reaches the entire REST API. Anything without a dedicated command is one request away.

pt api /v1/sandboxes
pt api POST /v1/sandboxes -d '{"template":"pt-base","cpu":2}'
pt api /v1/sandboxes/<id>/metrics -o yaml
CommandWhat it does
pt api [METHOD] <path> [-d json|@file|-] [--query "k=v&k2=v2"]Authenticated request to any endpoint. GET by default (POST when -d is given).
pt openOpen the dashboard.
pt completion bash|zsh|fishShell completion script (top-level commands).
pt update [--dry-run]Update the CLI to the latest version (upgrade works too).

Full flags for any command: pt <cmd> --help.

Put it together

Create → run → serve. setsid keeps the server alive after exec returns.

SBX=$(pt sandbox create -t pt-base -q)
pt sandbox cp ./server.sh $SBX:/workspace/server.sh
pt sandbox exec $SBX 'setsid sh /workspace/server.sh >/tmp/server.log 2>&1 </dev/null &'
URL=$(pt sandbox expose $SBX 8080)
curl "$URL"

Custom template → sandbox. Build once, create many.

pt template build py312 --image python:3.12-slim --wait
SBX=$(pt sandbox create -t py312 -q)
pt sandbox exec $SBX 'python3 -V'

Scripting / CI. Scoped API key via env, JSON output into jq.

export PLATINUM_API_KEY=pt_live_…
pt sandbox list --state running -o json | jq -r '.[].id'
pt sandbox exec "$SBX" 'make test' || echo "tests failed with $?"