@mjrussell/resend-cli
v0.1.0
Published
Unofficial CLI for Resend email API
Readme
resend-cli
Unofficial CLI for Resend — Not affiliated with or endorsed by Resend.
A command-line interface for the Resend email API for managing received (inbound) emails and attachments.
Features
- List and view received emails
- View email attachments
- JSON output for scripting
- Simple environment-based configuration
Installation
From npm (recommended)
npm install -g @mjrussell/resend-cliFrom source
git clone https://github.com/mjrussell/resend-cli.git
cd resend-cli
npm install
npm run build
npm install -g .Configuration
Set your Resend API key as an environment variable:
export RESEND_API_KEY="re_your_api_key_here"Getting an API Key
- Sign up at resend.com
- Set up inbound email routing for your domain
- Go to API Keys → Create API key (needs read permissions)
- Store securely (e.g., in your shell profile or a secrets manager)
Quick Start
# List received emails
resend email list
# Get details for a specific email
resend email get <email_id>
# List attachments for an email
resend email attachments <email_id>
# JSON output for scripting
resend email list --json | jq '.data.data[0]'Commands
resend email list [options]
List received (inbound) emails (default: 10 most recent).
| Option | Description |
|--------|-------------|
| -j, --json | Output as JSON |
| -l, --limit <n> | Number of emails (default: 10) |
resend email get <id>
Get details for a received email (from, to, subject, text, html).
| Option | Description |
|--------|-------------|
| -j, --json | Output as JSON |
resend email attachments <email_id>
List all attachments for a received email.
| Option | Description |
|--------|-------------|
| -j, --json | Output as JSON |
resend email attachment <email_id> <attachment_id>
Get metadata for a specific attachment.
| Option | Description |
|--------|-------------|
| -j, --json | Output as JSON |
| -o, --output <path> | Output path (metadata only) |
Examples
# List 5 most recent emails
resend email list --limit 5
# Get the most recent email ID
EMAIL_ID=$(resend email list --json | jq -r '.data.data[0].id')
# Get email details
resend email get $EMAIL_ID
# Check attachment count
resend email attachments $EMAIL_ID --json | jq '.data.data | length'Environment Variables
| Variable | Description | Required |
|----------|-------------|----------|
| RESEND_API_KEY | Your Resend API key | Yes |
Exit Codes
| Code | Description |
|------|-------------|
| 0 | Success |
| 1 | API error or generic failure |
| 2 | Invalid usage or missing API key |
Development
git clone https://github.com/mjrussell/resend-cli.git
cd resend-cli
npm install
npm run build # Build the CLI
npm run dev # Run with tsx (dev mode)
npm run watch # Watch mode with tsup
npm run typecheck # Type check without emittingRoadmap
- [ ] Send emails (
resend email send) - [ ] Domain management (
resend domain list) - [ ] Actual attachment file downloads
- [ ] Pagination support
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT © Matt Russell
Disclaimer
This is an unofficial tool. Resend is a trademark of Resend Inc.
