Prerequisites
- The CLI is installed. See CLI overview.
- A CloudThinker account with access to at least one workspace. A workspace is the project that holds your connections and conversations.
Log in
1
Start the login
Use the arrow keys or press
1 or 2, then Enter.2
Approve in the browser
The CLI prints 
Success state: the terminal prints
Open this URL to authorize CloudThinker: with the link and opens it. Press c to copy the link if the browser didn’t open. Sign in, choose the workspace, and approve the request within five minutes.
Logged in to <workspace>.Picked Log in with a code? Follow Log in on a remote machine instead.3
Verify the credential
whoami asks the API, not the local file, so it proves the credential works.Success state: one line with host=, email=, and workspace= values. Add --json for machine-readable output.Log in on a remote machine
Over SSH, or on Linux with no display, the CLI picks the code flow on its own and says so:No local browser detected (SSH session). Using device-code login. It prints a URL with the code already filled in, the code itself, and how long the code stays valid. Open the URL in any browser, on any device, and check that the page shows the same code before you approve.
Waiting for approval: … elapsed, code expires in ….
Work with several workspaces
Log in once per workspace. Each login is stored by host and workspace, so logging in to a second workspace keeps the first.--workspace, auth switch, and CLOUDTHINKER_WORKSPACE take a workspace ID or the exact workspace name. Quote names that contain spaces. --workspace goes before the command name:
Use a custom host
To use a host other thanhttps://app.cloudthinker.io, run cloudthinker login --url <origin> once. Later commands remember it. You can also set CLOUDTHINKER_URL. See the CLI reference.
Authenticate a script or CI job
A pipeline has no browser, so it can’t approve a login. Give it a service account token or a personal API token inCLOUDTHINKER_TOKEN instead. See Use CloudThinker in CI/CD.
cloudthinker auth token authenticates as you until it expires. Treat it like a password: never log it, commit it, or paste it into a chat.
The token already names its workspace, so every command except review setup and doctor, cloudthinker api included, exits with code 2 when --workspace or CLOUDTHINKER_WORKSPACE is set beside CLOUDTHINKER_TOKEN. Unset CLOUDTHINKER_WORKSPACE before you export the token. An API token (ct_pat_ or ct_sat_) works with cloudthinker chat, cloudthinker incident ls and incident status, the public API commands, and cloudthinker api; most other commands need a login or a token from auth token.
Where credentials live
The CLI writes credentials as plain JSON to one file, readable only by your user (mode 0600). It doesn’t use the OS keychain; releases before 0.5.3 did, and upgrading moves those logins into the file.
The file holds every workspace login, keyed by host and workspace.
Log out
Logged out., or Logged out of all workspaces for this host.
Troubleshooting
A command says you are not logged in (exit code 3)
A command says you are not logged in (exit code 3)
The credential is missing or expired, or the server refused access. Run
cloudthinker login again. In a non-interactive shell, the CLI never opens a browser: it prints the login command to run and stops.CLOUDTHINKER_TOKEN is rejected, or auth switch has no effect
CLOUDTHINKER_TOKEN is rejected, or auth switch has no effect
The environment token outranks stored credentials, so logging in again or running
auth switch changes nothing. Replace the token, or run unset CLOUDTHINKER_TOKEN and use your saved logins.Browser consent timed out
Browser consent timed out
The consent link is valid for five minutes. Run
cloudthinker login again, or use cloudthinker login --device-auth to approve from another device.A workspace name is not accepted
A workspace name is not accepted
--workspace matches an exact name or a workspace ID. Run cloudthinker auth status to see your saved workspaces, and quote a name that contains spaces.Next steps
Headless Chat
Send prompts from scripts and CI with the credential you just set up.
CLI Reference
Every flag, environment variable, and exit code.