Skip to main content
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

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:
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:
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.
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, which provides them. Examples:
resend emails batch Send up to 100 emails in a single API request from a JSON file.
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

Receiving

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

Domains

Manage your sending and receiving domains.

API Keys

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

Broadcasts

Create and send broadcast emails to segments.

Contacts

Manage contacts, segment membership, and topic subscriptions.
resend contacts imports create Start an asynchronous CSV import. The command uploads the file and returns a contact import ID immediately. Use resend contacts imports get <id> to check processing status.
FlagRequiredDescription
--file <path>YesPath to the CSV file to import. Maximum file size is 200MB
--column-map <json>NoJSON object mapping CSV headers to contact fields
--on-conflict <mode>Noupsert to update existing contacts or skip to leave them unchanged
--segment-id <id...>NoSegment IDs to add imported contacts to. Repeat the flag for multiple segments
--topics <json>NoJSON array of topic subscriptions with id and subscription fields
Without --column-map, CSV headers must match the lowercase contact field names exactly: email, first_name, and last_name. Use --column-map when your CSV uses headers like Email or First Name.
resend contacts imports get Retrieve a contact import by ID, including status and row counts.
resend contacts imports list List contact imports. The default limit is 10.
FlagRequiredDescription
--limit <n>NoMaximum number of imports to return. Must be between 1 and 100
--after <cursor>NoReturn imports after this contact import ID
--before <cursor>NoReturn imports before this contact import ID
--status <status>NoFilter by queued, in_progress, completed, or failed

Contact Properties

Define custom properties to store additional data on contacts.

Segments

Group contacts into targetable segments for broadcasts.

Topics

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

Templates

Create and manage email templates.

Logs

View API request logs.

Webhooks

Register endpoints and listen for email event notifications. resend webhooks create Register a webhook endpoint.
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.
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)
See the webhook events documentation for the full list of available event types. For agent-specific webhook patterns, see CLI for AI Agents.
Other webhook commands
Run resend <command> --help for the full list of flags and options on any command.

Automations

Create, manage, and monitor event-driven automation workflows. resend automations create Create a new automation from a JSON file describing the workflow graph.
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
Automation runs
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.
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

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 availableN/A
API KeyKey found (shows masked key + source)N/ANo key found
Credential StorageSecure backend (e.g., macOS Keychain)Plaintext file fallbackN/A
API ValidationVerified domains existSending-only key, no domains, or all pendingAPI key invalid
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:
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:
Errors always exit with code 1 and output structured JSON:

CI/CD

Set RESEND_API_KEY as an environment variable, with no resend login needed:

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

Using the CLI with AI Agents

Learn about Agent Skills, non-interactive mode, and local webhook development for AI agents.