The official command-line tool for Resend. Send emails, manage your account, and develop locally from the terminal.
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.
The CLI resolves your API key using the following priority chain:
Priority
Source
How to set
1 (highest)
--api-key flag
resend --api-key re_xxx emails send ...
2
RESEND_API_KEY env var
export RESEND_API_KEY=re_xxx
3 (lowest)
Saved credentials
resend login
If no key is found from any source, the CLI errors with code auth_error.resend loginAuthenticate by storing your API key locally. The key is validated against the Resend API before being saved.
resend login
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 logoutRemove your saved API key.
resend logout
Switch between profilesIf you work across multiple Resend teams or accounts, switch between profiles without logging in and out:
resend auth switch
Use the global --profile flag on any command to run it with a specific profile:
Send, retrieve, cancel, and manage email delivery.resend emails sendSend an email. Provide all options via flags for scripting, or let the CLI prompt interactively for missing fields.
resend emails batchSend 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 emailsresend emails get <id> # Retrieve a sent email by IDresend emails cancel <id> # Cancel a scheduled emailresend emails update <id> # Update a scheduled email's send time
Process inbound emails, download attachments, and stream incoming messages.
resend emails receiving list # List received (inbound) emailsresend emails receiving get <id> # Retrieve a received email with full detailsresend emails receiving listen # Poll for new inbound emails as they arriveresend emails receiving forward <id> # Forward a received emailresend emails receiving attachments <id> # List attachments for a received emailresend emails receiving attachment <id> <attachment-id> # Download a specific attachment
Create, list, and revoke API keys for programmatic access.
resend api-keys create --name "Production" --permission full_accessresend api-keys list # List all API keysresend api-keys delete <id> # Delete an API key
Manage contacts, segment membership, and topic subscriptions.
resend contacts create --email steve.wozniak@gmail.com --first-name Steveresend contacts list # List all contactsresend contacts get <id> # Retrieve a contact by ID or emailresend contacts update <id> # Update contact propertiesresend contacts delete <id> # Delete a contactresend contacts segments <id> # List segments a contact belongs toresend contacts add-segment <id> # Add a contact to a segmentresend contacts remove-segment <id> <segment-id> # Remove from a segmentresend contacts topics <id> # List topic subscriptionsresend contacts update-topics <id> # Update topic subscriptions
resend templates create --name "Welcome" --subject "Welcome to Acme" --react-email ./emails/welcome.tsxresend templates list # List all templatesresend templates get <id> # Retrieve a template by ID or aliasresend templates update <id> # Update a templateresend templates publish <id> # Publish a draft templateresend templates duplicate <id> # Duplicate a templateresend templates delete <id> # Delete a templateresend templates open [id] # Open a template in the dashboard
resend logs list # List API request logsresend logs get <id> # Retrieve a log with full request/response bodiesresend logs open [id] # Open logs in the dashboard
Event types to subscribe to (use all for all events)
resend webhooks listenListen for webhook events locally during development. Starts a server, registers a temporary webhook, streams events, and cleans up on exit.
resend webhooks list # List all webhook endpointsresend webhooks get <id> # Retrieve a webhook configurationresend webhooks update <id> # Update endpoint URL, events, or statusresend webhooks delete <id> # Delete a webhook endpoint
Run resend <command> --help for the full list of flags and options on any command.
Diagnose your setup, manage authentication, and configure shell completions.resend doctorRun environment diagnostics. Verifies your CLI version, API key, credential storage, and domain status.