Authentication is the gate between your terminal and your mailbox. nylas auth switch handles it.
The nylas auth switch command changes which connected email account the CLI targets by default. After switching, all email, calendar, and contact commands operate against the new account without needing --grant on every call.
Syntax
nylas auth switch [grant-id]
When to Use This
Reach for nylas auth switch during initial setup, in CI/CD pipelines, or when managing multiple connected accounts. Combine with --json to pipe output into other tools.
Examples
Switch interactively:
nylas auth switch
Switch to a specific grant:
nylas auth switch grant_abc123
How It Works
The CLI stores credentials securely in your system keychain (macOS Keychain, Linux Secret Service, or Windows Credential Manager). Tokens are refreshed automatically â you authenticate once and commands just work.
Key Flags
Run nylas auth switch --help to see all available flags. Add --json for machine-readable output â useful when piping into jq or feeding data to scripts.
nylas auth switch --help
Full docs: nylas auth switch reference â all flags, advanced examples, and troubleshooting.
All commands: Nylas CLI Command Reference
Get started: brew install nylas/nylas-cli/nylas â other install methods
Top comments (0)