DEV Community

Cover image for How to install and use the Resend CLI
Wanda
Wanda

Posted on • Originally published at apidog.com

How to install and use the Resend CLI

The Resend CLI is the official command-line utility for Resend, an email platform for developers. Install it with npm install -g resend-cli or brew install resend/cli/resend, authenticate using resend login, and you’ll be able to send emails, manage domains, and automate your email workflows directly from your terminal or CI/CD setup.

Try Apidog today

What is Resend?

Resend provides an email API designed for developers. Connect your domain, generate an API key, and start sending transactional emails—like password resets, order confirmations, and onboarding notifications—from your app.

On March 13, 2026, Resend released their CLI, giving developers terminal access to the same email infrastructure. The CLI features 53 commands across 13 resources, is written in TypeScript, open source (MIT), and supports:

  • Humans: Interactive prompts, readable tables, and natural language scheduling.
  • AI agents: JSON output, idempotency keys, agent detection.
  • CI/CD pipelines: Environment variable auth, scriptable flags, consistent exit codes.

💡 API Testing: When building apps that send emails, it's important to test email API calls before deploying. Apidog offers a free, visual tool for testing REST APIs—including Resend's. Import the Resend OpenAPI spec, configure environments, and run test suites, all without extra code.

Installing the Resend CLI

Pick an install method that matches your system.

Via cURL (standalone binary, no Node.js required)

curl -fsSL https://resend.com/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Downloads a prebuilt binary for your OS. No Node.js required.

Via npm

npm install -g resend-cli
Enter fullscreen mode Exit fullscreen mode

Requires Node.js 20+. Confirm installation:

resend --version
Enter fullscreen mode Exit fullscreen mode

Via Homebrew (macOS and Linux)

brew install resend/cli/resend
Enter fullscreen mode Exit fullscreen mode

Recommended for macOS; Homebrew manages updates.

Via PowerShell (Windows)

irm https://resend.com/install.ps1 | iex
Enter fullscreen mode Exit fullscreen mode

Alternatively, download .exe binaries from the GitHub Releases page.

For local development

If you want to contribute or build from source, use Node.js 20+ and pnpm:

git clone https://github.com/resend/resend-cli.git
cd resend-cli
pnpm install
pnpm build       # outputs ./dist/cli.cjs
pnpm build:bin   # native binary at ./dist/resend
Enter fullscreen mode Exit fullscreen mode

Authenticating your account

Connect the CLI to your Resend account:

resend login
Enter fullscreen mode Exit fullscreen mode

This opens your browser to create an API key, then stores credentials at ~/.config/resend/credentials.json (0600 permissions).

For scripts or CI, pass a key directly:

resend login --key re_xxxxxxxxxxxxx
Enter fullscreen mode Exit fullscreen mode

API key resolution order:

  1. --api-key flag
  2. RESEND_API_KEY env variable
  3. Credentials file

For CI pipelines, set RESEND_API_KEY as a secret:

RESEND_API_KEY=re_xxx resend emails send --from builds@yourco.com --to dev@yourco.com --subject "Build passed" --text "All tests green."
Enter fullscreen mode Exit fullscreen mode

Multi-account support

Switch between profiles:

resend auth switch
Enter fullscreen mode Exit fullscreen mode

Or specify a profile per command:

resend <command> --profile production
Enter fullscreen mode Exit fullscreen mode

Sending your first email

Use resend emails send with required fields: sender (from a verified domain), recipient, subject, and body.

Plain-text email

resend emails send \
  --from "you@yourdomain.com" \
  --to recipient@example.com \
  --subject "Hello from the CLI" \
  --text "This is a test email sent from the Resend CLI."
Enter fullscreen mode Exit fullscreen mode

HTML email

resend emails send \
  --from "team@yourco.com" \
  --to user@example.com \
  --subject "Your order is confirmed" \
  --html "<h1>Order confirmed</h1><p>Thanks for your purchase.</p>"
