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

# Authentication

## Getting an API Key

1. Log in to the [Atlas Portal](https://app.youratlas.com/)
2. Navigate to **Settings > API Keys**
3. Click **Create New Key**
4. Copy the key — it will only be shown once

## Login

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

The CLI validates your key by calling the Atlas API. On success, credentials are saved to `~/.atlas/config`.

### Verify Login

```bash
atlas whoami
```

Output:

```
Profile:  default
Email:    you@company.com
Name:     Your Name
Base URL: https://api.youratlas.com/v1/api
```

## Multi-Profile Support

Manage multiple accounts or environments with named profiles:

```bash
# Login with named profiles
atlas login --api-key PROD_KEY --profile production
atlas login --api-key STAGING_KEY --profile staging --base-url https://api-staging.youratlas.com/v1/api
```

### List Profiles

```bash
atlas profile list
```

Output:

```
  production (active) — https://api.youratlas.com/v1/api
  staging — https://api-staging.youratlas.com/v1/api
```

### Switch Profile

```bash
atlas profile use staging
```

## Logout

```bash
# Logout current active profile
atlas logout

# Logout a specific profile
atlas logout --profile staging
```

## Config File

Credentials are stored in `~/.atlas/config` with restricted file permissions (`0600`):

```yaml
active_profile: production
profiles:
  production:
    api_key: ak_...
    base_url: https://api.youratlas.com/v1/api
  staging:
    api_key: ak_...
    base_url: https://api-staging.youratlas.com/v1/api
spec_url: https://cdn.youratlas.com/atlas-cli/openapi.yaml
output_format: table
```

> **Warning**
>
> Never share your API key or commit the config file to version control.