Guide

Getting Started with Nylas CLI

Set up Nylas CLI in under a minute. The nylas init wizard creates your account via Google, Microsoft, or GitHub SSO, picks or creates an application, generates an API key, and syncs your connected email accounts across Gmail, Outlook, Exchange, Yahoo, iCloud, and IMAP. Already have an API key? Pass --api-key to skip the wizard entirely.

By Prem Keshari

Install Nylas CLI

Pick the install method for your platform. Each option auto-detects your architecture and verifies the download with SHA-256 checksums.

Homebrew (macOS and Linux)

brew install nylas/nylas-cli/nylas

Shell script (macOS, Linux, WSL)

curl -fsSL https://cli.nylas.com/install.sh | bash

PowerShell (Windows)

irm https://cli.nylas.com/install.ps1 | iex

Go

go install github.com/nylas/cli/cmd/nylas@latest

Verify the install:

nylas --version

What happens on first run

When you run nylas without arguments for the first time, you see a welcome screen instead of the standard help output:

$ nylas

  ╭──────────────────────────────────────────╮
  │                                          │
  │   ◈  N Y L A S   C L I                  │
  │                                          │
  │   Email, calendar, and contacts          │
  │   from your terminal.                    │
  │                                          │
  ╰──────────────────────────────────────────╯

  Get started in under a minute:

    ❯ nylas init                Guided setup
      nylas init --api-key      Quick setup with existing key

  ╭─ What you can do ────────────────────────╮
  │                                          │
  │  email        Send, search, and read     │
  │  calendar     Events and availability    │
  │  contacts     People and groups          │
  │  webhook      Real-time notifications    │
  │  ai           Chat with your data        │
  │                                          │
  ╰──────────────────────────────────────────╯

This screen only appears before setup. Once you run nylas init, subsequent runs show the standard command help.

Run the setup wizard

The nylas init command walks you through four steps. The entire process takes under 60 seconds.

nylas init

Step 1: Account

The wizard asks if you have a Nylas account. You get three choices:

  • No, create one (free) — opens your browser for SSO registration with Google, Microsoft, or GitHub
  • Yes, log me in — opens your browser for SSO login
  • I already have an API key — paste your key and skip straight to Step 4

To skip the provider selection menu, pass the SSO flag directly:

# Start with Google SSO
nylas init --google

# Start with Microsoft SSO
nylas init --microsoft

# Start with GitHub SSO
nylas init --github

Step 2: Application

After authentication, the wizard checks for existing applications. If you have one, it auto-selects it. If you have multiple, you pick from a list. If you have none, it creates a new one.

  Step 2 of 4: Application

  ✓ Found application: My App (us)

Step 3: API Key

The wizard generates a new API key for the selected application and activates it automatically. The key name includes the current timestamp for easy identification in the dashboard.

  Step 3 of 4: API Key

  ✓ API key created
  ✓ API key activated

Step 4: Email Accounts

The wizard syncs any email accounts (grants) already connected to your application. If you have connected accounts through the Nylas Dashboard, they appear here automatically. If not, it tells you how to connect one:

  Step 4 of 4: Email Accounts

  ✓ Set user@gmail.com as default account

After the wizard completes, you can start using the CLI immediately:

# List recent emails
nylas email list

# Check your calendar
nylas calendar events list

# List contacts
nylas contacts list

Quick setup with an existing API key

If you already have an API key from the Nylas Dashboard, skip the wizard entirely:

nylas init --api-key nyl_abc123

The CLI verifies the key, saves it to your local config, and syncs any existing grants. Use --region eu if your application is in the EU region:

nylas init --api-key nyl_abc123 --region eu

This mode works in non-interactive environments: CI/CD pipelines, Docker containers, SSH sessions, and automation scripts.

Connect an email account

After setup, connect a Gmail, Outlook, Exchange, Yahoo, iCloud, or IMAP account:

nylas auth login

This opens a browser window for OAuth. Once you authorize, the grant is stored locally and the CLI targets that account by default. To add more accounts:

# Connect another account
nylas auth login

# List all connected accounts
nylas auth list

# Switch between accounts
nylas auth switch

Manage your account from the CLI

The nylas dashboard commands let you manage your Nylas account without leaving the terminal:

# 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 switch

Try the AI chat interface

Nylas CLI includes a web-based AI chat that can read your email, manage your calendar, and search contacts through natural language:

nylas chat

This opens localhost:7367 in your browser. Ask questions like "show my unread emails", "create a meeting tomorrow at 2pm", or "find emails from Alice about the project". The chat supports Claude, Codex, and local Ollama models:

# Use Claude as the AI backend
nylas chat --agent claude

# Use a local Ollama model
nylas chat --agent ollama --model llama2

Reset and start over

If you need to clear all configuration and start fresh:

nylas config reset
nylas init

This removes API credentials, Dashboard session tokens, authenticated grants, and the config file. Use --force to skip the confirmation prompt.

Next steps