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: 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). 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:

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.
* 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.
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.
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.

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.
resend webhooks listen Listen for webhook events locally during development. Starts a server, registers a temporary webhook, streams events, and cleans up on exit.
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.
* Provide --file, or --name with --steps and --connections. When using --file, other flags override file values. Other automation commands
Automation runs

Events

Define and send events that trigger automations. resend events send Send an event to trigger matching automations for a contact.
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.
Exits 0 when all checks pass or warn. Exits 1 if any check fails. Other utility commands

Global options

These flags work on every command:

Output behavior

The CLI has two output modes that switch automatically: 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

Using the CLI with AI Agents

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