Clay logo

LeadMagic has made more than one billion API calls with Clay and won The Unstoppable Wheel award.

Recap
LeadMagicDocs

LeadMagic CLI Authentication

Sign in to LeadMagic CLI securely. The lm login session powers interactive work, enrichment, validation, credits, and connected services.

LeadMagic CLI uses secure browser sign-in. Run lm login once, then the CLI commands and interactive workspace use that session for enrichment, chat, validation, credits, and connected services. Do not paste a LeadMagic API key into LeadMagic CLI for normal use.

Sign In

This opens your browser for OAuth sign-in. After you authenticate, the CLI stores a Bearer session locally. Skip the confirmation prompt with:

Aliases: lm auth, lm signin, lm sign-in.

Verify you're connected:

If the session expired, run lm login again. Token refresh is attempted automatically; a failed refresh needs a fresh login.

How Auth Works

SurfaceAuth
CLI enrich / validate / findOAuth session → short-lived assertion
AI Chat (lm chat)Same OAuth session via ai.leadmagic.io
Hosted MCPOAuth Bearer: see MCP setup
Instantly / Smartlead / EmailBisonSeparate third-party keys via lm config set
HubSpot / SalesforceSecure browser connection via lm integrations … connect

Scoped LeadMagic API keys for programmatic/API use are managed separately with lm keys: they are not required for interactive LeadMagic CLI usage.

Config File

Session tokens live in:

  • Global: ~/.leadmagic/config.json
  • Project-local: .leadmagic/config.json (when a .leadmagic/ directory exists in the current or parent tree)

Never commit config.json or tokens to version control. Add .leadmagic/ to .gitignore.

What Requires Login

FeatureLogin required
AI Chat (lm chat)Yes
Enrichment (lm enrich)Yes
Email validation (lm validate)Yes
Contact finding (lm find)Yes
Recipes with paid stepsYes
Credits / dashboard / whoamiYes
File scan / analyzeNo
Local SQL (lm query)No
Health check (lm doctor)No (auth is one of the checks)

Sign Out

Clears the stored OAuth session. Aliases: lm signout, lm sign-out.

Next Steps