Complete reference for all 19 LeadMagic CLI commands. Run lm help to see this list in your terminal, or lm <command> --help for details on any command.
Global Options
These options work with any command:
| Option | Description |
|---|
-v, --version | Print the CLI version |
--debug | Enable debug logging (also via LM_DEBUG=1 env var) |
-h, --help | Show help for the command |
Core Commands
chat
Interactive AI chat for data enrichment. This is the default command — running lm with no arguments starts chat.
lm chat
lm chat --model claude-sonnet
lm chat --api-key lm_your_key
| Option | Description |
|---|
--api-key <key> | LeadMagic API key (overrides config) |
--model <model> | AI model to use |
See the AI Chat guide for slash commands and workflow examples.
run
Run an AI prompt on a file. Alias: prompt.
lm run -f contacts.csv -p "extract all email addresses"
lm run -f data.xlsx -p "summarize the data" -o summary.txt
| Option | Description |
|---|
-f, --file <path> | Input CSV or Excel file |
-p, --prompt <text> | Prompt to execute |
-o, --output <path> | Save result to file |
--model <model> | AI model override |
think
AI prompt with reasoning mode — shows the AI’s thought process before producing output. Alias: reason.
lm think -f contacts.csv -p "which contacts should I prioritize?"
lm think -f data.csv -p "find data quality issues" -y
| Option | Description |
|---|
-f, --file <path> | Input CSV or Excel file |
-p, --prompt <text> | Prompt to execute |
-o, --output <path> | Save result to file |
-y, --yes | Skip permission prompt (auto-approve) |
--model <model> | AI model override |
Data Commands
scan
Scan files or a directory for CSV, TSV, and Excel data. Alias: ls.
lm scan
lm scan ./data
lm scan ~/exports -d 3
| Argument | Description | Default |
|---|
[path] | File or directory to scan | . (current directory) |
| Option | Description | Default |
|---|
-d, --depth <n> | Max directory depth | 2 |
analyze
Analyze data health of a CSV or Excel file. Alias: health.
lm analyze contacts.csv
lm analyze data.xlsx -o report.md
| Argument | Description |
|---|
<file> | Path to CSV or Excel file |
| Option | Description |
|---|
-o, --output <path> | Save report to file |
enrich
Enrich a CSV or Excel file with LeadMagic API data. Alias: boost.
lm enrich -i contacts.csv
lm enrich -i leads.csv --email-column email --domain-column website
lm enrich -i data.csv --batch-size 25 --skip-validation
| Option | Description | Default |
|---|
-i, --input <file> | Input file path (required) | — |
-o, --output <file> | Output file path | Input file with _enriched suffix |
--email-column <name> | Column containing email addresses | Auto-detect |
--first-name-column <name> | Column containing first names | Auto-detect |
--last-name-column <name> | Column containing last names | Auto-detect |
--company-column <name> | Column containing company names | Auto-detect |
--domain-column <name> | Column containing domains | Auto-detect |
--skip-validation | Skip email validation step | false |
--batch-size <number> | Records per batch (1–100) | 10 |
validate
Validate email addresses for deliverability. Alias: verify.
lm validate john@acme.com jane@stripe.com
lm validate -f contacts.csv -c email
lm validate -f leads.csv -o validated.csv
| Argument | Description |
|---|
[emails...] | Email addresses to validate |
| Option | Description |
|---|
-f, --file <path> | CSV or Excel file with emails |
-c, --column <name> | Column name (default: auto-detect) |
-o, --output <path> | Output file for results |
find
Find emails or mobile numbers. Alias: lookup.
find email
lm find email -f "Jane" -l "Smith" -d stripe.com
lm find email -f "John" -l "Doe" -c "Acme Corp"
| Option | Description |
|---|
-d, --domain <domain> | Company domain |
-f, --first-name <name> | First name |
-l, --last-name <name> | Last name |
-c, --company <company> | Company name |
find mobile
lm find mobile -f "Jane" -l "Smith" -d stripe.com
lm find mobile -f "John" -l "Doe" -c "Acme Corp"
| Option | Description |
|---|
-f, --first-name <name> | First name |
-l, --last-name <name> | Last name |
-c, --company <company> | Company name |
-d, --domain <domain> | Company domain |
query
Run SQL queries against the local database. Alias: sql.
query sql
lm query sql "SELECT email, company FROM contacts WHERE status = 'valid'"
lm query sql "SELECT COUNT(*) FROM contacts" -o counts.csv
| Argument | Description |
|---|
<sql> | SQL query to execute |
| Option | Description |
|---|
-t, --table <name> | Query a specific table (shorthand for SELECT * FROM <table>) |
-o, --output <file> | Output results to CSV |
query tables
List all tables in the database.
query schema
Show the schema of a table.
| Argument | Description |
|---|
<table> | Table name |
Account Commands
login
Sign in to LeadMagic via browser OAuth. Aliases: auth, signin, sign-in.
| Option | Description |
|---|
-y, --yes | Open browser without confirmation prompt |
logout
Sign out of LeadMagic. Aliases: signout, sign-out.
dashboard
Display your account info and credit balance. Alias: dash.
Setup Commands
init
Initialize the project directory and database. Alias: setup.
lm init
lm init --global
lm init --local --skip-db
| Option | Description |
|---|
--skip-db | Skip database initialization (create directories only) |
--global | Use global directory (~/.leadmagic) |
--local | Use project-local directory (./.leadmagic) |
doctor
Check system health and configuration. Alias: checkup.
lm doctor
lm doctor --fix
lm doctor --verbose
| Option | Description |
|---|
--fix | Auto-repair fixable issues |
--verbose | Show additional diagnostic info |
config
Manage CLI configuration. Alias: cfg.
config get
lm config get apiKey
lm config get aiModel
| Argument | Description |
|---|
<key> | Configuration key |
config set
lm config set apiKey
lm config set aiModel claude-sonnet
lm config set dbMemoryLimit 4GB
| Argument | Description |
|---|
<key> | Configuration key |
[value] | Value (omit for sensitive keys to prompt securely) |
config show
Display all configuration values.
config model
Interactively select an AI model.
config interactive
Open the interactive configuration UI. Aliases: ui, tui.
config list-models
List available AI models.
lm config list-models
lm config list-models -p anthropic
| Option | Description |
|---|
-p, --provider <provider> | Filter by provider |
Local database management. Alias: database.
db init
Initialize the database and run migrations.
db stats
Show database statistics and memory usage.
db vacuum
Compact the database — reclaim space, update statistics, flush WAL. Alias: compact.
db analyze
Analyze tables and update query optimizer statistics.
db reset
Reset the database — drops all tables and data.
lm db reset
lm db reset --confirm
| Option | Description |
|---|
--confirm | Skip confirmation prompt |
lm db reset is destructive. All loaded data and enrichment results will be lost. Exported files in .leadmagic/export/ are not affected.
db repair
Repair the database — fix WAL corruption, re-run migrations, optimize.
db unlock
Release a database lock by stopping stale lm processes.
lm db unlock
lm db unlock --yes
| Option | Description |
|---|
--yes | Terminate lock holder processes without prompting |
completions
Manage shell tab-completions for bash, zsh, and fish.
completions install
lm completions install
lm completions install -s zsh
| Option | Description |
|---|
-s, --shell <shell> | Shell type: bash, zsh, fish (default: auto-detect) |
completions uninstall
| Option | Description |
|---|
-s, --shell <shell> | Shell type (default: auto-detect) |
completions show
Print the completion script to stdout.
lm completions show
lm completions show -s fish
| Option | Description |
|---|
-s, --shell <shell> | Shell type (default: auto-detect) |
update
Check for updates and upgrade the CLI. Alias: upgrade.
lm update
lm update --check
| Option | Description |
|---|
--check | Only check for updates (don’t install) |
welcome
Show the welcome screen and setup status.
lm welcome
lm welcome --fast
| Option | Description |
|---|
--fast | Skip animations |
--quiet | Minimal output (for installer use) |