Skip to main content
The official Data Legion CLI lets you enrich and search person and company data directly from the terminal. It’s fully async, outputs JSON to stdout (logs to stderr), and works as both a human-friendly tool and an AI agent backend. AI coding agents like Claude Code and Cursor can call it directly as a shell tool.

Installation

brew install datalegion-ai/tap/datalegion-cli
Requires Python 3.11+.

Authentication

Set your API key using the built-in encrypted config store or an environment variable.
datalegion-cli config set api_key legion_your_key_here

Person

Enrichment

Look up a person by email, phone, social URL, name, or other identifiers.
# By email
datalegion-cli person enrich --email jane.doe@example.com

# By phone
datalegion-cli person enrich --phone "+15551234567"

# By social URL
datalegion-cli person enrich --social-url https://linkedin.com/in/janedoe

# By name and company
datalegion-cli person enrich --name "Jane Doe" --company "Acme Corp"

# By first/last name with location context
datalegion-cli person enrich --first-name Jane --last-name Doe \
  --company Acme --city "San Francisco" --state california

# Return multiple matches with confidence scores
datalegion-cli person enrich --name "Jane Doe" --company Acme \
  --multiple --min-confidence high --limit 5

# Return specific fields only
datalegion-cli person enrich --email jane@example.com \
  --fields full_name,job_title,company_name

# Read input from stdin
echo '{"email": "jane@example.com"}' | datalegion-cli person enrich --stdin
All person enrich flags:
FlagDescription
--email / -eEmail address
--phone / -pPhone number
--social-urlSocial profile URL (e.g. LinkedIn)
--linkedin-idLinkedIn numeric ID
--legion-idLegion ID
--email-hashSHA-256, SHA-1, or MD5 email hash
--name / -nFull name
--first-nameFirst name
--last-nameLast name
--company / -cCompany name or domain
--titleJob title
--cityCity
--stateState
--countryCountry
--schoolSchool name
--birth-dateBirth date (YYYY-MM-DD)
--addressFull address string
--postal-codePostal/ZIP code
--multiple / -mReturn multiple matches
--limit / -lMax results (default: 2)
--min-confidenceMinimum confidence: high, moderate, low
--fieldsComma-separated fields to include
--excludeComma-separated fields to exclude
--requiredComma-separated required fields
--titlecaseTitle-case text fields in response
--stdinRead JSON payload from stdin
Query people using SQL syntax. The query is a positional argument.
datalegion-cli person search \
  "SELECT * FROM people WHERE job_title ILIKE '%engineer%' AND state = 'california'" \
  --limit 25
FlagDescription
--limit / -lMax results (default: 10)
--fieldsComma-separated fields to include
--excludeComma-separated fields to exclude
--titlecaseTitle-case text fields in response

Company

Enrichment

Look up a company by domain, name, ticker, social URL, or other identifiers.
# By domain
datalegion-cli company enrich --domain google.com

# By ticker
datalegion-cli company enrich --ticker GOOGL

# By name
datalegion-cli company enrich --name "Alphabet Inc"

# By name with industry qualifier
datalegion-cli company enrich --name "Mercury" --industry "financial services"

# Return multiple matches
datalegion-cli company enrich --name Google --multiple --limit 5
All company enrich flags:
FlagDescription
--domain / -dCompany domain
--name / -nCompany name
--ticker / -tStock ticker symbol
--social-urlSocial profile URL (e.g. LinkedIn company page)
--linkedin-idLinkedIn numeric ID
--legion-idLegion ID
--industryIndustry (narrows name matching)
--multiple / -mReturn multiple matches
--limit / -lMax results (default: 2)
--min-confidenceMinimum confidence: high, moderate, low
--fieldsComma-separated fields to include
--excludeComma-separated fields to exclude
--requiredComma-separated required fields
--titlecaseTitle-case text fields in response
--stdinRead JSON payload from stdin

Search

Query companies using SQL syntax. The query is a positional argument.
datalegion-cli company search \
  "SELECT * FROM companies WHERE industry = 'software development' AND legion_employee_count > 50" \
  --limit 20
FlagDescription
--limit / -lMax results (default: 10)
--fieldsComma-separated fields to include
--excludeComma-separated fields to exclude
--titlecaseTitle-case text fields in response

Utilities

Utility commands are free and don’t consume credits.

Clean Fields

Normalize emails, phones, names, domains, and other fields. Pass a JSON payload as a positional argument or via stdin.
# Positional JSON argument
datalegion-cli utility clean \
  '{"email": "  JANE.DOE+work@GMAIL.COM  ", "phone": "(555) 123-4567", "domain": "https://www.Google.com/about"}'

# From stdin
echo '{"email": "test@GMAIL.COM"}' | datalegion-cli utility clean --stdin
FlagDescription
--stdinRead JSON fields from stdin
--regionDefault phone region (default: US)

Hash Email

Generate privacy-preserving email hashes (SHA-256, SHA-1, MD5). The email is a positional argument.
datalegion-cli utility hash jane@example.com

Validate

Check data format and get cleaning suggestions before enrichment.
datalegion-cli utility validate \
  --email "not-an-email" --phone "+15551234567" --domain "google.com"
FlagDescription
--emailEmail to validate
--phonePhone to validate
--nameName to validate
--domainDomain to validate
--social-urlSocial URL to validate
--companyCompany name to validate
--tickerTicker symbol to validate
--stdinRead JSON from stdin

Account

Check Credit Balance

datalegion-cli credits balance

View Usage History

datalegion-cli credits usage --from 2026-03-01 --to 2026-03-26

Agent Integration

The CLI is designed for AI agent workflows. Claude Code, Cursor, and other AI coding agents can invoke it as a shell tool — no MCP configuration needed. All structured output goes to stdout as JSON, while logs and progress indicators go to stderr, so agents and scripts can parse results directly.
# Pipe to jq
datalegion-cli person enrich --email jane@example.com | jq '.full_name'

# Pipe from stdin
echo '{"email": "jane@example.com"}' | datalegion-cli person enrich --stdin

# Quiet mode (suppress all non-JSON output)
datalegion-cli person enrich --email jane@example.com --quiet
The CLI and MCP server are complementary. Use MCP for native tool-call integration with AI assistants. Use the CLI when you need shell access, scripting, or want a zero-config option that any agent can call via bash.

Global Flags

FlagDescription
--verbose / -vEnable debug logging
--quiet / -qSuppress all log output
--helpDisplay command help

Auto-Update

The CLI monitors GitHub releases and can self-update.
# Check for updates
datalegion-cli update --check

# Install updates
datalegion-cli update

# Show current version
datalegion-cli version

Credits

CLI commands consume credits at the same rate as the corresponding REST API endpoints. Utility commands are free.

Rate Limits

The same rate limits apply to CLI requests as to direct API calls.

Resources