Guide
Getting Started
Set up Nylas CLI in under 2 minutes with an API key from the Nylas Dashboard. Create an account, create an application, copy your API key, and run nylas auth config. Works everywhere — no browser auth flow required. An interactive wizard (nylas init) is also available for guided setup.
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?
The fastest way to get running is with an API key from the Nylas Dashboard. Five steps, under 2 minutes, no browser auth flow required.
Step 1: Create a Nylas account
Sign up at dashboard-v3.nylas.com. The free tier includes 5 connected accounts, which is enough for personal use and testing. You can sign up with Google, Microsoft, or GitHub SSO.
Step 2: Create an application
In the dashboard, go to All apps → Create new app. Pick a name and choose your region (US or EU). Each application holds unlimited connected email accounts (called grants) across Gmail, Outlook, Exchange, Yahoo, iCloud, and IMAP.
Step 3: Get your API key
Open your application in the dashboard and go to the API Keys section. Click Create new key. Copy the key — it starts with nyl_ and you'll paste it into the CLI in the next step.
Step 4: Connect your email account
Still in the dashboard, go to your application's Grants section and click Add Account. Authorize with your email provider (Gmail, Outlook, Exchange, Yahoo, iCloud, or IMAP). This creates a grant — the connection between your email account and your Nylas application.
Step 5: Configure the CLI
Run nylas auth config and paste your API key when prompted. The CLI validates the key against the Nylas API, saves it encrypted to ~/.config/nylas/config.yaml, and syncs the grant you just connected.
nylas auth configIf your Nylas application is in the EU region, pass --region eu:
nylas auth config --region euThe CLI confirms the key is saved and shows your connected accounts:
Paste your API key:
nyl_••••••••••••••••••••
> API key saved to system keyring
> Set [email protected] as default accountThat's it — try listing your inbox to confirm everything works:
nylas email listHow do I connect additional email accounts?
To add more accounts after setup, go to the Nylas Dashboard, open your application's Grants section, and click Add Account. The CLI picks up new grants automatically on the next command.
You can also connect accounts directly from the CLI with OAuth:
nylas auth loginThis opens your browser for authorization. According to Google's OAuth 2.0 documentation, access tokens expire after 3,600 seconds — the CLI refreshes them automatically. If the browser flow hangs after granting permissions, use the dashboard method instead.
Manage your connected accounts with:
# List all connected accounts
nylas auth list
# Switch between accounts
nylas auth switchHow do I set up with a single command?
If you already have an API key, skip the interactive prompt and pass it directly. This works in CI/CD pipelines, Docker containers, and SSH sessions.
nylas init --api-key nyl_abc123Use --region eu if your application is in the EU region:
nylas init --api-key nyl_abc123 --region euHow do I use the interactive setup wizard?
The nylas init wizard is an alternative to the API key flow above. It walks you through account creation, application selection, API key generation, and grant syncing in one interactive session. It requires a browser for SSO authentication.
nylas initTo skip the SSO provider selection menu, pass the flag directly:
nylas init --google
nylas init --microsoft
nylas init --githubHow 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 [email protected] --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 --participants [email protected]
# 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
- 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