> This page is for version v2.
> For other versions, use one of these documentation indexes:
> - v1 (default): https://doc.youratlas.com/v1/llms.txt
> - v2: https://doc.youratlas.com/v2/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://doc.youratlas.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://doc.youratlas.com/_mcp/server.

# 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](/v2/developers/authentication-and-api-keys).

## Sign in

```bash
atlas login --api-key YOUR_API_KEY
```

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".`

| Flag         | Default                            | What it does                                              |
| ------------ | ---------------------------------- | --------------------------------------------------------- |
| `--api-key`  | `ATLAS_API_KEY`, if set            | Your Atlas API key. Required if `ATLAS_API_KEY` isn't set |
| `--profile`  | `default`                          | The name to save this key under                           |
| `--base-url` | `https://api.youratlas.com/v1/api` | The API address for this profile                          |

## Check who you are

```bash
atlas whoami
```

It prints four lines:

```
Profile:  default
Email:    <your account email>
Name:     <your name>
Base URL: https://api.youratlas.com/v1/api
```

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.

```bash
atlas login --api-key KEY_FOR_CLIENT_A --profile client-a
atlas login --api-key KEY_FOR_CLIENT_B --profile client-b
```

`atlas login` makes the profile you just saved the active one. List your profiles. The active one is marked.

```bash
atlas profile list
```

```
  client-a — https://api.youratlas.com/v1/api
  client-b (active) — https://api.youratlas.com/v1/api
```

Switch the active profile:

```bash
atlas profile use client-a
```

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

```bash
# Remove the active profile
atlas logout

# Remove one profile
atlas logout --profile client-b
```

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.

```yaml
active_profile: default
profiles:
  default:
    api_key: YOUR_API_KEY
    base_url: https://api.youratlas.com/v1/api
spec_url: https://cdn.youratlas.com/atlas-cli/openapi.yaml
output_format: json
```

* `spec_url` is where the CLI reads the API definition its commands come from. You don't need to change it.
* `output_format` is the default output: `json`, `table` or `yaml`.

## 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.

```bash
export ATLAS_API_KEY="$YOUR_SECRET_VARIABLE"
atlas campaign get-all-campaigns
```

This is the best way to run the CLI in CI. See [Scripting and CI](/v2/developers/cli/commands#scripting-and-ci).

## Next

* [Commands](/v2/developers/cli/commands)
* [Atlas for AI agents](/v2/developers/atlas-for-ai-agents)