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

# Command Reference

> Current reference for LeadMagic CLI commands, subcommands, and common workflows

The LeadMagic CLI includes chat-first workflows plus direct commands for deterministic enrichment, analytics, automation, and outbound handoff. Run `lm help` for the current command list or `lm COMMAND --help` for command-specific flags.

## Global Options

| Option          | Description                                            |
| --------------- | ------------------------------------------------------ |
| `-v, --version` | Print the CLI version                                  |
| `--debug`       | Enable debug logging, also available with `LM_DEBUG=1` |
| `-h, --help`    | Show help for a command                                |

## Everyday Commands

| Command          | What it does                                     | Example             |
| ---------------- | ------------------------------------------------ | ------------------- |
| `lm` / `lm chat` | Start the AI data chat                           | `lm`                |
| `lm login`       | Sign in with browser OAuth                       | `lm login`          |
| `lm logout`      | Sign out                                         | `lm logout`         |
| `lm dashboard`   | Show account and credit details                  | `lm dashboard`      |
| `lm credits`     | Show credit balance                              | `lm credits`        |
| `lm pricing`     | Show enrichment pricing cheat sheet              | `lm pricing`        |
| `lm status`      | Show auth, config, AI routing, and credit status | `lm status`         |
| `lm doctor`      | Diagnose CLI, auth, database, and system issues  | `lm doctor --fix`   |
| `lm update`      | Check for and install CLI updates                | `lm update --check` |

## Data And AI Commands

Use these when you want file-level analysis or one-off AI assistance outside chat.

| Command      | What it does                                | Example                                                      |
| ------------ | ------------------------------------------- | ------------------------------------------------------------ |
| `lm scan`    | Find CSV, TSV, and Excel files              | `lm scan ./exports -d 3`                                     |
| `lm analyze` | Profile data quality, columns, and coverage | `lm analyze contacts.csv`                                    |
| `lm run`     | Run an AI prompt on a file                  | `lm run -f contacts.csv -p "summarize this data"`            |
| `lm think`   | Run an AI prompt with reasoning mode        | `lm think -f leads.csv -p "which rows should I prioritize?"` |

## Enrichment Commands

Direct enrichment commands call LeadMagic for specific lookup types.

| Command                     | What it does                                                                           | Example                                                           |
| --------------------------- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| `lm enrich`                 | Enrich a CSV or Excel file with auto-detected columns                                  | `lm enrich -i contacts.csv --batch-size 25`                       |
| `lm validate`               | Validate email deliverability for addresses or a file column                           | `lm validate -f contacts.csv -c email`                            |
| `lm find email`             | Find a work email from name plus domain or company                                     | `lm find email -f Alex -l Rivera -d example.com`                  |
| `lm find mobile`            | Find a mobile number from profile URL, work email, or personal email                   | `lm find mobile -p https://linkedin.com/in/morgan-lee`            |
| `lm find role`              | Find people by title or function at a company                                          | `lm find role -c Example Robotics -t "VP Sales"`                  |
| `lm find employees`         | List employees at a company                                                            | `lm find employees -d example.com --limit 25`                     |
| `lm find profile`           | Resolve an email to a LinkedIn/B2B profile                                             | `lm find profile -e alex.rivera@example.com`                      |
| `lm find profile-search`    | Fetch a full professional profile from a profile URL or handle                         | `lm find profile-search -p linkedin.com/in/morgan-lee`            |
| `lm find linkedin-to-email` | Convert a LinkedIn profile URL to a work email                                         | `lm find linkedin-to-email -p https://linkedin.com/in/morgan-lee` |
| `lm find personal-email`    | Find personal emails from a LinkedIn profile                                           | `lm find personal-email -p https://linkedin.com/in/morgan-lee`    |
| `lm find jobs`              | Search job postings by company, title, location, seniority, remote status, and recency | `lm find jobs -c Example Robotics --level senior --remote`        |

## Company Research

The `research` command focuses on account intelligence signals.

