CLI

Install the briq CLI, sign in with a link or an API key, and run the MCP tools from a terminal or a script.

npm install -g @briq-cloud/cli
briq login
briq run postgres --sleep 2h

The CLI calls the REST API. Most commands match an MCP tool with the same options: briq_exec is briq exec, briq_set_sleep is briq set-sleep. Agents use the MCP server; the CLI is for you, your scripts, git hooks and CI. It needs Node 22.6 or later.

Sign in

briq login
Open this link to sign in, then pick the team and budget for the briq CLI:

  https://app.briq.cloud/connect?user_code=WDJBMJHT

Approve only if the page shows the code WDJBMJHT.
  1. Open the link on any device, sign in, pick the team and the budget, and approve.
  2. The CLI shows the team and budget, and saves the sign-in.

The CLI's sign-in is listed on the dashboard's Agents & CLI page, where you revoke it. It stays signed in while you use it at least once every two weeks.

With an API key

briq login --key bq_live_…
cat key.txt | briq login --key
export BRIQ_API_KEY=bq_live_…     # CI, containers, agents

Create the key on the dashboard's API keys page. BRIQ_API_KEY wins over a saved sign-in.

For a sandbox credential, set BRIQ_API_KEY and use the exact sandbox ID. Only direct command, command-result/cancellation and file commands are supported. login --key, whoami, quota and status need a team credential. Read safe status through REST instead.

Who am I

briq whoami
team    Acme (acme), plan pro
as      briq CLI (signed in by link)
budget  … a day, 3 briqs at once, sizes nano, small
api     https://api.briq.cloud (production)

briq logout forgets the sign-in on this machine and prints its dashboard page. Revoke browser sign-ins on Agents & CLI, or keys on API keys. Run briq logout before signing in again.

Commands

The full command table assumes a team credential. See the sandbox credential support matrix.

Where a command takes a <briq>, give its id (bq_…) or its name. A name must belong to exactly one live briq of the team: when two stacks share it, the command lists the ids to use instead. A sandbox credential uses the exact id.

