> ## Documentation Index
> Fetch the complete documentation index at: https://docs.caged.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Overview

> Install and configure the Caged CLI.

# CLI Overview

The `caged` CLI is the primary way to create and manage sandboxes from your terminal.

## Installation

<CodeGroup>
  ```bash macOS (Homebrew) theme={null}
  brew tap caged-dev/tap
  brew install caged
  ```

  ```bash Linux theme={null}
  curl -fsSL https://get.caged.dev | sh
  ```

  ```bash Go Install theme={null}
  go install github.com/caged-dev/cli/cmd/caged@latest
  ```
</CodeGroup>

Verify the installation:

```bash theme={null}
caged version
```

## Authentication

```bash theme={null}
caged login
```

This prompts for your API URL and API key. After entering your credentials, the CLI stores them locally at `~/.config/caged/config.json`.

Alternatively, set the `CAGED_API_KEY` environment variable:

```bash theme={null}
export CAGED_API_KEY=caged_...
```

## Configuration

The CLI reads configuration from:

1. Command-line flags (highest priority)
2. `.caged.yaml` in the current directory
3. `~/.config/caged/config.json` (credentials)
4. Environment variables (`CAGED_*`)

### Credentials

```json theme={null}
// ~/.config/caged/config.json
{
  "api_url": "https://api.caged.dev",
  "api_key": "caged_..."
}
```

### Project Config

See [Config-as-Code](/guides/config-as-code) for the full `.caged.yaml` reference.

## Output Formats

The CLI supports multiple output formats:

```bash theme={null}
caged sandboxes list --format json   # JSON output
caged sandboxes list --format table  # Table (default)
caged sandboxes list --format yaml   # YAML output
```

## Autocomplete

```bash theme={null}
# Bash
caged completion bash > /etc/bash_completion.d/caged

# Zsh
caged completion zsh > "${fpath[1]}/_caged"

# Fish
caged completion fish > ~/.config/fish/completions/caged.fish
```
