The Resend CLI is the official command-line interface for Resend. It covers the full API surface and is built for humans, AI agents, and CI/CD pipelines.
Installation
cURL
npm
Homebrew
PowerShell (Windows)
curl -fsSL https://resend.com/install.sh | bash
npm install -g resend-cli
brew install resend/cli/resend
irm https: // resend.com / install.ps1 | iex
Authentication
The CLI resolves your API key using the following priority chain:
Priority Source How to set 1 (highest) --api-key flagresend --api-key re_xxx emails send ...2 RESEND_API_KEY env varexport RESEND_API_KEY=re_xxx3 (lowest) Saved credentials resend login
If no key is found from any source, the CLI errors with code auth_error.
resend login
Authenticate by storing your API key locally. The key is validated against the Resend API before being saved.
In a terminal, the command prompts for your key via masked input. In non-interactive environments (CI, pipes), use the --key flag:
resend login --key re_xxxxxxxxxxxxx
Credentials are saved to your system’s secure credential storage (macOS Keychain, Windows Credential Manager, or Linux secret service).
Flag Description --key <key>API key to store (required in non-interactive mode)
resend logout
Remove your saved API key.
Switch between profiles
If you work across multiple Resend teams or accounts, switch between profiles without logging in and out:
Use the global --profile flag on any command to run it with a specific profile:
resend domains list --profile production
Other profile management commands:
Command Description resend auth listList all profiles resend auth switch [name]Switch the active profile resend auth rename [old] [new]Rename a profile resend auth remove [name]Remove a profile resend whoamiShow current authentication status
Emails
resend emails send
Send an email. Provide all options via flags for scripting, or let the CLI prompt interactively for missing fields.
resend emails send \
--from "Acme <onboarding@resend.dev>" \
--to delivered@resend.dev \
--subject "Hello World" \
--text "It works!"
Flag Required Description --from <address>Yes * Sender email address (must be from a verified domain) --to <addresses...>Yes One or more recipient email addresses (space-separated) --subject <subject>Yes * Email subject line --text <text>One of text/html Plain text body --text-file <path>One of text/html Path to a plain text file (use - for stdin) --html <html>One of text/html HTML body as a string --html-file <path>One of text/html Path to an HTML file (use - for stdin) --react-email <path>One of text/html Path to a React Email template (.tsx) to render and send --cc <addresses...>No CC recipients --bcc <addresses...>No BCC recipients --reply-to <address>No Reply-to email address --scheduled-at <datetime>No Schedule for later — ISO 8601 or natural language --attachment <paths...>No File path(s) to attach --headers <key=value...>No Custom headers as key=value pairs --tags <name=value...>No Email tags as name=value pairs --idempotency-key <key>No Deduplicate this send request --template <id>No Template ID to use --var <key=value...>No Template variables as key=value pairs
* Not required when using --template — the template provides them.
Examples:
# HTML from a file
resend emails send \
--from "Acme <onboarding@resend.dev>" \
--to delivered@resend.dev \
--subject "Hello World" \
--html-file ./welcome.html
# Multiple recipients with CC, BCC, and reply-to
resend emails send \
--from "Acme <onboarding@resend.dev>" \
--to delivered@resend.dev \
--subject "Hello World" \
--text "It works!" \
--cc manager@example.com \
--bcc archive@example.com \
--reply-to noreply@example.com
# Send a React Email template
resend emails send \
--from "Acme <onboarding@resend.dev>" \
--to delivered@resend.dev \
--subject "Hello World" \
--react-email ./emails/welcome.tsx
# Send with a template
resend emails send \
--from "Acme <onboarding@resend.dev>" \
--to delivered@resend.dev \
--template tmpl_xxxxx \
--var "name=Alice" --var "company=Acme"
resend emails batch
Send up to 100 emails in a single API request from a JSON file.
resend emails batch --file ./emails.json
Flag Required Description --file <path>Yes Path to JSON file containing array of email objects (use - for stdin) --react-email <path>No Path to a React Email template (.tsx) — rendered HTML applies to every email in the batch --idempotency-key <key>No Deduplicate this batch request --batch-validation <mode>No strict (default, entire batch fails on any error) or permissive
Other email commands
resend emails list # List sent emails
resend emails get < i d > # Retrieve a sent email by ID
resend emails cancel < i d > # Cancel a scheduled email
resend emails update < i d > # Update a scheduled email's send time
Receiving
resend emails receiving list # List received (inbound) emails
resend emails receiving get < i d > # Retrieve a received email with full details
resend emails receiving listen # Poll for new inbound emails as they arrive
resend emails receiving forward < i d > # Forward a received email
resend emails receiving attachments < i d > # List attachments for a received email
resend emails receiving attachment < i d > < attachment-i d > # Download a specific attachment
Domains
Manage your sending and receiving domains.
resend domains create --name example.com --region us-east-1
resend domains list # List all domains
resend domains get < i d > # Retrieve domain with DNS records
resend domains verify < i d > # Trigger DNS verification
resend domains update < i d > # Update TLS, tracking, or receiving settings
resend domains delete < i d > # Delete a domain
API Keys
resend api-keys create --name "Production" --permission full_access
resend api-keys list # List all API keys
resend api-keys delete < i d > # Delete an API key
Broadcasts
Create and send broadcast emails to segments. Supports --html-file and --react-email for content.
resend broadcasts create \
--from "Acme <onboarding@resend.dev>" \
--subject "Product update" \
--segment-id seg_xxxxx \
--html-file ./broadcast.html \
--send
resend broadcasts list # List all broadcasts
resend broadcasts get < i d > # Retrieve broadcast details
resend broadcasts send < i d > # Send a draft broadcast
resend broadcasts update < i d > # Update a draft broadcast
resend broadcasts delete < i d > # Delete a broadcast
resend broadcasts open [id] # Open a broadcast in the dashboard
Manage contacts, segment membership, and topic subscriptions.
resend contacts create --email steve.wozniak@gmail.com --first-name Steve
resend contacts list # List all contacts
resend contacts get < i d > # Retrieve a contact by ID or email
resend contacts update < i d > # Update contact properties
resend contacts delete < i d > # Delete a contact
resend contacts segments < i d > # List segments a contact belongs to
resend contacts add-segment < i d > # Add a contact to a segment
resend contacts remove-segment < i d > < segment-i d > # Remove from a segment
resend contacts topics < i d > # List topic subscriptions
resend contacts update-topics < i d > # Update topic subscriptions
resend contact-properties create --key "company" --type string
resend contact-properties list | get | update | delete
Segments
resend segments create --name "VIPs"
resend segments list | get | delete
Topics
resend topics create --name "Product updates"
resend topics list | get | update | delete
Templates
Create and manage email templates. Supports --html-file and --react-email for content.
resend templates create --name "Welcome" --subject "Welcome to Acme" --react-email ./emails/welcome.tsx
resend templates list # List all templates
resend templates get < i d > # Retrieve a template by ID or alias
resend templates update < i d > # Update a template
resend templates publish < i d > # Publish a draft template
resend templates duplicate < i d > # Duplicate a template
resend templates delete < i d > # Delete a template
resend templates open [id] # Open a template in the dashboard
Logs
View API request logs.
resend logs list # List API request logs
resend logs get < i d > # Retrieve a log with full request/response bodies
resend logs open [id] # Open logs in the dashboard
Webhooks
resend webhooks create
Register a webhook endpoint.
resend webhooks create \
--endpoint https://example.com/webhook \
--events email.sent email.delivered
Flag Required Description --endpoint <url>Yes HTTPS URL to receive events --events <types...>Yes Event types to subscribe to (use all for all events)
resend webhooks listen
Listen for webhook events locally during development. Starts a server, registers a temporary webhook, streams events, and cleans up on exit.
resend webhooks listen \
--url https://hostname.tailnet-name.ts.net \
--events email.received
Flag Required Description --url <url>Yes Your public URL (e.g., Tailscale Funnel URL) --events <types...>No Event types to listen for (default: all) --forward-to <url>No Forward payloads to a local server (passes original Svix headers) --port <port>No Local server port (default: 4318)
Other webhook commands
resend webhooks list # List all webhook endpoints
resend webhooks get < i d > # Retrieve a webhook configuration
resend webhooks update < i d > # Update endpoint URL, events, or status
resend webhooks delete < i d > # Delete a webhook endpoint
Run resend <command> --help for the full list of flags and options on any command.
Utility
resend doctor
Run environment diagnostics. Verifies your CLI version, API key, credential storage, and domain status.
Check Pass Warn Fail CLI Version Running latest Update available — API Key Key found (shows masked key + source) — No key found Credential Storage Secure backend (e.g., macOS Keychain) Plaintext file fallback — API Validation Verified domains exist Sending-only key, no domains, or all pending API key invalid
# JSON output
resend doctor --json
{
"ok" : true ,
"checks" : [
{ "name" : "CLI Version" , "status" : "pass" , "message" : "v1.7.0 (latest)" },
{
"name" : "API Key" ,
"status" : "pass" ,
"message" : "re_...xxxx (source: env)"
},
{
"name" : "Credential Storage" ,
"status" : "pass" ,
"message" : "macOS Keychain"
},
{ "name" : "Domains" , "status" : "pass" , "message" : "2 verified, 0 pending" }
]
}
Exits 0 when all checks pass or warn. Exits 1 if any check fails.
Other utility commands
Command Description resend whoamiShow current authentication status resend openOpen the Resend dashboard in your browser resend updateCheck for available CLI updates resend completion [shell]Generate shell completion scripts (bash, zsh, fish, powershell) resend completion --installAuto-install completions into your shell profile
Global options
These flags work on every command:
resend [global options] < comman d > [command options]
Flag Description --api-key <key>Override API key for this invocation -p, --profile <name>Profile to use (overrides RESEND_PROFILE env var) --jsonForce JSON output even in interactive terminals -q, --quietSuppress spinners and status output (implies --json) --insecure-storageSave API key as plaintext instead of secure storage --versionPrint version and exit --helpShow help text
Output behavior
The CLI has two output modes that switch automatically:
Mode When Stdout Stderr Interactive Terminal (TTY) Formatted text Spinners, prompts Machine Piped, CI, or --json JSON Nothing
Pipe to another command and JSON output activates:
resend doctor | jq '.checks[].name'
resend emails send \
--from "Acme <onboarding@resend.dev>" \
--to delivered@resend.dev \
--subject "Hello World" \
--text "It works!" | jq '.id'
Errors always exit with code 1 and output structured JSON:
{ "error" : { "message" : "No API key found" , "code" : "auth_error" } }
CI/CD
Set RESEND_API_KEY as an environment variable — no resend login needed:
# GitHub Actions
env :
RESEND_API_KEY : ${{ secrets.RESEND_API_KEY }}
steps :
- run : |
resend emails send \
--from "Acme <onboarding@resend.dev>" \
--to delivered@resend.dev \
--subject "Deploy complete" \
--text "Version ${{ github.sha }} deployed."
Configuration
Item Path Notes Config directory ~/.config/resend/Respects $XDG_CONFIG_HOME on Linux, %APPDATA% on Windows Credentials System secure storage macOS Keychain, Windows Credential Manager, or Linux secret service Install directory ~/.resend/bin/Respects $RESEND_INSTALL
Using the CLI with AI Agents Learn about Agent Skills, non-interactive mode, and local webhook development
for AI agents.