Enter fullscreen mode Exit fullscreen mode

Or load from a local file:

resend emails send \
  --from "team@yourco.com" \
  --to user@example.com \
  --subject "Welcome aboard" \
  --html-file ./templates/welcome.html
Enter fullscreen mode Exit fullscreen mode

Schedule delivery

The CLI supports natural language and ISO 8601 timestamps:

resend emails send \
  --from "you@yourco.com" \
  --to user@example.com \
  --subject "Scheduled check-in" \
  --text "Just checking in." \
  --schedule "tomorrow at 9am"
Enter fullscreen mode Exit fullscreen mode

Works with phrases like in 1 hour, next Monday at 3pm, or ISO timestamps.

Capture email ID

Pipe output to jq to capture the email ID:

EMAIL_ID=$(resend emails send \
  --from a@acme.com \
  --to b@acme.com \
  --subject "Test" \
  --text "Hi" | jq -r '.data.id')

echo "Sent email: $EMAIL_ID"
Enter fullscreen mode Exit fullscreen mode

Cancel or update a scheduled email

resend emails cancel $EMAIL_ID
resend emails update $EMAIL_ID --schedule "next Monday at 10am"
Enter fullscreen mode Exit fullscreen mode

List recent emails

resend emails list
Enter fullscreen mode Exit fullscreen mode

Batch send (up to 100)

Create a JSON array:

[
  { "from": "you@yourco.com", "to": "alice@example.com", "subject": "Hi Alice", "text": "Hello!" },
  { "from": "you@yourco.com", "to": "bob@example.com", "subject": "Hi Bob", "text": "Hello!" }
]
Enter fullscreen mode Exit fullscreen mode

Send the batch:

resend emails send-batch --file emails.json
Enter fullscreen mode Exit fullscreen mode

Each batch counts as a single API call (up to 100 emails).

Managing domains and API keys

Verify your domain before sending emails. The CLI walks you through the process.

Add a domain

resend domains create --name yourdomain.com --region us-east-1
Enter fullscreen mode Exit fullscreen mode

Supported regions: us-east-1, eu-west-1, sa-east-1, ap-northeast-1.

Verify DNS records

After domain creation, add SPF, DKIM, and DMARC records with your DNS provider, then:

resend domains verify --id <domain-id>
Enter fullscreen mode Exit fullscreen mode

Check status:

resend domains get --id <domain-id>
Enter fullscreen mode Exit fullscreen mode

Configure tracking and TLS

resend domains configure --id <domain-id>
Enter fullscreen mode Exit fullscreen mode

Enable open/click tracking or custom DKIM.

List all domains

resend domains list
Enter fullscreen mode Exit fullscreen mode

Manage API keys

Create, list, or delete scoped API keys:

resend api-keys create
resend api-keys list
resend api-keys delete --id <key-id>
Enter fullscreen mode Exit fullscreen mode

Scoped keys restrict access per domain or environment.

Advanced features: broadcasts, webhooks, and templates

Resend CLI supports:

Broadcasts

Send to large lists:

resend broadcasts create
resend broadcasts send --id <broadcast-id>
resend broadcasts schedule --id <broadcast-id> --date "next Monday at 10am"
Enter fullscreen mode Exit fullscreen mode

Webhooks

Manage delivery event webhooks:

resend webhooks create
resend webhooks list
Enter fullscreen mode Exit fullscreen mode

For local dev, forward events:

resend webhooks listen --forward-to http://localhost:3000/webhooks/resend
Enter fullscreen mode Exit fullscreen mode

Supports 17 event types (sent, delivered, bounced, opened, clicked, etc).

Templates

Create reusable HTML templates with variables:

resend templates create
Enter fullscreen mode Exit fullscreen mode

Use {{variable_name}} syntax with fallbacks. Reference by ID when sending.

Contacts and audiences

Manage contacts for marketing emails:

