The nylas otp commands extract one-time passwords from your email automatically. Stop switching to your inbox to copy 6-digit codes — the CLI finds them and copies to your clipboard in under 3 seconds.
What nylas otp does
Scans recent emails for verification codes (6-digit, 8-digit, alphanumeric), extracts them using pattern matching, and copies the latest to your clipboard. Works with Gmail, Outlook, Yahoo, and any IMAP provider.
Quick Start
brew install nylas/nylas-cli/nylas
nylas init
nylas otp get
That's it — the latest OTP code is now in your clipboard. Paste it into the verification form.
Key commands
| Command | What it does |
|---|---|
nylas otp get |
Get latest OTP, copy to clipboard |
nylas otp get --raw |
Output only the code (for scripting) |
nylas otp watch |
Watch for new codes in real-time |
nylas otp watch --interval 5 |
Poll every 5 seconds |
nylas otp list |
List configured accounts |
nylas otp messages |
Show recent messages with OTP detection |
Use in Playwright/Cypress tests
# In your E2E test script:
OTP=$(nylas otp get --raw)
# Use $OTP to fill the verification form programmatically
This eliminates the need for Gmail API credentials in CI/CD pipelines. The CLI handles auth — your test just calls nylas otp get --raw.
Watching for codes in real-time
nylas otp watch --interval 3
Polls every 3 seconds and prints new codes as they arrive. Useful when you triggered a "send verification code" flow and are waiting for delivery.
Common issues
No OTP found
The code might not have arrived yet. Use nylas otp watch to wait, or check nylas otp messages to see what emails were scanned.
Wrong code extracted
If multiple verification emails arrived recently, nylas otp get returns the newest. Use nylas otp messages to see all candidates.
Related posts
- Extract OTP Codes from Email — Skip the Inbox
- E2E Email Testing with Playwright and Cypress
- Per-PR ephemeral email inboxes for E2E tests
All commands: Nylas CLI Command Reference
Get started: brew install nylas/nylas-cli/nylas — other install methods
Top comments (0)