Sign in to the Atlas CLI
Get an API key
Make a key in the Atlas app. Open Settings, then More settings, then API keys. You can have up to 5 keys, so make one just for the CLI. Full steps are in Authentication and API keys.
Sign in
The CLI tests the key by asking Atlas for your account profile. If the key is wrong, nothing is saved, you see invalid API key with the reason, and the exit code is 3. If it works, the CLI saves a profile named default, makes it the active one and prints Logged in as profile "default".
Check who you are
It prints four lines:
If the key comes from ATLAS_API_KEY, the first line says Profile: (credentials from environment). If no key is set up, you see not logged in: set ATLAS_API_KEY or run: atlas login --api-key <key> and the exit code is 2.
Profiles
A profile is a saved key plus an API address. Keep one per account or per use.
atlas login makes the profile you just saved the active one. List your profiles. The active one is marked.
Switch the active profile:
It prints Switched to profile "client-a". A name that doesn’t exist fails with profile "NAME" not found and exit code 2.
Sign out
It prints Logged out. This removes the key from your computer. It does not delete the key in the Atlas app. To turn a key off, delete it in the app.
Where the key is stored
Profiles are saved in ~/.atlas/config (on Windows, %USERPROFILE%\.atlas\config). Only you can read the file (permissions 0600). The key is stored as plain text in it. Don’t commit the file or copy it to shared machines.
spec_urlis where the CLI reads the API definition its commands come from. You don’t need to change it.output_formatis the default output:json,tableoryaml.
Use a key without signing in
Set ATLAS_API_KEY and the CLI uses it for every command. Nothing is written to disk. It overrides the active profile. ATLAS_BASE_URL does the same for the API address.
This is the best way to run the CLI in CI. See Scripting and CI.
