{"skill":{"slug":"resend-cli","displayName":"Resend CLI","summary":"Send and manage emails via the Resend CLI. Covers sending, domains, contacts, segments, broadcasts, templates, topics, webhooks, and API keys.","description":"---\nname: resend\ndescription: \"Send and manage emails via the Resend CLI. Covers sending, domains, contacts, segments, broadcasts, templates, topics, webhooks, and API keys.\"\nhomepage: https://github.com/resend/resend-cli\nsource: https://github.com/resend/resend-cli\nlicense: MIT\nmetadata:\n  emoji: \"📧\"\n  primaryEnv: RESEND_API_KEY\n  requires:\n    bins: [\"resend\"]\n    env: [\"RESEND_API_KEY\"]\n  configPaths:\n    - \"~/.config/resend/credentials.json\"\n  install:\n    - id: resend-brew\n      kind: brew\n      tap: resend/cli\n      formula: resend\n      bins: [\"resend\"]\n      label: \"Install Resend CLI (brew)\"\n---\n\n# Resend CLI — Email for Developers\n\nOfficial CLI for [Resend](https://resend.com). Covers sending, domains, contacts, segments, broadcasts, templates, webhooks, and API keys.\n\n## Prerequisites\n\n- Install: `brew install resend/cli/resend` (recommended) or `npm install -g resend-cli`\n- Auth: `resend login` or set `RESEND_API_KEY` env var\n- Credentials stored at: `~/.config/resend/credentials.json` (0600 permissions)\n- For automation, use a domain-scoped `sending_access` key (not full-access) when possible\n\n## Auth\n\nKey priority: `--api-key` flag > `RESEND_API_KEY` env var > `~/.config/resend/credentials.json`.\n\nAlways use `--json` or `--quiet` flag for non-interactive (agent) usage — forces JSON output, no spinners.\n\n## Quick Reference\n\n### Emails\n\n```bash\n# Send\nresend emails send \\\n  --from \"Name <you@yourdomain.com>\" \\\n  --to recipient@example.com \\\n  --subject \"Subject\" \\\n  --text \"Body\" \\\n  --json\n\n# Send with HTML file\nresend emails send --from you@domain.com --to user@example.com \\\n  --subject \"Newsletter\" --html-file ./email.html --json\n\n# Send with attachments\nresend emails send --from you@domain.com --to user@example.com \\\n  --subject \"Report\" --text \"See attached\" --attachment ./report.pdf --json\n\n# Schedule for later\nresend emails send --from you@domain.com --to user@example.com \\\n  --subject \"Later\" --text \"Hi\" --scheduled-at 2026-08-05T11:00:00Z --json\n\n# With CC, BCC, reply-to, tags, headers\nresend emails send --from you@domain.com --to user@example.com \\\n  --subject \"Meeting\" --text \"Notes\" \\\n  --cc manager@example.com --bcc archive@example.com \\\n  --reply-to noreply@example.com \\\n  --tags category=marketing --headers X-Entity-Ref-ID=123 --json\n\n# Batch send (up to 100 emails from JSON file)\nresend emails batch --file ./emails.json --json\n# File format: [{\"from\":\"...\",\"to\":[\"...\"],\"subject\":\"...\",\"text\":\"...\"},...]\n\n# List sent emails\nresend emails list --json\n\n# Get email details\nresend emails get <email-id> --json\n\n# Cancel scheduled email\nresend emails cancel <email-id> --json\n\n# Update scheduled email\nresend emails update <email-id> --scheduled-at 2026-08-06T09:00:00Z --json\n```\n\n### Inbound (Receiving) Emails\n\n```bash\n# List received emails\nresend emails receiving list --json\n\n# Get received email\nresend emails receiving get <email-id> --json\n\n# List attachments\nresend emails receiving attachments <email-id> --json\n\n# Get single attachment\nresend emails receiving attachment <email-id> <attachment-id>\n\n# Forward received email\nresend emails receiving forward <email-id> \\\n  --to user@example.com --from you@domain.com --json\n```\n\n### Domains\n\n```bash\n# List domains\nresend domains list --json\n\n# Create domain (returns DNS records to configure)\nresend domains create --name example.com --region eu-west-1 --tls enforced --json\n\n# Create with receiving enabled\nresend domains create --name example.com --sending --receiving --json\n\n# Verify domain (trigger DNS check)\nresend domains verify <domain-id> --json\n\n# Get domain details + DNS records\nresend domains get <domain-id> --json\n\n# Update domain settings\nresend domains update <domain-id> --tls enforced --open-tracking --json\n\n# Delete domain\nresend domains delete <domain-id> --yes --json\n```\n\nDomain lifecycle: create → configure DNS → verify → get (poll until \"verified\").\nRegions: `us-east-1`, `eu-west-1`, `sa-east-1`, `ap-northeast-1`.\n\n### Contacts\n\n```bash\n# List contacts\nresend contacts list --json\n\n# Create contact\nresend contacts create --email jane@example.com \\\n  --first-name Jane --last-name Smith --json\n\n# Create with properties + segments\nresend contacts create --email jane@example.com \\\n  --properties '{\"company\":\"Acme\",\"plan\":\"pro\"}' \\\n  --segment-id <segment-id> --json\n\n# Get contact (by ID or email)\nresend contacts get user@example.com --json\n\n# Update contact\nresend contacts update user@example.com --unsubscribed --json\n\n# Delete contact\nresend contacts delete <contact-id> --yes --json\n\n# List contact's segments\nresend contacts segments user@example.com --json\n\n# Add contact to segment\nresend contacts add-segment user@example.com --segment-id <id> --json\n\n# Remove from segment\nresend contacts remove-segment user@example.com <segment-id> --json\n\n# List contact's topic subscriptions\nresend contacts topics user@example.com --json\n\n# Update topic subscriptions\nresend contacts update-topics user@example.com \\\n  --topics '[{\"id\":\"topic-uuid\",\"subscription\":\"opt_in\"}]' --json\n```\n\n### Segments\n\n```bash\n# List segments\nresend segments list --json\n\n# Create segment\nresend segments create --name \"Newsletter Subscribers\" --json\n\n# Get segment\nresend segments get <segment-id> --json\n\n# Delete segment (no update endpoint — delete + recreate to rename)\nresend segments delete <segment-id> --yes --json\n```\n\n### Broadcasts\n\n```bash\n# Create draft\nresend broadcasts create \\\n  --from hello@domain.com \\\n  --subject \"Weekly Update\" \\\n  --segment-id <segment-id> \\\n  --html \"<p>Hello {{{FIRST_NAME|there}}}</p>\" --json\n\n# Create from HTML file\nresend broadcasts create --from hello@domain.com \\\n  --subject \"Launch\" --segment-id <id> --html-file ./email.html --json\n\n# Create + send immediately\nresend broadcasts create --from hello@domain.com \\\n  --subject \"Launch\" --segment-id <id> --html \"<p>Hi</p>\" --send --json\n\n# Create + schedule\nresend broadcasts create --from hello@domain.com \\\n  --subject \"News\" --segment-id <id> --text \"Hello!\" \\\n  --send --scheduled-at \"tomorrow at 9am ET\" --json\n\n# Send existing draft\nresend broadcasts send <broadcast-id> --json\n\n# List broadcasts\nresend broadcasts list --json\n\n# Get broadcast details\nresend broadcasts get <broadcast-id> --json\n\n# Update draft\nresend broadcasts update <broadcast-id> --subject \"Updated Subject\" --json\n\n# Delete broadcast\nresend broadcasts delete <broadcast-id> --yes --json\n```\n\nTemplate variables in HTML: `{{{FIRST_NAME|Friend}}}` — triple-brace with optional fallback.\n\n### Templates\n\n```bash\n# List templates\nresend templates list --json\n\n# Create template with variables\nresend templates create --name \"Welcome\" \\\n  --subject \"Welcome!\" \\\n  --html \"<h1>Hello {{{NAME}}}</h1>\" \\\n  --var NAME:string --json\n\n# Create with fallback\nresend templates create --name \"Invoice\" \\\n  --subject \"Invoice\" \\\n  --html \"<p>Amount: {{{AMOUNT}}}</p>\" \\\n  --var AMOUNT:number:0 --json\n\n# Get template\nresend templates get <template-id> --json\n\n# Update template\nresend templates update <template-id> --subject \"Updated Subject\" --json\n\n# Publish draft → live\nresend templates publish <template-id> --json\n\n# Duplicate template\nresend templates duplicate <template-id> --json\n\n# Delete template\nresend templates delete <template-id> --yes --json\n```\n\nLifecycle: create (draft) → update → publish. Re-publish after updating a published template.\n\n### Topics\n\n```bash\n# List topics\nresend topics list --json\n\n# Create topic\nresend topics create --name \"Product Updates\" --json\n\n# Create with default opt-out\nresend topics create --name \"Weekly Digest\" --default-subscription opt_out --json\n\n# Get topic\nresend topics get <topic-id> --json\n\n# Update topic\nresend topics update <topic-id> --name \"Security Alerts\" --json\n\n# Delete topic\nresend topics delete <topic-id> --yes --json\n```\n\n### Webhooks\n\n```bash\n# List webhooks\nresend webhooks list --json\n\n# Create webhook (all events)\nresend webhooks create \\\n  --endpoint https://app.example.com/hooks/resend \\\n  --events all --json\n\n# Get webhook\nresend webhooks get <webhook-id> --json\n\n# Update webhook\nresend webhooks update <webhook-id> --status disabled --json\n\n# Delete webhook\nresend webhooks delete <webhook-id> --yes --json\n\n# Listen locally (dev)\nresend webhooks listen --json\n```\n\nEvent types (17): email.sent, email.delivered, email.delivery_delayed, email.bounced, email.complained, email.opened, email.clicked, email.failed, email.scheduled, email.suppressed, email.received, contact.created, contact.updated, contact.deleted, domain.created, domain.updated, domain.deleted.\n\n### API Keys\n\n```bash\n# List API keys\nresend api-keys list --json\n\n# Create full-access key\nresend api-keys create --name \"Production\" --json\n\n# Create domain-scoped sending key\nresend api-keys create --name \"CI Token\" \\\n  --permission sending_access --domain-id <domain-id> --json\n\n# Delete key (immediate, irreversible)\nresend api-keys delete <api-key-id> --yes --json\n```\n\n### Utility\n\n```bash\n# Doctor — check CLI version, API key, domains, AI agent detection\nresend doctor --json\n\n# Who am I\nresend whoami --json\n\n# Open dashboard in browser\nresend open\n\n# Auth — switch profile\nresend auth switch\n\n# Login (non-interactive)\nresend login --key re_xxx --json\n\n# Logout\nresend logout --json\n```\n\n## Global Flags\n\n| Flag | Description |\n|------|-------------|\n| `--api-key <key>` | Override API key for this command |\n| `-p, --profile <name>` | Use specific profile |\n| `--json` | Force JSON output |\n| `-q, --quiet` | Suppress spinners (implies `--json`) |\n\n## Agent Usage Rules\n\n1. **Always use `--json` flag** — ensures structured output, no TTY prompts.\n2. **All required flags must be provided** — no interactive prompts in non-TTY mode.\n3. **Destructive actions need `--yes`** — deletes require confirmation bypass.\n4. **Exit codes:** 0 = success, 1 = error. Errors include `message` + `code`.\n5. **Batch limit:** 100 emails per `emails batch` request.\n6. **Attachments not supported in batch sends.**\n7. **`--scheduled-at` requires `--send` flag on broadcasts.**\n\n## Error Codes\n\n| Code | Cause |\n|------|-------|\n| `auth_error` | No API key found |\n| `missing_body` | No --text/--html/--html-file |\n| `file_read_error` | Can't read file |\n| `send_error` | API rejected the send |\n| `missing_key` | Login without --key in non-interactive |\n| `validation_failed` | API rejected the key |\n","tags":{"latest":"1.0.5"},"stats":{"comments":0,"downloads":620,"installsAllTime":2,"installsCurrent":2,"stars":0,"versions":6},"createdAt":1773435987956,"updatedAt":1778491894093},"latestVersion":{"version":"1.0.5","createdAt":1773437061870,"changelog":"Shorter description","license":"MIT-0"},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"maciejlis","userId":"s1706cwyey8ks5swj1pehr1ats83mky4","displayName":"maciejlis","image":"https://avatars.githubusercontent.com/u/15613594?v=4"},"moderation":null}