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

# CLI Introduction

> The official command-line interface for Loops. Manage contacts, send events, and deliver transactional emails from your terminal.

## Installation

### Homebrew

```bash theme={"dark"}
brew install loops-so/tap/loops
```

### Script for macOS, Linux, Windows via WSL

```bash theme={"dark"}
curl -fsSL --proto '=https' --tlsv1.2 https://cli.loops.so | bash
```

To install a specific version or to a custom path, append `-s -- <version> <path>` to `bash` in the command above. The default installation path is `~/.local/bin`.

### Script for Windows PowerShell

```powershell theme={"dark"}
irm https://raw.githubusercontent.com/Loops-so/cli/main/install.ps1 | iex
```

### Verify

```bash theme={"dark"}
loops version
```

## Authentication

The CLI requires a Loops API key. Get one from [Settings > API](https://app.loops.so/settings?page=api) in Loops.

There are two ways to authenticate the CLI.

### Keyring storage

Store a key locally with `loops auth login`:

```bash theme={"dark"}
loops auth login --name my-team
```

You can store keys for multiple teams and switch between them:

* `loops auth use <name>` — set a stored key as the default
* `loops auth list` — list stored keys and see which is the default
* `--team <name>` on any command — use a specific stored key for that command

See [Auth commands](/cli/auth) for the full reference.

### Environment variable

Set `LOOPS_API_KEY` to use a key directly — useful for CI or when keyring storage isn't available.

```bash theme={"dark"}
export LOOPS_API_KEY=your_api_key
```

### Precedence

When multiple keys are available, the CLI resolves them in this order:

1. `LOOPS_API_KEY` environment variable
2. `--team` flag
3. The current default (set via `loops auth use`)

## Global flags

These flags can be used with any command.

| Flag       | Short | Description                               |
| ---------- | ----- | ----------------------------------------- |
| `--debug`  |       | Print API request details before sending  |
| `--output` | `-o`  | Output format: `text` (default) or `json` |
| `--team`   | `-t`  | Team key name to use                      |
| `--help`   | `-h`  | Show help for any command                 |

## Commands

<CardGroup cols={2}>
  <Card title="auth" href="/cli/auth" icon="key">
    Log in, switch teams, and manage stored API keys.
  </Card>

  <Card title="contacts" href="/cli/contacts" icon="user">
    Create, update, find, and delete contacts.
  </Card>

  <Card title="events" href="/cli/events" icon="bolt">
    Send events to trigger automations.
  </Card>

  <Card title="lists" href="/cli/lists" icon="list">
    View your mailing lists.
  </Card>

  <Card title="transactional" href="/cli/transactional" icon="envelope">
    Send and manage transactional emails.
  </Card>

  <Card title="contact-properties" href="/cli/contact-properties" icon="address-book">
    Create and list contact properties.
  </Card>

  <Card title="completion" href="/cli/completion" icon="square-terminal">
    Set up shell autocompletion.
  </Card>
</CardGroup>

## Utility commands

### `loops api-key`

Validate your current API key.

```bash theme={"dark"}
loops api-key
```

### `loops version`

Print the CLI version.

```bash theme={"dark"}
loops version
```
