1
Start the login
Run the login command in your terminal:The CLI shows a short code and opens the authorization page in your browser.
2
Approve in the browser
Type the code on the page and approve. The CLI receives its own API key, no copy and paste needed, and saves it on this machine.
Output
blob:read and blob:write for the blob commands, and expires after 90 days. auth whoami shows the date; run squarecloud auth login again to renew it.
The key is saved in the system keychain: Windows Credential Manager, the macOS Keychain, or the Secret Service on Linux (GNOME Keyring, KWallet). Where there is none (containers, WSL without D-Bus), it stays in a config.json file readable only by you, and auth login says so: in %APPDATA%\Square Cloud CLI on Windows, and in $XDG_CONFIG_HOME/squarecloud or ~/.config/squarecloud on macOS and Linux. A key that an older version saved in that file moves to the keychain the next time it is used.
squarecloud auth login
Usage
Output with an API key
- Press
Ctrl+Cto cancel a login that is waiting for approval. - If this machine is already logged in to another account,
auth loginasks before replacing it. Pass-yto skip the question. - If your account has reached its API key limit, the browser login says so and continues on its own as soon as you revoke a key in the dashboard.
- Without a terminal, the command doesn’t prompt: it exits with a hint. With
CI=true, the browser login refuses to run. See CI and scripts.
squarecloud auth whoami
Usage
SQUARECLOUD_API_KEY, it says so instead.
Output
--json, it prints the account (ID, name, email, locale, plan and creation date) as JSON.
squarecloud auth logout
Usage
SQUARECLOUD_API_KEY is set, commands keep using it after a logout.
Output
No account is connected on this machine. and exits with code 0.
Several accounts
--profile <name>, or the SQUARECLOUD_PROFILE environment variable, picks a separate login with its own keychain entry. Without either, the CLI uses the default profile. A profile name has 1 to 32 letters, digits, - or _, and starts with a letter or digit.
auth login and auth whoami name the profile when it isn’t the default one. SQUARECLOUD_API_KEY, when set, wins over every profile.
CI and scripts
In CI, don’t log in at all: create an API key in the dashboard and set it in theSQUARECLOUD_API_KEY environment variable. Every command uses it instead of the saved key, and the CLI runs even on machines without a home folder.
- Without a terminal,
auth logindoesn’t prompt for anything: it exits with a hint. Use--with-token,--tokenorSQUARECLOUD_API_KEY. - With
CI=true, the browser login refuses to run, since its key expires in 90 days and only a person can renew it. - For the
blobcommands, the key needs theblob:readandblob:writescopes.
When the key stops working
If a command says your session expired or the API key was revoked, runsquarecloud auth login again. Do the same when it says the key doesn’t have the permission the command needs (MISSING_SCOPE): a key from a browser login before version 3.2.0 lacks the Blob scopes, and the new login issues a key that has them. Commands that need an account print You need to be logged in to run this command. and exit with code 1 when no key is saved or set.

