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

# CLI

> Drive the Phonic API from your terminal.

The Phonic CLI maps every API endpoint to a subcommand, so you can call Phonic without writing
code — handy for scripting, CI, or an AI coding agent that shells out directly.

## Install

#### npm

```bash
npm install -g @phonic-ai/cli
```

Or run it without installing:

```bash
npx @phonic-ai/cli --help
```

#### Shell (macOS / Linux)

```bash
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Phonic-Co/phonic-cli/releases/latest/download/phonic-installer.sh | sh
```

#### PowerShell (Windows)

```powershell
powershell -ExecutionPolicy ByPass -c "irm https://github.com/Phonic-Co/phonic-cli/releases/latest/download/phonic-installer.ps1 | iex"
```

#### Build from source

Install the [Rust toolchain](https://rustup.rs/), then:

```bash
cargo build --release
./target/release/phonic --help
```

## Authenticate

```bash
export PHONIC_API_KEY="your_api_key"
```

A `.env` file in the working directory also works — the CLI loads it automatically.

## Usage

Every API resource is a subcommand:

```bash
phonic <resource> <method>
```

```bash
phonic <resource> <method> --json '{"key": "value"}'
```

Run `phonic --help` or `phonic <resource> --help` to see what's available.

## Useful flags

| Flag                                | Description                                                                |
| ----------------------------------- | -------------------------------------------------------------------------- |
| `--dry-run`                         | Validate the request locally and print the HTTP request without sending it |
| `--json <JSON\|->`                  | Supply a request body as JSON (or `-` to read stdin)                       |
| `--format <json\|table\|yaml\|csv>` | Output format (default `json`)                                             |
| `--page-all`                        | Auto-paginate and stream results as NDJSON                                 |
| `-q, --quiet`                       | Suppress stdout output on success                                          |

See the [phonic-cli repo](https://github.com/Phonic-Co/phonic-cli) for the full command reference,
environment variables, and shell completion.