rembrembdocs

Documentation Index

Fetch the complete documentation index at: https://resend.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

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

curl -fsSL https://resend.com/install.sh | bash

npm

npm install -g resend-cli

Homebrew

brew install resend/cli/resend

PowerShell (Windows)

irm https://resend.com/install.ps1 | iex

Authentication

The CLI resolves your API key using the following priority chain:

PrioritySourceHow to set
1 (highest)--api-key flagresend --api-key re_xxx emails send ...
2RESEND_API_KEY env varexport RESEND_API_KEY=re_xxx
3 (lowest)Saved credentialsresend 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).

FlagDescription
--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:

CommandDescription
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

Send, retrieve, cancel, and manage email delivery. 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!"
FlagRequiredDescription
--from <address>Yes *Sender email address (must be from a verified domain)
--to <addresses...>YesOne or more recipient email addresses (space-separated)
--subject <subject>Yes *Email subject line
--text <text>One of text/htmlPlain text body
--text-file <path>One of text/htmlPath to a plain text file (use - for stdin)
--html <html>One of text/htmlHTML body as a string
--html-file <path>One of text/htmlPath to an HTML file (use - for stdin)
--react-email <path>One of text/htmlPath to a React Email template (.tsx) to render and send
--cc <addresses...>NoCC recipients
--bcc <addresses...>NoBCC recipients
--reply-to <address>NoReply-to email address
--scheduled-at <datetime>NoSchedule for later — ISO 8601 or natural language
--attachment <paths...>NoFile path(s) to attach
--headers <key=value...>NoCustom headers as key=value pairs
--tags <name=value...>NoEmail tags as name=value pairs
--idempotency-key <key>NoDeduplicate this send request
--template <id>NoTemplate ID to use
--var <key=value...>NoTemplate 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
FlagRequiredDescription
--file <path>YesPath to JSON file containing array of email objects (use - for stdin)
--react-email <path>NoPath to a React Email template (.tsx) — rendered HTML applies to every email in the batch
--idempotency-key <key>NoDeduplicate this batch request
--batch-validation <mode>Nostrict (default, entire batch fails on any error) or permissive

Other email commands

resend emails list                # List sent emails
resend emails get <id>            # Retrieve a sent email by ID
resend emails cancel <id>         # Cancel a scheduled email
resend emails update <id>         # Update a scheduled email's send time

Receiving

Process inbound emails, download attachments, and stream incoming messages.

resend emails receiving list              # List received (inbound) emails
resend emails receiving get <id>          # Retrieve a received email with full details
resend emails receiving listen            # Poll for new inbound emails as they arrive
resend emails receiving forward <id>      # Forward a received email
resend emails receiving attachments <id>  # List attachments for a received email
resend emails receiving attachment <id> <attachment-id>  # 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 <id>           # Retrieve domain with DNS records
resend domains verify <id>        # Trigger DNS verification
resend domains update <id>        # Update TLS, tracking, or receiving settings
resend domains delete <id>        # Delete a domain

API Keys

Create, list, and revoke API keys for programmatic access.

resend api-keys create --name "Production" --permission full_access
resend api-keys list              # List all API keys
resend api-keys delete <id>       # Delete an API key

Broadcasts

Create and send broadcast emails to segments.

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 <id>        # Retrieve broadcast details
resend broadcasts send <id>       # Send a draft broadcast
resend broadcasts update <id>     # Update a draft broadcast
resend broadcasts delete <id>     # 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 <id>          # Retrieve a contact by ID or email
resend contacts update <id>       # Update contact properties
resend contacts delete <id>       # Delete a contact
resend contacts segments <id>     # List segments a contact belongs to
resend contacts add-segment <id>  # Add a contact to a segment
resend contacts remove-segment <id> <segment-id>  # Remove from a segment
resend contacts topics <id>       # List topic subscriptions
resend contacts update-topics <id>  # Update topic subscriptions

Define custom properties to store additional data on contacts.

resend contact-properties create --key "company" --type string
resend contact-properties list | get | update | delete

Segments

Group contacts into targetable segments for broadcasts.

resend segments create --name "VIPs"
resend segments list              # List all segments
resend segments get <id>          # Retrieve a segment by ID
resend segments contacts <id>     # List contacts in a segment
resend segments delete <id>       # Delete a segment

Topics

Manage subscription topics that contacts can opt in or out of.

resend topics create --name "Product updates"
resend topics list | get | update | delete

