Source: https://cli.nylas.com/guides/getting-started

# Getting Started

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.

Written by [Prem Keshari](https://cli.nylas.com/authors/prem-keshari) Senior SRE

Reviewed by [Caleb Geene](https://cli.nylas.com/authors/caleb-geene)

Updated May 3, 2026

## How do I 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)

```bash
brew install nylas/nylas-cli/nylas
```

### Shell script (macOS, Linux, WSL)

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

### PowerShell (Windows)

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

### Go

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

Verify the install:

```bash
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:

```text
$ 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.

## How do I run the setup wizard?

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

```bash
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:

```bash
# 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.

```text
  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.

```text
  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:

```text
  Step 4 of 4: Email Accounts

  ✓ Set user@gmail.com as default account
```

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

```bash
# List recent emails
nylas email list

# Check your calendar
nylas calendar events list

# List contacts
nylas contacts list
```

## How do I set up with an existing API key?

If you already have an API key from the [Nylas Dashboard](https://dashboard-v3.nylas.com/), skip the wizard entirely:

```bash
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:

```bash
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.

## How do I connect an email account?

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

```bash
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:

```bash
# Connect another account
nylas auth login

# List all connected accounts
nylas auth list

# Switch between accounts
nylas auth switch
```

## How do I manage my account from the CLI?

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

```bash
# 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
```

## How do I use 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:

```bash
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:

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

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

## How do I reset and start over?

If you need to clear all configuration and start fresh:

```bash
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

- [Send your first email from the terminal](https://cli.nylas.com/guides/send-email-from-terminal) — one-line send across Gmail, Outlook, Exchange, Yahoo, iCloud, or IMAP with attachments and threading
- [Manage your calendar from the CLI](https://cli.nylas.com/guides/manage-calendar-from-terminal) — create, list, and update events with DST-aware time handling and free/busy lookups
- [Give AI agents email access via MCP](https://cli.nylas.com/guides/ai-agent-email-mcp) — expose your inbox as a typed tool to Claude, Cursor, or Codex through the built-in MCP server
- [Install Nylas Agent Skills](https://cli.nylas.com/guides/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](https://cli.nylas.com/guides/audit-ai-agent-activity) — record every tool call an agent makes against your inbox to a tamper-evident JSONL log
- [Browse the full command reference](https://cli.nylas.com/docs/commands) — every command, subcommand, and flag organized by category, with --json output examples
- [Extract OTP codes from email](https://cli.nylas.com/guides/extract-otp-codes-from-email) — pull verification codes without opening your inbox
- [Record meetings from the CLI](https://cli.nylas.com/guides/record-meetings-from-terminal) — send a notetaker bot to Zoom, Meet, or Teams
- [Receive inbound email](https://cli.nylas.com/guides/receive-inbound-email-cli) — create managed addresses and process messages via webhooks
- [Homebrew documentation](https://brew.sh/) — the package manager that backs the recommended macOS / Linux install
- [Nylas CLI release notes (GitHub)](https://github.com/nylas/cli/releases) — canonical changelog, signed checksums, and platform binaries
- [Google OAuth 2.0 token expiration](https://developers.google.com/identity/protocols/oauth2#expiration) — why Gmail access tokens last 3,600 seconds and how Nylas refreshes them transparently
- [Microsoft identity platform access tokens](https://learn.microsoft.com/en-us/entra/identity-platform/access-tokens) — Outlook and Exchange OAuth flow, token lifetime, and consent screens
- [RFC 6749 (OAuth 2.0)](https://datatracker.ietf.org/doc/html/rfc6749) — the protocol spec the CLI implements when you run `nylas auth login`
