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

the-resend-cli

v0.1.3

Published

CLI for the Resend email API

Readme

Resend CLI: An opinionated Resend email API client

CLI tool for Resend with JSON output across all 29 commands. Designed for LLM agents, scripts, and humans who prefer structured data over dashboards.

Why?

I want my LLM agents and scripts to send emails, manage domains, and work with audiences through Resend — without pulling in a full MCP server or writing fetch calls. resend emails send is all it takes. Every command returns clean JSON to stdout, making it trivial to pipe into jq, feed to an LLM, or integrate into CI/CD.

This project scratches my own itches. It wraps the full Resend API surface: emails, domains, API keys, audiences, contacts, and broadcasts. YMMV.

Command Examples

Emails

# Send an email
resend emails send --from "Acme <[email protected]>" --to [email protected] \
  --subject "Welcome!" --html "<h1>Hello</h1>"

# Send with plain text, CC, BCC, and tags
resend emails send --from [email protected] --to [email protected] \
  --subject "Update" --text "Plain text body" \
  --cc [email protected] --bcc [email protected] \
  --tag campaign=onboarding --tag version=2

# Schedule an email
resend emails send --from [email protected] --to [email protected] \
  --subject "Reminder" --text "Don't forget!" \
  --scheduled-at "2025-12-25T09:00:00Z"

# Send a batch of emails (up to 100)
resend emails send-batch --file ./batch.json

# Get email details
resend emails get em_123abc

# Update a scheduled email
resend emails update em_123abc --scheduled-at "2025-12-26T09:00:00Z"

# Cancel a scheduled email
resend emails cancel em_123abc

Domains

# Add a domain
resend domains create --name example.com --region us-east-1

# List all domains
resend domains list

# Get domain details (DNS records, status, etc.)
resend domains get d_123abc

# Update domain settings
resend domains update d_123abc --open-tracking --click-tracking --tls enforced

# Disable tracking
resend domains update d_123abc --no-open-tracking --no-click-tracking

# Verify a domain
resend domains verify d_123abc

# Delete a domain
resend domains delete d_123abc

API Keys

# Create a full-access API key
resend api-keys create --name "Production"

# Create a sending-only key restricted to a domain
resend api-keys create --name "Marketing" --permission sending-access --domain-id d_123abc

# List all API keys
resend api-keys list

# Delete an API key
resend api-keys delete ak_123abc

Audiences

# Create an audience
resend audiences create --name "Newsletter Subscribers"

# List all audiences
resend audiences list

# Get audience details
resend audiences get aud_123abc

# Delete an audience
resend audiences delete aud_123abc

Contacts

All contact commands require --audience-id because Resend namespaces contacts under audiences.

# Add a contact to an audience
resend contacts create --audience-id aud_123abc --email [email protected] \
  --first-name Jane --last-name Doe

# List contacts in an audience
resend contacts list --audience-id aud_123abc

# Get contact details
resend contacts get con_123abc --audience-id aud_123abc

# Update a contact
resend contacts update con_123abc --audience-id aud_123abc \
  --first-name Janet --unsubscribed

# Delete a contact
resend contacts delete con_123abc --audience-id aud_123abc

Broadcasts

# Create a broadcast
resend broadcasts create --audience-id aud_123abc \
  --from "Newsletter <[email protected]>" --subject "March Update" \
  --html "<h1>What's new</h1>" --name "march-2025"

# List all broadcasts
resend broadcasts list

# Get broadcast details
resend broadcasts get bc_123abc

# Update a broadcast before sending
resend broadcasts update bc_123abc --subject "March Update (revised)"

# Send a broadcast immediately
resend broadcasts send bc_123abc

# Schedule a broadcast
resend broadcasts send bc_123abc --scheduled-at "2025-03-15T10:00:00Z"

# Delete a broadcast
resend broadcasts delete bc_123abc

Piping & Scripting

# Extract the email ID from a send
resend emails send --from [email protected] --to [email protected] \
  --subject "Test" --text "Hi" | jq -r '.data.id'

# List all domain IDs
resend domains list | jq -r '.data.data[].id'

# Bulk-add contacts from a CSV
cat contacts.csv | while IFS=, read email first last; do
  resend contacts create --audience-id aud_123 \
    --email "$email" --first-name "$first" --last-name "$last"
done

Output Format

Every command returns JSON to stdout. Exit code 0 on success, 1 on error.

Success:

{
  "success": true,
  "data": { "id": "em_123abc" }
}

Error:

{
  "success": false,
  "error": { "message": "Invalid API key", "name": "validation_error" }
}

Installation

npm (recommended)

npm install -g the-resend-cli
resend --help

Or run without installing:

npx the-resend-cli --help

From source

git clone https://github.com/Shubham-Rasal/resend-cli.git
cd resend-cli/resend-cli
pnpm install
pnpm build
node dist/main.js --help

Development setup

git clone https://github.com/Shubham-Rasal/resend-cli.git
cd resend-cli/resend-cli
pnpm install
npx tsx src/main.ts --help  # No compilation needed

Authentication

You can authenticate by passing in your API key via --api-key flag:

resend --api-key re_xxx emails list

… OR by storing it in an environment variable RESEND_API_KEY:

RESEND_API_KEY=re_xxx resend emails send --from [email protected] --to [email protected] --subject "Hi" --text "Hello"

… OR by storing it in ~/.resend_api_key once, and then forgetting about it because the tool will check that file automatically:

# Save key once:
echo "re_xxx" > ~/.resend_api_key

# Day-to-day, just use the tool
resend emails send --from [email protected] --to [email protected] --subject "Hi" --text "Hello"

Getting a Resend API key

  1. Sign up or log in at resend.com
  2. Go to API Keys in the sidebar
  3. Click Create API Key

Example rule for your LLM agent

We send transactional and marketing emails through Resend (https://resend.com). We use the `resend` CLI tool for communicating with the Resend API. Use your Bash tool to call the `resend` executable. Run `resend --help` and `resend <command> --help` to see usage information.

All output is JSON. Parse the `success` field to determine if the operation succeeded. On success, the relevant data is in the `data` field. On failure, the error message is in `error.message`.

When sending emails, always specify `--from`, `--to`, and `--subject`. Use `--html` for rich emails or `--text` for plain text. For bulk sends, write a JSON array to a file and use `resend emails send-batch --file <path>`.

All contact operations require `--audience-id` because Resend namespaces contacts under audiences. When working with contacts, always fetch the audience list first if the audience ID isn't known.

Tech Stack

  • TypeScript (ESM) with Commander.js v12
  • Resend Node.js SDK v4 for API calls
  • Vitest for unit and integration testing
  • pnpm for package management

Testing

# Run unit tests (no API key needed)
pnpm test

# Run integration tests (requires RESEND_API_KEY)
RESEND_API_KEY=re_xxx pnpm test:integration

Command Reference

| Resource | Commands | |----------|----------| | emails | send, send-batch, get, update, cancel | | domains | create, list, get, update, delete, verify | | api-keys | create, list, delete | | audiences | create, list, get, delete | | contacts | create, list, get, update, delete | | broadcasts | create, list, get, update, send, delete |

Run resend <resource> --help for detailed flags and usage for each command.