| Command                   | What it does                                                   | Example                                               |
| ------------------------- | -------------------------------------------------------------- | ----------------------------------------------------- |
| `lm research competitors` | Find competitor companies                                      | `lm research competitors -d example.com`              |
| `lm research funding`     | Show funding rounds, investors, revenue, and financial context | `lm research funding -d example.org`                  |
| `lm research tech`        | Show a company's technology stack                              | `lm research tech -d example.com -c Example Robotics` |

## Local Database

LeadMagic stores imported data, enrichment output, chat history, recipes, schedules, and run history in a local analytics database. Use SQL when you want exact answers.

| Command           | What it does                                              | Example                                                                |
| ----------------- | --------------------------------------------------------- | ---------------------------------------------------------------------- |
| `lm query sql`    | Run SQL against local tables                              | `lm query sql "SELECT status, COUNT(*) FROM contacts GROUP BY status"` |
| `lm query tables` | List local tables                                         | `lm query tables`                                                      |
| `lm query schema` | Show table schema                                         | `lm query schema contacts`                                             |
| `lm db init`      | Initialize the database and migrations                    | `lm db init`                                                           |
| `lm db stats`     | Show memory, database size, table count, and row counts   | `lm db stats`                                                          |
| `lm db health`    | Run deep health checks with cleanup and performance hints | `lm db health`                                                         |
| `lm db vacuum`    | Compact the database, checkpoint WAL, and update stats    | `lm db vacuum`                                                         |
| `lm db analyze`   | Update query optimizer statistics                         | `lm db analyze`                                                        |
| `lm db repair`    | Repair stale WAL/temp files and re-run migrations         | `lm db repair`                                                         |
| `lm db unlock`    | Release stale local database locks                        | `lm db unlock --yes`                                                   |
| `lm db reset`     | Recreate the database from scratch                        | `lm db reset --confirm`                                                |

<Warning>
  `lm db reset --confirm` deletes local tables and run history. Export anything important first.
</Warning>

## Recipes, Schedules, And Watch Mode

Recipes are YAML enrichment pipelines. They make repeated cleanup and enrichment work predictable, estimable, and automatable.

| Command                                   | What it does                         | Example                                                                   |
| ----------------------------------------- | ------------------------------------ | ------------------------------------------------------------------------- |
| `lm recipe list`                          | List built-in and custom recipes     | `lm recipe list`                                                          |
| `lm recipe show`                          | Print recipe YAML                    | `lm recipe show outbound-cleanup`                                         |
| `lm recipe validate`                      | Validate a recipe file               | `lm recipe validate outbound-cleanup`                                     |
| `lm recipe estimate`                      | Estimate credits before a run        | `lm recipe estimate outbound-cleanup -i leads.csv`                        |
| `lm recipe run`                           | Execute a recipe on a CSV            | `lm recipe run outbound-cleanup -i leads.csv -o ./out`                    |
| `lm recipe delete`                        | Delete a custom recipe               | `lm recipe delete my-recipe`                                              |
| `lm schedule create`                      | Run a recipe on a cron or interval   | `lm schedule create --recipe outbound-cleanup -i leads.csv --every daily` |
| `lm schedule list`                        | List schedules                       | `lm schedule list`                                                        |
| `lm schedule pause` / `resume` / `delete` | Manage schedules                     | `lm schedule pause SCHEDULE_ID`                                           |
| `lm schedule run-now`                     | Execute a schedule immediately       | `lm schedule run-now SCHEDULE_ID`                                         |
| `lm schedule history`                     | Show recent scheduled run history    | `lm schedule history -n 20`                                               |
| `lm schedule daemon`                      | Start the foreground scheduler       | `lm schedule daemon --poll-interval 60`                                   |
| `lm watch setup`                          | Configure an inbound folder workflow | `lm watch setup`                                                          |
| `lm watch start`                          | Process new files as they arrive     | `lm watch start --recipe outbound-cleanup`                                |
| `lm watch status`                         | Show watch folder status             | `lm watch status`                                                         |
| `lm watch stop`                           | Stop an active watcher               | `lm watch stop`                                                           |

