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
auth whoami shows the date; run squarecloud auth login again to renew it.
The key is saved in a config.json file readable only by you: in %APPDATA%\Square Cloud CLI on Windows, and in $XDG_CONFIG_HOME/squarecloud or ~/.config/squarecloud on macOS and Linux.
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.
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.
When the key stops working
If a command says your session expired or the API key was revoked, runsquarecloud auth login again. 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.

