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

# CLI

The Channel3 CLI lets you call any API endpoint from your terminal. Source code lives at [github.com/channel3-ai/channel3-cli](https://github.com/channel3-ai/channel3-cli).

## Installation

```bash
# Clone and install from source
git clone https://github.com/channel3-ai/channel3-cli.git
cd channel3-cli
cargo install --path .
```

## Authentication

Set your API key via environment variable, or pass it with `--api-key` on any command.

```bash
export CHANNEL3_API_API_KEY="your_api_key_here"
```

You can also set `CHANNEL3_LANGUAGE`, `CHANNEL3_COUNTRY`, and `CHANNEL3_CURRENCY` to apply default locale settings to every call.

To set these permanently, add the `export` lines to your `~/.zshrc` (or `~/.bashrc`) and run `source ~/.zshrc` to apply them to your current shell.

## Usage

Commands follow a resource-based structure:

```bash
channel3-api [resource] <command> [flags...]
```

For example, to search for products:

```bash
channel3-api products search --query "organic cotton t-shirt"
```

Pass `--help` to any command for full flag documentation.

### Passing files

Use the `@` prefix to send a file as an argument — useful for image search:

```bash
channel3-api products search --base64-image @shoe.jpg
```

### Output formats

Change the output format with `--format` (`json`, `jsonl`, `yaml`, `pretty`, `raw`, `explore`), or extract fields with `--transform` using GJSON syntax:

```bash
channel3-api products search --query "running shoes" --transform "products.#.title"
```

### Search for products

```bash
channel3-api products search --query "organic cotton t-shirt"
```

### Get product details

```bash
channel3-api products retrieve --product-id "prod_abc123"
```

### Image search

```bash
channel3-api products image-search --image-url "https://example.com/shoe.jpg"
```

### Find similar products

```bash
channel3-api products similar --product-id "prod_abc123"
```

### Browse brands

```bash
channel3-api brands list
channel3-api brands search --query "Nike"
channel3-api brands get --brand-id "brand_abc123"
```

### Browse categories

```bash
channel3-api categories list
channel3-api categories search --query "electronics"
```

### Price tracking

```bash
channel3-api price-tracking start \
  --canonical-product-id "prod_abc123" \
  --webhook-url "https://example.com/webhook"
channel3-api price-tracking history --canonical-product-id "prod_abc123"
```

## Environment variables

| Variable               | Description                                         | Required |
| ---------------------- | --------------------------------------------------- | -------- |
| `CHANNEL3_API_API_KEY` | API key for authentication                          | Yes      |
| `CHANNEL3_LANGUAGE`    | Default ISO 639-1 language code (e.g. `en`)         | No       |
| `CHANNEL3_COUNTRY`     | Default ISO 3166-1 alpha-2 country code (e.g. `GB`) | No       |
| `CHANNEL3_CURRENCY`    | Default ISO 4217 currency code (e.g. `GBP`)         | No       |

## Global flags

| Flag              | Description                                                        |
| ----------------- | ------------------------------------------------------------------ |
| `--api-key`       | API key (overrides `CHANNEL3_API_API_KEY`)                         |
| `--language`      | Default language code                                              |
| `--country`       | Default country code                                               |
| `--currency`      | Default currency code                                              |
| `--format`        | Output format: `json`, `jsonl`, `yaml`, `pretty`, `raw`, `explore` |
| `--transform`     | GJSON expression for field extraction                              |
| `--help`          | Show command help                                                  |
| `--debug`         | Enable debug logging                                               |
| `--version`, `-v` | Show CLI version                                                   |
| `--base-url`      | Custom API backend URL                                             |