## Job Change Monitoring

Use job-change commands to check whether contacts still work where you expect.

| Command                 | What it does                                            | Example                                                                                          |
| ----------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `lm job-change check`   | Check one profile against an expected company           | `lm job-change check --profile https://linkedin.com/in/alex-rivera --company-domain example.com` |
| `lm job-change batch`   | Check eligible contacts from the local `contacts` table | `lm job-change batch -y`                                                                         |
| `lm job-change history` | Show recent contact-level results                       | `lm job-change history -n 20`                                                                    |
| `lm job-change runs`    | Show batch and scheduled run summaries                  | `lm job-change runs`                                                                             |

Alias: `lm jc`.

## Outbound Integrations

Push enriched, eligible contacts from the local database into outbound platforms. Each integration can verify credentials, list or create campaigns, push leads, show push history, export campaign leads, and read campaign stats.

| Platform         | Commands                                                              |
| ---------------- | --------------------------------------------------------------------- |
| Instantly        | `connect`, `campaigns`, `create`, `push`, `history`, `stats`, `leads` |
| EmailBison       | `connect`, `campaigns`, `create`, `push`, `history`, `stats`, `leads` |
| Example Robotics | `connect`, `campaigns`, `create`, `push`, `history`, `stats`, `leads` |

Examples:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
lm integrations instantly connect
lm integrations instantly campaigns
lm integrations instantly push --campaign <id>
lm integrations emailbison leads <campaign-id> --output leads.csv
lm integrations smartlead stats <campaign-id>
```

Alias: `lm int`.

## Configuration And Setup

| Command                    | What it does                                                | Example                         |
| -------------------------- | ----------------------------------------------------------- | ------------------------------- |
| `lm init`                  | Initialize project or global LeadMagic workspace            | `lm init --local`               |
| `lm config get`            | Read a config value                                         | `lm config get dbPath`          |
| `lm config set`            | Set a config value, prompting securely for sensitive keys   | `lm config set instantlyApiKey` |
| `lm config show`           | Show account, database, AI, integration, and display config | `lm config show`                |
| `lm config interactive`    | Open the interactive configuration UI                       | `lm config interactive`         |
| `lm completions install`   | Install shell completions for bash, zsh, or fish            | `lm completions install -s zsh` |
| `lm completions show`      | Print completion script                                     | `lm completions show -s fish`   |
| `lm completions uninstall` | Remove installed completions                                | `lm completions uninstall`      |
| `lm welcome`               | Show the welcome and setup status screen                    | `lm welcome --fast`             |

Useful config keys include `dbPath`, `dbMemoryLimit`, `dbThreads`, `outputDir`, `theme`, `plainTextMessages`, `instantlyApiKey`, `emailBisonApiKey`, `emailBisonInstanceUrl`, and `smartleadApiKey`.

## Common Workflows

<AccordionGroup>
  <Accordion title="Clean and enrich a lead file" icon="wand-magic-sparkles">
    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    lm analyze leads.csv
    lm enrich -i leads.csv --batch-size 25
    lm query sql "SELECT * FROM contacts WHERE email_status = 'valid'"
    ```
  </Accordion>

  <Accordion title="Research an account" icon="building">
    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    lm research funding -d example.com
    lm research competitors -d example.com
    lm research tech -d example.com -c Example Robotics
    lm find jobs -c Example Robotics --posted-within 30
    ```
  </Accordion>

  <Accordion title="Automate weekly enrichment" icon="clock">
    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    lm recipe estimate outbound-cleanup -i weekly-leads.csv
    lm schedule create --recipe outbound-cleanup -i weekly-leads.csv --cron "0 9 * * 1"
    lm schedule daemon
    ```
  </Accordion>

  <Accordion title="Push ready leads to outbound" icon="paper-plane">
    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    lm integrations instantly connect
    lm integrations instantly campaigns
    lm integrations instantly push --campaign <id>
    lm integrations instantly history
    ```
  </Accordion>
</AccordionGroup>
