Skip to main content
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:
OptionDescription
-v, --versionPrint the CLI version
--debugEnable debug logging (also via LM_DEBUG=1 env var)
-h, --helpShow 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
OptionDescription
--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
OptionDescription
-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
OptionDescription
-f, --file <path>Input CSV or Excel file
-p, --prompt <text>Prompt to execute
-o, --output <path>Save result to file
-y, --yesSkip 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
ArgumentDescriptionDefault
[path]File or directory to scan. (current directory)
OptionDescriptionDefault
-d, --depth <n>Max directory depth2

analyze

Analyze data health of a CSV or Excel file. Alias: health.
lm analyze contacts.csv
lm analyze data.xlsx -o report.md
ArgumentDescription
<file>Path to CSV or Excel file
OptionDescription
-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
OptionDescriptionDefault
-i, --input <file>Input file path (required)
-o, --output <file>Output file pathInput file with _enriched suffix
--email-column <name>Column containing email addressesAuto-detect
--first-name-column <name>Column containing first namesAuto-detect
--last-name-column <name>Column containing last namesAuto-detect
--company-column <name>Column containing company namesAuto-detect
--domain-column <name>Column containing domainsAuto-detect
--skip-validationSkip email validation stepfalse
--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
ArgumentDescription
[emails...]Email addresses to validate
OptionDescription
-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"
OptionDescription
-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"
OptionDescription
-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
ArgumentDescription
<sql>SQL query to execute
OptionDescription
-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.
lm query tables

query schema

Show the schema of a table.
lm query schema contacts
ArgumentDescription
<table>Table name

Account Commands

login

Sign in to LeadMagic via browser OAuth. Aliases: auth, signin, sign-in.
lm login
lm login -y
OptionDescription
-y, --yesOpen browser without confirmation prompt

logout

Sign out of LeadMagic. Aliases: signout, sign-out.
lm logout

dashboard

Display your account info and credit balance. Alias: dash.
lm dashboard

Setup Commands

init

Initialize the project directory and database. Alias: setup.
lm init
lm init --global
lm init --local --skip-db
OptionDescription
--skip-dbSkip database initialization (create directories only)
--globalUse global directory (~/.leadmagic)
--localUse project-local directory (./.leadmagic)

doctor

Check system health and configuration. Alias: checkup.
lm doctor
lm doctor --fix
lm doctor --verbose
OptionDescription
--fixAuto-repair fixable issues
--verboseShow additional diagnostic info

config

Manage CLI configuration. Alias: cfg.

config get

lm config get apiKey
lm config get aiModel
ArgumentDescription
<key>Configuration key

config set

lm config set apiKey
lm config set aiModel claude-sonnet
lm config set dbMemoryLimit 4GB
ArgumentDescription
<key>Configuration key
[value]Value (omit for sensitive keys to prompt securely)

config show

Display all configuration values.
lm config show

config model

Interactively select an AI model.
lm config model

config interactive

Open the interactive configuration UI. Aliases: ui, tui.
lm config interactive

config list-models

List available AI models.
lm config list-models
lm config list-models -p anthropic
OptionDescription
-p, --provider <provider>Filter by provider

db

Local database management. Alias: database.

db init

Initialize the database and run migrations.
lm db init

db stats

Show database statistics and memory usage.
lm db stats

db vacuum

Compact the database — reclaim space, update statistics, flush WAL. Alias: compact.
lm db vacuum

db analyze

Analyze tables and update query optimizer statistics.
lm db analyze

db reset

Reset the database — drops all tables and data.
lm db reset
lm db reset --confirm
OptionDescription
--confirmSkip 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.
lm db repair

db unlock

Release a database lock by stopping stale lm processes.
lm db unlock
lm db unlock --yes
OptionDescription
--yesTerminate 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
OptionDescription
-s, --shell <shell>Shell type: bash, zsh, fish (default: auto-detect)

completions uninstall

lm completions uninstall
OptionDescription
-s, --shell <shell>Shell type (default: auto-detect)

completions show

Print the completion script to stdout.
lm completions show
lm completions show -s fish
OptionDescription
-s, --shell <shell>Shell type (default: auto-detect)

update

Check for updates and upgrade the CLI. Alias: upgrade.
lm update
lm update --check
OptionDescription
--checkOnly check for updates (don’t install)

welcome

Show the welcome screen and setup status.
lm welcome
lm welcome --fast
OptionDescription
--fastSkip animations
--quietMinimal output (for installer use)