Guide
Getting Started
Set up Nylas CLI in under 2 minutes. Run nylas init for guided signup that creates your account, application, and API key and connects your email in one flow. Already have an API key? Log in with nylas auth config, then connect mailboxes with nylas auth login.
Written by Prem Keshari Senior SRE
Reviewed by Caleb Geene
How do I install Nylas CLI?
Nylas CLI installs as a single 12 MB static binary with no runtime dependencies. Pick the method that matches your platform — each option auto-detects your CPU architecture (x86_64 or arm64), downloads the correct build from GitHub, and verifies the download with SHA-256 checksums. Installation completes in under 30 seconds on most connections.
Homebrew (macOS and Linux)
The Homebrew formula taps the nylas/nylas-cli repository and pins the latest stable release. Homebrew handles upgrades automatically when you run brew upgrade.
brew install nylas/nylas-cli/nylasShell script (macOS, Linux, WSL)
The shell installer works on any POSIX system, including WSL. It writes the binary to ~/.config/nylas/bin and prints a PATH export line you can add to your shell profile.
curl -fsSL https://cli.nylas.com/install.sh | bashPowerShell (Windows)
The PowerShell installer downloads the Windows binary and adds the install directory to your user-level PATH. It requires PowerShell 5.1 or later, which ships with Windows 10 and 11.
irm https://cli.nylas.com/install.ps1 | iexGo
Building from source requires Go 1.23 or later. The binary lands in your $GOPATH/bin directory.
go install github.com/nylas/cli/cmd/nylas@latestAfter installing with any method, confirm the binary is on your PATH by printing its version:
nylas --versionHow do I set up Nylas CLI after installing?
Two setup paths exist after installation. New users run nylas init, an interactive wizard that creates a Nylas account, builds an application, generates an API key, and connects your first email account in one session. If you already have an API key, run nylas auth config to log in. Add mailboxes with nylas auth login — the free tier connects up to 5 accounts.
How do I set up with nylas init?
The nylas init wizard is the fastest path for new users. It runs four steps in one interactive session: log into or create a Nylas account, select or create an application, generate and activate an API key, then sync your existing email accounts. The flow takes about 90 seconds and opens a browser once for SSO sign-in.
nylas initThe wizard prompts for an SSO provider (Google, Microsoft, or GitHub), then walks through application and key creation before connecting your mailbox. To skip the provider menu, pass the flag directly:
nylas init --google
nylas init --microsoft
nylas init --githubWhen the wizard finishes, your account is authenticated and your email is connected. Confirm it by listing your inbox:
nylas email listHow do I log in with an existing API key?
Already have an API key from the Nylas Dashboard? Run nylas auth config and paste it when prompted to log in — this skips the 4-step wizard. The CLI validates the key in under a second and saves it encrypted, with no browser or SSO redirect, ideal for CI/CD pipelines, Docker containers, and SSH sessions.
nylas auth configPass the key as a flag for non-interactive setup, and add --region eu if your application lives in the EU region. The key starts with nyl_:
nylas auth config --api-key nyl_abc123
nylas auth config --api-key nyl_abc123 --region euHow do I get an API key from the dashboard?
New to Nylas but prefer the dashboard over the wizard? Generate an API key in three steps, then log in with nylas auth config above. The free tier includes 5 connected accounts and needs no credit card.
- Sign up at dashboard-v3.nylas.com with Google, Microsoft, or GitHub SSO.
- Create an application — open All apps, create a new app, and choose your region (US or EU).
- Generate an API key — open the app's API Keys section and click Create new key. The key starts with
nyl_.
Logging in with a key authenticates the CLI against your application but connects no mailbox yet. Connect your first email account with nylas auth login, the same command used to add more accounts later (covered next).
How do I connect email accounts?
Connect a mailbox with nylas auth login. The free tier connects up to 5 accounts (called grants) across Gmail, Outlook, Exchange, Yahoo, iCloud, and IMAP. Google is the default provider, so the bare command starts a Google sign-in; pass --provider for the other five. The CLI picks up each new grant automatically on the next command.
# OAuth providers (opens a browser)
nylas auth login --provider google
nylas auth login --provider microsoft
nylas auth login --provider ews
# Credential providers (app-specific password)
nylas auth login --provider icloud
nylas auth login --provider yahoo
nylas auth login --provider imapAccording to Google's OAuth 2.0 documentation, access tokens expire after 3,600 seconds. The CLI stores the grant and refreshes tokens automatically, so you authorize once. List and switch between connected accounts with:
# List all connected accounts
nylas auth list
# Switch the active account
nylas auth switchHow do I manage my account from the CLI?
Nylas CLI mirrors about 90% of the web dashboard functionality through nylas dashboard subcommands. You can create applications, rotate API keys, switch organizations, and check your login status without opening a browser. Every subcommand supports --json output for scripting.
The most common dashboard operations:
# Check login status
nylas dashboard status
# List applications
nylas dashboard apps list
# Create a new application
nylas dashboard apps create --name "Production App" --region us
# Set an application as active
nylas dashboard apps use app_abc123
# Generate a new API key
nylas dashboard apps apikeys create
# Switch organizations
nylas dashboard orgs switchHow do I use email, calendar, and contacts?
Nylas CLI organizes its 72+ commands into three core groups: email (send, list, search, draft, attach), calendar (events, availability, scheduling), and contacts (list, search, groups). Each group supports --json output for scripting and --limit to control result size. Here are the commands you'll use most after setup:
# Email: list, search, and send
nylas email list --limit 5
nylas email search "quarterly report"
nylas email send --to colleague@company.com --subject "Quick note" --body "See you at 2pm."
# Calendar: list events and check availability
nylas calendar events list --days 7
nylas calendar availability check --start 2026-05-12T09:00:00Z --end 2026-05-12T17:00:00Z --emails colleague@company.com
# Contacts: list and search
nylas contacts list --limit 10
nylas contacts search --query "Alice"
nylas contacts groups listAdd --json to any command to get structured output you can pipe into jq, feed to a script, or pass to an AI agent. The send email guide and calendar guide cover each group in depth.
How do I reset and start over?
Nylas CLI stores all configuration locally in ~/.config/nylas/ — typically 3-4 files totaling under 2 KB. Resetting removes API credentials, Dashboard session tokens, authenticated grants, and the config file — but it does not affect your Nylas Dashboard data or connected accounts on the server side. Your applications, grants, and API keys remain intact in the cloud.
To clear the local config and re-run setup:
nylas config reset
nylas initUse --force to skip the confirmation prompt, which is useful in scripts that need to reconfigure the CLI automatically.
Next steps
- Send your first email from the terminal — one-line send across Gmail, Outlook, Exchange, Yahoo, iCloud, or IMAP with scheduling and JSON output
- Manage your calendar from the CLI — create, list, and update events with DST-aware time handling and free/busy lookups
- Give AI agents email access via MCP — expose your inbox as a typed tool to Claude, Cursor, or Codex through the built-in MCP server
- Install Nylas Agent Skills — one command teaches Claude Code, Cursor, Codex CLI, Windsurf, and 30+ agents the CLI and v3 API conventions
- Set up audit logging for AI agents — record every tool call an agent makes against your inbox to a tamper-evident JSONL log
- Browse the full command reference — every command, subcommand, and flag organized by category, with --json output examples
- Extract OTP codes from email — pull verification codes without opening your inbox
- Record meetings from the CLI — send a notetaker bot to Zoom, Meet, or Teams
- Receive inbound email — create managed addresses and process messages via webhooks
- Email auth: OAuth vs API key vs app password — compare authentication methods and when to use each
- Back up email to JSON — export your entire mailbox with pagination and date filters
- Homebrew documentation — the package manager that backs the recommended macOS / Linux install
- Nylas CLI release notes (GitHub) — canonical changelog, signed checksums, and platform binaries
- Google OAuth 2.0 token expiration — why Gmail access tokens last 3,600 seconds and how Nylas refreshes them transparently
- Microsoft identity platform access tokens — Outlook and Exchange OAuth flow, token lifetime, and consent screens
- RFC 6749 (OAuth 2.0) — the protocol spec the CLI implements when you run
nylas auth login