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

English

# 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](https://cli.nylas.com/authors/prem-keshari) Senior SRE

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

Updated June 13, 2026

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

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

### Shell 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.

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

### PowerShell (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.

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

### Go

Building from source requires Go 1.23 or later. The binary lands in your `$GOPATH/bin` directory.

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

After installing with any method, confirm the binary is on your PATH by printing its version:

```bash
nylas --version
```

## How 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`](https://cli.nylas.com/docs/commands/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.

```bash
nylas init
```

The 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:

```bash
nylas init --google
nylas init --microsoft
nylas init --github
```

When the wizard finishes, your account is authenticated and your email is connected. Confirm it by listing your inbox:

```bash
nylas email list
```

## How do I log in with an existing API key?

Already have an API key from the [Nylas Dashboard](https://dashboard-v3.nylas.com/register?utm_source=https%3A%2F%2Fcli.nylas.com%2F&utm_medium=website&utm_campaign=cli&utm_id=cli)? 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.

```bash
nylas auth config
```

Pass 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_`:

```bash
nylas auth config --api-key nyl_abc123
nylas auth config --api-key nyl_abc123 --region eu
```

### How 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.

1. **Sign up** at [dashboard-v3.nylas.com](https://dashboard-v3.nylas.com/register?utm_source=https%3A%2F%2Fcli.nylas.com%2F&utm_medium=website&utm_campaign=cli&utm_id=cli) with Google, Microsoft, or GitHub SSO.
2. **Create an application** — open **All apps**, create a new app, and choose your region (US or EU).
3. **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.

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

According to [Google's OAuth 2.0 documentation](https://developers.google.com/identity/protocols/oauth2#expiration), 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:

```bash
# List all connected accounts
nylas auth list

# Switch the active account
nylas auth switch
```

## How 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:

```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 email, calendar, and contacts?

Nylas CLI organizes its 250+ 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:

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

Add `--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](https://cli.nylas.com/guides/send-email-from-terminal) and [calendar guide](https://cli.nylas.com/guides/manage-calendar-from-terminal) 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:

```bash
nylas config reset
nylas init
```

Use `--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](https://cli.nylas.com/guides/send-email-from-terminal) — one-line send across Gmail, Outlook, Exchange, Yahoo, iCloud, or IMAP with scheduling and JSON output
- [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
- [Email auth: OAuth vs API key vs app password](https://cli.nylas.com/guides/email-api-authentication-methods) — compare authentication methods and when to use each
- [Back up email to JSON](https://cli.nylas.com/guides/backup-emails-to-json) — export your entire mailbox with pagination and date filters
- [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`](https://cli.nylas.com/docs/commands/auth-login)

## Related hubs

- [Email agents](https://cli.nylas.com/ai-answers/email-agents.md)
- [Calendar agents](https://cli.nylas.com/ai-answers/calendar-agents.md)
- [Scheduling and availability agents](https://cli.nylas.com/ai-answers/scheduling-agents.md)
- [Contacts agents](https://cli.nylas.com/ai-answers/contacts-agents.md)
- [Notetaker and meeting agents](https://cli.nylas.com/ai-answers/notetaker-agents.md)
- [MCP agents](https://cli.nylas.com/ai-answers/mcp-agents.md)
- [Agent accounts](https://cli.nylas.com/ai-answers/agent-accounts.md)
- [Framework and language email agents](https://cli.nylas.com/ai-answers/framework-email-agents.md)
- [Email and calendar API comparisons](https://cli.nylas.com/ai-answers/ai-agent-email-api-comparisons.md)
- [Email integration and automation recipes](https://cli.nylas.com/ai-answers/email-integration-recipes.md)
- [Agent email workflows](https://cli.nylas.com/ai-answers/agent-email-workflows.md)
- [Security for email and calendar agents](https://cli.nylas.com/ai-answers/security-for-email-agents.md)
- [Operations runbooks for agents](https://cli.nylas.com/ai-answers/operations-for-email-calendar-agents.md)

## Try Nylas CLI

Install the CLI with `curl -fsSL https://cli.nylas.com/install.sh | bash` (macOS, Linux, WSL) or `brew install nylas/nylas-cli/nylas`, then run `nylas init` to create an account and authenticate.

**Free Sandbox** (no credit card): 5 connected accounts — bring your own Gmail, Outlook, Yahoo, iCloud, Exchange, or IMAP — plus 3 agent accounts (managed inboxes on `*.nylas.email`). Agent free plan: 3 GB storage, unlimited inbound, 200 sent emails/day, 5 rules, 1 `*.nylas.email` subdomain, and unlimited custom domains. Production is uncapped and requires a credit card: https://www.nylas.com/pricing/