CommandMCP toolWhat it does
briq catalog [name]briq_catalogThe recipes, or one with its fields and outputs
briq run <recipe or image>briq_runCreate and start a briq. See briq run
briq upbriq_upBring up the stack in briq.yaml. See briq up
briq listbriq_listBriqs of the team. --stack <name>, --all for destroyed ones too, --name <name>, --label <k=v> and --state <state> (repeat them), --limit <n> and --cursor <cursor> for a page
briq status <briq>briq_statusOne briq, with the time its create took to each step, its image digest and an opaque id of its host
briq shell <briq>Open an interactive terminal; type exit to leave. Requires terminal stdin and stdout
briq exec <briq> -- <cmd…>briq_execRun a command and exit with its code. --timeout <ms>, --stdin to pipe input, --env K=V (repeat it), --clear-env. Put CLI options before --
briq exec --async <briq> -- <cmd…>briq_execStart a command that takes over a minute; prints its exec id. --stdin-open for exec-input
briq exec-result <briq> <exec>briq_exec_resultWhere it stands, with its output. --wait <ms>. --offset <n> prints the output from that byte, raw, and the next offset on stderr (--stream, --max-bytes). Exits with its code
briq exec-input <briq> <exec> [text|-]briq_exec_inputWrite to its stdin; - pipes this command's stdin. --eof, --seq <n>
briq exec-stop <briq> <exec>briq_exec_stopStop it
briq logs <briq>briq_logsRecent logs. -n 200, --since <cursor>
briq files-put <briq> <path> [file]briq_files_putUpload a file, from file or piped stdin, sent as it is read. The limit is maxFileBytes in briq quota --json (1 MB or more)
briq files-get <briq> <path>briq_files_getDownload a file to stdout, or -o <file>
briq expose <briq> <port>briq_exposeA URL for a port. --mode private or public, --rotate for a new token
briq expose <briq> <port> --additionalbriq_exposeA separate HTTP URL, keeping the front door; supported environments only
briq unexpose <briq> <endpoint>briq_unexposeRemove one HTTP URL; the service keeps running privately
briq expose <briq> <port> --protocol postgresbriq_exposeA TCP endpoint over TLS. See Connect from outside
briq fork <briq>briq_forkFork one briq. --name, --stack, --sleep, --no-wait. --cmd <command> replaces CMD on a raw-image fork with a copied volume
briq fork --stack <stack>briq_forkFork every briq of a stack. --into <stack>, --branch <branch> (into the stack it names: feat/login → feat-login), --sleep, --env <file>, --expose (from outside), --no-wait. Exits 1 when a fork ends in error
briq stop <briq> · briq start <briq>briq_stop · briq_startStop or start a briq. Its disk is kept. Stop accepts --no-wait
briq destroy <briq>briq_destroyDestroy a briq. --no-wait returns after it is queued. --no-volume-publish skips publishing its --volume-publish volume
briq destroy --stack <stack>briq_destroy (stack)Destroy every briq of a stack, by name or id. --no-wait returns after they are queued. --branch <branch> for the stack a branch's fork made
briq set-sleep <briq> <sleep>briq_set_sleepWhen it goes to sleep: 30m, 3h, 7d, never. --stack for its whole stack
briq resize <briq>briq_resizeAnother size, bigger volume, or stopped image: --size medium, --volume-gb 20, or --image ubuntu:24.04 alone
briq move <briq> [stack]briq_moveInto a stack, or out of it with --out; a running briq joining a stack with briqs restarts
briq quotabriq_quotaWhat the credential may still spend and run today
briq secretsbriq_secretsThe team's secrets: names, ids, hosts and where each goes; never a value
briq secret-update <id>briq_secret_updateNarrow where a secret goes, without its value: --host <host...> and --location <header|body...>, the whole new lists. Adding a host or body is the dashboard's. See Edit a team secret
briq volumesbriq_volumesThe team's volumes: name, id, size, state, generation, last use and expiry
briq volume-destroy <volume>briq_volume_destroyDelete a volume, by name or id. Briqs that name it start empty
briq feedback <topic> <message>briq_feedbackWrite to the briq team: bug, idea or question
briq mcpWhere to add briq to an MCP client: Clients

--json on commands other than shell prints the API's response instead of the summary. Messages go to stderr, so --json output stays parseable.

With --no-wait, an already pending move returns invalid_state. Read its status to follow completion.

Command routing

A synchronous briq exec goes to the regional origin when the API returns scoped execution access, and through the API's exec route when the API answers that regional access is unsupported. There is no option to set. Sandbox credentials are refused regional access; their commands run through the API route.

briq exec <briq> -- uname -a

Put CLI options before the briq ID, then -- before the command to preserve its arguments. Without --, recognized CLI options are consumed even after the briq ID.

briq run and briq up ask for this access with the create, and the CLI never prints an access grant, --json included. After sending a regional command, the CLI never retries it through the API route. An uncertain result requires checking the command's effects before running it again. Async commands, interactive terminals and file transfers use the API routes.

briq run

A recipe and the fields it changes, or an image with its settings: the briq_run input as flags.

