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

# Atlas CLI commands

Every Atlas API endpoint is a command. A few built-in commands handle sign-in, updates and completion.

## Command pattern

```
atlas <resource> <operation> [arguments] [flags]
```

* The **resource** is the area of the API, such as `campaign`, `call`, `agent`, `contact`, `phone-number`, `knowledge-base`.
* The **operation** is the action, such as `get-all-campaigns`.
* **Arguments** are the IDs in the path, in order.
* **Flags** are the query filters for that endpoint. You give each as `--name value`.

Ask any command for its help:

```bash
atlas --help
atlas campaign --help
atlas call get-call-records --help
```

The help for a command lists its arguments, filters and the body fields it accepts. For a machine-readable list of every command, flag, argument and exit code, run:

```bash
atlas help --json
```

## Built-in commands

| Command                                                       | What it does                                              |
| ------------------------------------------------------------- | --------------------------------------------------------- |
| `atlas login --api-key KEY [--profile NAME] [--base-url URL]` | Test the key and save it as a profile                     |
| `atlas logout [--profile NAME]`                               | Remove a profile (the active one if you give no name)     |
| `atlas whoami`                                                | Show the active profile, account email, name and base URL |
| `atlas profile list`                                          | List profiles                                             |
| `atlas profile use NAME`                                      | Switch the active profile                                 |
| `atlas update`                                                | Update the CLI                                            |
| `atlas update-spec`                                           | Download the API definition again now                     |
| `atlas completion bash\|zsh\|fish\|powershell`                | Print a shell completion script                           |
| `atlas help --json`                                           | Print every command, flag and exit code as JSON           |

## Global flags

Every command accepts these.

| Flag                 | Short | What it does                                                                                                   |
| -------------------- | ----- | -------------------------------------------------------------------------------------------------------------- |
| `--output <format>`  | `-o`  | `json` (default), `table` or `yaml`                                                                            |
| `--verbose`          | `-v`  | Show the request and response on `stderr`. The key is hidden. The bodies are shown, so keep the output private |
| `--no-update`        |       | Skip the automatic update check for this run                                                                   |
| `--spec-file <path>` |       | Build commands from a local OpenAPI file instead of the published one                                          |
| `--help`             | `-h`  | Help for any command                                                                                           |
| `--version`          |       | Print the CLI version                                                                                          |

## Environment variables

| Variable          | What it does                                                                      |
| ----------------- | --------------------------------------------------------------------------------- |
| `ATLAS_API_KEY`   | API key to use. Overrides the saved profile. No `atlas login` needed              |
| `ATLAS_BASE_URL`  | API address. Overrides the profile's base URL                                     |
| `ATLAS_NO_UPDATE` | Set to `1` or `true` to skip the automatic update check                           |
| `CI`              | Set to `1` or `true` (most CI systems do this) to skip the automatic update check |
| `ATLAS_SPEC_FILE` | Same as `--spec-file`                                                             |

## API commands

The CLI builds these from the Atlas API definition, so the list grows when the API does. They are there whether or not you are signed in. The CLI downloads the definition on first run and keeps a copy for 24 hours. If a refresh fails, it keeps using the copy it has. To download it again now:

```bash
atlas update-spec
```

Run `atlas <resource> --help` for the full list in your version. These are the main commands. Arguments in angle brackets are IDs.

### Jobs (the `campaign` resource)

The API and the CLI call a job a **campaign**. In the Atlas app it is a job inside a department. Command names keep the API word.

```bash
atlas campaign get-all-campaigns
atlas campaign get-campaign <id>
atlas campaign create-campaign
atlas campaign update-campaign <id>
atlas campaign delete-campaign <id>
atlas campaign get-templates
atlas campaign set-campaign-status <id>
atlas campaign get-campaign-snapshots <campaignId>
atlas campaign get-campaign-calendars <campaignId>
```

### Calls

```bash
atlas call get-call-records
atlas call get-call-record <id>
atlas call get-scheduled-calls <campaignId>
```

### Statistics

```bash
atlas statistic get-all-campaigns-overview
atlas statistic get-campaign-overview <campaign_id>
```

### Agents

```bash
atlas agent get-all-agents
atlas agent get-agents-by-campaign <campaignId>
atlas agent get-agent <campaignId> <id>
```

### Contacts

```bash
atlas contact get-contacts <campaignId>
atlas contact get-global-contacts
atlas contact get-contact-count <campaign_id>
atlas contact get-contact-tokens <campaignId>
```

