A powerful command-line interface for the Resend email API. Send emails, manage domains, contacts, audiences, broadcasts, and webhooks directly from your terminal.
- Email Management - Send single emails, batch emails, schedule delivery, and track status
- Domain Management - Add, verify, and configure sending domains
- Audience Management - Create and manage contact lists
- Contact Management - Add, update, import contacts from CSV
- Broadcast Campaigns - Send bulk emails to audiences
- Webhook Integration - Set up event notifications for email delivery events
- Multiple Output Formats - JSON or human-readable table output
- Scriptable - Perfect for CI/CD pipelines and automation
# Using npm
npm install -g resend-email-cli
# Using bun
bun install -g resend-email-cli# Interactive setup
resend config init
# Or set directly
resend config set api_key re_xxxxxxxxxxxxx
# Or use environment variable
export RESEND_API_KEY=re_xxxxxxxxxxxxxresend emails send \
--from "you@yourdomain.com" \
--to "recipient@example.com" \
--subject "Hello from Resend CLI" \
--text "This email was sent from the command line!"resend config init # Interactive configuration setup
resend config get # Show current configuration
resend config set <key> <value> # Set a configuration value
resend config delete <key> # Remove a configuration value# Send a single email
resend emails send --from "sender@example.com" --to "recipient@example.com" --subject "Hello" --text "Body"
# Send with HTML content
resend emails send --from "sender@example.com" --to "recipient@example.com" --subject "Hello" --html "<h1>Hello</h1>"
# Send with HTML file
resend emails send --from "sender@example.com" --to "recipient@example.com" --subject "Hello" --html-file ./email.html
# Send with attachments
resend emails send --from "sender@example.com" --to "recipient@example.com" --subject "Report" --text "See attached" --attachment ./report.pdf
# Schedule email for later
resend emails send --from "sender@example.com" --to "recipient@example.com" --subject "Reminder" --text "Don't forget!" --scheduled-at "2024-12-25T09:00:00Z"
# Send batch emails from JSON file
resend emails send-batch ./emails.json
# Get email details
resend emails get <email-id>
# List sent emails
resend emails list --limit 20
# Update scheduled email
resend emails update <email-id> --scheduled-at "2024-12-26T09:00:00Z"
# Cancel scheduled email
resend emails cancel <email-id># List all domains
resend domains list
# Add a new domain
resend domains add example.com --region us-east-1
# Get domain details and DNS records
resend domains get <domain-id>
# Verify domain DNS records
resend domains verify <domain-id>
# Update domain settings
resend domains update <domain-id> --open-tracking --click-tracking
# Delete a domain
resend domains delete <domain-id># List all audiences
resend audiences list
# Create a new audience
resend audiences create "Newsletter Subscribers"
# Get audience details
resend audiences get <audience-id>
# Delete an audience
resend audiences delete <audience-id># List contacts in an audience
resend contacts list <audience-id>
# Add a contact
resend contacts create <audience-id> --email "user@example.com" --first-name "John" --last-name "Doe"
# Get contact details
resend contacts get <audience-id> <contact-id>
# Update a contact
resend contacts update <audience-id> <contact-id> --first-name "Jane"
# Unsubscribe a contact
resend contacts update <audience-id> <contact-id> --unsubscribe
# Delete a contact
resend contacts delete <audience-id> <contact-id>
# Import contacts from CSV
resend contacts import <audience-id> ./contacts.csv# List all broadcasts
resend broadcasts list
# Create a broadcast
resend broadcasts create <audience-id> --from "news@example.com" --subject "Newsletter" --html-file ./newsletter.html
# Get broadcast details
resend broadcasts get <broadcast-id>
# Update a broadcast
resend broadcasts update <broadcast-id> --subject "Updated Subject"
# Send a broadcast
resend broadcasts send <broadcast-id>
# Delete a broadcast
resend broadcasts delete <broadcast-id># List all webhooks
resend webhooks list
# Create a webhook
resend webhooks create https://example.com/webhook --events email.sent --events email.delivered
# Get webhook details
resend webhooks get <webhook-id>
# Update webhook events
resend webhooks update <webhook-id> --events email.bounced --events email.complained
# Delete a webhook
resend webhooks delete <webhook-id>All commands support these global options:
| Option | Description |
|---|---|
--api-key <key> |
Use a specific API key (overrides config) |
--output <format> |
Output format: json or table (default: json) |
--verbose |
Enable verbose logging |
--no-color |
Disable colored output |
-h, --help |
Display help for command |
The CLI stores configuration in ~/.resend/config.json. Configuration priority:
- Command-line flags (
--api-key) - Environment variables (
RESEND_API_KEY) - Configuration file
| Variable | Description |
|---|---|
RESEND_API_KEY |
Your Resend API key |
[
{
"from": "sender@example.com",
"to": "recipient1@example.com",
"subject": "Hello 1",
"text": "Message 1"
},
{
"from": "sender@example.com",
"to": "recipient2@example.com",
"subject": "Hello 2",
"html": "<h1>Message 2</h1>"
}
]email,first_name,last_name
john@example.com,John,Doe
jane@example.com,Jane,Smithresend emails send \
--from "sender@example.com" \
--to "recipient@example.com" \
--cc "copy@example.com" \
--bcc "hidden@example.com" \
--subject "Important Update" \
--text "Please review the attached document."resend emails send \
--from "sender@example.com" \
--to "recipient@example.com" \
--subject "Welcome!" \
--text "Welcome to our service" \
--tag "campaign:welcome" \
--tag "source:signup"cat email.html | resend emails send \
--from "sender@example.com" \
--to "recipient@example.com" \
--subject "Newsletter"# Send deployment notification
resend emails send \
--api-key $RESEND_API_KEY \
--from "ci@example.com" \
--to "team@example.com" \
--subject "Deployment Complete" \
--text "Version $VERSION deployed to production" \
--output json# Get email ID from send response
EMAIL_ID=$(resend emails send \
--from "sender@example.com" \
--to "recipient@example.com" \
--subject "Test" \
--text "Test" \
--output json | jq -r '.id')
# Check email status
resend emails get $EMAIL_ID --output json | jq '.status'Available webhook event types:
email.sent- Email accepted by Resendemail.delivered- Email delivered to recipientemail.delivery_delayed- Delivery temporarily delayedemail.bounced- Email bouncedemail.complained- Recipient marked as spamemail.opened- Email opened (if tracking enabled)email.clicked- Link clicked (if tracking enabled)
For detailed API documentation, visit Resend API Docs.
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