resend contacts create --audience-id <id> --email user@example.com --first-name "Alice"
resend contacts list --audience-id <id>
resend contacts update --id <contact-id> --unsubscribed false
Enter fullscreen mode Exit fullscreen mode

Run diagnostics

Check your environment:

resend doctor
Enter fullscreen mode Exit fullscreen mode

Verifies CLI version, API key, domains, and detects AI coding agents.

Using Resend CLI in CI/CD pipelines

The CLI is designed for automation.

Machine-readable output

Pipe or use --json for JSON output:

resend emails send --from a@co.com --to b@co.com --subject "Deploy" --text "Done" --json
Enter fullscreen mode Exit fullscreen mode

Use --quiet to suppress extra output:

resend emails list --quiet | jq '.[0].id'
Enter fullscreen mode Exit fullscreen mode

Auto-confirm for scripts

Skip confirmation prompts:

resend api-keys delete --id <key-id> --yes
Enter fullscreen mode Exit fullscreen mode

GitHub Actions example

- name: Send deployment notification
  env:
    RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
  run: |
    resend emails send \
      --from deploys@yourco.com \
      --to team@yourco.com \
      --subject "Deploy to production: ${{ github.sha }}" \
      --text "Deployed commit ${{ github.sha }} to production."
Enter fullscreen mode Exit fullscreen mode

Rate limits

API rate is 2 requests/sec, shared across team keys. Use send-batch for up to 100 emails per call.

Testing your email API with Apidog

The Resend CLI is ideal for interactive and scripted use. For API-level testing—before writing backend code—use Apidog:

  • Import the Resend API spec: Available at resend.com/docs, which you can load into Apidog to view endpoints and schemas.
  • Set up environments: Store RESEND_API_KEY as an environment variable, reference it as {{RESEND_API_KEY}}, and easily switch between dev/prod.
  • Test sending: Run POST /emails with your intended payload, verify responses, and test edge cases.
  • Automate tests: Chain API calls and assertions in Apidog’s runner (e.g., send an email, fetch it by ID, verify status) without writing code.

This helps catch integration bugs early. Combine with the Resend CLI for a complete local and API-level workflow.

Resend pricing

The CLI is free and open source; Resend platform pricing:

Plan Price Monthly emails Daily limit Log retention
Free $0/mo 3,000 100/day 1 day
Pro $20/mo 50,000 No limit 3 days
Scale $90/mo 100,000 No limit 7 days
Enterprise Custom Custom Custom Custom

Key points about the free tier:

  • 100 emails/day (good for testing, not production)
  • Analytics (open/click tracking) require paid plans
  • Log retention is 1 day (older status not available after 24h)
  • 2 requests/sec limit for all plans, shared across team
  • Paid plan overage capped at 5x quota to prevent large bills

Dedicated IPs are a $30/month add-on (Scale plan, for >500 emails/day).

FAQ

Do I need Node.js to install the Resend CLI?

No, not with cURL or Homebrew; only the npm install requires Node.js 20+.

Why can't I send from any email address?

You must verify your sending domain by adding SPF, DKIM, and DMARC DNS records. Free email providers like Gmail aren't supported as sender addresses.

Can I send to any address on the free plan?

Yes—recipient addresses aren't restricted, but you are limited to 3,000 emails/month and 100/day.

How does natural language scheduling work?

The CLI parses phrases like "tomorrow at 9am" or ISO 8601 timestamps, using your system's local timezone.

What happens when I pipe output?

The CLI auto-switches to JSON-only output—no spinners/prompts. No need to pass --json explicitly.

Can I use the CLI with multiple Resend accounts?

Yes. Use resend login multiple times to store profiles, then resend auth switch or --profile <name>.

Is the Resend CLI open source?

Yes, it's MIT licensed at github.com/resend/resend-cli.

What's the difference between --quiet and --json?

Both produce JSON output. --json forces JSON; --quiet also suppresses spinners/progress and any non-data output.

Additional resources

Top comments (0)