@letanure/resend-cli
v0.40.0
Published
A command-line interface for Resend email API
Maintainers
Readme
Resend CLI
A command-line interface for the Resend email API. Send emails, manage domains, and more via CLI commands or an interactive TUI.
Disclaimer: This is an unofficial CLI tool built on top of the Resend Node.js SDK. It is not affiliated with or endorsed by Resend.
Warning: Currently in active development. Some features may be incomplete or subject to change.
TLDR
Get your API key at resend.com/api-keys, export it, and run:
CLI Mode:
export RESEND_API_KEY="re_your_api_key_here"
npx @letanure/resend-cli email send \
--from="Acme <[email protected]>" \
--to="[email protected]" \
--subject="Hello from CLI" \
--text="This email was sent from the command line!"TUI Mode:
npx @letanure/resend-cliRequirements
Node.js 18+ and a Resend API key
Get Your API Key
- Sign up at resend.com
- Go to API Keys
- Create a new API key
- Copy the key (starts with
re_)
Table of Contents
- Requirements
- Get Your API Key
- Installation
- Configuration
- Usage
- Commands
- TUI Mode
- Output Formats
- CI/CD Integration
- Troubleshooting
- Development
- License
- Contributing
Installation
Recommended: Use with npx (no installation required)
npx @letanure/resend-cli --helpFor frequent use: Install globally
npm install -g @letanure/resend-cli
resend-cli --helpIn projects: Install locally
npm install @letanure/resend-cli
npx resend-cli --helpConfiguration
Environment Variables
The CLI requires your Resend API key to be available as an environment variable.
Setup Methods
Temporary (current session only):
export RESEND_API_KEY="re_xxxxxxxxxxxx"Permanent (recommended):
# Add to your shell profile
echo 'export RESEND_API_KEY="re_xxxxxxxxxxxx"' >> ~/.bashrc
source ~/.bashrc
# Or for zsh users
echo 'export RESEND_API_KEY="re_xxxxxxxxxxxx"' >> ~/.zshrc
source ~/.zshrcOne-time usage:
RESEND_API_KEY="re_xxxxxxxxxxxx" resend-cli email send --from="..." --to="..."Getting Your API Key
- Sign up at resend.com
- Go to API Keys
- Create a new API key
- Copy the key (starts with
re_)
Usage
$ resend-cli --help
Usage: resend-cli [options] [command]
Resend CLI - Send emails, manage domains, and more
API Key: Set RESEND_API_KEY environment variable or use --api-key option
Options:
-V, --version output the version number
-v output the version number
--dry-run Enable dry-run mode for all operations (default: false)
--api-key <key> Resend API key (overrides RESEND_API_KEY environment
variable)
-h, --help display help for command
Commands:
apikeys Manage API keys
audiences Audience operations
broadcasts Broadcast operations
contacts Manage contacts in your audiences
domains Domain operations
email Email operations
help [command] display help for command
Commands
apikeys
Manage API keys
$ resend-cli apikeys --help
Usage: resend-cli apikeys [options] [command]
Manage API keys
Options:
-h, --help display help for command
Commands:
create [options] Create a new API key in Resend
delete [options] Delete an existing API key from Resend
list [options] List all API keys in Resend
audiences
Manage audiences for newsletters and broadcasts
$ resend-cli audiences --help
Usage: resend-cli audiences [options] [command]
Audience operations
Options:
-h, --help display help for command
Commands:
create [options] Create a new audience via Resend API
retrieve [options] Retrieve an audience by ID from Resend API
delete [options] Delete an audience by ID from Resend API
list [options] List all audiences from Resend API
broadcasts
Manage newsletter broadcasts
$ resend-cli broadcasts --help
Usage: resend-cli broadcasts [options] [command]
Broadcast operations
Options:
-h, --help display help for command
Commands:
create|c [options] Create a new broadcast to send to your audience
delete|d [options] Delete a broadcast (only draft or scheduled broadcasts)
list|l List all broadcasts
retrieve [options] Retrieve a broadcast by ID from Resend API
send|s [options] Send a broadcast to your audience
update|u [options] Update a broadcast to send to your audience
contacts
Manage contacts in your audiences
$ resend-cli contacts --help
Usage: resend-cli contacts [options] [command]
Manage contacts in your audiences
Options:
-h, --help display help for command
Commands:
create [options] Create a contact in an audience via Resend API
delete [options] Delete a contact by ID or email from an audience in Resend
API
list [options] List all contacts in an audience
retrieve [options] Retrieve a contact by ID or email from an audience
update|u [options] Update an existing contact
domains
Manage domains and DNS configuration
$ resend-cli domains --help
Usage: resend-cli domains [options] [command]
Domain operations
Options:
-h, --help display help for command
Commands:
create [options] Create a domain through the Resend Email API
retrieve [options] Retrieve a domain by ID from Resend API
verify [options] Verify a domain by ID using Resend API
update [options] Update a domain configuration using Resend API
delete [options] Delete a domain by ID using Resend API
list [options] List all domains from Resend API
Send and manage emails
$ resend-cli email --help
Usage: resend-cli email [options] [command]
Email operations
Options:
-h, --help display help for command
Commands:
send [options] Send an email via Resend API
retrieve [options] Retrieve an email by ID from Resend API
update [options] Update a scheduled email via Resend API
cancel [options] Cancel a scheduled email via Resend API
email send
$ resend-cli email send --help
Usage: email send [OPTIONS]
Send an email via Resend API
OPTIONS:
--from, -f <value> Sender email address with optional name
--to, -t <value> Recipient email(s) - comma separated for multiple (max 50)
--subject, -s <value> Email subject line
--bcc, -b <value> Blind carbon copy recipients - comma separated
--cc, -c <value> Carbon copy recipients - comma separated for multiple
--scheduled-at, -a <value> Natural language (in 1 min) or ISO 8601 format
--reply-to, -r <value> Reply-to address(es) - comma separated
--html, -h <value> HTML version of the message
--text, -x <value> Plain text version
--output <value> Output format (text, json)
--dry-run Validate and preview without sending
--api-key <value> Resend API key (overrides RESEND_API_KEY environment variable)
EXAMPLES:
$ resend-cli email send --from="Acme <[email protected]>" --to="[email protected]" --subject="Hello World" --html="<h1>it works!</h1>"
$ resend-cli email send -f [email protected] -t [email protected] -s "Hello World" --text="it works!"
$ resend-cli email send --output json --from="..." --to="..." --subject="..." --html="..." | jq '.'
$ EMAIL_ID=$(resend-cli email send --output json ... | jq -r '.data.id')
$ RESEND_API_KEY="re_xxxxx" resend-cli email send --from="..." --to="..." --subject="..." --html="..."
$ resend-cli email send --api-key="re_xxxxx" --from="..." --to="..." --subject="..." --html="..."
TUI Mode
Launch the interactive interface for a guided experience:
$ resend-cliFeatures:
- Interactive navigation with arrow keys and Enter
- Form-based input with validation
- Module organization by functionality
- Rich display with colors and layout
Available Modules:
- Email Operations - Send, retrieve, update, cancel emails
- Domain Management - List and manage domains
- Audience Management - Create, list, retrieve, delete audiences
- API Key Management - Create, list, delete API keys
- Contact Management - Create, list, update, delete contacts
- Broadcast Operations - List and manage broadcasts
Navigation:
- Arrow Keys / Enter: Navigate and select options
- Escape: Go back | Ctrl+C: Exit
Dry-Run Mode: Both CLI and TUI modes support dry-run validation without sending:
- CLI: Add
--dry-runflag to any command - TUI: Start with
npx @letanure/resend-cli --dry-run - Warning banner appears when dry-run mode is active
Output Formats
The CLI supports both human-readable and machine-readable output:
Default (Human-readable): Rich formatted output with colors and layout
JSON Output (for automation):
Add --output json flag to any command for structured data:
$ resend-cli email send --output json --from="..." --to="..." --subject="..." --text="..."
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"to": "[email protected]",
"from": "Acme <[email protected]>",
"subject": "Hello"
}
}CI/CD Integration
Perfect for automated workflows:
# Extract email ID for further processing
EMAIL_ID=$(resend-cli email send --output json \
--from="Acme <[email protected]>" \
--to="[email protected]" \
--subject="Welcome to our app" \
--html="<h1>Welcome!</h1>" | jq -r '.data.id')
echo "Sent email with ID: $EMAIL_ID"Troubleshooting
Common Issues
Missing API Key:
✗ Configuration Error
Missing required environment variable: RESEND_API_KEY
Get your API key at https://resend.com/api-keysInput Validation: All inputs are validated - invalid emails, missing required fields, etc. will show clear error messages
Unknown Options: Unknown command options will trigger helpful error messages with suggestions
Development
See DEVELOPMENT.md for development setup, architecture details, and contributing guidelines.
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Update documentation
- Submit a pull request
See DEVELOPMENT.md for detailed development setup.
README is auto-generated based on CLI commands and modules
