The Nylas CLI is an open-source command-line tool that handles the entire Nylas setup — account creation, app configuration, API key generation, and account connection — in a single interactive command.
Install the CLI
Section titled “Install the CLI”-
Install using your preferred method:
brew install nylas/nylas-cli/nylascurl -fsSL https://cli.nylas.com/install.sh | bashirm https://cli.nylas.com/install.ps1 | iex -
Verify the installation:
nylas --version
Set up your application
Section titled “Set up your application”Run the init wizard. It walks you through four steps in under a minute:
- Create an account (or log into an existing one) via Google, Microsoft, or GitHub SSO
- Select an application (or create a new one)
- Generate an API key (named automatically for easy identification in the Dashboard)
- Connect an email account from your synced accounts
nylas initYou can also sign up with a specific SSO provider:
nylas init --googlenylas init --microsoftIf you already have an API key from the Dashboard, skip the wizard entirely:
nylas init --api-key <NYLAS_API_KEY>For EU data residency:
nylas init --api-key <NYLAS_API_KEY> --region euOnce nylas init completes, you’re ready to make API calls. The CLI displays your grant ID (the connected account identifier) at the end of setup.
Make your first API call
Section titled “Make your first API call”List your five most recent messages using the CLI:
nylas email list --limit 5Or call the Nylas API directly with curl. Replace <NYLAS_GRANT_ID> and <NYLAS_API_KEY> with the values from the setup step.
curl --request GET \ --url "https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/messages?limit=5" \ --header 'Accept: application/json, application/gzip' \ --header 'Authorization: Bearer <NYLAS_API_KEY>' \ --header 'Content-Type: application/json'{ "request_id": "d0c951b9-61db-4daa-ab19-cd44afeeabac", "data": [ { "starred": false, "unread": true, "folders": ["UNREAD", "CATEGORY_PERSONAL", "INBOX"], "grant_id": "1", "date": 1706811644, "attachments": [ { "id": "1", "grant_id": "1", "filename": "invite.ics", "size": 2504, "content_type": "text/calendar; charset=\"UTF-8\"; method=REQUEST" }, { "id": "2", "grant_id": "1", "filename": "invite.ics", "size": 2504, "content_type": "application/ics; name=\"invite.ics\"", "is_inline": false, "content_disposition": "attachment; filename=\"invite.ics\"" } ], "from": [ { "name": "Nylas DevRel", } ], "id": "1", "object": "message", "snippet": "Send Email with Nylas APIs", "subject": "Learn how to Send Email with Nylas APIs", "thread_id": "1", "to": [ { "name": "Nyla", } ], "created_at": 1706811644, "body": "Learn how to send emails using the Nylas APIs!" } ], "next_cursor": "123"}Connect more accounts
Section titled “Connect more accounts”Add another email account at any time:
nylas auth loginList all connected accounts:
nylas auth listSwitch between accounts:
nylas auth switchUseful commands
Section titled “Useful commands”Here are some commands to try now that you’re set up:
| Command | What it does |
|---|---|
nylas email list | List recent messages |
nylas email send --to [email protected] --subject "Hello" --body "Hi" | Send an email |
nylas email search --query "from:[email protected]" | Search messages |
nylas calendar events list | List upcoming calendar events |
nylas calendar events create --title "Standup" --start "tomorrow 9am" --end "tomorrow 9:30am" | Create an event |
nylas contacts list | List contacts |
nylas webhook list | List configured webhooks |
The CLI also includes AI-powered features:
| Command | What it does |
|---|---|
nylas email smart-compose --prompt "Reply saying I'll be there" | Draft an email with AI |
nylas calendar schedule ai "Coffee with Alex next Tuesday" | Schedule with natural language |
nylas chat | Open the AI chat interface |
Add --json to any command for machine-readable output, or pipe to jq for filtering:
nylas email list --limit 10 --json | jq '.[].subject'See the full CLI command reference for 100+ commands covering email, calendar, contacts, webhooks, and more.
What’s next
Section titled “What’s next”- Email quickstart — send your first email with the Nylas API
- Calendar quickstart — create your first event
- Authentication — set up OAuth for your users
- API reference — full endpoint documentation