npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

resend-email-cli

v1.0.1

Published

Command-line interface for Resend - The Email API for Developers

Readme

Resend CLI

npm version License: MIT

A powerful command-line interface for the Resend email API. Send emails, manage domains, contacts, audiences, broadcasts, and webhooks directly from your terminal.

Features

  • 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

Installation

# Using npm
npm install -g resend-email-cli

# Using bun
bun install -g resend-email-cli

Quick Start

1. Configure your API key

# Interactive setup
resend config init

# Or set directly
resend config set api_key re_xxxxxxxxxxxxx

# Or use environment variable
export RESEND_API_KEY=re_xxxxxxxxxxxxx

2. Send your first email

resend emails send \
  --from "[email protected]" \
  --to "[email protected]" \
  --subject "Hello from Resend CLI" \
  --text "This email was sent from the command line!"

Commands

Configuration

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

Emails

# Send a single email
resend emails send --from "[email protected]" --to "[email protected]" --subject "Hello" --text "Body"

# Send with HTML content
resend emails send --from "[email protected]" --to "[email protected]" --subject "Hello" --html "<h1>Hello</h1>"

# Send with HTML file
resend emails send --from "[email protected]" --to "[email protected]" --subject "Hello" --html-file ./email.html

# Send with attachments
resend emails send --from "[email protected]" --to "[email protected]" --subject "Report" --text "See attached" --attachment ./report.pdf

# Schedule email for later
resend emails send --from "[email protected]" --to "[email protected]" --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>

Domains

# 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>

Audiences

# 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>

Contacts

# List contacts in an audience
resend contacts list <audience-id>

# Add a contact
resend contacts create <audience-id> --email "[email protected]" --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

Broadcasts

# List all broadcasts
resend broadcasts list

# Create a broadcast
resend broadcasts create <audience-id> --from "[email protected]" --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>

Webhooks

# 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>

Global Options

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 |

Configuration

The CLI stores configuration in ~/.resend/config.json. Configuration priority:

  1. Command-line flags (--api-key)
  2. Environment variables (RESEND_API_KEY)
  3. Configuration file

Environment Variables

| Variable | Description | |----------|-------------| | RESEND_API_KEY | Your Resend API key |

File Formats

Batch Email JSON

[
  {
    "from": "[email protected]",
    "to": "[email protected]",
    "subject": "Hello 1",
    "text": "Message 1"
  },
  {
    "from": "[email protected]",
    "to": "[email protected]",
    "subject": "Hello 2",
    "html": "<h1>Message 2</h1>"
  }
]

Contact Import CSV

email,first_name,last_name
[email protected],John,Doe
[email protected],Jane,Smith

Examples

Send email with CC and BCC

resend emails send \
  --from "[email protected]" \
  --to "[email protected]" \
  --cc "[email protected]" \
  --bcc "[email protected]" \
  --subject "Important Update" \
  --text "Please review the attached document."

Send email with tags for tracking

resend emails send \
  --from "[email protected]" \
  --to "[email protected]" \
  --subject "Welcome!" \
  --text "Welcome to our service" \
  --tag "campaign:welcome" \
  --tag "source:signup"

Pipe HTML content

cat email.html | resend emails send \
  --from "[email protected]" \
  --to "[email protected]" \
  --subject "Newsletter"

Use in CI/CD pipeline

# Send deployment notification
resend emails send \
  --api-key $RESEND_API_KEY \
  --from "[email protected]" \
  --to "[email protected]" \
  --subject "Deployment Complete" \
  --text "Version $VERSION deployed to production" \
  --output json

JSON output for scripting

# Get email ID from send response
EMAIL_ID=$(resend emails send \
  --from "[email protected]" \
  --to "[email protected]" \
  --subject "Test" \
  --text "Test" \
  --output json | jq -r '.id')

# Check email status
resend emails get $EMAIL_ID --output json | jq '.status'

Webhook Events

Available webhook event types:

  • email.sent - Email accepted by Resend
  • email.delivered - Email delivered to recipient
  • email.delivery_delayed - Delivery temporarily delayed
  • email.bounced - Email bounced
  • email.complained - Recipient marked as spam
  • email.opened - Email opened (if tracking enabled)
  • email.clicked - Link clicked (if tracking enabled)

API Documentation

For detailed API documentation, visit Resend API Docs.

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Links