briq run postgres --image pgvector/pgvector:pg16 --volume-gb 10 --sleep 2h
briq run node --checkout github.com/acme/api --step 'npm ci' --cmd 'npm start' --expose private
briq run nginx:1.27 --port 80 --file /usr/share/nginx/html/index.html=index.html --expose public
OptionFieldNotes
--image <image>imageA recipe: another tag (postgres:17) or a compatible image
-e, --env <K=V…>envAdded to a recipe's env, or replacing one of its values
--cmd <command>cmdRun with sh -c. A language recipe's start command
--port <n…>portsAn image's ports, or the port a language recipe's app listens on
--file <path=local…>filesWritten before the command starts, from a local file
--on-exit <policy>onExitImage only: retain (default), or destroy (destroy after final process exit); the run must have no healthcheck
--restart <policy>restartImage only: on-failure (default), or never to leave a failing process stopped (details)
--ttl <duration>ttlImage only: 5m to 30d. The briq is destroyed that long after it was created, whatever its state (details)
--size <size>sizepico, micro, nano, small, medium, large or xlarge. Your plan, your key and the recipe can allow fewer: briq whoami lists the key's sizes
--sleep <sleep>sleep30m, 3h, 7d: a whole number and m, h or d, from 5 minutes to 7 days. Or never, on the Pro plan and above. See Sleep
--volume-gb <n>volume.gbA whole number from 1 to 500, within your plan's disk. With an image, --volume <mount> too
--volume-from <name>volume.fromAn image, with --volume: start the volume from the team volume of that name: lowercase letters, digits, dots and dashes. An unknown name starts empty
--volume-publishvolume.publishWith --volume-from: the volume becomes the named volume's next copy when the briq is destroyed after a clean stop
--checkout <repo>checkout.repoA language recipe: github.com/owner/app. --ref, --path
--token <NAME>checkout.tokenA private repo: the secret holding its token, its value read from $NAME
--step <command…>stepsRun before it starts, in order
-n, --name, -s, --stackname, stack
--expose <mode>exposeprivate (behind a token) or public: a URL in the outputs. A recipe may allow only private
--no-waitwait: falseReturn before the briq is ready

A field no flag covers (nginx's routes, a healthcheck) goes in a stack file.

briq up

Bring the stack in briq.yaml up: create each service the stack does not have, leave the others. See Stack file.

$ briq up --secret STRIPE_KEY --env .env.local
stack shop: 3 created, 1 already there
bq_7kq2m9x1p4ab  db  postgres:16  running  …
…
14 values written to .env.local
OptionNotes
-f, --file <path>The stack file. Default: briq.yaml in the current directory or a parent
-s, --stack <name>Bring it up as this stack instead of the file's stack
--secret <NAME[=value]…>The value of a { secret: NAME } of the file. NAME alone reads $NAME. Without it, briq generates one
--env <file>Write the outputs into this dotenv file, mode 600 when new
--exposeOutputs this machine can use: each database gets a TLS endpoint, and the connection strings name it. As fork --expose
--no-waitReturn before the new briqs are ready

It prints an endpoint that cannot be opened yet as a warning, and exits with 1 when a briq of the stack is in error. An agent's permission prompt can allow one command: Bash(briq up:*).

Environment variables

VariableWhat it setsDefault
BRIQ_API_KEYThe key every call uses, over the saved sign-innone
BRIQ_API_URLThe API, and so the environment: https://api.stg.briq.cloud for staging, http://localhost:3001 for a local stackhttps://api.briq.cloud, or the API of the saved sign-in
BRIQ_CONFIG_DIRWhere the sign-in is saved~/.config/briq ($XDG_CONFIG_HOME/briq)

The config file holds one sign-in and the API it is for, readable by you only (mode 600).

Exit codes

CodeMeaning
0Done
1The API refused the call, or could not be reached. The error code comes first: not_found: …
2A wrong command, flag or argument
3Not signed in, or the credential was refused (revoked, expired). Run briq login

briq exec and briq exec-result exit with the command's own code.

Good to know

  • briq login uses the device flow (RFC 8628), as agents on a server do: see Setup for agents.
  • Prefer piping a key to --key: a key on the command line stays in your shell history.
  • A 5xx error prints a request id. Quote it when you ask for help.
  • To fork a stack per git branch with hooks, see Give each Claude Code worktree its own database.

Interactive shell

briq shell my-sandbox

Opens sh -i in the briq. Its image needs sh. Window resizes and Ctrl-C reach the remote terminal; exit returns its exit code. Sessions last at most one hour; reaching that limit ends the shell with a nonzero exit. Closing your terminal closes the connection. A lost connection ends the session; the CLI also restores your terminal if the server goes silent for 90 seconds. Run the command again to open a new shell: it never reconnects automatically. Providers without interactive terminals refuse the request; use briq exec for scripted commands.

How can we help?

Message to the briq team