# CLI

> Command-line interface for managing FoxReach leads, campaigns, templates, and more from your terminal.

> Documentation index: https://www.foxreach.io/docs/llms.txt lists every page of these docs. Each page is also served as Markdown: add `.md` to its URL.

## Installation

```bash
pip install foxreach-cli
```

**Requirements:** Python 3.9+

## Setup

```bash
# Save your API key
foxreach config set-key
# Enter: otr_your_api_key

# Verify configuration
foxreach config show
```

You can also use environment variables (they take precedence over the config file):

```bash
export FOXREACH_API_KEY=otr_your_api_key
export FOXREACH_BASE_URL=https://api.foxreach.io/api/v1  # optional
```

## Commands

### Leads

```bash
# List leads (with optional filters)
foxreach leads list
foxreach leads list --search "jane" --status active --limit 25

# Get a single lead
foxreach leads get cld_abc123

# Create a lead
foxreach leads create --email jane@example.com --first-name Jane --last-name Smith --company "Acme"

# Update a lead
foxreach leads update cld_abc123 --company "New Corp" --title "VP Sales"

# Delete a lead
foxreach leads delete cld_abc123

# Get lead activity and campaign memberships
foxreach leads activity cld_abc123
```

### Campaigns

```bash
# List campaigns
foxreach campaigns list
foxreach campaigns list --status active

# Get campaign details
foxreach campaigns get cmp_xyz789

# Create a campaign
foxreach campaigns create --name "Q1 Outreach" --daily-limit 100 --timezone "America/New_York"

# Update a campaign
foxreach campaigns update cmp_xyz789 --daily-limit 200

# Start / pause / resume
foxreach campaigns start cmp_xyz789
foxreach campaigns pause cmp_xyz789
foxreach campaigns resume cmp_xyz789

# Add leads and email accounts
foxreach campaigns add-leads cmp_xyz789 --lead-ids cld_1,cld_2,cld_3
foxreach campaigns add-accounts cmp_xyz789 --account-ids acc_1

# Move leads into another campaign (beta: not in the published foxreach-cli 0.6.0 yet; campaign must not be active)
foxreach campaigns move-leads cmp_xyz789 --to cmp_other --lead-ids cld_abc123

# Remove leads and accounts (campaign must not be active)
foxreach campaigns remove-lead cmp_xyz789 cld_1
foxreach campaigns remove-account cmp_xyz789 acc_1

# Delete (must be draft)
foxreach campaigns delete cmp_xyz789
```

### Sequences

```bash
# List steps for a campaign
foxreach sequences list --campaign cmp_xyz789

# Add a step
foxreach sequences create --campaign cmp_xyz789 \
  --subject "Quick question about {{company}}" \
  --body "Hi {{firstName}}, ..." \
  --delay-days 0

# Update a step
foxreach sequences update --campaign cmp_xyz789 --sequence seq_1 --delay-days 3

# Delete a step
foxreach sequences delete --campaign cmp_xyz789 --sequence seq_1
```

### Templates

```bash
foxreach templates list
foxreach templates get tpl_abc123
foxreach templates create --name "Cold Intro" --body "Hi {{firstName}}, just checking in."
foxreach templates update tpl_abc123 --name "Updated Follow-up"
foxreach templates delete tpl_abc123
```

### Email Accounts

```bash
foxreach accounts list
foxreach accounts get acc_abc123
foxreach accounts delete acc_abc123
```

### Inbox

```bash
# List threads
foxreach inbox list
foxreach inbox list --unread --category interested

# Get a thread
foxreach inbox get rpl_abc123

# Get the full conversation (all messages in a thread)
foxreach inbox conversation rpl_abc123

# Send a reply
foxreach inbox reply rpl_abc123 --body "Thanks for your interest! Let's schedule a call."
foxreach inbox reply rpl_abc123 --body "Follow-up" --subject "Re: Custom subject"

# Update (mark read, categorize, star)
foxreach inbox update rpl_abc123 --read --category qualified --starred

# Get inbox stats (counts by category)
foxreach inbox stats
```

### Webhooks

```bash
# List available event types
foxreach webhooks events

# List webhooks
foxreach webhooks list

# Create a webhook (the secret is shown on creation, save it! An active webhook
# with the same URL and events is returned, secret included, instead of a duplicate)
foxreach webhooks create --url "https://your-app.com/webhooks" --events email.sent,reply.received,campaign.completed

# Update a webhook
foxreach webhooks update cwh_abc123 --events email.sent,lead.created --active

# Disable a webhook
foxreach webhooks update cwh_abc123 --inactive

# Delete a webhook
foxreach webhooks delete cwh_abc123
```

### Analytics

```bash
# Dashboard overview
foxreach analytics overview

# Campaign stats
foxreach analytics campaign cmp_xyz789
```

### Lead Finder: search, then reveal

The API finds a work email by name plus company or domain, so `reveal` takes the people rows printed by `search`, not ids alone. Before 0.6.0, `reveal --person-ids` sent only the ids and every person came back unsearchable; upgrade with `pip install -U foxreach-cli`.

```bash
# Search (one search page), save the result
foxreach lead-finder search --filters '{"jobTitles": ["Head of Sales"], "countries": ["US"]}' > people.json

# Reveal everyone in the file, or pick some with --person-ids (spends reveal credits)
foxreach lead-finder reveal --from-file people.json
foxreach lead-finder reveal --from-file people.json --person-ids p_1,p_2 --campaign cmp_xyz789

# Or pipe it
foxreach lead-finder search --filters '{...}' | foxreach lead-finder reveal --from-file -
```

### Account, jobs and workspaces

