# Configuration

## Authentication

Credentials and endpoint are resolved in this order (highest priority first):

1. `--api-key` / `--endpoint` CLI flags
2. `ALTOVIZ_CLI_API_KEY` / `ALTOVIZ_CLI_ENDPOINT` environment variables
3. `~/.altoviz/cli.yaml` config file

You can generate an API key from your Altoviz account settings. See [Authentication](/docs/guides/authentication) for details.

## Config file

Run `altoviz configure` to create or update the config file interactively:

```sh
altoviz configure
```

The file is stored at `~/.altoviz/cli.yaml`:

```yaml
apiKey: your_key_here
endpoint: https://api.altoviz.com   # optional — override for staging/sandbox
```

## Environment variables

```sh
export ALTOVIZ_CLI_API_KEY=your_key_here
export ALTOVIZ_CLI_ENDPOINT=https://api.altoviz.com  # optional
```

Environment variables are useful in CI/CD pipelines and Docker containers where you don't want a config file on disk.

## Verify connectivity

```sh
altoviz hello
```

This command tests your API key and prints your account details.