### Knowledge base

```bash
atlas knowledge-base get-all-knowledge-files
atlas knowledge-base get-knowledge-files <campaignId>
```

### Tools

```bash
atlas tool get-all-tools
atlas tool get-tool-templates
atlas tool get-tool-template-categories
```

### Phone numbers

```bash
atlas phone-number get-all-phone-numbers
atlas phone-number get-phone-number <id>
```

### Voices

```bash
atlas voice get-all-voices
atlas voice get-pangrams
```

### Webhooks (the `events-gateway` resource)

```bash
atlas events-gateway events-get-campaign-triggers <campaignId>
atlas events-gateway events-subscribe-trigger --body '{"hookUrl": "https://example.com/atlas/webhook", "campaignId": "CAMPAIGN_ID", "triggerName": "call_completed", "provider": "custom"}'
atlas events-gateway events-unsubscribe-trigger --body '{"hookUrl": "https://example.com/atlas/webhook", "campaignId": "CAMPAIGN_ID", "triggerName": "call_completed", "provider": "custom"}'
atlas events-gateway events-get-sample-payload <triggerName> --campaignId <campaignId>
```

The signing-secret commands (`events-get-webhook-signing-secret`, `events-rotate-webhook-signing-secret`) are listed too, but their endpoints are not open yet. See [Webhooks](/v2/developers/webhooks#your-signing-secret).

### Other resources

```bash
atlas calendar-setting get-calendar-settings
atlas calls-forward get-call-forwards <campaignId>
atlas dashboard get-dashboard-stats
atlas dashboard get-deployment-stats
atlas account get-profile
atlas customer-quota get-customer-quota
atlas campaign-chat get-chat-sessions <campaignId>
atlas api-key get-api-keys
```

The other resources are `booking` and `business-verification`. Every endpoint in the [API reference](https://docs.youratlas.com/api-reference) has a command.

## Send data

For commands that create or change something, give the body as JSON.

Inline:

```bash
atlas api-key create-api-key --body '{"label": "CI runner"}'
```

From a file (JSON or YAML). Save this as `subscribe.yaml`:

```yaml
hookUrl: https://example.com/atlas/webhook
campaignId: CAMPAIGN_ID
triggerName: call_completed
provider: custom
```

Then:

```bash
atlas events-gateway events-subscribe-trigger --from-file subscribe.yaml
```

Run `<command> --help` to see the body fields for any command and which are required.

If a field is a text field that holds JSON, you can give it as a normal object. The CLI turns it into text for you.

Commands that upload a raw file take `--file <path>` instead of a body.

## Output

Output goes to `stdout` as JSON by default. Pick another format with `--output` (short: `-o`), or set `output_format` in `~/.atlas/config`.

| Format  | Use it for                                                     |
| ------- | -------------------------------------------------------------- |
| `json`  | Scripts and agents. The default. Pipe it into tools like `jq`. |
| `yaml`  | Reading by eye, config files.                                  |
| `table` | Quick look at a list. Long values are cut at 50 characters.    |

```bash
atlas campaign get-all-campaigns -o table
atlas campaign get-all-campaigns | jq '.[].name'
```

For list endpoints, the CLI prints the rows from `value` directly. You get an array, without the wrapper.

To see exactly what the CLI sends and receives, add `--verbose` (short: `-v`). The request and response show on `stderr`. The key is hidden.

## Shell completion

The macOS and Linux installer and the PowerShell installer set up tab completion for you. Restart your terminal after installing. The Command Prompt installer does not. To set it up by hand:

Zsh. Add to `~/.zshrc`:

```bash
eval "$(atlas completion zsh)"
```

Bash. Add to `~/.bashrc`:

```bash
eval "$(atlas completion bash)"
```

Fish:

```bash
atlas completion fish > ~/.config/fish/completions/atlas.fish
```

PowerShell. Add to your PowerShell profile:

```powershell
atlas completion powershell | Out-String | Invoke-Expression
```

## Exit codes

Every command exits with one of these codes. `atlas help --json` lists them under `exit_codes`.

| Code | Name     | When                                                                                                       |
| ---- | -------- | ---------------------------------------------------------------------------------------------------------- |
| `0`  | `ok`     | It worked                                                                                                  |
| `2`  | `usage`  | Bad flag or argument, invalid JSON in `--body`, a file it can't read, or `atlas whoami` with no key set up |
| `3`  | `auth`   | The API returned `401` or `403`, or no API key is set for an API command                                   |
| `4`  | `client` | The API returned any other `4xx`, such as `400`, `404`, `409` or `429`                                     |
| `5`  | `server` | The API returned a `5xx`, or the network failed (DNS, connect, TLS, timeout)                               |

Errors go to `stderr`. With the default JSON output, an error is one JSON object. `status` and `body` are there when the API answered:

```json
{"error":{"body":{"message":"Invalid or inactive Api-Key."},"code":"auth","exit_code":3,"message":"Invalid or inactive Api-Key.","status":401}}
```

With `-o table` or `-o yaml`, it is one line of text:

```
Error: unauthorized (401): Invalid or inactive Api-Key. | body: {"message":"Invalid or inactive Api-Key."}
```

## Scripting and CI

The CLI runs without a person at the keyboard.

### What you can count on

* Results go to `stdout` as JSON. Errors go to `stderr`.
* The exit code tells you the kind of failure. See [Exit codes](#exit-codes).
* A request waits up to 90 seconds for the API, then fails with exit code `5`.

### What to know before you automate

* Set `ATLAS_API_KEY` from your secret store. The CLI uses it directly, so you don't need `atlas login` and no key is written to disk:

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

* If you do use `atlas login` on a shared or temporary runner, the key is saved in `~/.atlas/config`. Remove it when the job ends with `atlas logout`.

* The automatic update check is skipped when `CI` or `ATLAS_NO_UPDATE` is `1` or `true`, when `stdout` is not a terminal (for example when you pipe the output), and with `--no-update`. For a pinned build, install a fixed version from the release folder. See [Install by hand](/v2/developers/cli/installation#install-by-hand).

* List commands return one response. See [Rate limits and pagination](/v2/developers/rate-limits-and-pagination).

* The API allows 100 requests a minute per key for each request method (`GET`, `POST` and so on). Add a pause in loops. A `429` exits with code `4`.

### Example: nightly export of call records

```bash
#!/usr/bin/env bash
set -euo pipefail

export ATLAS_API_KEY="$ATLAS_KEY_FROM_SECRETS"

atlas call get-call-records \
  --campaignId "$CAMPAIGN_ID" \
  --startDate "$(date -u -d 'yesterday' +%Y-%m-%dT%H:%M:%SZ)" \
  --endDate "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
  -o json > calls.json
```

`--startDate` and `--endDate` are filters from the call records endpoint. Run `atlas call get-call-records --help` to see every filter. The `date -d` form works on Linux. On macOS, use `date -u -v-1d`.

## When something goes wrong

| What you see                                                                                 | Exit code | What to do                                                                                          |
| -------------------------------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------- |
| `no API key configured: set ATLAS_API_KEY or run: atlas login --api-key <key>`               | `3`       | Set `ATLAS_API_KEY` or run `atlas login --api-key YOUR_API_KEY`.                                    |
| `not logged in: set ATLAS_API_KEY or run: atlas login --api-key <key>` (from `atlas whoami`) | `2`       | Same as above.                                                                                      |
| `unauthorized (401): Invalid or inactive Api-Key.`                                           | `3`       | Your key is wrong or was deleted. Make a new key and sign in again.                                 |
| `invalid API key: ...` when you run `atlas login`                                            | `3`       | The key was refused. Nothing was saved. Check the key in the Atlas app.                             |
| `not found (404)`                                                                            | `4`       | Check the ID. List the resource first.                                                              |
| `API error (400)`                                                                            | `4`       | The request is wrong. Read the `details` and `body` in the message.                                 |
| `API error (429)`                                                                            | `4`       | You hit the rate limit. Wait, then retry.                                                           |
| `server error (5xx)` or `network error`                                                      | `5`       | Wait and try again.                                                                                 |
| `unknown flag` or `invalid JSON in --body`                                                   | `2`       | Fix the command. Run it with `--help`.                                                              |
| `profile "..." not found` or `active profile "..." not found`                                | `2`       | Run `atlas profile list`, then `atlas profile use NAME`.                                            |
| No commands besides the built-ins                                                            |           | The CLI could not download the API definition. Check your connection, then run `atlas update-spec`. |
| A new endpoint is missing                                                                    |           | Run `atlas update-spec`.                                                                            |

More on status codes in [Errors](/v2/developers/errors).

## Using the CLI from an AI agent

Agents can use the CLI. Read [Atlas for AI agents](/v2/developers/atlas-for-ai-agents) first. It covers safe use.