Templates

Create and manage email templates.

resend templates create --name "Welcome" --subject "Welcome to Acme" --react-email ./emails/welcome.tsx
resend templates list             # List all templates
resend templates get <id>         # Retrieve a template by ID or alias
resend templates update <id>      # Update a template
resend templates publish <id>     # Publish a draft template
resend templates duplicate <id>   # Duplicate a template
resend templates delete <id>      # 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 <id>          # Retrieve a log with full request/response bodies
resend logs open [id]         # Open logs in the dashboard

Webhooks

Register endpoints and listen for email event notifications. resend webhooks create Register a webhook endpoint.

resend webhooks create \
  --endpoint https://example.com/webhook \
  --events email.sent email.delivered
FlagRequiredDescription
--endpoint <url>YesHTTPS URL to receive events
--events <types...>YesEvent 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
FlagRequiredDescription
--url <url>YesYour public URL (e.g., Tailscale Funnel URL)
--events <types...>NoEvent types to listen for (default: all)
--forward-to <url>NoForward payloads to a local server (passes original Svix headers)
--port <port>NoLocal server port (default: 4318)

Other webhook commands

resend webhooks list              # List all webhook endpoints
resend webhooks get <id>          # Retrieve a webhook configuration
resend webhooks update <id>       # Update endpoint URL, events, or status
resend webhooks delete <id>       # Delete a webhook endpoint

Automations

Create, manage, and monitor event-driven automation workflows. resend automations create Create a new automation from a JSON file describing the workflow graph.

resend automations create --file ./automation.json
FlagRequiredDescription
--name <name>Yes *Automation name
--status <status>NoInitial status: enabled or disabled (default: disabled)
--steps <json>Yes *Steps array as JSON string
--connections <json>Yes *Connections array as JSON string
--file <path>Yes *Path to JSON file with full automation payload (use - for stdin)

* Provide --file, or --name with --steps and --connections. When using --file, other flags override file values. Other automation commands

resend automations list              # List all automations
resend automations get <id>          # Retrieve an automation with steps and connections
resend automations update <id>       # Update an automation's status (enable or disable)
resend automations stop <id>         # Stop an enabled automation
resend automations delete <id>       # Delete an automation
resend automations open [id]         # Open an automation in the dashboard

Automation runs

resend automations runs list <automation-id>                    # List runs for an automation
resend automations runs list <automation-id> --status running   # Filter by status
resend automations runs get --automation-id <id> --run-id <id>  # Retrieve a specific run
FlagRequiredDescription
--status <status>NoFilter by status: running, completed, failed, cancelled (comma-separated)

Events

Define and send events that trigger automations. resend events send Send an event to trigger matching automations for a contact.

resend events send \
  --event user.created \
  --email steve.wozniak@gmail.com \
  --payload '{"plan":"pro"}'
FlagRequiredDescription
--event <name>YesEvent name (e.g. user.created)
--contact-id <id>One of contactContact ID (mutually exclusive with --email)
--email <email>One of contactContact email (mutually exclusive with --contact-id)
--payload <json>NoEvent payload as JSON string

Other event commands

resend events create --name user.created --schema '{"plan":"string"}'
resend events list                   # List all event definitions
resend events get <id>               # Retrieve an event by ID or name
resend events update <id>            # Update an event's schema
resend events delete <id>            # Delete an event definition
resend events open                   # Open events in the dashboard

Utility

Diagnose your setup, manage authentication, and configure shell completions. resend doctor Run environment diagnostics. Verifies your CLI version, API key, credential storage, and domain status.

CheckPassWarnFail
CLI VersionRunning latestUpdate available
API KeyKey found (shows masked key + source)No key found
Credential StorageSecure backend (e.g., macOS Keychain)Plaintext file fallback
API ValidationVerified domains existSending-only key, no domains, or all pendingAPI 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

CommandDescription
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] <command> [command options]
FlagDescription
--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:

ModeWhenStdoutStderr
InteractiveTerminal (TTY)Formatted textSpinners, prompts
MachinePiped, CI, or --jsonJSONNothing

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

ItemPathNotes
Config directory~/.config/resend/Respects $XDG_CONFIG_HOME on Linux, %APPDATA% on Windows
CredentialsSystem secure storagemacOS Keychain, Windows Credential Manager, or Linux secret service
Install directory~/.resend/bin/Respects $RESEND_INSTALL