```bash
foxreach me                                   # key, workspace, plan, rate limit, credits
foxreach jobs list --type lead_import --status running
foxreach jobs get job_abc123
foxreach workspaces list                      # workspaces an agency key can act as
foxreach --workspace ws_client123 leads list  # run any command as a client workspace
```

### Bulk lead actions, export and labels

```bash
foxreach leads bulk-tag hot --lead-id cld_1 --lead-id cld_2
foxreach leads bulk-untag cold --filter-tags old-list
foxreach leads bulk-verify --filter-status active   # spends verification credits
foxreach leads bulk-delete --lead-id cld_3          # shows the campaigns affected, asks first
foxreach leads export --tags enterprise -o leads.csv --wait
foxreach leads variables
foxreach leads set-interest cld_abc123 interested   # or: clear
foxreach leads list --interest-status interested

foxreach lead-labels create Champion --color success --meaning positive
foxreach lead-labels assign cld_abc123 lbl_1
foxreach block-list add competitor.com --note "never email"
```

### Campaign operations and A/B variants

```bash
foxreach campaigns duplicate cmp_xyz789
foxreach campaigns share cmp_xyz789             # public report link; --off to turn it off
foxreach campaigns preview cmp_xyz789 --subject "Hi {{firstName}}" --body "..." --lead-id cld_abc123
foxreach campaigns test-email cmp_xyz789 --to me@example.com --account-id acc_1 --subject Test --body Hello
foxreach campaigns bulk-remove-leads cmp_xyz789 --lead-ids cld_1,cld_2
foxreach campaigns activity cmp_xyz789 --type reply
foxreach campaigns cohorts cmp_xyz789 --days 14
foxreach campaigns cohort-detail cmp_xyz789 2026-11-01   # emails and replies of one UTC day
foxreach campaigns lead-emails cmp_xyz789 cld_abc123

foxreach sequences variants list --campaign cmp_xyz789 --step seq_1
foxreach sequences variants add --campaign cmp_xyz789 --step seq_1 --label B --subject "Another angle" --body "..."
foxreach sequences variants stats --campaign cmp_xyz789 --step seq_1
```

### Inbox actions and AI drafts

```bash
foxreach inbox mark-read rpl_abc123
foxreach inbox mark-all-read --category interested
foxreach inbox bulk-update rpl_1 rpl_2 --starred
foxreach inbox notes add rpl_abc123 --content "Called, wants a demo on Friday"
foxreach inbox sent --campaign cmp_xyz789

foxreach inbox drafts list --category interested
foxreach inbox drafts edit rpl_abc123 --body "Thanks! Does Thursday at 10 work?"
foxreach inbox drafts send rpl_abc123        # sends a real email, once
```

### Webhook tools, events and copy

```bash
foxreach webhooks test cwh_abc123
foxreach webhooks deliveries cwh_abc123 --status failed
foxreach webhooks resume cwh_abc123          # after 10 failed deliveries in a row
foxreach webhooks create --url https://your-app.com/hook --events reply.categorized --reply-categories interested
foxreach events list --type reply.received

foxreach copy judge --subject "Quick question" --body-file email.txt    # free
foxreach copy rewrite --subject "Quick question" --body-file email.txt  # 1 AI credit
```

### More command groups

| Group | Commands |
|-------|----------|
| `workspace` | `show`, `rename`, `members`, `invite`, `set-role`, `remove`, `invites`, `revoke-invite`, `resend-invite`, `defaults` (changes need a key with the `admin` scope) |
| `api-keys` | `list`, `create`, `revoke` (`admin` scope) |
| `agency` | `overview`, `clients`, `create-client`, `rename-client`, `delete-client`, `branding`, `set-branding` |
| `audit-log` | `list` |
| `analytics` | `account`, `report`, `export-report`, `leaderboard`, `activity`, `campaign-daily`, `campaign-steps` |
| `lead-finder` | `create-list`, `get-list`, `rename-list`, `delete-list`, `list-items`, `add-items`, `remove-items`, `reveal-list`, `add-list-to-leads`, `export-list`, `create-saved-search`, `get-saved-search`, `update-saved-search`, `delete-saved-search`, `run-saved-search` |
| `warmup` | `create-tag`, `update-tag`, `delete-tag`, `assign-tag`, `unassign-tag` |
| `accounts` | `test-connection`, `check-domain-auth` |
| `templates` | `publish`, `unpublish`, `clone` |

## JSON Output

Add `--json` to commands that return data (such as `list`, `get`, `create`, `update`, `stats`, and `activity`) to get raw JSON output, useful for scripting and piping. Action commands such as `start`, `pause`, `resume`, `add-leads`, `remove-lead`, and `delete` print a confirmation line and do not accept `--json`:

```bash
foxreach leads list --json | jq '.data[].email'
foxreach campaigns get cmp_xyz789 --json
foxreach analytics overview --json
```

## Configuration

Config is stored at `~/.foxreach/config.json`:

```json
{
  "api_key": "otr_your_api_key",
  "base_url": "https://api.foxreach.io/api/v1"
}
```

Environment variables take precedence over the config file:

| Setting | Env Var | Config Key |
|---------|---------|------------|
| API Key | `FOXREACH_API_KEY` | `api_key` |
| Base URL | `FOXREACH_BASE_URL` | `base_url` |

### Config Commands

```bash
foxreach config set-key            # Prompts for API key
foxreach config set-url <url>      # Override base URL
foxreach config show               # Show current config (key masked)
```

## Source Code

- **GitHub:** [foxreach/foxreach-cli](https://github.com/foxreach/foxreach-cli)
- **PyPI:** `pip install foxreach-cli`
