format auth
Sign Studio in from a machine your browser can't reach, such as over SSH, in a container, or in an agent's sandbox.
The format auth CLI allows you to programmatically authenticate Studio. It's useful for cloud agents or CI when Studio runs somewhere your browser can't return to. You use the auth command on the remote machine, approve it in any browser, and bring the one-time code back.
When running Studio on your own computer, format dev handles authentication, so you don't need these commands. Authentication explains more about each situation.
Start a sign-in
Prints the link to open and the command to run next. Nothing is sent to Format until someone approves the link.
npx format auth startpnpm dlx format auth startyarn dlx format auth startbun x format auth startThe sign-in waits 30 minutes for its code. Start another if that passes.
Reference
--jsonType booleanPrints the result as a JSON object to stdout. Useful for scripts and agents.Complete a sign-in
Trades the one-time code from the browser for Studio credentials. At a terminal it prompts you for the code.
npx format auth complete --request <id>pnpm dlx format auth complete --request <id>yarn dlx format auth complete --request <id>bun x format auth complete --request <id>The code works once and expires 10 minutes after the page showed it. A code that was mistyped leaves the sign-in open, so run the command again with the right one.
Reference
--requestThe sign-in request to complete against. You obtain this from running format auth start.
The id format auth start printed, which names the sign-in on this machine. It is not a secret.
string--codePass your sign-in code with the command as text. Be aware that it lands in your shell history.
Passes the code as an argument. It then appears in your shell history, so at a keyboard let the prompt ask instead.
npx format auth complete --request <id> --code <code>pnpm dlx format auth complete --request <id> --code <code>yarn dlx format auth complete --request <id> --code <code>bun x format auth complete --request <id> --code <code>string--code-stdinReads your sign-in code from stdin. Useful for scripts and agents that pipe it in. Standard terminals default to this behaviour but this flag forces it regardless of the terminal.
Reads the code from stdin even when stdin is a pipe. Without this flag the command only asks a terminal, and stops with MISSING_CODE anywhere else, so a script that forgot the code fails at once rather than waiting.
echo "$CODE" | npx format auth complete --request <id> --code-stdinboolean--jsonPrints the result as a JSON object to stdout. Useful for scripts and agents.
booleanCheck sign-ins
Lists the sign-ins started on this machine and the organizations it holds credentials for. It reads local files only, so it can't say whether a browser has approved a sign-in or whether Format still accepts the saved credentials.
npx format auth statuspnpm dlx format auth statusyarn dlx format auth statusbun x format auth statusReference
--requestType stringLimit the status to a specific sign-in request ID.--jsonType booleanPrints the result as a JSON object to stdout. Useful for scripts and agents.Cancel a sign-in
npx format auth cancel --request <id>pnpm dlx format auth cancel --request <id>yarn dlx format auth cancel --request <id>bun x format auth cancel --request <id>Reference
--requestType stringThe sign-in request ID to cancel.--jsonType booleanPrints the result as a JSON object to stdout. Useful for scripts and agents.Scripts and agents
An agent in a cloud sandbox runs these commands and relays the link and the code through you. Each command can run in its own process, and a fresh sandbox needs a fresh sign-in unless its .format home folder is kept.
npx format auth start --json{
"status": "pending",
"attemptId": "k3Yd…",
"url": "https://dash.format.dev/studio/link?v=2&mode=remote&attempt=k3Yd…",
"expiresAt": "2026-11-13T12:45:00.000Z",
"next": "npx format auth complete --request k3Yd… --code-stdin"
}The agent gives you the url. You open it in a browser, approve the connection, and give the one-time code to your agent.
echo "$CODE" | npx format auth complete --request <id> --code-stdin --json{
"status": "signed-in",
"organization": { "id": "…", "name": "Acme" },
"account": { "name": "Ada Lovelace", "email": "[email protected]" }
}A failure prints { "status": "error", "error": { "code", "message" } } and exits with code 1.
| Code | Meaning | What to do |
|---|---|---|
INVALID_CODE | The code was mistyped, already used, or expired | Ask for the code again, or start over |
UNREACHABLE | Format could not be reached, or did not give a clear answer. The code may or may not be used | Try the same code again. If it is refused, run format auth start again |
INTERRUPTED | The sign-in ended without finishing and its code is used up | Run format auth start again |
EXPIRED | The sign-in waited more than 30 minutes | Run format auth start again |
NOT_FOUND | No connection request with that --request id on this machine | Check the id for a typo, or run format auth start again |
ACCESS_DENIED | The account can no longer use Studio for that organization | A person needs to check their membership |
UNSUPPORTED_PROTOCOL | Format no longer accepts sign-in from this Studio version | Run format update latest |
MISSING_REQUEST | No --request id was given | Pass the attemptId from format auth start |
MISSING_CODE | Stdin is not a terminal and no code was given | Pass --code, or pipe the code in with --code-stdin |
format dev itself exits with code 3 and prints AUTH_REQUIRED when it detects a machine the browser can't reach, so an agent knows to run these commands first. Never log or store the code.