resend
Use when working with the Resend email API — sending transactional emails (single or batch), receiving inbound emails via webhooks, managing email templates, tracking delivery events, managing domains, contacts, broadcasts, webhooks, API keys, inboxes (threads, labels, drafts, replies), automations,
- 01GitHub stars
- 211
- 02Installs
- New
- 03Files scanned
- 23
Security scan
Needs reviewSuspicious-but-common patterns. Skim the findings before installing.
- mediumUses sudo or world-writable permissions
references/webhooks.md:365
sudo tailscale funnel 3000
Root access or chmod 777 widens the blast radius of anything the skill runs.
Content sha256 d774b8a269d9c606… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
Resend
Quick Send — Node.js
import { Resend } from 'resend';
const resend = new Resend(process.env.RESEND_API_KEY);
const { data, error } = await resend.emails.send(
{
from: 'Acme <[email protected]>',
to: ['[email protected]'],
subject: 'Hello World',
html: '<p>Email body here</p>',
},
{ idempotencyKey: `welcome-email/${userId}` }
);
if (error) {
console.error('Failed:', error.message);
return;
}
console.log('Sent:', data.id);
Key gotcha: The Resend Node.js SDK does NOT throw exceptions — it returns { data, error }. Always check error explicitly instead of using try/catch for API errors.
Quick Send — Python
import resend
import os
resend.api_key = os.environ["RESEND_API_KEY"]
email = resend.Emails.send({
"from": "Acme <[email protected]>",
"to": ["[email protected]"],
"subject": "Hello World",
"html": "<p>Email body here</p>",
}, idempotency_key=f"welcome-email/{user_id}")
Single vs Batch Decision
| Choose | When |
|---|---|
Single (POST /emails) | 1 email, needs attachments, needs scheduling |
Batch (POST /emails/batch) | 2-100 distinct emails, no attachments, no scheduling |
Batch is atomic — if one email fails validation, the entire batch fails. Always validate before sending. Batch does NOT support attachments or scheduled_at.
Idempotency Keys (Critical for Retries)
Prevent duplicate emails when retrying failed requests:
| Key Facts | |
|---|---|
| Format (single) | <event-type>/<entity-id> (e.g., welcome-email/user-123) |
| Format (batch) | batch-<event-type>/<batch-id> (e.g., batch-orders/batch-456) |
| Expiration | 24 hours |
| Max length | 256 characters |
| Same key + same payload | Returns original response without resending |
| Same key + different payload | Returns 409 error |
Quick Receive (Node.js)
import { Resend } from 'resend';
const resend = new Resend(process.env.RESEND_API_KEY);
export async function POST(req: Request) {
const payload = await req.text(); // Must use raw text, not req.json()
const event = resend.webhooks.verify({
payload,
headers: {
'svix-id': req.headers.get('svix-id'),
'svix-timestamp': req.headers.get('svix-timestamp'),
'svix-signature': req.headers.get('svix-signature'),
},
secret: process.env.RESEND_WEBHOOK_SECRET,
});
if (event.type === 'email.received') {
// Webhook has metadata only — call API for body
const { data: email } = await resend.emails.receiving.get(
event.data.email_id
);
console.log(email.text);
}
return new Response('OK', { status: 200 });
}
Key gotcha: Webhook payloads do NOT contain the email body. You must call resend.emails.receiving.get() separately.
What Do You Need?
| Task | Reference |
|---|---|
| Send a single email | sending/overview.md — parameters, deliverability, testing |
| Send batch emails | sending/overview.md → sending/batch-email-examples.md |
| Full SDK examples (Node.js, Python, Go, cURL) | sending/single-email-examples.md |
| Idempotency, retries, error handling | sending/best-practices.md |
| Get, list, reschedule, cancel emails, retrieve metrics | sending/email-management.md |
| Receive inbound emails | receiving.md — domain setup, webhooks, attachments |
| Manage templates (CRUD, variables) | templates.md — lifecycle, aliases, pagination |
| Set up webhooks (events, verification) | webhooks.md — verification, CRUD, retry schedule, IP allowlist |
| Manage domains (create, verify, claim, DNS) | domains.md — regions, TLS, tracking, claiming, capabilities |
| Manage contacts (CRUD, properties) | contacts.md — segments, topics, custom properties, bulk CSV import |
| Send broadcasts (marketing campaigns) | broadcasts.md — lifecycle, scheduling, template variables |
| Manage API keys | api-keys.md — permission scoping, domain restrictions |
| View API request logs | logs.md — list and retrieve API call history, debugging |
| Define contact properties | contact-properties.md — custom fields for contacts |
| Manage segments (contact groups) | segments.md — broadcast targeting, contact grouping |
| Manage topics (subscriptions) | topics.md — opt-in/out preferences, broadcast filtering |
| Create automations (event-driven workflows) | automations.md — steps, connections, runs, conditions |
| Define and send events (automation triggers) | events.md — schemas, payloads, contact association |
| Check account usage and quotas | usage.md — emails, contacts, segments, broadcasts, AI credits, automation runs, domains, rate limit |
| Manage inboxes (threads, replies, drafts) | inboxes.md — labels, folders, search, agent settings, inbox webhook events |
| Install SDK (8+ languages) | installation.md |
| Set up an AI agent inbox | Install the agent-email-inbox skill — covers security levels for untrusted input |
SDK Version Requirements
Always install the latest SDK version. Older SDKs may be missing webhooks.verify(), emails.receiving.get(), domains.claims.*, domains.forge.*, or inboxes.*.
If the project already has a Resend SDK installed, check its version against the minimum versions in installation.md and upgrade if it's below. Inboxes need higher versions. See inboxes.md.
See installation.md for the minimum version per language, full installation commands, language detection, and cURL fallback.
Common Setup
API Key
Store in environment variable — never hardcode:
export RESEND_API_KEY=re_xxxxxxxxx
Get your key at resend.com/api-keys.
Detect Project Language
Check for these files: package.json (Node.js), requirements.txt/pyproject.toml (Python), go.mod (Go), Gemfile (Ruby), composer.json (PHP), Cargo.toml (Rust), pom.xml/build.gradle (Java), *.csproj (.NET).
Common Mistakes
| # | Mistake | Fix |
|---|---|---|
| 1 | Retrying without idempotency key | Always include idempotency key — prevents duplicate sends on retry. Format: <event-type>/<entity-id> |
| 2 | Not verifying webhook signatures | Always verify with resend.webhooks.verify() — unverified events can't be trusted |
| 3 | Template variable name mismatch | Variable names are case-sensitive — must match the template definition exactly. Use triple mustache {{{VAR}}} syntax |
| 4 | Expecting email body in webhook payload | Webhooks contain metadata only — call resend.emails.receiving.get() for body content |
| 5 | Using try/catch for Node.js SDK errors | SDK returns { data, error } — check error explicitly, don't wrap in try/catch |
| 6 | Using batch for emails with attachments | Batch doesn't support attachments — use single sends instead |
| 7 | Testing with fake emails ([email protected]) | Use [email protected] — fake addresses bounce and hurt reputation |
| 8 | Sending with draft template | Templates must be published before sending — call .publish() first |
| 9 | html + template in same send call | Mutually exclusive — remove html/text/react when using template |
| 10 | MX record not lowest priority for inbound | Ensure Resend's MX has the lowest number (highest priority) or emails won't route |
| 11 | 403 when sending from resend.dev | The default [email protected] is a sandbox — it can only deliver to your Resend account email. Verify your own domain first |
| 12 | 403 domain mismatch | The from address domain must exactly match a verified domain. Verified send.acme.com but sending from [email protected] will fail |
| 13 | Calling Resend API from the browser (CORS) | The API does not support CORS — this is intentional to protect your API key. Always call from server-side (API routes, serverless functions) |
| 14 | 401 restricted_api_key | A sending-only API key was used on a non-sending endpoint (domains, contacts, etc.). Create a full-access key instead |
Cross-Cutting Concerns
Send + Receive Together
Auto-replies, email forwarding, or any receive-then-send workflow requires both capabilities:
- Set up inbound domain first (see receiving.md)
- Set up sending (see sending/overview.md)
- Note: batch sending does NOT support attachments or scheduling — use single sends when forwarding with attachments
AI Agent Inbox
If your system processes untrusted email content and takes actions (refunds, database changes, forwarding), install the agent-email-inbox skill. This applies whether or not AI is involved — any system interpreting freeform email content from external senders needs security measures.
Marketing Emails
The sending capabilities in this skill are for transactional email (receipts, confirmations, notifications). For marketing campaigns to large subscriber lists with unsubscribe links and engagement tracking, use Resend Broadcasts — see broadcasts.md for the API.
Domain Warm-up
New domains must gradually increase sending volume. Day 1 limit: ~150 emails (new domain) or ~1,000 (existing domain). See the warm-up schedule in sending/overview.md.
Testing
Never test with fake addresses at real email providers ([email protected], [email protected]) — they bounce and destroy sender reputation.
| Address | Result |
|---|---|
[email protected] | Simulates successful delivery |
[email protected] | Simulates hard bounce |
[email protected] | Simulates spam complaint |
Suppression List
Resend automatically suppresses hard-bounced and spam-complained addresses. Sending to suppressed addresses fires the email.suppressed webhook event instead of attempting delivery. Manage in Dashboard → Suppressions.
Webhook Event Types
| Event | Trigger |
|---|---|
email.sent | API request successful |
email.delivered | Reached recipient's mail server |
email.bounced | Permanently rejected (hard bounce) |
email.complained | Recipient marked as spam |
email.opened / email.clicked | Recipient engagement |
email.delivery_delayed | Soft bounce, Resend retries |
email.received | Inbound email arrived |
domain.* / contact.* | Domain/contact changes |
See webhooks.md for full details, signature verification, and retry schedule.
Error Handling Quick Reference
| Code | Action |
|---|---|
| 400, 422 | Fix request parameters, don't retry |
| 401 | Check API key — restricted_api_key means sending-only key used on non-sending endpoint |
| 403 | Verify domain ownership — common causes: resend.dev sandbox, from domain mismatch, unverified domain |
| 409 | Idempotency conflict — use new key or fix payload |
| 429 | Rate limited — retry with exponential backoff (default rate limit: 10 req/s) |
| 500 | Server error — retry with exponential backoff |
Resources
Files
23- SKILL.md
4d6aad32cf14.0 KB - references/api-keys.md
7f350d7e233.4 KB - references/automations.md
fc602f33e88.8 KB - references/broadcasts.md
89a6c9c2fa6.4 KB - references/contact-properties.md
0d2afba2413.4 KB - references/contacts.md
4a68b67dad6.5 KB - references/domains.md
e73aaf93ee14.1 KB - references/events.md
021bfe29a43.7 KB - references/fetch-all-templates.mjs
6f98543145889 B - references/inboxes.md
bf9669c64f24.1 KB - references/installation.md
276a2ae6513.4 KB - references/logs.md
46d6c9d74a4.8 KB - references/receiving.md
78da6c609e8.7 KB - references/segments.md
34179817db2.3 KB - references/sending/batch-email-examples.md
6d9bc7ceed23.7 KB - references/sending/best-practices.md
a1b075637f12.4 KB - references/sending/email-management.md
16d649da848.4 KB - references/sending/overview.md
0c2b10f1bf7.4 KB - references/sending/single-email-examples.md
9ff0df770d12.0 KB - references/templates.md
dfea43049a7.1 KB - references/topics.md
4258030d532.8 KB - references/usage.md
f3575efcf75.3 KB - references/webhooks.md
abb84ba9c614.0 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from resend/resend-skills4
Use when building any system where email content triggers actions — AI agent inboxes, automated support handlers, email-to-task pipelines, or any workflow processing untrusted inbound email. Always use this skill when the user wants to receive emails and act on them programmatically, even if they do
Use when building email features, emails going to spam, high bounce rates, setting up SPF/DKIM/DMARC authentication, implementing email capture, ensuring compliance (CAN-SPAM, GDPR, CASL), handling webhooks, retry logic, making emails accessible (alt text, headings, contrast, screen readers), or dec
Use when building HTML email templates with React components, adding a visual email editor to an application using the React Email visual editor, rendering emails to HTML, or sending emails with Resend. Covers welcome emails, password resets, notifications, order confirmations, newsletters, transact
Operate the Resend platform from the terminal — send emails (including React Email .tsx templates via --react-email), manage domains, contacts, broadcasts, templates, webhooks, API keys, logs, automations, and events via the `resend` CLI. Use when the user wants to run Resend commands in the shell,
Related backend skillsscan passed
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Report browser/API/CLI/job/worker/webhook bugs. Use for: qa report only, just report bugs, test but dont fix. (gstack)
Use this when generating RTK Query endpoints from OpenAPI schemas with @rtk-query/codegen-openapi. Covers the empty API pattern, filterEndpoints, endpointOverrides, generated tags, and reviewing generated output before it becomes part of the app.
Python background job patterns including task queues, workers, and event-driven architecture. Use when implementing async task processing, job queues, long-running operations, or decoupling work from request/response cycles.
PostHog integration for server-rendered Astro applications with API routes
Configures API gateways for routing, authentication, rate limiting, and request transformation in microservice architectures. Use when setting up Kong, Nginx, AWS API Gateway, or Traefik for centralized API management.