# Add and verify a domain Source: https://resend.com/docs/add-a-domain Get started sending emails by adding a domain to your account. Resend sends emails using a domain you own. Before you can send or receive emails with Resend, you must have a verified domain associated with your account. > [!NOTE] > > If you don't own a domain, please purchase one from a domain registrar such as > [Cloudflare](https://www.cloudflare.com/) or > [Namecheap](https://www.namecheap.com/) before continuing. ## Add a domain You can add and verify a domain you own in four ways: * in the [**Domains** Dashboard page](/docs/dashboard/domains/introduction) * using the [Resend API](/docs/api-reference/domains/create-domain) * with a [Resend CLI command](/docs/cli#domains) * with the [Resend MCP server](/docs/mcp-server) To add a new domain from the Resend Dashboard: **1. In your Resend Dashboard, navigate to the Domains page.** **2. Click the Add Domain button.** **3. Enter a domain including a subdomain to use for your Resend emails.** We strongly recommend sending emails from a subdomain (e.g., `notifications.example.com`) instead of your root domain (`example.com`) to conform to deliverability best practices. Choose a subdomain that reflects the purpose of your emails, such as `customers.example.com` or `updates.example.com`. You can have multiple subdomains associated with your root domain. But, each one must be configured and verified individually. If you add a domain already used by another team, the dashboard will notify you and you can [claim the domain](/docs/dashboard/domains/claim) to transfer it to your team. **4. Choose a region from the list provided.** Select a region to send your emails from. Choose one that is closest to the majority of your recipients. **5. (optional) Enter a custom subdomain for the Return-Path address if desired.** Return-Path defaults to `send.example.com`, although you can [provide a custom path](/docs/dashboard/domains/custom-return-path). **6. Update your DNS records with values provided by Resend.** View the **Records** tab for your domain to find the records to provide to your DNS host provider. Adding these records will verify that you own the domain and have the correct permissions to send and receive emails. Provide the DKIM and SPF configurations (`TXT` and `MX` or `CNAME` records) to your DNS provider. These records must match exactly what Resend generated. Copy and paste the records to avoid configuration errors. > [!TIP] > > Consult one of our [DNS provider guides](/docs/knowledge-base/introduction) for specific examples of updating your DNS records with your host. Also, when shown a CNAME, make sure *not* to use proxying features (e.g., Cloudflare's orange cloud) for that record, as it will prevent verification from completing. **7. Wait for DNS verification to complete** When this process is completed correctly, your domain will often verify within 15 minutes of adding the DNS records. However, DNS changes can occasionally take up to 72 hours to propagate globally. You can use Resend's [dns.email tool](https://dns.email/) to check that your records are visible publicly. If verification has not completed after 72 hours, use the “Restart verification” button in the Resend dashboard to trigger a fresh verification check. **8. Add a DMARC record.** After your domain is verified, you can then [implement DMARC](/docs/dashboard/domains/dmarc) to build additional trust in your domain and protect against email spoofing. This is an email authentication protocol to verify email senders and to allow receivers to reject unauthenticated messages, and is important for email deliverability. **9. (optional) Update your domain's Resend configuration options.** After your domain is verified, you may wish to [enable open and click tracking](/docs/dashboard/domains/tracking) or [enforce Transport Layer Security (TLS)](/docs/dashboard/domains/tls). ## Learn more > [card] [Manage domains](/docs/dashboard/domains/introduction) > > View, create, edit, delete, and manage your domains. > [card] [Multi-tenant domain setup](/docs/knowledge-base/setting-up-resend-for-multi-tenants) > > Learn how to configure Resend for SaaS platforms where tenants send emails > from their own domains. ## Next steps > [card] [Add a DMARC record](/docs/dashboard/domains/dmarc) > > Implement DMARC to build trust in your domain and protect against email > spoofing. > [card] [Quickstart tutorials](/docs/introduction) > > Send your first transactional email with a quick tutorial for your language > or framework. # Agent Email Inbox Skill Source: https://resend.com/docs/agent-email-inbox-skill Give your AI agent a secure email inbox to receive and act on inbound emails. The Agent Email Inbox skill enables AI agents to securely receive and respond to emails through a Resend [Inbox](/docs/api-reference/inboxes/create-inbox). It provides security patterns that prevent untrusted email content from controlling your agent, including sender allowlists, content filtering, and sandboxed processing. The inbox groups each conversation into a thread, and your agent replies in the thread with one call. Without a custom domain, or when your plan has no inbox available, the skill falls back to [Receiving](/docs/dashboard/receiving/introduction) with the same security levels. ## Why your agent needs a secure inbox An AI agent's inbox receives **untrusted input**. Without proper security, anyone who knows your agent's email address can send instructions that your agent will execute. The Agent Email Inbox skill solves this with a leveled security approach built in from the start. Unlike polling-based approaches, Resend uses **webhooks** for inbound email. Your agent is notified instantly when an email arrives. No cron jobs, no wasted API calls checking empty inboxes. ## Installation This skill is part of the [resend-skills](https://github.com/resend/resend-skills) repository, which also includes the [Resend skill](/docs/resend-skill) for sending emails. When you run the install command, you'll be prompted to choose which skills to install. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} npx skills add resend/resend-skills ``` ## Advantages * **5 security levels**: From strict sender allowlists to human-in-the-loop approval, choose the right level of security for your use case. * **Real-time webhook architecture**: Event-driven design means your agent reacts to emails in seconds, not minutes. * **Threaded replies**: Your agent replies inside the conversation, and Resend sets the recipients and threading headers. * **Webhook signature verification**: Built-in patterns for verifying Resend webhook signatures to prevent spoofed events. * **Multi-language SDK support**: The inbox examples use the Node.js SDK. The Receiving fallback works with Node.js, Python, Go, Ruby, PHP, Rust, Java, and .NET. * **Common threat protection**: Built-in guidance for handling prompt injection, sender spoofing, and email flooding. ## Architecture ``` Email → Resend Inbox → Webhook → Your Server → Validate ↓ Process or Reject → Reply in the thread ``` Your agent only processes emails that pass your chosen security level. Rejected emails are logged and silently acknowledged to prevent retries. ## Security Levels Choose a security level before setting up your webhook endpoint. Start with **Level 1** and relax only if needed. | Level | Name | Best For | | - | - | - | | **1** | Strict Allowlist | Most use cases, only process emails from known senders | | **2** | Domain Allowlist | Organization-wide access from trusted domains | | **3** | Content Filtering | Accept from anyone, but filter unsafe patterns | | **4** | Sandboxed Processing | Process all emails with restricted agent capabilities | | **5** | Human-in-the-Loop | Require human approval for actions from untrusted senders | Each level includes full implementation code in the skill. After installation, your AI agent will have access to the detailed security patterns and can help you implement the right level. ## Example A minimal webhook handler that verifies the signature, checks the sender against an allowlist, retrieves the full email, and replies in its thread: ```js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend(process.env.RESEND_API_KEY); const ALLOWED_SENDERS = ['your@email.com']; // `from` can be `Name
`, so compare the address only const senderAddress = (from) => { const match = from.match(/<([^<>]+)>\s*$/); return (match ? match[1] : from).trim().toLowerCase(); }; async function handler(req) { const payload = await req.text(); const event = resend.webhooks.verify({ payload, headers: { id: req.headers.get('svix-id'), timestamp: req.headers.get('svix-timestamp'), signature: req.headers.get('svix-signature'), }, webhookSecret: process.env.RESEND_WEBHOOK_SECRET, }); if (event.type === 'inbox.email.received') { const { inbox_id, thread_id, email_id, email } = event.data; if (!email || !ALLOWED_SENDERS.includes(senderAddress(email.from))) { return new Response('OK', { status: 200 }); } const thread = { inboxId: inbox_id, threadId: thread_id, emailId: email_id, }; const { data: fullEmail } = await resend.inboxes.threads.emails.get(thread); const answer = await processEmailForAgent(fullEmail); await resend.inboxes.threads.emails.reply({ ...thread, text: answer }); } return new Response('OK', { status: 200 }); } ``` The inbox methods need `resend` 6.34.1 or later. ## Learn More > [card] [OpenClaw Setup Guide](/docs/openclaw-guide) > > Step-by-step guide for giving an OpenClaw agent a fully functional email > inbox. > [card] [View on GitHub](https://github.com/resend/resend-skills/tree/main/skills/agent-email-inbox) > > See the full source code, security patterns, and documentation. # AI onboarding Source: https://resend.com/docs/ai-onboarding Everything you need to onboard your AI agent to Resend. If you're developing with AI, Resend offers several resources to improve your experience. * [Resend MCP Server](#resend-mcp-server) * [Resend CLI](#resend-cli) * [Resend Docs for Agents](#resend-docs-for-agents) * [Email Skills for Agents](#email-skills-for-agents) * [Quick Start Guides](#quick-start-guides) * [OpenClaw Guide](#openclaw-guide) * [Chat SDK](#chat-sdk) * [AI Builder Guides](#ai-builder-guides) * [AI Integrations](#ai-integrations) ## Prerequisite: Create an API Key A human must create the Resend account. Once you have an account, you'll need to [create an API key](/docs/create-an-api-key). With an API key, your agent can perform many other tasks. > [!NOTE] > > To send or receive with Resend, you'll need to [verify a domain](https://resend.com/domains). While an agent can [create a domain](/docs/api-reference/domains/create-domain), the API returns DNS records you will need to add in your DNS provider before [verifying your DNS records](/docs/api-reference/domains/verify-domain). You may find it easier to verify your domain in the dashboard. ## Resend MCP Server MCP is an open protocol that standardizes how applications provide context to LLMs. Among other benefits, it provides LLMs tools to act on your behalf. Our [MCP server](https://github.com/resend/resend-mcp) is open-source and covers our full API surface area. Resend hosts the MCP server, so you can connect any MCP client without installing anything: ``` https://mcp.resend.com/mcp ``` When you connect, your client authenticates with OAuth by opening a browser to log in to Resend. Clients that can't complete a browser login can pass an API key as a Bearer token instead. You can also run the server locally with `npx` using the `resend-mcp` package on NPM. The [Resend plugin](https://github.com/resend/resend-skills) follows the [Agent Plugins](https://agent-plugins.org) spec. On clients whose landing page installs that plugin, it adds the remote MCP server and the Resend skills together. Setup for each client is on the [MCP server page](/docs/mcp-server), and it matches the page at resend.com. Claude and Codex also keep these one-click installs: * [Resend connector for Claude](https://claude.ai/directory/connectors/resend) * [Resend plugin for Codex](https://chatgpt.com/plugins/plugin_asdk_app_6a3c407853888191beddc2151c2b6f8b?open_in_codex) > [card] [MCP Server](/docs/mcp-server) > > View setup instructions for Claude, Cursor, Codex, Copilot, Hermes, OpenClaw, > and more. ## Resend CLI The Resend CLI lets you send emails, manage your account, and develop locally, all from the terminal. It's built for humans, AI agents, and CI/CD pipelines. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} # Authenticate resend login # Send an email resend emails send \ --from "you@example.com" \ --to hello@example.com \ --subject "Hello" \ --text "Sent from my terminal." ``` The CLI also includes a full local webhook setup for developing with inbound email events without deploying anything. > [card] [Resend CLI](/docs/cli) > > Install the CLI and set up a local webhook development environment. ## Resend Docs for Agents You can give your agent current docs in a context-aware way in three ways: 1. **Markdown docs** Every doc includes a markdown version (append `md` to any page) ``` Docs for this page: https://resend.com/docs/ai-onboarding.md ``` 2. **Full llms.txt** Give your agent all our docs in a single file. ``` Here are the Resend docs: https://resend.com/docs/llms-full.txt ``` 3. **MCP Docs server** For a more structured approach using MCP tools, you can install our MCP docs server in any MCP client, like Cursor, Codex, or Claude Code. ``` npx add-mcp https://resend.com/docs/mcp ``` ## Email Skills for Agents Skills give AI agents specialized knowledge for specific tasks. Install skills with a single command: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} npx skills add resend/resend-skills ``` Or install individually: | Skill | Install | What it does | | - | - | - | | [Resend](/docs/resend-skill) | `npx skills add resend/resend-skills` | Send and receive emails, handle errors, and prevent duplicate sends. Get code examples from various SDKs. | | [React Email](/docs/react-email-skill) | `npx skills add resend/react-email` | Build emails in React, Tailwind, and TypeScript. Audit existing React emails for style and cross-client rendering. | | [Email Best Practices](/docs/email-best-practices-skill) | `npx skills add resend/email-best-practices` | Audit SPF/DKIM/DMARC setup, compliance (CAN-SPAM, GDPR), webhook handling | ## Quick Start Guides The documentation includes quick start guides for common tasks with Resend. They contain step-by-step instructions for sending emails, creating templates, and more. Copy the prompt for your agent or click to open in Cursor. Example agent quick start guide for sending emails. Resend provides two endpoints for sending emails: | Approach | Endpoint | Use Case | | - | - | - | | **Single** | `POST /emails` | Individual transactional emails, emails with attachments, scheduled sends | | **Batch** | `POST /emails/batch` | Multiple distinct emails in one request (max 100), bulk notifications | **Choose batch when:** * Sending 2+ distinct emails at once * Reducing API calls is important (by default, rate limit is 10 requests per second) * No attachments or scheduling needed **Choose single when:** * Sending one email * Email needs attachments * Email needs to be scheduled * Different recipients need different timing ## Quick Start 1. **Detect project language** from config files (package.json, requirements.txt, go.mod, etc.) 2. **Install SDK** (preferred) or use cURL 3. **Choose single or batch** based on the decision matrix above 4. **Implement best practices** - Idempotency keys, error handling, retries ## Best Practices (Critical for Production) Always implement these for production email sending. ### Idempotency Keys Prevent duplicate emails when retrying failed requests. | Key Facts | | | - | - | | **Format (single)** | `/` (e.g., `welcome-email/user-123`) | | **Format (batch)** | `batch-/` (e.g., `batch-orders/batch-456`) | | **Expiration** | 24 hours | | **Max length** | 256 characters | | **Duplicate payload** | Returns original response without resending | | **Different payload** | Returns 409 error | ### Error Handling | Code | Action | | - | - | | 400, 422 | Fix request parameters, don't retry | | 401, 403 | Check API key / verify domain, don't retry | | 409 | Idempotency conflict - use new key or fix payload | | 429 | Rate limited - retry with exponential backoff (by default, rate limit is 10 requests/second) | | 500 | Server error - retry with exponential backoff | ### Retry Strategy * **Backoff:** Exponential (1s, 2s, 4s...) * **Max retries:** 3-5 for most use cases * **Only retry:** 429 (rate limit) and 500 (server error) * **Always use:** Idempotency keys when retrying ## Single Email **Endpoint:** `POST /emails` (prefer SDK over cURL) ### Required Parameters | Parameter | Type | Description | | - | - | - | | `from` | string | Sender address. Format: `"Name "` | | `to` | string\[] | Recipient addresses (max 50) | | `subject` | string | Email subject line | | `html` or `text` | string | Email body content | ### Optional Parameters | Parameter | Type | Description | | - | - | - | | `cc` | string\[] | CC recipients | | `bcc` | string\[] | BCC recipients | | `reply_to`\* | string\[] | Reply-to addresses | | `scheduled_at`\* | string | Schedule send time (ISO 8601) | | `attachments` | array | File attachments (max 40MB total) | | `tags` | array | Key/value pairs for tracking | | `headers` | object | Custom headers | \*Parameter naming varies by SDK (e.g., `replyTo` in Node.js, `reply_to` in Python). ### Minimal Example (Node.js) ```typescript theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('YOUR_RESEND_API_KEY'); const { data, error } = await resend.emails.send( { from: 'Acme ', to: ['delivered@resend.dev'], subject: 'Hello World', html: '

Email body here

', }, { idempotencyKey: `welcome-email/${userId}` }, ); if (error) { console.error('Failed:', error.message); return; } console.log('Sent:', data.id); ``` ## Batch Email **Endpoint:** `POST /emails/batch` (but prefer SDK over cURL) ### Limitations * **No attachments** - Use single sends for emails with attachments * **No scheduling** - Use single sends for scheduled emails * **Atomic** - If one email fails validation, the entire batch fails * **Max 100 emails** per request * **Max 50 recipients** per individual email in the batch ### Pre-validation Since the entire batch fails on any validation error, validate all emails before sending: * Check required fields (from, to, subject, html/text) * Validate email formats * Ensure batch size is less than or equal to 100 ### Minimal Example (Node.js) ```typescript theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('YOUR_RESEND_API_KEY'); const { data, error } = await resend.batch.send( [ { from: 'Acme ', to: ['delivered@resend.dev'], subject: 'Order Shipped', html: '

Your order has shipped!

', }, { from: 'Acme ', to: ['delivered@resend.dev'], subject: 'Order Confirmed', html: '

Your order is confirmed!

', }, ], { idempotencyKey: `batch-orders/${batchId}` }, ); if (error) { console.error('Batch failed:', error.message); return; } console.log( 'Sent:', data.map((e) => e.id), ); ``` ## OpenClaw Guide Equipping your agent with its own email inbox can be a powerful tool to unlock new workflows. Alternatively, give it access to your Resend account to support agentic flows for sending and receiving emails. > [card] [Email Automation for OpenClaw using Resend](/docs/openclaw-guide) > > View the OpenClaw guide. ## Chat SDK The `@resend/chat-sdk-adapter` package is a Vercel Chat SDK adapter that turns email into a two-way communication channel. Receive inbound emails through webhooks, reply through the Resend API, and let the adapter handle threading automatically. It also supports card emails, attachments, and proactive outreach. > [card] [Chat SDK](/docs/chat-sdk) > > Build conversational email experiences with the Chat SDK adapter. ## AI Builder Guides Get started using Resend with popular AI builders: * [Anything Integration](/docs/anything-integration) * [Lovable Integration](/docs/lovable-integration) * [v0 Integration](/docs/v0-integration) * [Bolt.new Integration](/docs/bolt-new-integration) * [Replit Integration](/docs/replit-integration) * [Base44 Integration](/docs/base44-integration) * [Leap.new Integration](/docs/leap-new-integration) ## AI Integrations Several AI tools have created integrations for working with Resend. Visit their documentation for information on integrating Resend with their tools. > [card] [Lovable](https://docs.lovable.dev/integrations/resend) > > Tell the Lovable AI to send emails > [card] [Anything](https://www.createanything.com/docs/integrations/resend) > > Add email to your Anything projects > [card] [Wildcard](https://github.com/wild-card-ai/agents-json/blob/master/examples/resend.ipynb) > > Send natural language emails using Wildcard > [card] [mcp.run](https://www.mcp.run/nilslice/resend) > > Build email AI agents using mcp.run > [card] [Rocket](https://docs.rocket.new/integrations/resend) > > Send emails from apps built with Rocket > [card] [Base44](https://docs.base44.com/Integrations/Resend-integration) > > Add email to your Base44 apps > [card] [Leap.new](https://docs.leap.new/integrations/resend) > > Add email to your Leap apps > [card] [Parsley](https://www.parsley.id/integrations/resend) > > Send alerts and follow-ups with Parsley > [card] [Pica](https://www.picaos.com/integrations/resend) > > Integrate Pica with Resend # How to add the Resend integration to your Anything project Source: https://resend.com/docs/anything-integration Learn how to add the Resend integration to your Anything project. [Anything](https://createanything.com) is a platform for building web sites, tools, apps, and projects via chat. With their [Resend integration](https://www.createanything.com/docs/integrations/resend), you can send emails from your Anything project. If you prefer to watch a video, check out our video walkthrough below. [YouTube video player](https://www.youtube.com/embed/Avp1OOMH2Z0) ## Guide **1. Call the Resend integration in Anything** Type `/Resend` in the chat and select the integration, and ask Anything to add email functionality to your project. ![adding the Resend integration to a Anything chat](https://mintcdn.com/resend/ABWmVTZIHGIFNTFD/images/create-xyz-integration.png?fit=max\&auto=format\&n=ABWmVTZIHGIFNTFD\&q=85\&s=810ab7bd912d16365530bbda50d339d8) **2. Add your Resend API key** Anything usually prompts you for a Resend API key, which you can add in the [Resend Dashboard](https://resend.com/api-keys). If Anything doesn't prompt you for a Resend API key, click the **More options** button and select **Secrets**. Click the **Add new secret** button. * **Name:** `RESEND_API_KEY` * **Value:** Your Resend API key (e.g., `re_xxxxxxxxx0`) Learn more about [Secrets in Create](https://www.createanything.com/docs/essentials#project-settings). **3. Add a custom domain to your Resend account** By default, you can only send emails to your own email address. To send emails to other email addresses: 1. Add a [custom domain to your Resend account](https://resend.com/domains). 2. Add the custom domain to the `from` field in the `resend` function in Create. Learn more about [Functions in Create](https://www.createanything.com/docs/builder/functions). # Create API key Source: https://resend.com/docs/api-reference/api-keys/create-api-key POST /api-keys Add a new API key to authenticate communications with Resend. ## Body Parameters **name** `string` *required* The API key name. Maximum 50 characters. **permission** `full_access | sending_access` The API key can have full access to Resend's API or be only restricted to send emails. * `full_access`: Can create, delete, get, and update any resource. * `sending_access`: Can only send emails. For Inboxes, it can call only [Reply to Thread Email](/docs/api-reference/inboxes/reply-thread-email), [Forward Thread Email](/docs/api-reference/inboxes/forward-thread-email), [Create Draft](/docs/api-reference/inboxes/create-draft) and [Send Draft](/docs/api-reference/inboxes/send-draft). A key restricted to a domain can use only the inboxes on that domain. Restrict an API key to send emails only from a specific domain. This is only used when the `permission` is set to `sending_access`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.apiKeys.create({ name: 'Production' }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->apiKeys->create([ 'name' => 'Production' ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.ApiKeys.CreateParams = { "name": "Production", } resend.ApiKeys.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { name: "Production" } Resend::ApiKeys.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateApiKeyRequest{ Name: "Production", } client.ApiKeys.Create(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::CreateApiKeyOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _api_key = resend .api_keys .create(CreateApiKeyOptions::new("Production")) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.apikeys.model.CreateApiKeyOptions; import com.resend.services.apikeys.model.CreateApiKeyResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateApiKeyOptions params = CreateApiKeyOptions .builder() .name("Production").build(); CreateApiKeyResponse apiKey = resend.apiKeys().create(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ApiKeyCreateAsync( "Production" ); Console.WriteLine( "Token={0}", resp.Content.Token ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/api-keys' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "Production" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend api-keys create --name Production ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "id": "dacf4072-4119-4d88-932f-6202748ac7c8", "object": "api_key", "token": "re_c1tpEyD8_NKFusih9vKVQknRAQfmFcWCv" } ``` # Delete API key Source: https://resend.com/docs/api-reference/api-keys/delete-api-key DELETE /api-keys/:api_key_id Remove an existing API key. ## Path Parameters The API key ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.apiKeys.remove( 'b6d24b8e-af0b-4c3c-be0c-359bbd97381e', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->apiKeys->remove('b6d24b8e-af0b-4c3c-be0c-359bbd97381e'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.ApiKeys.remove(api_key_id="b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::ApiKeys.remove "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.ApiKeys.Remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); resend .api_keys .delete("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); resend.apiKeys().remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.ApiKeyDeleteAsync( new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/api-keys/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend api-keys delete b6d24b8e-af0b-4c3c-be0c-359bbd97381e ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "api_key", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "deleted": true } ``` # List API keys Source: https://resend.com/docs/api-reference/api-keys/list-api-keys GET /api-keys Retrieve a list of API keys for the authenticated user. ## Query Parameters If `limit` is not provided, all API keys will be returned in a single response. Pass `limit` to paginate. `after` and `before` only take effect together with `limit`. **limit** `number` Number of API keys to retrieve.
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more API keys (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more API keys (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.apiKeys.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->apiKeys->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.ApiKeys.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::ApiKeys.list ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.ApiKeys.List() } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _api_keys = resend.api_keys.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); resend.apiKeys().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ApiKeyListAsync(); Console.WriteLine( "Nr keys={0}", resp.Content.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/api-keys' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend api-keys list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "91f3200a-df72-4654-b0cd-f202395f5354", "name": "Production", "created_at": "2026-04-08 00:11:13.110779+00", "last_used_at": "2026-11-01 17:09:51.813959+00" } ] } ``` # Update API key Source: https://resend.com/docs/api-reference/api-keys/update-api-key PATCH /api-keys/:api_key_id Update the name of an existing API key. > [!NOTE] > > This endpoint only updates the API key's name. To change an API key's > [permission or domain](/docs/dashboard/api-keys/introduction#edit-api-key-details), > edit the key in the [Resend Dashboard](https://resend.com/api-keys). ## Path Parameters The API key ID. ## Body Parameters **name** `string` *required* The API key name. Maximum 50 characters. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.apiKeys.update( 'b6d24b8e-af0b-4c3c-be0c-359bbd97381e', { name: 'Production' }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->apiKeys->update('b6d24b8e-af0b-4c3c-be0c-359bbd97381e', [ 'name' => 'Production' ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.ApiKeys.UpdateParams = { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "name": "Production", } resend.ApiKeys.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { id: "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", name: "Production" } Resend::ApiKeys.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.UpdateApiKeyRequest{ Name: "Production", } client.ApiKeys.Update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::UpdateApiKeyOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _api_key = resend .api_keys .update( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", UpdateApiKeyOptions::new("Production"), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.apikeys.model.UpdateApiKeyOptions; import com.resend.services.apikeys.model.UpdateApiKeyResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateApiKeyOptions params = UpdateApiKeyOptions .builder() .name("Production").build(); UpdateApiKeyResponseSuccess apiKey = resend.apiKeys().update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ApiKeyUpdateAsync( new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ), "Production" ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/api-keys/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "Production" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend api-keys update b6d24b8e-af0b-4c3c-be0c-359bbd97381e --name Production ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "api_key", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" } ``` # Create Automation Source: https://resend.com/docs/api-reference/automations/create-automation POST /automations Create a new automation to automate email sequences. ## Body Parameters **name** `string` *required* The name of the automation. **status** `string` The status of the automation. Possible values are `enabled` or `disabled`. Defaults to `disabled`. **steps** `Step[]` The steps that compose the automation graph. Must be provided together with `connections`. See [Step Properties](/docs/dashboard/automations/steps#step-properties) for full object definition. **connections** `Connection[]` The connections between steps in the automation graph. Must be provided together with `steps`. See [Connection Properties](/docs/dashboard/automations/connections#connection-properties) for full object definition. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.automations.create({ name: 'Welcome series', status: 'disabled', steps: [ { key: 'start', type: 'trigger', config: { eventName: 'user.created' }, }, { key: 'welcome', type: 'send_email', config: { template: { id: '34a080c9-b17d-4187-ad80-5af20266e535' }, }, }, ], connections: [{ from: 'start', to: 'welcome' }], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->automations->create([ 'name' => 'Welcome series', 'status' => 'disabled', 'steps' => [ [ 'key' => 'start', 'type' => 'trigger', 'config' => ['event_name' => 'user.created'], ], [ 'key' => 'welcome', 'type' => 'send_email', 'config' => [ 'template' => ['id' => '34a080c9-b17d-4187-ad80-5af20266e535'], ], ], ], 'connections' => [['from' => 'start', 'to' => 'welcome']], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Automations.CreateParams = { "name": "Welcome series", "status": "disabled", "steps": [ { "key": "start", "type": "trigger", "config": {"event_name": "user.created"}, }, { "key": "welcome", "type": "send_email", "config": { "template": {"id": "34a080c9-b17d-4187-ad80-5af20266e535"}, }, }, ], "connections": [{"from": "start", "to": "welcome"}], } resend.Automations.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { name: "Welcome series", status: "disabled", steps: [ { key: "start", type: "trigger", config: { event_name: "user.created" }, }, { key: "welcome", type: "send_email", config: { template: { id: "34a080c9-b17d-4187-ad80-5af20266e535" }, }, }, ], connections: [{ from: "start", to: "welcome" }], } Resend::Automations.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateAutomationRequest{ Name: "Welcome series", Status: resend.AutomationStatusDisabled, Steps: []resend.AutomationStep{ { Key: "start", Type: resend.AutomationStepTypeTrigger, Config: map[string]any{ "event_name": "user.created", }, }, { Key: "welcome", Type: resend.AutomationStepTypeSendEmail, Config: map[string]any{ "template": map[string]any{ "id": "34a080c9-b17d-4187-ad80-5af20266e535", }, }, }, }, Connections: []resend.AutomationConnection{ {From: "start", To: "welcome"}, }, } client.Automations.Create(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{ AutomationStatus, AutomationTemplate, Connection, CreateAutomationOptions, SendEmailStepConfig, Step, TriggerStepConfig, }, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = CreateAutomationOptions { name: "Welcome series".to_owned(), status: AutomationStatus::Disabled, steps: vec![ Step::Trigger { key: "start".to_owned(), config: TriggerStepConfig { event_name: "user.created".to_owned(), }, }, Step::SendEmail { key: "welcome".to_owned(), config: SendEmailStepConfig::new(AutomationTemplate::new( "34a080c9-b17d-4187-ad80-5af20266e535", )), }, ], connections: vec![Connection::new("start", "welcome")], }; let _automation = resend.automations.create(opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.automations.model.AutomationConnection; import com.resend.services.automations.model.AutomationStatus; import com.resend.services.automations.model.AutomationStep; import com.resend.services.automations.model.CreateAutomationOptions; import com.resend.services.automations.model.CreateAutomationResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateAutomationOptions options = CreateAutomationOptions.builder() .name("Welcome series") .status(AutomationStatus.DISABLED) .steps( AutomationStep.trigger("start") .eventName("user.created") .build(), AutomationStep.sendEmail("welcome") .template("34a080c9-b17d-4187-ad80-5af20266e535") .build() ) .connections( AutomationConnection.builder() .from("start") .to("welcome") .build() ) .build(); CreateAutomationResponseSuccess response = resend.automations().create(options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; using System.Text.Json; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var startConfig = JsonSerializer.SerializeToElement( new { event_name = "user.created" } ); var welcomeConfig = JsonSerializer.SerializeToElement( new { template = new { id = "34a080c9-b17d-4187-ad80-5af20266e535" } } ); var resp = await resend.AutomationCreateAsync( new AutomationCreateData() { Name = "Welcome series", Status = "disabled", Steps = new List { new AutomationStepData { Ref = "start", Type = "trigger", Config = startConfig }, new AutomationStepData { Ref = "welcome", Type = "send_email", Config = welcomeConfig }, }, Connections = new List { new AutomationEdge { From = "start", To = "welcome" }, }, } ); Console.WriteLine( "AutomationId={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/automations' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Welcome series", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations create --name "Welcome series" --file ./automation.json ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd" } ``` # Delete Automation Source: https://resend.com/docs/api-reference/automations/delete-automation DELETE /automations/:automation_id Remove an existing automation. ## Path Parameters The automation ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.automations.remove( 'c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->automations->remove('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Automations.remove("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Automations.remove("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Automations.Remove("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _automation = resend .automations .delete("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.automations.model.DeleteAutomationResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); DeleteAutomationResponseSuccess data = resend.automations().remove("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.AutomationDeleteAsync( new Guid( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd" ) ); Console.WriteLine( "Deleted={0}", resp.Content.Deleted ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations delete c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "deleted": true } ``` # Duplicate Automation Source: https://resend.com/docs/api-reference/automations/duplicate-automation POST /automations/:automation_id/duplicate Duplicate an existing automation. ## Path Parameters The automation ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.automations.duplicate( 'c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->automations->duplicate('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Automations.duplicate("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Automations.duplicate("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Automations.Duplicate("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _automation = resend .automations .duplicate("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.automations.model.DuplicateAutomationResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); DuplicateAutomationResponseSuccess data = resend.automations().duplicate("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.AutomationDuplicateAsync( new Guid( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd" ) ); Console.WriteLine( "AutomationId={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/duplicate' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations duplicate c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "automation", "id": "e169aa45-1ecf-4183-9955-b1499d5701d3" } ``` # Retrieve Automation Source: https://resend.com/docs/api-reference/automations/get-automation GET /automations/:automation_id Retrieve a single automation. ## Path Parameters The automation ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.automations.get( 'c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->automations->get('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Automations.get("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Automations.get("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Automations.Get("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _automation = resend .automations .get("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.automations.model.Automation; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); Automation data = resend.automations().get("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.AutomationRetrieveAsync( new Guid( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd" ) ); Console.WriteLine( "Name={0}", resp.Content.Name ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations get c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "name": "Welcome series", "status": "disabled", "created_at": "2026-10-01 12:00:00.000000+00", "updated_at": "2026-10-01 12:00:00.000000+00", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome", "type": "default" } ] } ``` # Retrieve Automation Run Source: https://resend.com/docs/api-reference/automations/get-automation-run GET /automations/:automation_id/runs/:run_id Retrieve a single automation run. ## Path Parameters The automation ID. The automation run ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.automations.runs.get({ automationId: 'c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', runId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->automations->runs->get( 'c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Automations.Runs.get( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Automations::Runs.get( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890", ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Automations.GetRun( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _automation = resend .automations .get_run( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.automations.model.AutomationRun; import com.resend.services.automations.model.GetAutomationRunOptions; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); AutomationRun data = resend.automations().getRun( GetAutomationRunOptions.builder() .automationId("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") .runId("a1b2c3d4-e5f6-7890-abcd-ef1234567890") .build() ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.AutomationRunRetrieveAsync( new Guid( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd" ), new Guid( "a1b2c3d4-e5f6-7890-abcd-ef1234567890" ) ); Console.WriteLine( "Status={0}", resp.Content.Status ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/runs/a1b2c3d4-e5f6-7890-abcd-ef1234567890' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations runs get --automation-id c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd --run-id a1b2c3d4-e5f6-7890-abcd-ef1234567890 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "automation_run", "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "status": "completed", "started_at": "2026-10-01 12:00:00.000000+00", "completed_at": "2026-10-01 12:05:00.000000+00", "created_at": "2026-10-01 12:00:00.000000+00", "steps": [ { "key": "start", "type": "trigger", "status": "completed", "started_at": "2026-10-01 12:00:00.000000+00", "completed_at": "2026-10-01 12:00:01.000000+00", "output": null, "error": null, "created_at": "2026-10-01 12:00:00.000000+00" }, { "key": "welcome", "type": "send_email", "status": "completed", "started_at": "2026-10-01 12:00:01.000000+00", "completed_at": "2026-10-01 12:00:02.000000+00", "output": null, "error": null, "created_at": "2026-10-01 12:00:01.000000+00" } ] } ``` # List Automation Runs Source: https://resend.com/docs/api-reference/automations/list-automation-runs GET /automations/:automation_id/runs Retrieve a list of automation runs. ## Path Parameters The automation ID. ## Query Parameters **limit** `number` Number of automation-runs to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more automation-runs (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more automation-runs (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. Filter runs by status. Comma-separated list: `running`, `completed`, `failed`, `cancelled`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.automations.runs.list({ automationId: 'c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', status: 'completed', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->automations->runs->list('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Automations.Runs.list("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Automations::Runs.list("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Automations.ListRuns("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _automation = resend .automations .list_runs( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", None, ListOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.automations.model.ListAutomationRunsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListAutomationRunsResponseSuccess data = resend.automations().listRuns("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.AutomationRunListAsync( new Guid( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd" ) ); Console.WriteLine( "Count={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/runs?status=completed' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations runs list c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "status": "completed", "started_at": "2026-10-01 12:00:00.000000+00", "completed_at": "2026-10-01 12:05:00.000000+00", "created_at": "2026-10-01 12:00:00.000000+00" }, { "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901", "status": "running", "started_at": "2026-10-02 08:30:00.000000+00", "completed_at": null, "created_at": "2026-10-02 08:30:00.000000+00" } ] } ``` # List Automations Source: https://resend.com/docs/api-reference/automations/list-automations GET /automations Retrieve a list of automations. ## Query Parameters **limit** `number` Number of automations to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more automations (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more automations (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. Filter automations by status. Possible values: `enabled`, `disabled`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.automations.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->automations->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Automations.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Automations.list ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Automations.List() } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _automations = resend.automations.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.automations.model.ListAutomationsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListAutomationsResponseSuccess data = resend.automations().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.AutomationListAsync(); Console.WriteLine( "Count={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/automations' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "name": "Welcome series", "status": "enabled", "created_at": "2026-10-01 12:00:00.000000+00", "updated_at": "2026-10-01 12:00:00.000000+00" }, { "id": "662892b2-4270-4130-a186-33a19752319d", "name": "Re-engagement", "status": "disabled", "created_at": "2026-09-15 08:30:00.000000+00", "updated_at": "2026-09-20 14:00:00.000000+00" } ] } ``` # Stop Automation Source: https://resend.com/docs/api-reference/automations/stop-automation POST /automations/:automation_id/stop Stop a running automation. ## Path Parameters The automation ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.automations.stop( 'c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->automations->stop('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Automations.stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Automations.stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Automations.Stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _automation = resend .automations .stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.automations.model.StopAutomationResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); StopAutomationResponseSuccess data = resend.automations().stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.AutomationStopAsync( new Guid( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd" ) ); Console.WriteLine( "Status={0}", resp.Content.Status ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/stop' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations stop c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "status": "disabled" } ``` # Update Automation Source: https://resend.com/docs/api-reference/automations/update-automation PATCH /automations/:automation_id Update an existing automation. > [!NOTE] > > Provide at least one of `name`, `status`, or both `steps` and `connections`. > When updating the workflow graph, `steps` and `connections` must be sent > together. ## Path Parameters The automation ID. ## Body Parameters **name** `string` The name of the automation. **status** `string` The status of the automation. Possible values are `enabled` or `disabled`. **steps** `Step[]` The steps that compose the automation graph. Must be provided together with `connections`. The graph of an `enabled` automation cannot be updated: disable the automation first, or duplicate it and edit the copy. See [Step Properties](/docs/dashboard/automations/steps#step-properties) for full object definition. **connections** `Connection[]` The connections between steps in the automation graph. Must be provided together with `steps`. See [Connection Properties](/docs/dashboard/automations/connections#connection-properties) for full object definition. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.automations.update( 'c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', { status: 'enabled' }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->automations->update('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', [ 'status' => 'enabled', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Automations.UpdateParams = { "automation_id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "status": "enabled", } resend.Automations.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { automation_id: "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", status: "enabled", } Resend::Automations.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.UpdateAutomationRequest{ Status: resend.AutomationStatusEnabled, } client.Automations.Update("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{AutomationStatus, UpdateAutomationOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = UpdateAutomationOptions::new().with_status(AutomationStatus::Enabled); let _automation = resend .automations .update("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", opts) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.automations.model.AutomationStatus; import com.resend.services.automations.model.UpdateAutomationOptions; import com.resend.services.automations.model.UpdateAutomationResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateAutomationOptions options = UpdateAutomationOptions.builder() .id("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") .status(AutomationStatus.ENABLED) .build(); UpdateAutomationResponseSuccess response = resend.automations().update(options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.AutomationUpdateAsync( new Guid( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd" ), new AutomationUpdateData { Status = "enabled" } ); Console.WriteLine( "AutomationId={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "status": "enabled" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations update c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd --status enabled ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd" } ``` # Cancel Broadcast Source: https://resend.com/docs/api-reference/broadcasts/cancel-broadcast POST /broadcasts/:broadcast_id/cancel Cancel a queued or scheduled broadcast. You can only cancel Broadcasts that are `queued` or `scheduled`. When you cancel a Broadcast, here's what happens based on its status: * `scheduled` → `draft`: no emails are sent. You can update the Broadcast and reschedule it to be sent. * `queued` → `canceled`: emails that have already been sent are not affected, but any emails still in the queue will no longer be sent. ## Path Parameters The broadcast ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.broadcasts.cancel( '559ac32e-9ef5-46fb-82a1-b76b840c0f7b', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->broadcasts->cancel('559ac32e-9ef5-46fb-82a1-b76b840c0f7b'); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Broadcasts.cancel(id="559ac32e-9ef5-46fb-82a1-b76b840c0f7b") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Broadcasts.cancel("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Broadcasts.Cancel("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _canceled = resend .broadcasts .cancel("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.broadcasts.model.CancelBroadcastResponseSuccess; Resend resend = new Resend("re_xxxxxxxxx"); CancelBroadcastResponseSuccess data = resend.broadcasts().cancel("559ac32e-9ef5-46fb-82a1-b76b840c0f7b"); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.BroadcastCancelAsync( new Guid( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/broadcasts/559ac32e-9ef5-46fb-82a1-b76b840c0f7b/cancel' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend broadcasts cancel 559ac32e-9ef5-46fb-82a1-b76b840c0f7b ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "broadcast", "id": "559ac32e-9ef5-46fb-82a1-b76b840c0f7b" } ``` # Create Broadcast Source: https://resend.com/docs/api-reference/broadcasts/create-broadcast POST /broadcasts Create a new broadcast to send to your contacts. ## Body Parameters The ID of the segment you want to send to. > [!NOTE] > > Audiences are now called Segments. Follow the [Migration > Guide](/docs/dashboard/segments/migrating-from-audiences-to-segments). **from** `string` *required* Sender email address. To include a friendly name, pass the sender as `Name `, for example `Acme `. **subject** `string` *required* Email subject. Reply-to email address. For multiple addresses, send as an array of strings. **html** `string` The HTML version of the message. You can include Contact Properties in the body of the Broadcast. Learn more about [Contact Properties](/docs/dashboard/contacts/properties). **text** `string` The plain text version of the message. You can include Contact Properties in the body of the Broadcast. Learn more about [Contact Properties](/docs/dashboard/contacts/properties). > [!NOTE] > > If not provided, the HTML will be used to generate a plain text version. You > can opt out of this behavior by setting value to an empty string. **react** `React.ReactNode` The React component used to write the message. *Only available in the Node.js SDK.* **name** `string` The friendly name of the broadcast. Only used for internal reference. Optional. Omit it to send to every subscribed contact in the segment, without checking topic preferences. **send** `boolean` Send the broadcast immediately after creation. Defaults to `false`. > [!NOTE] > > When set to `true`, the broadcast will be sent or scheduled (if `scheduled_at` is provided) without requiring a separate call to the [Send Broadcast](/docs/api-reference/broadcasts/send-broadcast) endpoint. Schedule the broadcast to be sent later. The date should be in natural language (e.g.: `in 1 min`) or ISO 8601 format (e.g: `2026-08-05T11:52:01.858Z`). > [!WARNING] > > This parameter requires `send` to be set to `true`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); // Create a draft broadcast const { data, error } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme ', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', }); // Create and send immediately const { data: sent, error: sendError } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme ', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', send: true, }); // Create and schedule const { data: scheduled, error: scheduleError } = await resend.broadcasts.create({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', from: 'Acme ', subject: 'hello world', html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', send: true, scheduledAt: 'in 1 hour', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Create a draft broadcast $resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme ', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', ]); // Create and send immediately $resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme ', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', 'send' => true, ]); // Create and schedule $resend->broadcasts->create([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', 'from' => 'Acme ', 'subject' => 'hello world', 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', 'send' => true, 'scheduled_at' => 'in 1 hour', ]); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" # Create a draft broadcast params: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme ", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", } resend.Broadcasts.create(params) # Create and send immediately params: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme ", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": True, } resend.Broadcasts.create(params) # Create and schedule params: resend.Broadcasts.CreateParams = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme ", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": True, "scheduled_at": "in 1 hour", } resend.Broadcasts.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" # Create a draft broadcast params = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme ", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", } Resend::Broadcasts.create(params) # Create and send immediately params = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme ", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true, } Resend::Broadcasts.create(params) # Create and schedule params = { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme ", "subject": "Hello, world!", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true, "scheduled_at": "in 1 hour", } Resend::Broadcasts.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") // Create a draft broadcast params := &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme ", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Subject: "Hello, world!", } client.Broadcasts.Create(params) // Create and send immediately params = &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme ", Subject: "Hello, world!", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Send: true, } client.Broadcasts.Create(params) // Create and schedule params = &resend.CreateBroadcastRequest{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", From: "Acme ", Subject: "Hello, world!", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", Send: true, ScheduledAt: "in 1 hour", } client.Broadcasts.Create(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::CreateBroadcastOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let segment_id = "78261eea-8f8b-4381-83c6-79fa7120f1cf"; let from = "Acme "; let subject = "hello world"; let html = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"; let opts = CreateBroadcastOptions::new(segment_id, from, subject).with_html(html); // Create a draft broadcast let _broadcast = resend.broadcasts.create(opts.clone()).await?; // Create and send immediately let _broadcast = resend .broadcasts .create(opts.clone().with_send(true)) .await?; // Create and schedule let _broadcast = resend .broadcasts .create(opts.with_send(true).with_scheduled_at("in 1 hour")) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.broadcasts.model.CreateBroadcastOptions; import com.resend.services.broadcasts.model.CreateBroadcastResponseSuccess; Resend resend = new Resend("re_xxxxxxxxx"); // Create a draft broadcast CreateBroadcastOptions params = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme ") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .build(); CreateBroadcastResponseSuccess data = resend.broadcasts().create(params); // Create and send immediately CreateBroadcastOptions sendParams = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme ") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .send(true) .build(); CreateBroadcastResponseSuccess sent = resend.broadcasts().create(sendParams); // Create and schedule CreateBroadcastOptions scheduleParams = CreateBroadcastOptions.builder() .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .from("Acme ") .subject("hello world") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .send(true) .scheduledAt("in 1 hour") .build(); CreateBroadcastResponseSuccess scheduled = resend.broadcasts().create(scheduleParams); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI // Create a draft broadcast var resp = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme ", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", } ); Console.WriteLine( "Broadcast Id={0}", resp.Content ); // Create and send immediately var sent = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme ", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", SendAfterAdd = true, } ); Console.WriteLine( "Broadcast Id={0}", sent.Content ); // Create and schedule var scheduled = await resend.BroadcastAddAsync( new BroadcastData() { DisplayName = "Example Broadcast", SegmentId = new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), From = "Acme ", Subject = "Hello, world!", HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", SendAfterAdd = true, MomentSchedule = DateTime.UtcNow.AddHours( 1 ), } ); Console.WriteLine( "Broadcast Id={0}", scheduled.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} # Create a draft broadcast curl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $' { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme ", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" }' # Create and send immediately curl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $' { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme ", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true }' # Create and schedule curl -X POST 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $' { "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme ", "subject": "hello world", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", "send": true, "scheduled_at": "in 1 hour" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Create a draft broadcast resend broadcasts create \ --from "Acme " \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" # Create and send immediately resend broadcasts create \ --from "Acme " \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" \ --send # Create and schedule resend broadcasts create \ --from "Acme " \ --subject "hello world" \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" \ --send \ --scheduled-at "in 1 hour" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "broadcast", "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` # Delete Broadcast Source: https://resend.com/docs/api-reference/broadcasts/delete-broadcast DELETE /broadcasts/:broadcast_id Remove an existing broadcast. You can only delete Broadcasts that have not yet been sent (i.e., `draft` or `scheduled`). Deleting a `scheduled` Broadcast also cancels the scheduled delivery and the email will not be sent. ## Path Parameters The broadcast ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.broadcasts.remove( '559ac32e-9ef5-46fb-82a1-b76b840c0f7b', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->broadcasts->remove('559ac32e-9ef5-46fb-82a1-b76b840c0f7b'); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Broadcasts.remove(id="559ac32e-9ef5-46fb-82a1-b76b840c0f7b") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Broadcasts.remove("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Broadcasts.Remove("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _deleted = resend .broadcasts .delete("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.broadcasts.model.RemoveBroadcastResponseSuccess; Resend resend = new Resend("re_xxxxxxxxx"); RemoveBroadcastResponseSuccess data = resend.broadcasts().remove("559ac32e-9ef5-46fb-82a1-b76b840c0f7b"); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.BroadcastDeleteAsync( new Guid( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/broadcasts/559ac32e-9ef5-46fb-82a1-b76b840c0f7b' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend broadcasts delete 559ac32e-9ef5-46fb-82a1-b76b840c0f7b ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "broadcast", "id": "559ac32e-9ef5-46fb-82a1-b76b840c0f7b", "deleted": true } ``` # Duplicate Broadcast Source: https://resend.com/docs/api-reference/broadcasts/duplicate-broadcast POST /broadcasts/:broadcast_id/duplicate Duplicate a broadcast. Creates a new draft broadcast with the same segment, topic, sender, subject, reply-to, preview text, and content as the source. The copy is named after the source with ` (copy)` appended, truncated to 70 characters. Any broadcast can be duplicated, including sent ones. ## Path Parameters The broadcast ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.broadcasts.duplicate( '559ac32e-9ef5-46fb-82a1-b76b840c0f7b', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->broadcasts->duplicate('559ac32e-9ef5-46fb-82a1-b76b840c0f7b'); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Broadcasts.duplicate(id="559ac32e-9ef5-46fb-82a1-b76b840c0f7b") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Broadcasts.duplicate("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Broadcasts.Duplicate("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _duplicated = resend .broadcasts .duplicate("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.broadcasts.model.DuplicateBroadcastResponseSuccess; Resend resend = new Resend("re_xxxxxxxxx"); DuplicateBroadcastResponseSuccess data = resend.broadcasts().duplicate("559ac32e-9ef5-46fb-82a1-b76b840c0f7b"); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.BroadcastDuplicateAsync( new Guid( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/broadcasts/559ac32e-9ef5-46fb-82a1-b76b840c0f7b/duplicate' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend broadcasts duplicate 559ac32e-9ef5-46fb-82a1-b76b840c0f7b ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "broadcast", "id": "1f85ae38-f5b9-4c1f-8766-667a53970fea" } ``` # Retrieve Broadcast Source: https://resend.com/docs/api-reference/broadcasts/get-broadcast GET /broadcasts/:broadcast_id Retrieve a single broadcast. You can retrieve broadcasts created via both this API and the Resend dashboard. ## Path Parameters The broadcast ID. > [!NOTE] > > See all available `status` types in [the Broadcasts > overview](/docs/dashboard/broadcasts/manage-broadcasts#understand-broadcast-statuses). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.broadcasts.get( '559ac32e-9ef5-46fb-82a1-b76b840c0f7b', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->broadcasts->get('559ac32e-9ef5-46fb-82a1-b76b840c0f7b'); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Broadcasts.get(id="559ac32e-9ef5-46fb-82a1-b76b840c0f7b") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Broadcasts.get("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Broadcasts.Get("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _broadcast = resend .broadcasts .get("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.broadcasts.model.GetBroadcastResponseSuccess; Resend resend = new Resend("re_xxxxxxxxx"); GetBroadcastResponseSuccess data = resend.broadcasts().get("559ac32e-9ef5-46fb-82a1-b76b840c0f7b"); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.BroadcastRetrieveAsync( new Guid( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b" ) ); Console.WriteLine( "Broadcast name={0}", resp.Content.DisplayName ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/broadcasts/559ac32e-9ef5-46fb-82a1-b76b840c0f7b' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend broadcasts get 559ac32e-9ef5-46fb-82a1-b76b840c0f7b ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "broadcast", "id": "559ac32e-9ef5-46fb-82a1-b76b840c0f7b", "name": "Announcements", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", // now called segment_id "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "from": "Acme ", "subject": "hello world", "reply_to": null, "preview_text": "Check out our latest announcements", "html": "

Hello {{{contact.first_name|there}}}!

", "text": "Hello {{{contact.first_name|there}}}!", "status": "draft", "created_at": "2026-12-01 19:32:22.980+00", "scheduled_at": null, "sent_at": null, "topic_id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" } ``` # List Clicked Links Source: https://resend.com/docs/api-reference/broadcasts/list-broadcast-clicked-links GET /broadcasts/:broadcast_id/clicked-links Retrieve the links clicked in a broadcast. Retrieve every link clicked in a broadcast, ranked by total clicks. Results are paginated with cursors. See [Pagination](/docs/api-reference/pagination) for how `after` and `before` work. > [!NOTE] > > Responses are cached for up to 15 minutes, so requesting the same page again > may return slightly stale data within that window. ## Path Parameters The broadcast ID. ## Query Parameters Number of links to return. Between `1` and `100`. Defaults to `20`. Cursor to fetch the page after this link. Cannot be used with `before`. Cursor to fetch the page before this link. Cannot be used with `after`. ## Response Fields **object** `string` Always `list`. **has\_more** `boolean` Whether more links exist beyond this page. **data** `array` The clicked links, ordered by total clicks, descending. **properties** **id** `string` An opaque cursor for this row, used only for pagination. It does not identify any entity in Resend. **url** `string` The URL that was clicked. **clicks** `number` Total clicks on this link, including repeat clicks by the same recipient. **unique\_clicks** `number` The number of distinct recipients who clicked this link. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.broadcasts.clickedLinks( '559ac32e-9ef5-46fb-82a1-b76b840c0f7b', { limit: 20 }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->broadcasts->clickedLinks->list('559ac32e-9ef5-46fb-82a1-b76b840c0f7b',[ 'limit' => 20 ]); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Broadcasts.clicked_links( id="559ac32e-9ef5-46fb-82a1-b76b840c0f7b", params={"limit": 20}, ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Broadcasts.clicked_links("559ac32e-9ef5-46fb-82a1-b76b840c0f7b", { limit: 20 }) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Broadcasts.ClickedLinks("559ac32e-9ef5-46fb-82a1-b76b840c0f7b") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _links = resend .broadcasts .clicked_links("559ac32e-9ef5-46fb-82a1-b76b840c0f7b", ListOptions::default()) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.broadcasts.model.ListBroadcastClickedLinksResponseSuccess; Resend resend = new Resend("re_xxxxxxxxx"); ListBroadcastClickedLinksResponseSuccess data = resend.broadcasts().clickedLinks("559ac32e-9ef5-46fb-82a1-b76b840c0f7b"); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.BroadcastClickedLinksAsync( new Guid( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b" ) ); Console.WriteLine( "Nr Links={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/broadcasts/559ac32e-9ef5-46fb-82a1-b76b840c0f7b/clicked-links?limit=20' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend broadcasts clicked-links 559ac32e-9ef5-46fb-82a1-b76b840c0f7b --limit 20 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": true, "data": [ { "id": "b2Zmc2V0OjA", "url": "https://resend.com/pricing", "clicks": 42, "unique_clicks": 30 }, { "id": "b2Zmc2V0OjE", "url": "https://resend.com/docs", "clicks": 17, "unique_clicks": 15 } ] } ``` # List Recipients Source: https://resend.com/docs/api-reference/broadcasts/list-broadcast-recipients GET /broadcasts/:broadcast_id/recipients Retrieve the recipients of a broadcast for a given event type. Retrieve the recipients of a broadcast, filtered by a single event `type` (for example everyone who `opened`, `clicked`, or `bounced`). Results are paginated with cursors. See [Pagination](/docs/api-reference/pagination) for how `after` and `before` work. > [!NOTE] > > Responses are cached for up to 15 minutes, so requesting the same page again > may return slightly stale data within that window. ## Path Parameters The broadcast ID. ## Query Parameters The event to filter recipients by. One of `sent`, `delivered`, `opened`, `clicked`, `bounced`, `complained`, `unsubscribed`, or `suppressed`. Number of recipients to return. Between `1` and `100`. Defaults to `20`. Cursor to fetch the page after this recipient. Cannot be used with `before`. Cursor to fetch the page before this recipient. Cannot be used with `after`. Filter recipients whose email contains this value. Filter by bounce classification. One of `permanent`, `transient`, or `undetermined`. Can only be used with `type=bounced`. ## Response Fields **object** `string` Always `list`. **has\_more** `boolean` Whether more recipients exist beyond this page. **data** `array` The recipients matching the requested `type`. **properties** **id** `string` An opaque cursor for this row, used only for pagination. It does not identify any entity in Resend. Use `contact_id` to reference the contact. **contact\_id** `string | null` The matching contact's ID. `null` when the recipient's email no longer maps to a contact. **email** `string` The recipient's email address. **count** `number` How many times the recipient triggered the event. Only returned for `type=opened` and `type=clicked`. **bounce\_type** `string | null` The bounce classification: `permanent`, `transient`, or `undetermined`. Only returned for `type=bounced`. **clicked\_links** `array` The links this recipient clicked. Only returned for `type=clicked`. **properties** **url** `string` The URL that was clicked. **clicks** `number` How many times the recipient clicked this link. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.broadcasts.recipients( '559ac32e-9ef5-46fb-82a1-b76b840c0f7b', { type: 'clicked', limit: 20 }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->broadcasts->recipients('559ac32e-9ef5-46fb-82a1-b76b840c0f7b', [ 'type' => 'clicked', 'limit' => 20 ]); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Broadcasts.recipients( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b", {"type": "clicked", "limit": 20} ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Broadcasts.recipients( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b", { type: "clicked", limit: 20 }, ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") limit := 20 client.Broadcasts.Recipients("559ac32e-9ef5-46fb-82a1-b76b840c0f7b", &resend.ListBroadcastRecipientsOptions{ Type: resend.BroadcastRecipientEventTypeClicked, Limit: &limit, }) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::{BroadcastRecipientEventType, ListRecipientsOptions}, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let list_opts = ListRecipientsOptions::new(BroadcastRecipientEventType::Clicked).with_limit(20); let _recipients = resend .broadcasts .recipients("559ac32e-9ef5-46fb-82a1-b76b840c0f7b", list_opts) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.broadcasts.model.BroadcastRecipientEventType; import com.resend.services.broadcasts.model.ListBroadcastRecipientsParams; import com.resend.services.broadcasts.model.ListBroadcastRecipientsResponseSuccess; Resend resend = new Resend("re_xxxxxxxxx"); ListBroadcastRecipientsResponseSuccess data = resend.broadcasts().recipients( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b", ListBroadcastRecipientsParams.builder() .type(BroadcastRecipientEventType.CLICKED) .limit(20) .build()); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.BroadcastListRecipientsAsync( new Guid( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b" ), BroadcastRecipientEventType.Clicked, new BroadcastListRecipientsQuery() { Limit = 20 } ); Console.WriteLine( "Recipients={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/broadcasts/559ac32e-9ef5-46fb-82a1-b76b840c0f7b/recipients?type=clicked&limit=20' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend broadcasts recipients 559ac32e-9ef5-46fb-82a1-b76b840c0f7b --type clicked --limit 20 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": true, "data": [ { "id": "b2Zmc2V0OjA", "contact_id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "email": "carter@example.com", "count": 3, "clicked_links": [ { "url": "https://resend.com/pricing", "clicks": 2 }, { "url": "https://resend.com/docs", "clicks": 1 } ] }, { "id": "b2Zmc2V0OjE", "contact_id": null, "email": "dana@example.com", "count": 1, "clicked_links": [{ "url": "https://resend.com/pricing", "clicks": 1 }] } ] } ``` # List Broadcasts Source: https://resend.com/docs/api-reference/broadcasts/list-broadcasts GET /broadcasts Retrieve a list of broadcast. > [!NOTE] > > See all available `status` types in [the Broadcasts > overview](/docs/dashboard/broadcasts/manage-broadcasts#understand-broadcast-statuses). ## Query Parameters If `limit` is not provided, all broadcasts will be returned in a single response. Pass `limit` to paginate. `after` and `before` only take effect together with `limit`. **limit** `number` Number of broadcasts to retrieve.
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more broadcasts (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more broadcasts (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.broadcasts.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->broadcasts->list(); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Broadcasts.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Broadcasts.list() ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Broadcasts.List() } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _broadcasts = resend.broadcasts.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.broadcasts.model.ListBroadcastsResponseSuccess; Resend resend = new Resend("re_xxxxxxxxx"); ListBroadcastsResponseSuccess data = resend.broadcasts().list(); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.BroadcastListAsync(); Console.WriteLine( "Nr Broadcasts={0}", resp.Content.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/broadcasts' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend broadcasts list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "name": "Announcements", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", // now called segment_id "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "status": "draft", "created_at": "2026-11-01 15:13:31.723+00", "scheduled_at": null, "sent_at": null }, { "id": "559ac32e-9ef5-46fb-82a1-b76b840c0f7b", "name": "Black Friday", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", // now called segment_id "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "status": "sent", "created_at": "2026-12-01 19:32:22.980+00", "scheduled_at": "2026-12-02 19:32:22.980+00", "sent_at": "2026-12-02 19:32:22.980+00" } ] } ``` # Send Broadcast Source: https://resend.com/docs/api-reference/broadcasts/send-broadcast POST /broadcasts/:broadcast_id/send Start sending broadcasts to your audience through the Resend API. > [!NOTE] > > You can send broadcasts only if they were created via the API. ## Path Parameters The broadcast ID. ## Body Parameters Schedule email to be sent later. The date should be in natural language (e.g.: `in 1 min`) or ISO 8601 format (e.g: `2026-08-05T11:52:01.858Z`). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.broadcasts.send( '559ac32e-9ef5-46fb-82a1-b76b840c0f7b', { scheduledAt: 'in 1 min', }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->broadcasts->send('559ac32e-9ef5-46fb-82a1-b76b840c0f7b', [ 'scheduled_at' => 'in 1 min', ]); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Broadcasts.SendParams = { "broadcast_id": "559ac32e-9ef5-46fb-82a1-b76b840c0f7b", "scheduled_at": "in 1 min" } resend.Broadcasts.send(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { broadcast_id: "559ac32e-9ef5-46fb-82a1-b76b840c0f7b", scheduled_at: "in 1 min" } Resend::Broadcasts.send(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") sendParams := &resend.SendBroadcastRequest{ BroadcastId: "559ac32e-9ef5-46fb-82a1-b76b840c0f7b", ScheduledAt: "in 1 min", } client.Broadcasts.Send(sendParams) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::SendBroadcastOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = SendBroadcastOptions::new("559ac32e-9ef5-46fb-82a1-b76b840c0f7b").with_scheduled_at("in 1 min"); let _broadcast = resend.broadcasts.send(opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.broadcasts.model.SendBroadcastOptions; import com.resend.services.broadcasts.model.SendBroadcastResponseSuccess; Resend resend = new Resend("re_xxxxxxxxx"); SendBroadcastOptions params = SendBroadcastOptions.builder() .scheduledAt("in 1 min") .build(); SendBroadcastResponseSuccess data = resend.broadcasts().send(params, "498ee8e4-7aa2-4eb5-9f04-4194848049d1"); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI // Send now await resend.BroadcastSendAsync( new Guid( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b" ) ); // Send in 5 mins await resend.BroadcastScheduleAsync( new Guid( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b" ), DateTime.UtcNow.AddMinutes( 5 ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/broadcasts/559ac32e-9ef5-46fb-82a1-b76b840c0f7b/send' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "scheduled_at": "in 1 min" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend broadcasts send 559ac32e-9ef5-46fb-82a1-b76b840c0f7b --scheduled-at "in 1 min" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` # Update Broadcast Source: https://resend.com/docs/api-reference/broadcasts/update-broadcast PATCH /broadcasts/:broadcast_id Update a broadcast to send to your contacts. ## Path Parameters The ID of the broadcast you want to update. ## Body Parameters The ID of the segment you want to send to. > [!NOTE] > > Audiences are now called Segments. Follow the [Migration > Guide](/docs/dashboard/segments/migrating-from-audiences-to-segments). **from** `string` Sender email address. To include a friendly name, use the format `"Your Name "`. **subject** `string` Email subject. Reply-to email address. For multiple addresses, send as an array of strings. **html** `string` The HTML version of the message. **text** `string` The plain text version of the message. > [!NOTE] > > If not provided, the HTML will be used to generate a plain text version. You > can opt out of this behavior by setting value to an empty string. **react** `React.ReactNode` The React component used to write the message. *Only available in the Node.js SDK.* **name** `string` The friendly name of the broadcast. Only used for internal reference. The topic ID that the broadcast will be scoped to. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.broadcasts.update( '49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', { html: 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->broadcasts->update('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', [ 'html' => 'Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}', ]); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Broadcasts.UpdateParams = { "broadcast_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" } resend.Broadcasts.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { "broadcast_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", } Resend::Broadcasts.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.UpdateBroadcastRequest{ BroadcastId: "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", Html: "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", } client.Broadcasts.Update(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::UpdateBroadcastOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let id = "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"; let html = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}"; let opts = UpdateBroadcastOptions::new().with_html(html); let _broadcast = resend.broadcasts.update(id, opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.broadcasts.model.UpdateBroadcastOptions; import com.resend.services.broadcasts.model.UpdateBroadcastResponseSuccess; Resend resend = new Resend("re_xxxxxxxxx"); UpdateBroadcastOptions params = UpdateBroadcastOptions.builder() .id("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") .html("Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}") .build(); UpdateBroadcastResponseSuccess data = resend.broadcasts().update(params); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.BroadcastUpdateAsync( new Guid( "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" ), new BroadcastUpdateData() { HtmlBody = "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}", } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/broadcasts/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "html": "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend broadcasts update 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 \ --html "Hi {{{contact.first_name|there}}}, you can unsubscribe here: {{{RESEND_UNSUBSCRIBE_URL}}}" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "broadcast", "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` # Create Contact Property Source: https://resend.com/docs/api-reference/contact-properties/create-contact-property POST /contact-properties Create a custom property for your contacts. ## Body Parameters The property key. Max length is `50` characters. Only alphanumeric characters and underscores are allowed. The property type. Possible values: `string` or `number`. The default value to use when the property is not set for a contact. Must match the type specified in the `type` field. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contactProperties.create({ key: 'company_name', type: 'string', fallbackValue: 'Acme Corp', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contactProperties->create([ 'key' => 'company_name', 'type' => 'string', 'fallback_value' => 'Acme Corp', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' params: resend.ContactProperties.CreateParams = { "key": "company_name", "type": "string", "fallback_value": "Acme Corp", } contact_property = resend.ContactProperties.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" property = Resend::ContactProperties.create({ key: "company_name", type: "string", fallback_value: "Acme Corp" }) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateContactPropertyRequest{ Key: "company_name", Type: "string", FallbackValue: "Acme Corp", } property, err := client.ContactProperties.CreateWithContext(ctx, params) if err != nil { panic(err) } fmt.Println(property) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{CreateContactPropertyOptions, PropertyType}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let contact_property = CreateContactPropertyOptions::new("company_name", PropertyType::String) .with_fallback("Acme Corp"); let _contact_property = resend.contacts.create_property(contact_property).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contactproperties.model.CreateContactPropertyOptions; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateContactPropertyOptions options = CreateContactPropertyOptions.builder() .key("company_name") .type("string") .fallbackValue("Acme Corp") .build(); resend.contactProperties().create(options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ContactPropCreateAsync( new ContactPropertyData() { Key = "company_name", PropertyType = ContactPropertyType.String, DefaultValue = "Acme Corp", } ); Console.WriteLine( "Prop Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/contact-properties' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "key": "company_name", "type": "string", "fallback_value": "Acme Corp" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contact-properties create \ --key company_name \ --type string \ --fallback-value "Acme Corp" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact_property", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" } ``` # Delete Contact Property Source: https://resend.com/docs/api-reference/contact-properties/delete-contact-property DELETE /contact-properties/:contact_property_id Remove an existing contact property. ## Path Parameters The Contact Property ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contactProperties.remove( 'b6d24b8e-af0b-4c3c-be0c-359bbd97381e', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contactProperties->remove('b6d24b8e-af0b-4c3c-be0c-359bbd97381'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' contact_property = resend.ContactProperties.remove('b6d24b8e-af0b-4c3c-be0c-359bbd97381e') ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::ContactProperties.remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") property, err := client.ContactProperties.RemoveWithContext(ctx, "b6d24b8e-af0b-4c3c-be0c-359bbd97381e") if err != nil { panic(err) } fmt.Println(property) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _deleted = resend .contacts .delete_property("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); resend.contactProperties().remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ContactPropDeleteAsync( new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contact-properties delete b6d24b8e-af0b-4c3c-be0c-359bbd97381e --yes ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact_property", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "deleted": true } ``` # Retrieve Contact Property Source: https://resend.com/docs/api-reference/contact-properties/get-contact-property GET /contact-properties/:contact_property_id Retrieve a contact property by its ID. ## Path Parameters The Contact Property ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contactProperties.get( 'b6d24b8e-af0b-4c3c-be0c-359bbd97381e', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contactProperties->get('b6d24b8e-af0b-4c3c-be0c-359bbd97381'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' contact_property = resend.ContactProperties.get('b6d24b8e-af0b-4c3c-be0c-359bbd97381e') ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" property = Resend::ContactProperties.get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") property, err := client.ContactProperties.GetWithContext(ctx, "b6d24b8e-af0b-4c3c-be0c-359bbd97381e") if err != nil { panic(err) } fmt.Println(property) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _property = resend .contacts .get_property("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); resend.contactProperties().get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ContactPropRetrieveAsync( new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ) ); Console.WriteLine( "Prop Id={0}", resp.Content.Id ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contact-properties get b6d24b8e-af0b-4c3c-be0c-359bbd97381e ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact_property", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "key": "company_name", "type": "string", "fallback_value": "Acme Corp", "created_at": "2026-04-08 00:11:13.110779+00" } ``` # List Contact Properties Source: https://resend.com/docs/api-reference/contact-properties/list-contact-properties GET /contact-properties Retrieve a list of contact properties. ## Query Parameters **limit** `number` Number of contact-properties to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more contact-properties (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more contact-properties (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contactProperties.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contactProperties->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' contact_properties = resend.ContactProperties.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" properties = Resend::ContactProperties.list ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") properties, err := client.ContactProperties.ListWithContext(ctx) if err != nil { panic(err) } fmt.Println(properties) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _contact_properties = resend .contacts .list_properties(ListOptions::default()) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); resend.contactProperties().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ContactPropListAsync(); Console.WriteLine( "Nr Props={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/contact-properties' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contact-properties list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "key": "company_name", "type": "string", "fallback_value": "Acme Corp", "created_at": "2026-04-08 00:11:13.110779+00" } ] } ``` # Update Contact Property Source: https://resend.com/docs/api-reference/contact-properties/update-contact-property PATCH /contact-properties/:contact_property_id Update an existing contact property. ## Path Parameters The Contact Property ID. > [!NOTE] > > The `key` and `type` fields cannot be changed after creation. This preserves > data integrity for existing contact values. ## Body Parameters The default value to use when the property is not set for a contact. Must match the type of the property. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contactProperties.update({ id: 'b6d24b8e-af0b-4c3c-be0c-359bbd97381e', fallbackValue: 'Example Company', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contactProperties->update('b6d24b8e-af0b-4c3c-be0c-359bbd97381', [ 'fallback_value' => 'Example Company', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' params: resend.ContactProperties.UpdateParams = { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "fallback_value": "Example Company", } contact_property = resend.ContactProperties.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" property = Resend::ContactProperties.update({ id: "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", fallback_value: "Example Company" }) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") params := &resend.UpdateContactPropertyRequest{ Id: "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", FallbackValue: "Example Company", } property, err := client.ContactProperties.UpdateWithContext(ctx, params) if err != nil { panic(err) } fmt.Println(property) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::ContactPropertyChanges, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let update = ContactPropertyChanges::default().with_fallback("Example Company"); let _contact_property = resend .contacts .update_property("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", update) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contactproperties.model.UpdateContactPropertyOptions; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateContactPropertyOptions options = UpdateContactPropertyOptions.builder() .id("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") .fallbackValue("Example Company") .build(); resend.contactProperties().update(options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ContactPropUpdateAsync( new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ), new ContactPropertyUpdateData() { DefaultValue = "Example Company", } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "fallback_value": "Example Company" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contact-properties update b6d24b8e-af0b-4c3c-be0c-359bbd97381e \ --fallback-value "Example Company" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact_property", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" } ``` # Add Contact to Segment Source: https://resend.com/docs/api-reference/contacts/add-contact-to-segment POST /contacts/:contact_id/segments/:segment_id Add an existing contact to a segment. ## Path Parameters Either `id` or `email` must be provided. **id** `string` The Contact ID. **email** `string` The Contact Email. The Segment ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.segments.add({ contactId: 'e169aa45-1ecf-4183-9955-b1499d5701d3', // or: email: 'steve.wozniak@gmail.com', segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Add by contact id $resend->contacts->segments->add( contact: 'e169aa45-1ecf-4183-9955-b1499d5701d3', segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf' ); // Add by contact email $resend->contacts->segments->add( contact: 'steve.wozniak@gmail.com', segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' # Add by contact id params: resend.Contacts.Segments.AddParams = { "segment_id": '78261eea-8f8b-4381-83c6-79fa7120f1cf', "contact_id": 'e169aa45-1ecf-4183-9955-b1499d5701d3', } response = resend.Contacts.Segments.add(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' # Add by contact id result = Resend::Contacts::Segments.add( contact_id: 'e169aa45-1ecf-4183-9955-b1499d5701d3', segment_id: '78261eea-8f8b-4381-83c6-79fa7120f1cf' ) # Add by contact email result = Resend::Contacts::Segments.add( email: 'steve.wozniak@gmail.com', segment_id: '78261eea-8f8b-4381-83c6-79fa7120f1cf' ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") // Add by contact id addParams := &resend.AddContactSegmentRequest{ ContactId: "e169aa45-1ecf-4183-9955-b1499d5701d3", SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", } response, err := client.Contacts.Segments.AddWithContext(ctx, addParams) if err != nil { panic(err) } fmt.Println(response) // Add by contact email addByEmailParams := &resend.AddContactSegmentRequest{ Email: "steve.wozniak@gmail.com", SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", } response, err = client.Contacts.Segments.AddWithContext(ctx, addByEmailParams) if err != nil { panic(err) } fmt.Println(response) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); // Update by contact id let _contact = resend .contacts .add_contact_segment( "e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf", ) .await?; // // Update by contact email let _contact = resend .contacts .add_contact_segment( "steve.wozniak@gmail.com", "78261eea-8f8b-4381-83c6-79fa7120f1cf", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contacts.model.AddContactToSegmentOptions; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); // Add by contact id AddContactToSegmentOptions optionsById = AddContactToSegmentOptions.builder() .id("e169aa45-1ecf-4183-9955-b1499d5701d3") .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .build(); resend.contacts().segments().add(optionsById); // Add by contact email AddContactToSegmentOptions optionsByEmail = AddContactToSegmentOptions.builder() .email("steve.wozniak@gmail.com") .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .build(); resend.contacts().segments().add(optionsByEmail); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.ContactAddToSegmentAsync( contactId: new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" ), segmentId: new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} // Update by contact id curl -X POST 'https://api.resend.com/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf' \ -H 'Authorization: Bearer re_xxxxxxxxx' // Update by contact email curl -X POST 'https://api.resend.com/contacts/steve.wozniak@gmail.com/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Add by contact id resend contacts add-segment e169aa45-1ecf-4183-9955-b1499d5701d3 \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf # Add by contact email resend contacts add-segment steve.wozniak@gmail.com \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf" } ``` # Create Contact Source: https://resend.com/docs/api-reference/contacts/create-contact POST /contacts Create a contact. ## Body Parameters **email** `string` *required* The email address of the contact. The first name of the contact. The last name of the contact. **unsubscribed** `boolean` The Contact's global subscription status. If set to `true`, the contact will be unsubscribed from all Broadcasts. **properties** `object` A map of custom property keys and values to create. **custom properties** **key** `string` *required* The property key. **value** `string` *required* The property value. **segments** `array` Array of objects. Each object must contain the ID of the segment that you'd like to add the contact to. **segments** **id** `string` *required* The segment ID. **topics** `array` Array of topic subscriptions for the contact. **topics** **id** `string` *required* The topic ID. **subscription** `'opt_in' | 'opt_out'` *required* The subscription status for this topic. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.create({ email: 'steve.wozniak@gmail.com', firstName: 'Steve', lastName: 'Wozniak', unsubscribed: false, }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contacts->create( parameters: [ 'email' => 'steve.wozniak@gmail.com', 'first_name' => 'Steve', 'last_name' => 'Wozniak', 'unsubscribed' => false ] ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Contacts.CreateParams = { "email": "steve.wozniak@gmail.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": False, } resend.Contacts.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { "email": "steve.wozniak@gmail.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false, } Resend::Contacts.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateContactRequest{ Email: "steve.wozniak@gmail.com", FirstName: "Steve", LastName: "Wozniak", Unsubscribed: false, } client.Contacts.Create(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::CreateContactOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let contact = CreateContactOptions::new("steve.wozniak@gmail.com") .with_first_name("Steve") .with_last_name("Wozniak") .with_unsubscribed(false); let _contact = resend.contacts.create(contact).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contacts.model.CreateContactOptions; import com.resend.services.contacts.model.CreateContactResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateContactOptions params = CreateContactOptions.builder() .email("steve.wozniak@gmail.com") .firstName("Steve") .lastName("Wozniak") .unsubscribed(false) .build(); CreateContactResponseSuccess data = resend.contacts().create(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ContactAddAsync( new ContactData() { Email = "steve.wozniak@gmail.com", FirstName = "Steve", LastName = "Wozniak", IsUnsubscribed = false, } ); Console.WriteLine( "Contact Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/contacts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "email": "steve.wozniak@gmail.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contacts create \ --email steve.wozniak@gmail.com \ --first-name Steve \ --last-name Wozniak ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact", "id": "479e3145-dd38-476b-932c-529ceb705947" } ``` # Create Contact Import Source: https://resend.com/docs/api-reference/contacts/create-contact-import POST /contacts/imports Create a contact import. ## Body Parameters This endpoint accepts `multipart/form-data`. Object and array fields (`column_map`, `segments`, `topics`) must be sent as JSON-encoded strings. **file** `file` *required* The CSV file to import. The file must be sent as a form field named `file`. Maximum file size is 200MB. **column\_map** `object` Maps CSV columns to contact fields. **column\_map** **email** `string` The CSV column that contains contact email addresses. **first\_name** `string` The CSV column that contains contact first names. **last\_name** `string` The CSV column that contains contact last names. **unsubscribed** `string` The CSV column that contains the contact's global subscription status. **properties** `object` A map of custom property keys to CSV columns. **properties** **key** `object` The custom property key. **property mapping** **column** `string` *required* The CSV column that contains the custom property value. **type** `'string' | 'number' | 'boolean'` The custom property value type. Defaults to `string`. **on\_conflict** `'upsert' | 'skip'` How to handle contacts that already exist. Defaults to `upsert`. **segments** `array` Array of objects. Each object must contain the ID of the segment that you'd like to add the imported contacts to. **segments** **id** `string` *required* The segment UUID. **topics** `array` Array of topic subscriptions for imported contacts. **topics** **id** `string` *required* The Topic UUID. **subscription** `'opt_in' | 'opt_out'` *required* The subscription status for this topic. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { readFile } from 'node:fs/promises'; import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const file = new Blob([await readFile('contacts.csv')], { type: 'text/csv', }); const { data, error } = await resend.contacts.imports.create({ file, columnMap: { email: 'Email', firstName: 'First Name', lastName: 'Last Name', properties: { plan: { column: 'Plan', type: 'string', }, }, }, onConflict: 'upsert', segments: [{ id: '78e7a5c6-9a91-4c63-9d1f-3b9c0b5b9ab6' }], topics: [ { id: '059ac693-2fc8-4c13-8b27-01350d638a17', subscription: 'opt_in', }, ], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $file = fopen('contacts.csv', 'r'); $resend->contacts->imports->create([ 'file' => $file, 'column_map' => [ 'email' => 'Email', 'first_name' => 'First Name', 'last_name' => 'Last Name', 'properties' => [ 'plan' => [ 'column' => 'Plan', 'type' => 'string', ], ], ], 'on_conflict' => 'upsert', 'segments' => [['id' => '78e7a5c6-9a91-4c63-9d1f-3b9c0b5b9ab6']], 'topics' => [ [ 'id' => '059ac693-2fc8-4c13-8b27-01350d638a17', 'subscription' => 'opt_in', ], ], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" with open("contacts.csv", "rb") as f: file_content = f.read() params: resend.Contacts.Imports.CreateParams = { "file": file_content, "column_map": { "email": "Email", "first_name": "First Name", "last_name": "Last Name", "properties": { "plan": { "column": "Plan", "type": "string", }, }, }, "on_conflict": "upsert", "segments": [{"id": "78e7a5c6-9a91-4c63-9d1f-3b9c0b5b9ab6"}], "topics": [ { "id": "059ac693-2fc8-4c13-8b27-01350d638a17", "subscription": "opt_in", }, ], } resend.Contacts.Imports.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { file: File.read("contacts.csv"), column_map: { "email" => "Email", "first_name" => "First Name", "last_name" => "Last Name", "properties" => { "plan" => { "column" => "Plan", "type" => "string" } } }, on_conflict: "upsert", segments: [{ id: "78e7a5c6-9a91-4c63-9d1f-3b9c0b5b9ab6" }], topics: [ { id: "059ac693-2fc8-4c13-8b27-01350d638a17", subscription: "opt_in" } ] } Resend::Contacts::Imports.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "os" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") file, err := os.ReadFile("contacts.csv") if err != nil { panic(err) } params := &resend.CreateContactImportRequest{ File: file, Filename: "contacts.csv", OnConflict: "upsert", ColumnMap: map[string]any{ "email": "Email", "first_name": "First Name", "last_name": "Last Name", "properties": map[string]any{ "plan": map[string]any{ "column": "Plan", "type": "string", }, }, }, Segments: []resend.ContactImportSegment{{Id: "78e7a5c6-9a91-4c63-9d1f-3b9c0b5b9ab6"}}, Topics: []resend.TopicSubscriptionUpdate{ {Id: "059ac693-2fc8-4c13-8b27-01350d638a17", Subscription: "opt_in"}, }, } client.Contacts.Imports.Create(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use std::fs::File; use resend_rs::{ Resend, Result, types::{ ContactImportColumnMap, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportTopic, ContactImportTopicSubscription, CreateContactImportOptions, }, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let file = File::open("contacts.csv").unwrap(); let contact_import = CreateContactImportOptions::new() .with_column_map( ContactImportColumnMap::new() .with_email("Email") .with_first_name("First Name") .with_last_name("Last Name") .with_property( "plan", ContactImportPropertyMapping { column: "Plan".to_owned(), r#type: ContactImportPropertyType::String, }, ), ) .with_on_conflict(ContactImportOnConflict::Upsert) .with_segment("78e7a5c6-9a91-4c63-9d1f-3b9c0b5b9ab6") .with_topic(ContactImportTopic { id: "059ac693-2fc8-4c13-8b27-01350d638a17".to_owned(), subscription: ContactImportTopicSubscription::OptIn, }); let _data = resend.contacts.create_import(file, contact_import).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.contacts.model.*; import java.io.File; public class Main { public static void main(String[] args) throws Exception { Resend resend = new Resend("re_xxxxxxxxx"); ContactImportColumnMap columnMap = ContactImportColumnMap.builder() .email("Email") .firstName("First Name") .lastName("Last Name") .property("plan", ContactImportPropertyMapping.builder() .column("Plan") .type("string") .build()) .build(); CreateContactImportOptions params = CreateContactImportOptions.builder() .file(new File("contacts.csv")) .columnMap(columnMap) .onConflict("upsert") .segments(new ContactImportSegmentReference("78e7a5c6-9a91-4c63-9d1f-3b9c0b5b9ab6")) .topics(ContactImportTopicSubscription.builder() .id("059ac693-2fc8-4c13-8b27-01350d638a17") .subscription("opt_in") .build()) .build(); CreateContactImportResponseSuccess data = resend.contacts().imports().create(params); } } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/contacts/imports' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -F 'file=@contacts.csv;type=text/csv' \ -F 'column_map={"email":"Email","first_name":"First Name","last_name":"Last Name","properties":{"plan":{"column":"Plan","type":"string"}}}' \ -F 'on_conflict=upsert' \ -F 'segments=[{"id":"78e7a5c6-9a91-4c63-9d1f-3b9c0b5b9ab6"}]' \ -F 'topics=[{"id":"059ac693-2fc8-4c13-8b27-01350d638a17","subscription":"opt_in"}]' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contacts imports create \ --file contacts.csv \ --column-map '{"email":"Email","firstName":"First Name","lastName":"Last Name","properties":{"plan":{"column":"Plan","type":"string"}}}' \ --on-conflict upsert \ --segment-id 78e7a5c6-9a91-4c63-9d1f-3b9c0b5b9ab6 \ --topics '[{"id":"059ac693-2fc8-4c13-8b27-01350d638a17","subscription":"opt_in"}]' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact_import", "id": "479e3145-dd38-476b-932c-529ceb705947" } ``` # Delete Contact Source: https://resend.com/docs/api-reference/contacts/delete-contact DELETE /contacts/:contact_id Remove an existing contact. ## Path Parameters Either `id` or `email` must be provided. **id** `string` The Contact ID. **email** `string` The Contact email. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.remove({ id: '520784e2-887d-4c25-b53c-4ad46ad38100', // or: email: 'acme@example.com', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Delete by contact id $resend->contacts->remove( idOrEmail: '520784e2-887d-4c25-b53c-4ad46ad38100' ); // Delete by contact email $resend->contacts->remove( idOrEmail: 'acme@example.com' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" # Delete by contact id resend.Contacts.remove( id="520784e2-887d-4c25-b53c-4ad46ad38100" ) # Delete by contact email resend.Contacts.remove( email="acme@example.com" ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" # Delete by contact id Resend::Contacts.remove( id: "520784e2-887d-4c25-b53c-4ad46ad38100" ) # Delete by contact email Resend::Contacts.remove( email: "acme@example.com" ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") // Delete by contact id client.Contacts.Remove(&resend.RemoveContactOptions{ Id: "520784e2-887d-4c25-b53c-4ad46ad38100", }) // Delete by contact email client.Contacts.Remove(&resend.RemoveContactOptions{ Id: "acme@example.com", }) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); // Delete by contact id let _deleted = resend .contacts .delete("520784e2-887d-4c25-b53c-4ad46ad38100") .await?; // Delete by contact email let _deleted = resend .contacts .delete("acme@example.com") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contacts.model.RemoveContactOptions; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); // Delete by contact id resend.contacts().remove(RemoveContactOptions.builder() .id("520784e2-887d-4c25-b53c-4ad46ad38100") .build()); // Delete by contact email resend.contacts().remove(RemoveContactOptions.builder() .email("acme@example.com") .build()); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI // By Id await resend.ContactDeleteAsync( contactId: new Guid( "520784e2-887d-4c25-b53c-4ad46ad38100" ) ); // By Email await resend.ContactDeleteByEmailAsync( "acme@example.com" ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} # Delete by contact id curl -X DELETE 'https://api.resend.com/contacts/520784e2-887d-4c25-b53c-4ad46ad38100' \ -H 'Authorization: Bearer re_xxxxxxxxx' # Deleted by contact email curl -X DELETE 'https://api.resend.com/contacts/acme@example.com' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Delete by contact id resend contacts delete 520784e2-887d-4c25-b53c-4ad46ad38100 # Delete by contact email resend contacts delete acme@example.com ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact", "contact": "520784e2-887d-4c25-b53c-4ad46ad38100", "deleted": true } ``` # Delete Contact Segment Source: https://resend.com/docs/api-reference/contacts/delete-contact-segment DELETE /contacts/:contact_id/segments/:segment_id Remove an existing contact from a segment. ## Path Parameters Either `id` or `email` must be provided. **id** `string` The Contact ID. **email** `string` The Contact Email. The Segment ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.segments.remove({ contactId: 'e169aa45-1ecf-4183-9955-b1499d5701d3', // or: email: 'steve.wozniak@gmail.com', segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Remove by contact id $resend->contacts->segments->remove( contact: 'e169aa45-1ecf-4183-9955-b1499d5701d3', segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf' ); // Remove by contact email $resend->contacts->segments->remove( contact: 'steve.wozniak@gmail.com', segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' # Remove by contact id params: resend.Contacts.Segments.RemoveParams = { "segment_id": '78261eea-8f8b-4381-83c6-79fa7120f1cf', "contact_id": 'e169aa45-1ecf-4183-9955-b1499d5701d3', } response = resend.Contacts.Segments.remove(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' # Remove by contact id removed = Resend::Contacts::Segments.remove( contact_id: 'e169aa45-1ecf-4183-9955-b1499d5701d3', segment_id: '78261eea-8f8b-4381-83c6-79fa7120f1cf' ) # Remove by contact email removed = Resend::Contacts::Segments.remove( email: 'steve.wozniak@gmail.com', segment_id: '78261eea-8f8b-4381-83c6-79fa7120f1cf' ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") // Remove by contact id removeParams := &resend.RemoveContactSegmentRequest{ ContactId: "e169aa45-1ecf-4183-9955-b1499d5701d3", SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", } response, err := client.Contacts.Segments.RemoveWithContext(ctx, removeParams) if err != nil { panic(err) } fmt.Println(response) // Remove by contact email removeByEmailParams := &resend.RemoveContactSegmentRequest{ Email: "steve.wozniak@gmail.com", SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", } response, err = client.Contacts.Segments.RemoveWithContext(ctx, removeByEmailParams) if err != nil { panic(err) } fmt.Println(response) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); // Remove by contact id let _contact = resend .contacts .delete_contact_segment( "e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf", ) .await?; // Remove by contact email let _contact = resend .contacts .delete_contact_segment( "steve.wozniak@gmail.com", "78261eea-8f8b-4381-83c6-79fa7120f1cf", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contacts.model.RemoveContactFromSegmentOptions; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); // Remove by contact id RemoveContactFromSegmentOptions optionsById = RemoveContactFromSegmentOptions.builder() .id("e169aa45-1ecf-4183-9955-b1499d5701d3") .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .build(); resend.contacts().segments().remove(optionsById); // Remove by contact email RemoveContactFromSegmentOptions optionsByEmail = RemoveContactFromSegmentOptions.builder() .email("steve.wozniak@gmail.com") .segmentId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .build(); resend.contacts().segments().remove(optionsByEmail); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.ContactRemoveFromSegmentAsync( contactId: new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" ), segmentId: new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} # Remove by contact id curl -X DELETE 'https://api.resend.com/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf' \ -H 'Authorization: Bearer re_xxxxxxxxx' # Remove by contact email curl -X DELETE 'https://api.resend.com/contacts/steve.wozniak@gmail.com/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Remove by contact id resend contacts remove-segment e169aa45-1ecf-4183-9955-b1499d5701d3 78261eea-8f8b-4381-83c6-79fa7120f1cf # Remove by contact email resend contacts remove-segment steve.wozniak@gmail.com 78261eea-8f8b-4381-83c6-79fa7120f1cf ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact_segment", "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "audienceId": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "deleted": true } ``` # Retrieve Contact Source: https://resend.com/docs/api-reference/contacts/get-contact GET /contacts/:contact_id Retrieve a single contact. ## Path Parameters Either `id` or `email` must be provided. **id** `string` The Contact ID. **email** `string` The Contact Email. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.get({ id: 'e169aa45-1ecf-4183-9955-b1499d5701d3', // or: email: 'steve.wozniak@gmail.com', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Get by contact id $resend->contacts->get( idOrEmail: 'e169aa45-1ecf-4183-9955-b1499d5701d3' ); // Get by contact email $resend->contacts->get( idOrEmail: 'steve.wozniak@gmail.com' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" # Get by contact id resend.Contacts.get( id="e169aa45-1ecf-4183-9955-b1499d5701d3", ) # Get by contact email resend.Contacts.get( email="steve.wozniak@gmail.com", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" # Get by contact id params = { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", } Resend::Contacts.get(params) # Get by contact email params = { "email": "steve.wozniak@gmail.com", } Resend::Contacts.get(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") // Get by contact id client.Contacts.Get(&resend.GetContactOptions{ Id: "e169aa45-1ecf-4183-9955-b1499d5701d3", }) // Get by contact email client.Contacts.Get(&resend.GetContactOptions{ Id: "steve.wozniak@gmail.com", }) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); // Get by contact id let _contact = resend .contacts .get("e169aa45-1ecf-4183-9955-b1499d5701d3") .await?; // Get by contact email let _contact = resend .contacts .get("steve.wozniak@gmail.com") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contacts.model.GetContactOptions; import com.resend.services.contacts.model.GetContactResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetContactOptions params = GetContactOptions.builder() .id("e169aa45-1ecf-4183-9955-b1499d5701d3") // or: .email("steve.wozniak@gmail.com") .build(); GetContactResponseSuccess data = resend.contacts().get(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI // Get by contact id var resp1 = await resend.ContactRetrieveAsync( contactId: new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" ) ); // Get by contact email var resp2 = await resend.ContactRetrieveByEmailAsync( email: "steve.wozniak@gmail.com" ); Console.WriteLine( "Contact Email={0}", resp2.Content.Email ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} # Get by contact id curl -X GET 'https://api.resend.com/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3' \ -H 'Authorization: Bearer re_xxxxxxxxx' # Get by contact email curl -X GET 'https://api.resend.com/contacts/steve.wozniak@gmail.com' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Get by contact id resend contacts get e169aa45-1ecf-4183-9955-b1499d5701d3 # Get by contact email resend contacts get steve.wozniak@gmail.com ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact", "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "email": "steve.wozniak@gmail.com", "first_name": "Steve", "last_name": "Wozniak", "created_at": "2026-10-06 23:47:56.678+00", "unsubscribed": false, "properties": { "company_name": { "value": "Acme Corp", "type": "string" }, "department": { "value": "Engineering", "type": "string" } } } ``` # Retrieve Contact Import Source: https://resend.com/docs/api-reference/contacts/get-contact-import GET /contacts/imports/:id Retrieve a single contact import. ## Path Parameters **id** `string` *required* The Contact Import ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.imports.get( '479e3145-dd38-476b-932c-529ceb705947', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contacts->imports->get('479e3145-dd38-476b-932c-529ceb705947'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Contacts.Imports.get("479e3145-dd38-476b-932c-529ceb705947") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Contacts::Imports.get("479e3145-dd38-476b-932c-529ceb705947") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Contacts.Imports.Get("479e3145-dd38-476b-932c-529ceb705947") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _data = resend .contacts .get_import("479e3145-dd38-476b-932c-529ceb705947") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.contacts.model.GetContactImportResponseSuccess; public class Main { public static void main(String[] args) throws Exception { Resend resend = new Resend("re_xxxxxxxxx"); GetContactImportResponseSuccess data = resend .contacts() .imports() .get("479e3145-dd38-476b-932c-529ceb705947"); } } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/contacts/imports/479e3145-dd38-476b-932c-529ceb705947' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contacts imports get 479e3145-dd38-476b-932c-529ceb705947 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact_import", "id": "479e3145-dd38-476b-932c-529ceb705947", "status": "completed", "created_at": "2026-05-15 18:32:37.823+00", "completed_at": "2026-05-15 18:33:42.916+00", "counts": { "total": 1200, "created": 800, "updated": 300, "skipped": 75, "failed": 25 } } ``` # Retrieve Contact Topics Source: https://resend.com/docs/api-reference/contacts/get-contact-topics GET /contacts/:contact_id/topics Retrieve a list of topics subscriptions for a contact. ## Path Parameters Either `id` or `email` must be provided. **id** `string` The Contact ID. **email** `string` The Contact Email. ## Query Parameters **limit** `number` Number of topics to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more topics (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more topics (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.topics.list({ id: 'e169aa45-1ecf-4183-9955-b1499d5701d3', // or: email: 'steve.wozniak@gmail.com', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Get by contact id $resend->contacts->topics->list('e169aa45-1ecf-4183-9955-b1499d5701d3'); // Get by contact email $resend->contacts->topics->list('steve.wozniak@gmail.com'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' # Get by contact id topics = resend.Contacts.Topics.list(contact_id='e169aa45-1ecf-4183-9955-b1499d5701d3') # Get by contact email topics = resend.Contacts.Topics.list(email='steve.wozniak@gmail.com') ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" # Get by contact id contact_topics = Resend::Contacts::Topics.list(id: "e169aa45-1ecf-4183-9955-b1499d5701d3") # Get by contact email contact_topics = Resend::Contacts::Topics.list(email: "steve.wozniak@gmail.com") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") // Get by contact id topics, err := client.Contacts.Topics.ListWithContext(ctx, "e169aa45-1ecf-4183-9955-b1499d5701d3") if err != nil { panic(err) } fmt.Println(topics) // Get by contact email topics, err = client.Contacts.Topics.ListWithContext(ctx, "steve.wozniak@gmail.com") if err != nil { panic(err) } fmt.Println(topics) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _topics = resend .contacts .get_contact_topics( "e169aa45-1ecf-4183-9955-b1499d5701d3", ListOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); // Get by contact id resend.contacts().topics().list("e169aa45-1ecf-4183-9955-b1499d5701d3"); // Get by contact email resend.contacts().topics().list("steve.wozniak@gmail.com"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ContactListTopicsAsync( new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" )); Console.WriteLine( "Nr Topics={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} // Get by contact id curl -X GET 'https://api.resend.com/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/topics' \ -H 'Authorization: Bearer re_xxxxxxxxx' // Get by contact email curl -X GET 'https://api.resend.com/contacts/steve.wozniak@gmail.com/topics' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Get by contact id resend contacts topics e169aa45-1ecf-4183-9955-b1499d5701d3 # Get by contact email resend contacts topics steve.wozniak@gmail.com ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "name": "Product Updates", "description": "New features, and latest announcements.", "subscription": "opt_in" } ] } ``` # List Contact Imports Source: https://resend.com/docs/api-reference/contacts/list-contact-imports GET /contacts/imports Retrieve a list of contact imports. ## Query Parameters **limit** `number` Number of contact imports to retrieve.
  • Default value: `10`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The contact import ID *after* which we'll retrieve more contact imports. This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The contact import ID *before* which we'll retrieve more contact imports. This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. **status** `'queued' | 'in_progress' | 'completed' | 'failed'` Filter contact imports by status. > [!NOTE] > > You can only use either `after` or `before` parameter, > not both. See our [pagination guide](/docs/api-reference/pagination) for > more information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.imports.list({ limit: 10, status: 'completed', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contacts->imports->list([ 'limit' => 10, 'status' => 'completed', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Contacts.Imports.ListParams = { "limit": 10, "status": "completed", } resend.Contacts.Imports.list(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Contacts::Imports.list(limit: 10, status: "completed") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") limit := 10 client.Contacts.Imports.List(&resend.ListContactImportsOptions{ Limit: &limit, Status: string(resend.ContactImportStatusCompleted), }) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, Value, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _data = resend .contacts .list_imports( ListOptions::default() .with_limit(10) .with_other("status", Value::String("completed".to_owned())), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.contacts.model.ListContactImportsParams; import com.resend.services.contacts.model.ListContactImportsResponseSuccess; public class Main { public static void main(String[] args) throws Exception { Resend resend = new Resend("re_xxxxxxxxx"); ListContactImportsParams params = ListContactImportsParams.builder() .limit(10) .status("completed") .build(); ListContactImportsResponseSuccess data = resend.contacts().imports().list(params); } } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/contacts/imports?limit=10&status=completed' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contacts imports list --limit 10 --status completed ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "object": "contact_import", "id": "479e3145-dd38-476b-932c-529ceb705947", "status": "completed", "created_at": "2026-05-15 18:32:37.823+00", "completed_at": "2026-05-15 18:33:42.916+00", "counts": { "total": 1200, "created": 800, "updated": 300, "skipped": 75, "failed": 25 } } ] } ``` # List Contact Segments Source: https://resend.com/docs/api-reference/contacts/list-contact-segments GET /contacts/:contact_id/segments Retrieve a list of segments that a contact is part of. ## Path Parameters Either `id` or `email` must be provided. **id** `string` The Contact ID. **email** `string` The Contact Email. ## Query Parameters **limit** `number` Number of segments to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more segments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more segments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.segments.list({ contactId: 'e169aa45-1ecf-4183-9955-b1499d5701d3', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contacts->segments->list( contactId: 'e169aa45-1ecf-4183-9955-b1499d5701d3' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' params: resend.Contacts.Segments.ListParams = { "contact_id": 'e169aa45-1ecf-4183-9955-b1499d5701d3', } segments = resend.Contacts.Segments.list(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' segments = Resend::Contacts::Segments.list( contact_id: 'e169aa45-1ecf-4183-9955-b1499d5701d3' ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") listParams := &resend.ListContactSegmentsRequest{ ContactId: "479e3145-dd38-476b-932c-529ceb705947", } client.Contacts.Segments.List(listParams) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _contacts = resend .contacts .list_contact_segment( "e169aa45-1ecf-4183-9955-b1499d5701d3", ListOptions::default() ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); resend.contacts().segments().list("e169aa45-1ecf-4183-9955-b1499d5701d3"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ContactListSegmentsAsync( new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" )); Console.WriteLine( "Nr Segments={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/segments' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contacts segments e169aa45-1ecf-4183-9955-b1499d5701d3 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "data": [ { "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Registered Users", "created_at": "2026-10-06 22:59:55.977+00" } ], "has_more": false } ``` # List Contacts Source: https://resend.com/docs/api-reference/contacts/list-contacts GET /contacts Show all contacts. ## Query Parameters **limit** `number` Number of contacts to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more contacts (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more contacts (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. **segment\_id** `string` The Segment ID to filter contacts by. If provided, only contacts in this Segment will be returned. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contacts->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Contacts.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Contacts.list() ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Contacts.List(&resend.ListContactsOptions{}) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _contacts = resend .contacts .list( ListOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contacts.model.ListContactsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListContactsResponseSuccess data = resend.contacts().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ContactListAsync(); Console.WriteLine( "Nr Contacts={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/contacts' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend contacts list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "email": "steve.wozniak@gmail.com", "first_name": "Steve", "last_name": "Wozniak", "created_at": "2026-10-06 23:47:56.678+00", "unsubscribed": false } ] } ``` # Update Contact Source: https://resend.com/docs/api-reference/contacts/update-contact PATCH /contacts/:contact_id Update an existing contact. ## Path Parameters Either `id` or `email` must be provided. **id** `string` The Contact ID. **email** `string` The Contact Email. ## Body Parameters The first name of the contact. The last name of the contact. **unsubscribed** `boolean` The Contact's global subscription status. If set to `true`, the contact will be unsubscribed from all Broadcasts. **properties** `object` A map of custom property keys and values to update. **custom properties** **key** `string` *required* The property key. **value** `string | number | boolean | null` *required* The property value. Use `null` to clear the property value. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.update({ id: 'e169aa45-1ecf-4183-9955-b1499d5701d3', // or: email: 'acme@example.com', unsubscribed: true, }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Update by contact id $resend->contacts->update( idOrEmail: 'e169aa45-1ecf-4183-9955-b1499d5701d3', parameters: [ 'unsubscribed' => true ] ); // Update by contact email $resend->contacts->update( idOrEmail: 'acme@example.com', parameters: [ 'unsubscribed' => true ] ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" # Update by contact id params: resend.Contacts.UpdateParams = { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "unsubscribed": True, } resend.Contacts.update(params) # Update by contact email params: resend.Contacts.UpdateParams = { "email": "acme@example.com", "unsubscribed": True, } resend.Contacts.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" # Update by contact id params = { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "unsubscribed": true, } Resend::Contacts.update(params) # Update by contact email params = { "email": "acme@example.com", "unsubscribed": true, } Resend::Contacts.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") // Update by contact id params := &resend.UpdateContactRequest{ Id: "e169aa45-1ecf-4183-9955-b1499d5701d3", Unsubscribed: true, } client.Contacts.Update(params) // Update by contact email params = &resend.UpdateContactRequest{ Email: "acme@example.com", Unsubscribed: true, } client.Contacts.Update(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::ContactChanges, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let changes = ContactChanges::new().with_unsubscribed(true); // Update by contact id let _contact = resend .contacts .update("e169aa45-1ecf-4183-9955-b1499d5701d3", changes.clone()) .await?; // Update by contact email let _contact = resend .contacts .update("acme@example.com", changes) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contacts.model.UpdateContactOptions; import com.resend.services.contacts.model.UpdateContactResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateContactOptions params = UpdateContactOptions.builder() .id("e169aa45-1ecf-4183-9955-b1499d5701d3") // or: .email("acme@example.com") .unsubscribed(true) .build(); UpdateContactResponseSuccess data = resend.contacts().update(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI // By Id await resend.ContactUpdateAsync( contactId: new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" ), new ContactData() { FirstName = "Stevie", LastName = "Wozniaks", IsUnsubscribed = true, } ); // By Email await resend.ContactUpdateByEmailAsync( "acme@example.com", new ContactData() { FirstName = "Stevie", LastName = "Wozniaks", IsUnsubscribed = true, } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} # Update by contact id curl -X PATCH 'https://api.resend.com/contacts/520784e2-887d-4c25-b53c-4ad46ad38100' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "unsubscribed": true }' # Update by contact email curl -X PATCH 'https://api.resend.com/contacts/acme@example.com' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "unsubscribed": true }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Update by contact id resend contacts update e169aa45-1ecf-4183-9955-b1499d5701d3 --unsubscribed # Update by contact email resend contacts update acme@example.com --unsubscribed ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact", "id": "479e3145-dd38-476b-932c-529ceb705947" } ``` # Update Contact Topics Source: https://resend.com/docs/api-reference/contacts/update-contact-topics PATCH /contacts/:contact_id/topics Update topic subscriptions for a contact. ## Path Parameters Either `id` or `email` must be provided. **id** `string` The Contact ID. **email** `string` The Contact Email. ## Body Parameters **topics** `array` *required* Array of topic subscription updates. **properties** **id** `string` *required* The Topic ID. **subscription** `string` *required* The subscription action. Must be either `opt_in` or `opt_out`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.topics.update({ id: 'e169aa45-1ecf-4183-9955-b1499d5701d3', // or: email: 'steve.wozniak@gmail.com', topics: [ { id: 'b6d24b8e-af0b-4c3c-be0c-359bbd97381e', subscription: 'opt_out', }, { id: '07d84122-7224-4881-9c31-1c048e204602', subscription: 'opt_in', }, ], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Update by contact id $resend->contacts->topics->update('e169aa45-1ecf-4183-9955-b1499d5701d3', [ [ 'id' => '07d84122-7224-4881-9c31-1c048e204602', 'subscription' => 'opt_out', ], [ 'id' => '07d84122-7224-4881-9c31-1c048e204602', 'subscription' => 'opt_in', ], ]); // Update by contact email $resend->contacts->topics->update('steve.wozniak@gmail.com', [ [ 'id' => '07d84122-7224-4881-9c31-1c048e204602', 'subscription' => 'opt_out', ], [ 'id' => '07d84122-7224-4881-9c31-1c048e204602', 'subscription' => 'opt_in', ], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' # Update by contact id params: resend.Contacts.Topics.UpdateParams = { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "topics": [ {"id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "subscription": "opt_out"}, {"id": "07d84122-7224-4881-9c31-1c048e204602", "subscription": "opt_in"}, ], } response = resend.Contacts.Topics.update(params) # Update by contact email params_by_email: resend.Contacts.Topics.UpdateParams = { "email": "steve.wozniak@gmail.com", "topics": [ {"id": "07d84122-7224-4881-9c31-1c048e204602", "subscription": "opt_out"}, {"id": "07d84122-7224-4881-9c31-1c048e204602", "subscription": "opt_in"}, ], } response = resend.Contacts.Topics.update(params_by_email) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" # Update by contact id update_params = { id: "e169aa45-1ecf-4183-9955-b1499d5701d3", topics: [ { id: "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", subscription: "opt_out" }, { id: "07d84122-7224-4881-9c31-1c048e204602", subscription: "opt_in" } ] } updated_topics = Resend::Contacts::Topics.update(update_params) # Update by contact email update_params = { email: "steve.wozniak@gmail.com", topics: [ { id: "07d84122-7224-4881-9c31-1c048e204602", subscription: "opt_out" }, { id: "07d84122-7224-4881-9c31-1c048e204602", subscription: "opt_in" } ] } updated_topics = Resend::Contacts::Topics.update(update_params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") // Update by contact id params := &resend.UpdateContactTopicsRequest{ Id: "e169aa45-1ecf-4183-9955-b1499d5701d3", Topics: []resend.TopicSubscriptionUpdate{ { Id: "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", Subscription: "opt_out", }, { Id: "07d84122-7224-4881-9c31-1c048e204602", Subscription: "opt_in", }, }, } updatedTopics, err := client.Contacts.Topics.UpdateWithContext(ctx, params) if err != nil { panic(err) } fmt.Println(updatedTopics) // Update by contact email params = &resend.UpdateContactTopicsRequest{ Email: "steve.wozniak@gmail.com", Topics: []resend.TopicSubscriptionUpdate{ { Id: "07d84122-7224-4881-9c31-1c048e204602", Subscription: "opt_out", }, { Id: "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", Subscription: "opt_in", }, }, } updatedTopics, err = client.Contacts.Topics.UpdateWithContext(ctx, params) if err != nil { panic(err) } fmt.Println(updatedTopics) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{SubscriptionType, UpdateContactTopicOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let topics = [ UpdateContactTopicOptions::new( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", SubscriptionType::OptOut, ), UpdateContactTopicOptions::new( "07d84122-7224-4881-9c31-1c048e204602", SubscriptionType::OptIn, ), ]; let _contact = resend .contacts .update_contact_topics("e169aa45-1ecf-4183-9955-b1499d5701d3", topics) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contacts.model.ContactTopicOptions; import com.resend.services.contacts.model.UpdateContactTopicsOptions; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); // Update by contact id UpdateContactTopicsOptions optionsById = UpdateContactTopicsOptions.builder() .id("e169aa45-1ecf-4183-9955-b1499d5701d3") .topics(ContactTopicOptions.builder() .id("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") .subscription("opt_out") .build(), ContactTopicOptions.builder() .id("07d84122-7224-4881-9c31-1c048e204602") .subscription("opt_in") .build()) .build(); resend.contacts().topics().update(optionsById); // Update by contact email UpdateContactTopicsOptions optionsByEmail = UpdateContactTopicsOptions.builder() .email("steve.wozniak@gmail.com") .topics(ContactTopicOptions.builder() .id("07d84122-7224-4881-9c31-1c048e204602") .subscription("opt_in") .build(), ContactTopicOptions.builder() .id("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") .subscription("opt_out") .build()) .build(); resend.contacts().topics().update(optionsByEmail); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var topics = new List(); topics.Add( new TopicSubscription() { Id = new Guid( "07d84122-7224-4881-9c31-1c048e204602" ), Subscription = SubscriptionType.OptIn, }); topics.Add( new TopicSubscription() { Id = new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ), Subscription = SubscriptionType.OptOut, }); await resend.ContactUpdateTopicsAsync( new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" ), topics ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} // Update by contact id curl -X PATCH 'https://api.resend.com/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/topics' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'[ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "subscription": "opt_out" } ]' // Update by contact email curl -X PATCH 'https://api.resend.com/contacts/steve.wozniak@gmail.com/topics' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'[ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "subscription": "opt_out" } ]' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Update by contact id resend contacts update-topics e169aa45-1ecf-4183-9955-b1499d5701d3 \ --topics '[{"id":"b6d24b8e-af0b-4c3c-be0c-359bbd97381e","subscription":"opt_out"}]' # Update by contact email resend contacts update-topics steve.wozniak@gmail.com \ --topics '[{"id":"b6d24b8e-af0b-4c3c-be0c-359bbd97381e","subscription":"opt_out"}]' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "contact_topics", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" } ``` # Claim Domain Source: https://resend.com/docs/api-reference/domains/claim-domain POST /domains/claim Claim a domain that is already verified by another team. > [!NOTE] > > Use this endpoint when [creating a > domain](/docs/api-reference/domains/create-domain) fails because the domain is > already verified by another team. Resend creates a placeholder domain on your > team and returns a `domain_claim` with a TXT record to add to your DNS. Learn > more in [Claiming a domain](/docs/dashboard/domains/claim). ## Body Parameters **name** `string` *required* The name of the domain you want to claim. **region** `string` (default: us-east-1) The region where emails will be sent from. Possible values: `'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1'` Choose a subdomain for the Return-Path address. Defaults to `send` (i.e., `send.yourdomain.tld`). Avoid setting values that could undermine credibility (e.g. `testing`), as they may be exposed to recipients. Track the open rate of each email. > [!NOTE] > > This setting is only applied if a `tracking_subdomain` is configured and verified. Track clicks within the body of each HTML email. > [!NOTE] > > This setting is only applied if a `tracking_subdomain` is configured and verified. Configure a custom subdomain for click and open tracking. For example, setting `"links"` on domain `example.com` will produce a CNAME record for `links.example.com`. Avoid setting values that have a negative connotation (e.g. `tracking`). Learn more about [custom tracking subdomains](/docs/dashboard/domains/tracking). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.domains.claims.create({ name: 'example.com', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->domains->claims->create([ 'name' => 'example.com' ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Domains.Claims.CreateParams = { "name": "example.com", } resend.Domains.Claims.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { name: "example.com", } claim = Resend::Domains::Claims.create(params) puts claim ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateDomainClaimRequest{ Name: "example.com", } client.DomainClaims.Create(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, types::CreateDomainClaimOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let domain_claim = CreateDomainClaimOptions::new("example.com"); let _data = resend.domains.claim(domain_claim).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.domains.model.ClaimDomainOptions; import com.resend.services.domains.model.DomainClaimResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ClaimDomainOptions params = ClaimDomainOptions .builder() .name("example.com").build(); DomainClaimResponseSuccess claim = resend.domains().claims().create(params); } } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/domains/claim' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "example.com" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains claim create --name example.com ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "domain_claim", "id": "dacf4072-4119-4d88-932f-6c6126d3a9d1", "name": "example.com", "status": "pending", "domain_id": "d91cd9bd-1176-453e-8fc1-35364d380206", "region": "us-east-1", "record": { "type": "TXT", "name": "example.com", "value": "resend-domain-verification=3f8a1c2d4e5b6a7f8091a2b3c4d5e6f7", "ttl": "Auto" }, "blocked_reason": null, "failure_reason": null, "created_at": "2026-06-16 17:12:02.059593+00", "expires_at": "2026-06-23 17:12:02.059593+00" } ``` # Create Domain Source: https://resend.com/docs/api-reference/domains/create-domain POST /domains Create a domain through the Resend Email API. ## Body Parameters **name** `string` *required* The name of the domain you want to create. **region** `string` (default: us-east-1) The region where emails will be sent from. Possible values: `'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1'` For advanced use cases, choose a subdomain for the Return-Path address. The custom return path is used for SPF authentication, DMARC alignment, and handling bounced emails. Defaults to `send` (i.e., `send.yourdomain.tld`). Avoid setting values that could undermine credibility (e.g. `testing`), as they may be exposed to recipients. Learn more about [custom return paths](/docs/dashboard/domains/custom-return-path). Track the open rate of each email. > [!NOTE] > > This setting is only applied if a `tracking_subdomain` is configured and verified. Track clicks within the body of each HTML email. > [!NOTE] > > This setting is only applied if a `tracking_subdomain` is configured and verified. Configure a custom subdomain for click and open tracking. For example, setting `"links"` on domain `example.com` will produce a CNAME record for `links.example.com`. Avoid setting values that have a negative connotation (e.g. `tracking`). Learn more about [custom tracking subdomains](/docs/dashboard/domains/tracking). **tls** `string` (default: opportunistic)
  • `opportunistic`: Opportunistic TLS means that it always attempts to make a secure connection to the receiving mail server. If it can't establish a secure connection, it sends the message unencrypted.
  • `enforced`: Enforced TLS on the other hand, requires that the email communication must use TLS no matter what. If the receiving server does not support TLS, the email will not be sent.
**capabilities** `object` Configure the domain capabilities for sending and receiving emails. At least one capability must be enabled. **properties** **sending** `string` (default: enabled) Enable or disable sending emails from this domain. Possible values: `'enabled' | 'disabled'` **receiving** `string` (default: disabled) Enable or disable receiving emails to this domain. Possible values: `'enabled' | 'disabled'` > [!NOTE] > > See all available [domain `status` > types](/docs/dashboard/domains/manage-domains#understand-a-domain-status). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.domains.create({ name: 'example.com' }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->domains->create([ 'name' => 'example.com' ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Domains.CreateParams = { "name": "example.com", } resend.Domains.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { name: "example.com", } domain = Resend::Domains.create(params) puts domain ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateDomainRequest{ Name: "example.com", } client.Domains.Create(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::CreateDomainOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _domain = resend .domains .create(CreateDomainOptions::new("example.com")) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.domains.model.CreateDomainOptions; import com.resend.services.domains.model.CreateDomainResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateDomainOptions params = CreateDomainOptions .builder() .name("example.com").build(); CreateDomainResponse domain = resend.domains().create(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.DomainAddAsync( "example.com" ); Console.WriteLine( "Domain Id={0}", resp.Content.Id ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/domains' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "example.com" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains create --name example.com --region us-east-1 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "id": "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "name": "example.com", "created_at": "2026-03-28 17:12:02.059593+00", "status": "not_started", "open_tracking": true, "click_tracking": false, "tracking_subdomain": "links", "capabilities": { "sending": "enabled", "receiving": "disabled" }, "records": [ { "record": "DKIM", "name": "resend._domainkey", "value": "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsc4Lh8xilsngyKEgN2S84+21gn+x6SEXtjWvPiAAmnmggr5FWG42WnqczpzQ/mNblqHz4CDwUum6LtY6SdoOlDmrhvp5khA3cd661W9FlK3yp7+jVACQElS7d9O6jv8VsBbVg4COess3gyLE5RyxqF1vYsrEXqyM8TBz1n5AGkQIDAQA2", "type": "TXT", "status": "not_started", "ttl": "Auto" }, { "record": "SPF", "name": "send", "type": "MX", "ttl": "Auto", "status": "not_started", "value": "feedback-smtp.us-east-1.amazonses.com", "priority": 10 }, { "record": "SPF", "name": "send", "value": "v=spf1 include:amazonses.com ~all", "type": "TXT", "ttl": "Auto", "status": "not_started" }, { "record": "Tracking", "type": "CNAME", "name": "links", "value": "links1.resend-dns.com", "ttl": "Auto", "status": "not_started" } ], "region": "us-east-1" } ``` # Delete Domain Source: https://resend.com/docs/api-reference/domains/delete-domain DELETE /domains/:domain_id Remove an existing domain. > [!WARNING] > > Removing a domain with a configured [custom tracking subdomain](/docs/dashboard/domains/tracking) > will also remove the Resend provisioned proxy, breaking any existing email links that use that subdomain. > > To keep links working, set up your own proxy pointing to Resend’s tracking DNS records before removing the domain. ## Path Parameters The Domain ID. ```js Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.domains.remove( 'd91cd9bd-1176-453e-8fc1-35364d380206', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->domains->remove('d91cd9bd-1176-453e-8fc1-35364d380206'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Domains.remove(domain_id="d91cd9bd-1176-453e-8fc1-35364d380206") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Domains.remove("d91cd9bd-1176-453e-8fc1-35364d380206") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Domains.Remove("d91cd9bd-1176-453e-8fc1-35364d380206") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _deleted = resend .domains .delete("d91cd9bd-1176-453e-8fc1-35364d380206") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.domains.model.RemoveDomainResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RemoveDomainResponse removed = resend.domains().remove("d91cd9bd-1176-453e-8fc1-35364d380206"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.DomainDeleteAsync( new Guid( "d91cd9bd-1176-453e-8fc1-35364d380206" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/domains/d91cd9bd-1176-453e-8fc1-35364d380206' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains delete d91cd9bd-1176-453e-8fc1-35364d380206 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "domain", "id": "d91cd9bd-1176-453e-8fc1-35364d380206", "deleted": true } ``` # Retrieve Domain Source: https://resend.com/docs/api-reference/domains/get-domain GET /domains/:domain_id Retrieve a single domain for the authenticated user. ## Path Parameters The Domain ID. > [!NOTE] > > See all available [domain `status` > types](/docs/dashboard/domains/manage-domains#understand-a-domain-status). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.domains.get( 'd91cd9bd-1176-453e-8fc1-35364d380206', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->domains->get('d91cd9bd-1176-453e-8fc1-35364d380206'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Domains.get(domain_id="d91cd9bd-1176-453e-8fc1-35364d380206") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Domains.get "d91cd9bd-1176-453e-8fc1-35364d380206" ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Domains.Get("d91cd9bd-1176-453e-8fc1-35364d380206") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _domain = resend .domains .get("d91cd9bd-1176-453e-8fc1-35364d380206") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.domains.model.Domain; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); Domain domain = resend.domains().get("d91cd9bd-1176-453e-8fc1-35364d380206"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.DomainRetrieveAsync( new Guid( "d91cd9bd-1176-453e-8fc1-35364d380206" ) ); Console.WriteLine( "Domain Id={0}", resp.Content.Name ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/domains/d91cd9bd-1176-453e-8fc1-35364d380206' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains get d91cd9bd-1176-453e-8fc1-35364d380206 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "domain", "id": "d91cd9bd-1176-453e-8fc1-35364d380206", "name": "example.com", "status": "not_started", "created_at": "2026-04-26 20:21:26.347412+00", "region": "us-east-1", "open_tracking": true, "click_tracking": false, "tracking_subdomain": "links", "capabilities": { "sending": "enabled", "receiving": "disabled" }, "records": [ { "record": "SPF", "name": "send", "type": "MX", "ttl": "Auto", "status": "not_started", "value": "feedback-smtp.us-east-1.amazonses.com", "priority": 10 }, { "record": "SPF", "name": "send", "value": "\"v=spf1 include:amazonses.com ~all\"", "type": "TXT", "ttl": "Auto", "status": "not_started" }, { "record": "DKIM", "name": "resend._domainkey", "value": "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsc4Lh8xilsngyKEgN2S84+21gn+x6SEXtjWvPiAAmnmggr5FWG42WnqczpzQ/mNblqHz4CDwUum6LtY6SdoOlDmrhvp5khA3cd661W9FlK3yp7+jVACQElS7d9O6jv8VsBbVg4COess3gyLE5RyxqF1vYsrEXqyM8TBz1n5AGkQIDAQA2", "type": "TXT", "status": "not_started", "ttl": "Auto" }, { "record": "Tracking", "name": "links.example.com", "type": "CNAME", "value": "links1.resend-dns.com", "ttl": "Auto", "status": "not_started" } ] } ``` # Retrieve Domain Claim Source: https://resend.com/docs/api-reference/domains/get-domain-claim GET /domains/:domain_id/claim Retrieve the latest claim for a domain. > [!NOTE] > > Poll this endpoint to follow a claim's `status` after you [start a > claim](/docs/api-reference/domains/claim-domain). The `domain_id` is the > placeholder domain id returned in the `domain_claim` object. ## Path Parameters The placeholder Domain ID returned when the claim was created. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.domains.claims.get( 'd91cd9bd-1176-453e-8fc1-35364d380206', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->domains->claims->get( 'd91cd9bd-1176-453e-8fc1-35364d380206' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Domains.Claims.get(domain_id="d91cd9bd-1176-453e-8fc1-35364d380206") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" claim = Resend::Domains::Claims.get("d91cd9bd-1176-453e-8fc1-35364d380206") puts claim ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.DomainClaims.Get("d91cd9bd-1176-453e-8fc1-35364d380206") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _data = resend .domains .get_claim("d91cd9bd-1176-453e-8fc1-35364d380206") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.domains.model.DomainClaimResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); DomainClaimResponseSuccess claim = resend.domains().claims() .get("d91cd9bd-1176-453e-8fc1-35364d380206"); } } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/domains/d91cd9bd-1176-453e-8fc1-35364d380206/claim' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains claim get d91cd9bd-1176-453e-8fc1-35364d380206 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "domain_claim", "id": "dacf4072-4119-4d88-932f-6c6126d3a9d1", "name": "example.com", "status": "pending", "domain_id": "d91cd9bd-1176-453e-8fc1-35364d380206", "region": "us-east-1", "record": { "type": "TXT", "name": "example.com", "value": "resend-domain-verification=3f8a1c2d4e5b6a7f8091a2b3c4d5e6f7", "ttl": "Auto" }, "blocked_reason": null, "failure_reason": null, "created_at": "2026-06-16 17:12:02.059593+00", "expires_at": "2026-06-23 17:12:02.059593+00" } ``` # List Domains Source: https://resend.com/docs/api-reference/domains/list-domains GET /domains Retrieve a list of domains for the authenticated user. > [!NOTE] > > See all available [domain `status` > types](/docs/dashboard/domains/manage-domains#understand-a-domain-status). ## Query Parameters If `limit` is not provided, all domains will be returned in a single response. Pass `limit` to paginate. `after` and `before` only take effect together with `limit`. **limit** `number` Number of domains to retrieve.
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more domains (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more domains (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.domains.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->domains->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Domains.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Domains.list ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Domains.List() } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _domains = resend.domains.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.domains.model.ListDomainsResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListDomainsResponse response = resend.domains().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.DomainListAsync(); Console.WriteLine( "Nr Domains={0}", resp.Content.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/domains' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "d91cd9bd-1176-453e-8fc1-35364d380206", "name": "example.com", "status": "not_started", "created_at": "2026-04-26 20:21:26.347412+00", "region": "us-east-1", "open_tracking": true, "click_tracking": false, "capabilities": { "sending": "enabled", "receiving": "disabled" } } ] } ``` # Update Domain Source: https://resend.com/docs/api-reference/domains/update-domain PATCH /domains/:domain_id Update an existing domain. ## Path Parameters The Domain ID. ## Body Parameters Track clicks within the body of each HTML email. > [!NOTE] > > This setting is only applied if a `tracking_subdomain` is configured and verified. Track the open rate of each email. > [!NOTE] > > This setting is only applied if a `tracking_subdomain` is configured and verified. Configure a custom subdomain for click and open tracking. For example, setting `"links"` on domain `example.com` will produce a CNAME record for `links.example.com`. Avoid setting values that have a negative connotation (e.g. `tracking`). This value can only be changed after it has been specified, never removed. This is to preserve any email links that may already be sent with the current tracking subdomain. After changing the tracking subdomain, a new DNS record must be verified, until then, the previous value is used. Do not remove old tracking DNS records, all previously used records remain active and are included in the response. Learn more about [custom tracking subdomains](/docs/dashboard/domains/tracking). **tls** `string` (default: opportunistic)
  • `opportunistic`: Opportunistic TLS means that it always attempts to make a secure connection to the receiving mail server. If it can't establish a secure connection, it sends the message unencrypted.
  • `enforced`: Enforced TLS on the other hand, requires that the email communication must use TLS no matter what. If the receiving server does not support TLS, the email will not be sent.
**capabilities** `object` Update the domain capabilities for sending and receiving emails. You can specify one or both fields. Omitted fields will keep their current value. At least one capability must remain enabled. **properties** **sending** `string` Enable or disable sending emails from this domain. Possible values: `'enabled' | 'disabled'` **receiving** `string` Enable or disable receiving emails to this domain. Possible values: `'enabled' | 'disabled'` ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.domains.update({ id: 'b8617ad3-b712-41d9-81a0-f7c3d879314e', openTracking: false, clickTracking: true, trackingSubdomain: 'links', tls: 'enforced', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->domains->update( 'b8617ad3-b712-41d9-81a0-f7c3d879314e', [ 'open_tracking' => false, 'click_tracking' => true, 'tracking_subdomain' => 'links', 'tls' => 'enforced', ] ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Domains.UpdateParams = { "id": "b8617ad3-b712-41d9-81a0-f7c3d879314e", "open_tracking": False, "click_tracking": True, "tracking_subdomain": "links", "tls": "enforced", } resend.Domains.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Domains.update({ id: "b8617ad3-b712-41d9-81a0-f7c3d879314e", open_tracking: false, click_tracking: true, tracking_subdomain: "links", tls: "enforced", }) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") updateDomainParams := &resend.UpdateDomainRequest{ OpenTracking: false, ClickTracking: true, TrackingSubdomain: "links", Tls: resend.Enforced, } client.Domains.Update("b8617ad3-b712-41d9-81a0-f7c3d879314e", updateDomainParams) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::{DomainChanges, Tls}, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let changes = DomainChanges::new() .with_open_tracking(false) .with_click_tracking(true) .with_tracking_subdomain("links") .with_tls(Tls::Enforced); let _domain = resend .domains .update("b8617ad3-b712-41d9-81a0-f7c3d879314e", changes) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.services.domains.model.Tls; import com.resend.services.domains.model.UpdateDomainOptions; Resend resend = new Resend("re_xxxxxxxxx"); UpdateDomainOptions params = UpdateDomainOptions.builder() .id("b8617ad3-b712-41d9-81a0-f7c3d879314e") .openTracking(false) .clickTracking(true) .trackingSubdomain("links") .tls(Tls.ENFORCED) .build(); resend.domains().update(params); ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.DomainUpdateAsync( new Guid( "b8617ad3-b712-41d9-81a0-f7c3d879314e" ), new DomainUpdateData() { TrackOpen = false, TrackClicks = true, TrackingSubdomain = "links", TlsMode = TlsMode.Enforced, } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/domains/b8617ad3-b712-41d9-81a0-f7c3d879314e' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "open_tracking": false, "click_tracking": true, "tracking_subdomain": "links", "tls": "enforced" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains update b8617ad3-b712-41d9-81a0-f7c3d879314e \ --no-open-tracking \ --click-tracking \ --tracking-subdomain links \ --tls enforced ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "domain", "id": "b8617ad3-b712-41d9-81a0-f7c3d879314e" } ``` # Verify Domain Source: https://resend.com/docs/api-reference/domains/verify-domain POST /domains/:domain_id/verify Verify an existing domain. > [!NOTE] > > Calling this API endpoint triggers an **asynchronous domain verification > process**. Records that are already verified stay `verified` while the > verification is in progress, so sending and receiving are not interrupted. > Records that are not verified are marked as `pending`. If a verified record is > no longer found, it is marked as `failed` once the verification times out. > Since this request initiates the complete domain verification cycle, it will > trigger `domain.updated` webhook events as the domain status changes during > the verification process. > [!NOTE] > > **Claimed a domain?** A [domain claim](/docs/dashboard/domains/claim) transfers the > domain into your account as a brand-new domain with its own DKIM keys, so the > previous account's DNS records can't be reused. After the claim is > `completed`, fetch the domain with [Retrieve > Domain](/docs/api-reference/domains/get-domain), update your DNS with the new DKIM > record(s) it returns, then call this endpoint to verify it before sending or > receiving email. See [DKIM > records](/docs/dashboard/domains/manage-domains#what-are-dkim-records) for details. ## Path Parameters The Domain ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.domains.verify( 'd91cd9bd-1176-453e-8fc1-35364d380206', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->domains->verify('d91cd9bd-1176-453e-8fc1-35364d380206'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Domains.verify(domain_id="d91cd9bd-1176-453e-8fc1-35364d380206") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Domains.verify("d91cd9bd-1176-453e-8fc1-35364d380206") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Domains.Verify("d91cd9bd-1176-453e-8fc1-35364d380206") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); resend .domains .verify("d91cd9bd-1176-453e-8fc1-35364d380206") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.domains.model.VerifyDomainResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); VerifyDomainResponse verified = resend.domains().verify("d91cd9bd-1176-453e-8fc1-35364d380206"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.DomainVerifyAsync( new Guid( "d91cd9bd-1176-453e-8fc1-35364d380206" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/domains/d91cd9bd-1176-453e-8fc1-35364d380206/verify' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains verify d91cd9bd-1176-453e-8fc1-35364d380206 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "domain", "id": "d91cd9bd-1176-453e-8fc1-35364d380206" } ``` # Verify Domain Claim Source: https://resend.com/docs/api-reference/domains/verify-domain-claim POST /domains/:domain_id/claim/verify Trigger DNS verification for a domain claim. > [!NOTE] > > Calling this endpoint starts an **asynchronous verification process**. Resend > checks the claim's TXT record and runs ownership-safety checks before > transferring the domain to your team. Add the TXT record returned by [Claim > Domain](/docs/api-reference/domains/claim-domain) before calling this, then poll > [Retrieve Domain Claim](/docs/api-reference/domains/get-domain-claim) to follow the > `status`. > [!NOTE] > > **After the claim completes:** the domain is transferred to your account as a > brand-new domain with its own DKIM keys, so the previous account's DNS records > can't be reused. Fetch it with [Retrieve > Domain](/docs/api-reference/domains/get-domain), update your DNS with the new DKIM > record(s), then run [Verify Domain](/docs/api-reference/domains/verify-domain) to > finish setup before sending or receiving email. See [DKIM > records](/docs/dashboard/domains/manage-domains#what-are-dkim-records) for details. ## Path Parameters The placeholder Domain ID returned when the claim was created. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.domains.claims.verify( 'd91cd9bd-1176-453e-8fc1-35364d380206', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->domains->claims->verify( 'd91cd9bd-1176-453e-8fc1-35364d380206' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Domains.Claims.verify(domain_id="d91cd9bd-1176-453e-8fc1-35364d380206") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" claim = Resend::Domains::Claims.verify("d91cd9bd-1176-453e-8fc1-35364d380206") puts claim ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.DomainClaims.Verify("d91cd9bd-1176-453e-8fc1-35364d380206") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _data = resend .domains .verify_claim("d91cd9bd-1176-453e-8fc1-35364d380206") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.domains.model.DomainClaimResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); DomainClaimResponseSuccess claim = resend.domains().claims() .verify("d91cd9bd-1176-453e-8fc1-35364d380206"); } } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/domains/d91cd9bd-1176-453e-8fc1-35364d380206/claim/verify' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains claim verify d91cd9bd-1176-453e-8fc1-35364d380206 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "domain_claim", "id": "dacf4072-4119-4d88-932f-6c6126d3a9d1", "name": "example.com", "status": "pending", "domain_id": "d91cd9bd-1176-453e-8fc1-35364d380206", "region": "us-east-1", "record": { "type": "TXT", "name": "example.com", "value": "resend-domain-verification=3f8a1c2d4e5b6a7f8091a2b3c4d5e6f7", "ttl": "Auto" }, "blocked_reason": null, "failure_reason": null, "created_at": "2026-06-16 17:12:02.059593+00", "expires_at": "2026-06-23 17:12:02.059593+00" } ``` # Cancel Email Source: https://resend.com/docs/api-reference/emails/cancel-email POST /emails/:email_id/cancel Cancel a scheduled email. ## Path Parameters **id** `string` *required* The Email ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.cancel( '49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->cancel('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Emails.cancel(email_id="49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Emails.cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "fmt" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") canceled, err := client.Emails.Cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") if err != nil { panic(err) } fmt.Println(canceled.Id) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _canceled = resend .emails .cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.CancelEmailResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CancelEmailResponse canceled = resend .emails() .cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.EmailCancelAsync( new Guid( "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794/cancel' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails cancel 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "email", "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` # Retrieve Metrics Source: https://resend.com/docs/api-reference/emails/get-metrics GET /emails/metrics Retrieve account-level email metrics. > [!NOTE] > > Metrics are retained according to your plan's data retention window. > Requesting a `start_date` older than your retention window returns data > clamped to the oldest date your plan retains. This doesn't apply when > `broadcast_id` is set. > [!NOTE] > > Responses are cached for up to 15 minutes, so a request for the same range may > return slightly stale data within that window. All parameters are optional. With none, the response covers the last 7 days (today plus the 6 previous days), includes every metric, and returns only `totals`. ## Query Parameters List-type query parameters below accept a comma-separated value, the parameter repeated (`domain_id=a&domain_id=b`), or a mix of both. **start\_date** `string` The start of the date range, as an ISO 8601 date (`2026-07-01`) or datetime (`2026-07-01T00:00:00Z`). Must be on or before `end_date`, and can equal it to query a single day. Defaults to 6 days before `end_date`. **end\_date** `string` The end of the date range, as an ISO 8601 date or datetime. Values in the future are clamped to the current time. Defaults to now. **timezone** `string` (default: UTC) The IANA timezone (e.g. `America/New_York`) used to bucket periods when `period` is in `dimensions`. **granularity** `hourly | daily | weekly | monthly` (default: daily) The bucket size used when `period` is in `dimensions`. Accepted but has no effect otherwise. The date range can't produce more than 10,000 periods at the chosen granularity. This limit only applies when `period` is in `dimensions`. **metrics** `string[]` List of metrics to include in the response. Omit for all. See [Metrics](#metrics). **dimensions** `string[]` (default: \[]) List of dimensions to break the response down by. Combine any of `period`, `domain`, `email`, or `broadcast` to group the data by more than one at once, except `email` cannot be combined with `broadcast`. Omit for a single `totals` row for the whole range, with no `data`. Possible values: * `period`: groups the data by `granularity` period, in chronological order. * `domain`: groups the data by sending domain. * `email`: groups the data by email. Cannot be combined with `broadcast`. * `broadcast`: groups the data by broadcast. Cannot be combined with `email`. **domain\_id** `string[]` List of sending domain IDs to restrict the response to, up to 100. **email\_id** `string[]` List of email IDs to restrict the response to, up to 100. Cannot be combined with the `broadcast` dimension or `broadcast_id`. **broadcast\_id** `string[]` List of broadcast IDs to restrict the response to, up to 100. Cannot be combined with the `email` dimension or `email_id`. > [!TIP] > > For a 24-hour breakdown of one day, set `start_date` and `end_date` to the > same date, with `granularity=hourly` and `period` in `dimensions`. ## Metrics | Metric | Description | | - | - | | `received` | Emails Resend accepted for processing. | | `sent` | Emails sent to the recipient's mail server. | | `delivered` | Emails the recipient's mail server accepted. | | `delivery_delayed` | Delivery postponed by a temporary issue. Not final. | | `failed` | Emails that never reached a mail server. | | `suppressed` | Skipped because the recipient is [suppressed](/docs/dashboard/emails/email-suppressions). | | `bounced` | All [bounces](/docs/dashboard/emails/email-bounces), summing the three below. | | `bounced_transient` | Soft bounce. Temporary, so a later send can succeed. | | `bounced_permanent` | Hard bounce. Permanent, and the address is suppressed. | | `bounced_undetermined` | Bounce with no classifiable reason. | | `opened` | Open events, including repeats. | | `unique_opened` | Emails opened at least once. | | `clicked` | Link click events, including repeats. | | `unique_clicked` | Emails clicked at least once. | | `complained` | Delivered emails marked as spam. | | `unsubscribed` | Recipients who unsubscribed. | | `delivery_rate` | `delivered` / `sent` | | `open_rate` | `unique_opened` / `delivered` | | `click_rate` | `unique_clicked` / `delivered` | | `bounce_rate` | `bounced` / `sent` | | `complaint_rate` | `complained` / `delivered` | | `unsubscribe_rate` | `unsubscribed` / `delivered` | > [!NOTE] > > Open and click metrics require [open and click > tracking](/docs/dashboard/domains/tracking) on the sending domain. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data } = await resend.emails.metrics({ startDate: '2026-07-01', endDate: '2026-07-08', metrics: ['sent', 'delivered', 'open_rate'], dimensions: ['period', 'broadcast'], broadcastId: ['5a5a3b1e-3b1a-4b1a-8b1a-3b1a4b1a8b1a'], }); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Emails.MetricsParams = { "start_date": "2026-07-01", "end_date": "2026-07-08", "metrics": ["sent", "delivered", "open_rate"], "dimensions": ["period", "broadcast"], "broadcast_id": ["5a5a3b1e-3b1a-4b1a-8b1a-3b1a4b1a8b1a"], } metrics = resend.Emails.metrics(params) print(metrics) ``` ```rb Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { start_date: "2026-07-01", end_date: "2026-07-08", metrics: ["sent", "delivered", "open_rate"], dimensions: ["period", "broadcast"], broadcast_id: ["5a5a3b1e-3b1a-4b1a-8b1a-3b1a4b1a8b1a"] } metrics = Resend::Emails.metrics(params) puts metrics ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") startDate := "2026-07-01" endDate := "2026-07-08" metrics, err := client.Emails.MetricsWithOptions(ctx, &resend.MetricsOptions{ StartDate: &startDate, EndDate: &endDate, Metrics: []resend.MetricName{ resend.MetricSent, resend.MetricDelivered, resend.MetricOpenRate, }, Dimensions: []resend.MetricsDimension{ resend.MetricsDimensionPeriod, resend.MetricsDimensionBroadcast, }, BroadcastId: []string{"5a5a3b1e-3b1a-4b1a-8b1a-3b1a4b1a8b1a"}, }) if err != nil { panic(err) } fmt.Println(metrics.Totals) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::types::{GetEmailMetricsOptions, Metric}; use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let options = GetEmailMetricsOptions::default() .with_start_date("2026-07-01") .with_end_date("2026-07-08") .with_metrics([Metric::Sent, Metric::Delivered, Metric::OpenRate]) .with_period_dimension() .with_broadcast_dimension() .with_broadcast_id("5a5a3b1e-3b1a-4b1a-8b1a-3b1a4b1a8b1a"); let _metrics = resend.emails.metrics(options).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.*; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetEmailsMetricsOptions options = GetEmailsMetricsOptions.builder() .startDate("2026-07-01") .endDate("2026-07-08") .metrics(MetricName.SENT, MetricName.DELIVERED, MetricName.OPEN_RATE) .dimensions(MetricsDimension.PERIOD, MetricsDimension.BROADCAST) .broadcastIds("5a5a3b1e-3b1a-4b1a-8b1a-3b1a4b1a8b1a") .build(); EmailsMetricsResponse metrics = resend.emails().metrics(options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.EmailMetricsAsync( new EmailMetricsQuery() { StartDate = new DateTime( 2026, 7, 1 ), EndDate = new DateTime( 2026, 7, 8 ), Metrics = new List { MetricType.Sent, MetricType.Delivered, MetricType.OpenRate }, Dimensions = new List { MetricDimension.Period, MetricDimension.Broadcast }, BroadcastId = new List { Guid.Parse( "5a5a3b1e-3b1a-4b1a-8b1a-3b1a4b1a8b1a" ) }, } ); Console.WriteLine( "Totals={0}", resp.Content?.Totals ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/emails/metrics?start_date=2026-07-01&end_date=2026-07-08&metrics=sent,delivered,open_rate&dimensions=period,domain' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "metrics", "start_date": "2026-07-01T00:00:00.000Z", "end_date": "2026-07-08T00:00:00.000Z", "metrics": ["sent", "delivered", "open_rate"], "dimensions": ["period", "domain"], "granularity": "daily", "totals": { "sent": 1204, "delivered": 1180, "open_rate": 50.0 }, "data": [ { "period": "2026-07-01", "domain_id": "d91cd9bd-1176-4f47-2a4b-fce2d5399cbf", "domain_name": "example.com", "sent": 172, "delivered": 169, "open_rate": 49.7 } ] } ``` # List Attachments Source: https://resend.com/docs/api-reference/emails/list-email-attachments GET /emails/:email_id/attachments Retrieve a list of attachments from a sent email. ## Query Parameters **limit** `number` Number of attachments to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more attachments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more attachments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ## Path Parameters **email\_id** `string` *required* The Email ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.attachments.list({ emailId: '4ef9a417-02e9-4d39-ad75-9611e0fcc33c', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->attachments->list( emailId: '4ef9a417-02e9-4d39-ad75-9611e0fcc33c' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' attachments = resend.Emails.Attachments.list( email_id='4ef9a417-02e9-4d39-ad75-9611e0fcc33c' ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' Resend::Emails::Attachments.list( email_id: "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Emails.ListAttachmentsWithContext( context.TODO(), "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _email = resend .emails .list_attachments( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", ListOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.ListAttachmentsResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListAttachmentsResponse response = resend.emails().listAttachments( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.EmailAttachmentListAsync( new Guid( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" )); Console.WriteLine( "Nr Attachments={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/emails/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails attachments 4ef9a417-02e9-4d39-ad75-9611e0fcc33c ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "size": 4096, "content_type": "image/png", "content_disposition": "inline", "content_id": "img001", "download_url": "https://outbound-cdn.resend.com/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318?some-params=example&signature=sig-123", "expires_at": "2026-10-17T14:29:41.521Z" } ] } ``` # List Sent Emails Source: https://resend.com/docs/api-reference/emails/list-emails GET /emails Retrieve a list of emails sent by your team. You can list all emails sent by your team. The list returns references to individual emails. If needed, you can use the `id` of an email to retrieve the email HTML to plain text using the [Retrieve Email](/docs/api-reference/emails/retrieve-email) endpoint or the [Retrieve Attachments](/docs/api-reference/emails/list-email-attachments) endpoint to get an email's attachments. > [!NOTE] > > This endpoint only returns emails sent by your team. If you need to list > emails received by your domain, use the [List Received > Emails](/docs/api-reference/emails/list-received-emails) endpoint. ## Query Parameters **limit** `number` Number of emails to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more emails (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more emails (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Emails.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" emails = Resend::Emails.list puts emails ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") paginatedResp, err := client.Emails.ListWithOptions(ctx, nil) if err != nil { panic(err) } if paginatedResp.HasMore { opts := &resend.ListOptions{ After: &paginatedResp.Data[len(paginatedResp.Data)-1].Id, } client.Emails.ListWithOptions(ctx, opts) } } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _emails = resend.emails.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.ListEmailsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListEmailsResponseSuccess emails = resend.emails().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.EmailListAsync(); Console.WriteLine( "Count={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/emails' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "message_id": "<111-222-333@email.example.com>", "to": ["delivered@resend.dev"], "from": "Acme ", "created_at": "2026-04-03 22:13:42.674981+00", "subject": "Hello World", "bcc": null, "cc": null, "reply_to": null, "last_event": "delivered", "scheduled_at": null }, { "id": "3a9f8c2b-1e5d-4f8a-9c7b-2d6e5f8a9c7b", "message_id": "<444-555-666@email.example.com>", "to": ["user@example.com"], "from": "Acme ", "created_at": "2026-04-03 21:45:12.345678+00", "subject": "Welcome to Acme", "bcc": null, "cc": null, "reply_to": null, "last_event": "opened", "scheduled_at": null } ] } ``` # List Attachments Source: https://resend.com/docs/api-reference/emails/list-received-email-attachments GET /emails/receiving/:email_id/attachments Retrieve a list of attachments from a received email. ## Query Parameters **limit** `number` Number of attachments to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more attachments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more attachments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ## Path Parameters **email\_id** `string` *required* The Email ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.receiving.attachments.list({ emailId: '4ef9a417-02e9-4d39-ad75-9611e0fcc33c', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->receiving->attachments->list( emailId: '4ef9a417-02e9-4d39-ad75-9611e0fcc33c' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' attachments = resend.Emails.Receiving.Attachments.list( email_id='4ef9a417-02e9-4d39-ad75-9611e0fcc33c' ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' attachments = Resend::Emails::Receiving::Attachments.list( email_id: '4ef9a417-02e9-4d39-ad75-9611e0fcc33c' ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Emails.Receiving.ListAttachmentsWithContext( context.TODO(), "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _email = resend .receiving .list_attachments( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", ListOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.receiving.model.ListAttachmentsResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListAttachmentsResponse response = resend.receiving().listAttachments( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ReceivedEmailAttachmentListAsync( new Guid( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" )); Console.WriteLine( "Nr Attachments={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails receiving attachments 4ef9a417-02e9-4d39-ad75-9611e0fcc33c ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "size": 4096, "content_type": "image/png", "content_disposition": "inline", "content_id": "img001", "download_url": "https://inbound-cdn.resend.com/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318?some-params=example&signature=sig-123", "expires_at": "2026-10-17T14:29:41.521Z" } ] } ``` # List Received Emails Source: https://resend.com/docs/api-reference/emails/list-received-emails GET /emails/receiving Retrieve a list of received emails for the authenticated user. You can list all emails received by your team. The list returns references to individual emails. If needed, you can use the `id` of an email to retrieve the email HTML to plain text using the [Retrieve Received Email](/docs/api-reference/emails/retrieve-received-email) endpoint or the [Retrieve Received Attachment](/docs/api-reference/emails/retrieve-received-email-attachment) endpoint to get an email's attachments. > [!NOTE] > > This endpoint only returns emails received by your team. If you need to list > emails sent by your team, use the [List Sent > Emails](/docs/api-reference/emails/list-emails) endpoint. ## Query Parameters **limit** `number` Number of emails to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more emails (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more emails (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.receiving.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->receiving->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Emails.Receiving.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Emails::Receiving.list() ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Emails.Receiving.ListWithContext(context.TODO()) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _email = resend.receiving.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.receiving.model.ListReceivedEmailsResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListReceivedEmailsResponse response = resend.receiving().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ReceivedEmailListAsync(); Console.WriteLine( "Nr Received={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/emails/receiving' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails receiving list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": true, "data": [ { "id": "a39999a6-88e3-48b1-888b-beaabcde1b33", "to": ["recipient@example.com"], "from": "sender@example.com", "created_at": "2026-10-09T14:37:40.951Z", "subject": "Hello World", "bcc": [], "cc": [], "reply_to": [], "message_id": "<111-222-333@email.example.com>", "attachments": [ { "filename": "example.txt", "content_type": "text/plain", "content_id": null, "content_disposition": "attachment", "id": "47e999c7-c89c-4999-bf32-aaaaa1c3ff21", "size": 13 } ] } ] } ``` # Retrieve Sent Email Source: https://resend.com/docs/api-reference/emails/retrieve-email GET /emails/:email_id Retrieve a single sent email. ## Path Parameters **id** `string` *required* The Email ID. > [!NOTE] > > See all available `last_event` types in [the Email Events > overview](/docs/dashboard/emails/manage-emails#understand-email-events). ```js Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.get( '37e4414c-5e25-4dbc-a071-43552a4bd53b', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->get('37e4414c-5e25-4dbc-a071-43552a4bd53b'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Emails.get(email_id="4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" email = Resend::Emails.get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") puts email ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Emails.Get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _email = resend .emails .get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.Email; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); Email email = resend.emails().get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.EmailRetrieveAsync( new Guid( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" ) ); Console.WriteLine( "Subject={0}", resp.Content.Subject ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/emails/4ef9a417-02e9-4d39-ad75-9611e0fcc33c' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails get 4ef9a417-02e9-4d39-ad75-9611e0fcc33c ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "email", "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "message_id": "<111-222-333@email.example.com>", "to": ["delivered@resend.dev"], "from": "Acme ", "created_at": "2026-04-03 22:13:42.674981+00", "subject": "Hello World", "html": "Congrats on sending your first email!", "text": null, "bcc": [], "cc": [], "reply_to": [], "last_event": "delivered", "scheduled_at": null, "tags": [ { "name": "category", "value": "confirm_email" } ] } ``` # Retrieve Attachment Source: https://resend.com/docs/api-reference/emails/retrieve-email-attachment GET /emails/:email_id/attachments/:attachment_id Retrieve a single attachment from a sent email. ## Path Parameters **id** `string` *required* The Attachment ID. **email\_id** `string` *required* The Email ID. ```js Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.attachments.get({ id: '2a0c9ce0-3112-4728-976e-47ddcd16a318', emailId: '4ef9a417-02e9-4d39-ad75-9611e0fcc33c', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->attachments->get( id: '2a0c9ce0-3112-4728-976e-47ddcd16a318', emailId: '4ef9a417-02e9-4d39-ad75-9611e0fcc33c' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' attachment = resend.Emails.Attachments.get( email_id='4ef9a417-02e9-4d39-ad75-9611e0fcc33c', attachment_id='2a0c9ce0-3112-4728-976e-47ddcd16a318' ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' Resend::Emails::Attachments.get( id: "2a0c9ce0-3112-4728-976e-47ddcd16a318", email_id: "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Emails.GetAttachmentWithContext( context.TODO(), "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _email = resend .emails .get_attachment( "2a0c9ce0-3112-4728-976e-47ddcd16a318", "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.AttachmentResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); AttachmentResponse attachment = resend.emails().getAttachment( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318" ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.EmailAttachmentRetrieveAsync( emailId: new Guid( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" ), attachmentId: new Guid( "2a0c9ce0-3112-4728-976e-47ddcd16a318" ) ); Console.WriteLine( "URL={0}", resp.Content.DownloadUrl ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/emails/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails attachment 4ef9a417-02e9-4d39-ad75-9611e0fcc33c 2a0c9ce0-3112-4728-976e-47ddcd16a318 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "attachment", "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "size": 4096, "content_type": "image/png", "content_disposition": "inline", "content_id": "img001", "download_url": "https://outbound-cdn.resend.com/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318?some-params=example&signature=sig-123", "expires_at": "2026-10-17T14:29:41.521Z" } ``` # Retrieve Received Email Source: https://resend.com/docs/api-reference/emails/retrieve-received-email GET /emails/receiving/:email_id Retrieve a single received email. ## Path Parameters **id** `string` *required* The ID for the received email. ## Query Parameters **html\_format** `'data_uri' | 'cid'` Controls how inline images are returned inside `html`. The response echoes the form actually served as `html_format` on the body. By default (or when set to `data_uri`), inline images appear in `html` as base64 `data:` URIs. Set `html_format=cid` to keep the original `` references instead. Each `cid:` matches the `content_id` of an attachment, so you can correlate inline images with entries in the `attachments` array and fetch them via the attachment download endpoint. Emails whose inlined HTML would exceed 100 MB, typically long reply chains that quote the same inline image hundreds of times, are always stored and returned with `cid:` references. For those emails the response reports `html_format: "cid"` regardless of the requested format, so check the `html_format` field on the body rather than assuming the format you asked for. ## Response Fields **html\_format** `'data_uri' | 'cid'` How inline images are referenced in `html`. Usually matches the requested format, but is `cid` when the email is too large to inline (see the query parameter above). **received\_for** `array` The recipient addresses the email was forwarded for, taken from the `for` clause of the message's `Received` headers. **authentication** `object | null` The SPF, DKIM, and DMARC results computed when the email was received. These come from the receiving mail server, not from the message headers, so the sender cannot forge them. `null` for emails received before this field was introduced. **properties** **spf** `'pass' | 'fail' | 'gray' | 'processing_failed' | 'unknown'` SPF result. `gray` means the result was `none`, `softfail`, or `neutral`. **dkim** `'pass' | 'fail' | 'gray' | 'processing_failed' | 'unknown'` DKIM result. `gray` means the message is not signed, or the signing domain does not match the `From` domain. **dmarc** `'pass' | 'fail' | 'gray' | 'processing_failed' | 'unknown'` DMARC result. `gray` means SPF or DKIM passed but the sending domain has no DMARC policy or uses `p=none`. **raw** `object | null` Raw email content download information. Contains a signed URL to download the original email file including all attachments. **properties** **download\_url** `string` Signed CloudFront URL to download the raw email file. **expires\_at** `string` ISO 8601 timestamp indicating when the download URL expires. ```js Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.receiving.get( '37e4414c-5e25-4dbc-a071-43552a4bd53b', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->receiving->get('37e4414c-5e25-4dbc-a071-43552a4bd53b'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Emails.Receiving.get(email_id="37e4414c-5e25-4dbc-a071-43552a4bd53b") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Emails::Receiving.get("37e4414c-5e25-4dbc-a071-43552a4bd53b") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Emails.Receiving.GetWithContext( context.TODO(), "37e4414c-5e25-4dbc-a071-43552a4bd53b", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::GetInboundEmailOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _email = resend .receiving .get( "37e4414c-5e25-4dbc-a071-43552a4bd53b", GetInboundEmailOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.receiving.model.ReceivedEmail; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ReceivedEmail email = resend.receiving().get("37e4414c-5e25-4dbc-a071-43552a4bd53b"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ReceivedEmailRetrieveAsync( new Guid( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" ) ); Console.WriteLine( "Subject={0}", resp.Content.Subject ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails receiving get 4ef9a417-02e9-4d39-ad75-9611e0fcc33c ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "email", "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "to": ["delivered@resend.dev"], "from": "onboarding@resend.dev", "created_at": "2026-04-03T22:13:42.674Z", "subject": "Hello World", "html": "Congrats on sending your first email!", "html_format": "data_uri", "text": null, "headers": { "from": "Acme ", "return-path": "lucas.costa@resend.com", "mime-version": "1.0" }, "bcc": [], "cc": [], "reply_to": [], "received_for": ["forwarded@example.com"], "authentication": { "spf": "pass", "dkim": "pass", "dmarc": "pass" }, "message_id": "<111-222-333@email.example.com>", "raw": { "download_url": "https://example.resend.com/receiving/raw/054da427-439a-4e91-b785-e4fb1966285f?Signature=...", "expires_at": "2026-04-03T23:13:42.674Z" }, "attachments": [ { "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "content_type": "image/png", "content_disposition": "inline", "content_id": "img001", "size": 4096 }, { "id": "3b1d0df1-4223-5839-087f-54eedd27b419", "filename": "document.pdf", "content_type": "application/pdf", "content_disposition": null, "content_id": null, "size": 13264 } ] } ``` # Retrieve Attachment Source: https://resend.com/docs/api-reference/emails/retrieve-received-email-attachment GET /emails/receiving/:email_id/attachments/:attachment_id Retrieve a single attachment from a received email. ## Path Parameters **id** `string` *required* The Attachment ID. **email\_id** `string` *required* The Email ID. ```js Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.receiving.attachments.get({ id: '2a0c9ce0-3112-4728-976e-47ddcd16a318', emailId: '4ef9a417-02e9-4d39-ad75-9611e0fcc33c', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->receiving->attachments->get( id: '2a0c9ce0-3112-4728-976e-47ddcd16a318', emailId: '4ef9a417-02e9-4d39-ad75-9611e0fcc33c' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' attachment = resend.Emails.Receiving.Attachments.get( email_id='4ef9a417-02e9-4d39-ad75-9611e0fcc33c', attachment_id='2a0c9ce0-3112-4728-976e-47ddcd16a318' ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' attachment = Resend::Emails::Receiving::Attachments.get( id: '2a0c9ce0-3112-4728-976e-47ddcd16a318', email_id: '4ef9a417-02e9-4d39-ad75-9611e0fcc33c' ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Emails.Receiving.GetAttachmentWithContext( context.TODO(), "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _email = resend .receiving .get_attachment( "2a0c9ce0-3112-4728-976e-47ddcd16a318", "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.receiving.model.AttachmentDetails; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); AttachmentDetails attachment = resend.receiving().getAttachment( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318" ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.ReceivedEmailAttachmentRetrieveAsync( emailId: new Guid( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" ), attachmentId: new Guid( "2a0c9ce0-3112-4728-976e-47ddcd16a318" ) ); Console.WriteLine( "URL={0}", resp.Content.DownloadUrl ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails receiving attachment 4ef9a417-02e9-4d39-ad75-9611e0fcc33c 2a0c9ce0-3112-4728-976e-47ddcd16a318 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "attachment", "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "size": 4096, "content_type": "image/png", "content_disposition": "inline", "content_id": "img001", "download_url": "https://inbound-cdn.resend.com/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318?some-params=example&signature=sig-123", "expires_at": "2026-10-17T14:29:41.521Z" } ``` # Send Batch Emails Source: https://resend.com/docs/api-reference/emails/send-batch-emails POST /emails/batch Trigger up to 100 batch emails at once. Instead of sending one email per HTTP request, Resend provides a batching endpoint that permits you to send up to 100 emails in a single API call. ## Body Parameters **from** `string` *required* Sender email address. To include a friendly name, pass the sender as `Name `, for example `Acme `. **to** `string | string[]` *required* Recipient email address. For multiple addresses, send as an array of strings. Max 50. **subject** `string` *required* Email subject. **bcc** `string | string[]` Bcc recipient email address. For multiple addresses, send as an array of strings. **cc** `string | string[]` Cc recipient email address. For multiple addresses, send as an array of strings. Schedule email to be sent later. The date should be in natural language (e.g.: `in 1 min`) or ISO 8601 format (e.g: `2026-08-05T11:52:01.858Z`). [See examples](/docs/dashboard/emails/schedule-email) Reply-to email address. For multiple addresses, send as an array of strings. **html** `string` The HTML version of the message. **text** `string` The plain text version of the message. > [!NOTE] > > If not provided, the HTML will be used to generate a plain text version. You > can opt out of this behavior by setting value to an empty string. **react** `React.ReactNode` The React component used to write the message. *Only available in the Node.js SDK.* **headers** `object` Custom headers to add to the email. The topic ID to receive the email. * If the recipient is a contact and has opted-in to the topic, the email is sent. * If the recipient is a contact and has opted-out of the topic, the email is not sent and will be marked as failed. * If the recipient is not a contact, the email is sent if the topic default subscription value is set to `opt-in`. > [!NOTE] > > Each email address (to, cc, bcc) is checked and handled separately. **tags** `array` Custom data passed in key/value pairs. [See examples](/docs/dashboard/emails/tags). **properties** **name** `string` *required* The name of the email tag. It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (\_), or dashes (-). It can contain no more than 256 characters. **value** `string` *required* The value of the email tag. It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (\_), or dashes (-). It can contain no more than 256 characters. **template** `object` To send using a template, provide a `template` object with: * `id`: the id *or* the alias of the published template * `variables`: an object with a key for each variable (if applicable) > [!NOTE] > > If a `template` is provided, you cannot send `html`, `text`, or `react` in the payload, otherwise the API will return a validation error. > > When sending a template, the payload for `from`, `subject`, and `reply_to` take precedence over the template's defaults for these fields. If the template does not provide a default value for these fields, you must provide them in the payload. **id** `string` *required* The id of the published email template. Required if `template` is provided. Only published templates can be used when sending emails. **variables** `object` Template variables object with key/value pairs. ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} variables: { CTA: 'Sign up now', CTA_LINK: 'https://example.com/signup' } ``` When sending the template, the HTML will be parsed. If all the variables used in the template were provided, the email will be sent. If not, the call will throw a validation error. See the [errors reference](/docs/api-reference/errors) for more details or [learn more about templates](/docs/dashboard/templates/introduction). **properties** **key** `string` *required* The key of the variable. May only contain ASCII letters (a–z, A–Z), numbers (0–9), and underscores (\_). The following variable names are reserved and cannot be used: `FIRST_NAME`, `LAST_NAME`, `EMAIL`, `UNSUBSCRIBE_URL`. It can contain no more than 50 characters. **value** `string | number` *required* The value of the variable. Observe these technical limitations: * `string`: maximum length of 2,000 characters * `number`: not greater than 2^53 - 1 ## Headers **Idempotency-Key** `string` Add an idempotency key to prevent duplicated emails. * Should be **unique per API request** * Idempotency keys expire after **24 hours** * Have a maximum length of **256 characters** [Learn more about idempotency keys →](/docs/dashboard/emails/idempotency-keys) ## Limitations The `attachments` field is not supported yet. ## Response format When the request succeeds, each entry in `data` corresponds to the email at the same index in the batch payload (0-based). The first email in your request will be the first entry in `data`, and so on. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.batch.send([ { from: 'Acme ', to: ['foo@gmail.com'], subject: 'hello world', html: '

it works!

', }, { from: 'Acme ', to: ['bar@outlook.com'], subject: 'world hello', html: '

it works!

', }, ]); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->batch->send([ [ 'from' => 'Acme ', 'to' => ['foo@gmail.com'], 'subject' => 'hello world', 'html' => '

it works!

', ], [ 'from' => 'Acme ', 'to' => ['bar@outlook.com'], 'subject' => 'world hello', 'html' => '

it works!

', ] ]); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend from typing import List resend.api_key = "re_xxxxxxxxx" params: List[resend.Emails.SendParams] = [ { "from": "Acme ", "to": ["foo@gmail.com"], "subject": "hello world", "html": "

it works!

", }, { "from": "Acme ", "to": ["bar@outlook.com"], "subject": "world hello", "html": "

it works!

", } ] resend.Batch.send(params) ``` ```rb Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = 're_xxxxxxxxx' params = [ { "from": "Acme ", "to": ["foo@gmail.com"], "subject": "hello world", "html": "

it works!

", }, { "from": "Acme ", "to": ["bar@outlook.com"], "subject": "world hello", "html": "

it works!

", } ] Resend::Batch.send(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") var batchEmails = []*resend.SendEmailRequest{ { From: "Acme ", To: []string{"foo@gmail.com"}, Subject: "hello world", Html: "

it works!

", }, { From: "Acme ", To: []string{"bar@outlook.com"}, Subject: "world hello", Html: "

it works!

", }, } sent, err := client.Batch.SendWithContext(ctx, batchEmails) if err != nil { panic(err) } fmt.Println(sent.Data) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::types::CreateEmailBaseOptions; use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let emails = vec![ CreateEmailBaseOptions::new( "Acme ", vec!["foo@gmail.com"], "hello world", ) .with_html("

it works!

"), CreateEmailBaseOptions::new( "Acme ", vec!["bar@outlook.com"], "world hello", ) .with_html("

it works!

"), ]; let _emails = resend.batch.send(emails).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.batch.model.CreateBatchEmailsResponse; import com.resend.services.emails.model.CreateEmailOptions; import java.util.Arrays; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateEmailOptions firstEmail = CreateEmailOptions.builder() .from("Acme ") .to("foo@gmail.com") .subject("hello world") .html("

it works!

") .build(); CreateEmailOptions secondEmail = CreateEmailOptions.builder() .from("Acme ") .to("bar@outlook.com") .subject("world hello") .html("

it works!

") .build(); CreateBatchEmailsResponse data = resend.batch().send( Arrays.asList(firstEmail, secondEmail) ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var mail1 = new EmailMessage() { From = "Acme ", To = "foo@gmail.com", Subject = "hello world", HtmlBody = "

it works!

", }; var mail2 = new EmailMessage() { From = "Acme ", To = "bar@outlook.com", Subject = "hello world", HtmlBody = "

it works!

", }; var resp = await resend.EmailBatchAsync( [ mail1, mail2 ] ); Console.WriteLine( "Nr Emails={0}", resp.Content.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/emails/batch' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'[ { "from": "Acme ", "to": ["foo@gmail.com"], "subject": "hello world", "html": "

it works!

" }, { "from": "Acme ", "to": ["bar@outlook.com"], "subject": "world hello", "html": "

it works!

" } ]' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails batch --file ./path/to/emails.json ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "data": [ { "id": "ae2014de-c168-4c61-8267-70d2662a1ce1" }, { "id": "faccb7a5-8a28-4e9a-ac64-8da1cc3bc1cb" } ] } ``` # Send Email Source: https://resend.com/docs/api-reference/emails/send-email POST /emails Start sending emails through the Resend Email API. ## Body Parameters **from** `string` *required* Sender email address. To include a friendly name, pass the sender as `Name `, for example `Acme `. **to** `string | string[]` *required* Recipient email address. For multiple addresses, send as an array of strings. Max 50. **subject** `string` *required* Email subject. **bcc** `string | string[]` Bcc recipient email address. For multiple addresses, send as an array of strings. **cc** `string | string[]` Cc recipient email address. For multiple addresses, send as an array of strings. Schedule email to be sent later. The date should be in natural language (e.g.: `in 1 min`) or ISO 8601 format (e.g: `2026-08-05T11:52:01.858Z`). [See examples](/docs/dashboard/emails/schedule-email) Reply-to email address. For multiple addresses, send as an array of strings. **html** `string` The HTML version of the message. **text** `string` The plain text version of the message. > [!NOTE] > > If not provided, the HTML will be used to generate a plain text version. You > can opt out of this behavior by setting value to an empty string. **react** `React.ReactNode` The React component used to write the message. *Only available in the Node.js SDK.* **headers** `object` Custom headers to add to the email. The topic ID to receive the email. * If the recipient is a contact and has opted-in to the topic, the email is sent. * If the recipient is a contact and has opted-out of the topic, the email is not sent and will be marked as failed. * If the recipient is not a contact, the email is sent if the topic default subscription value is set to `opt-in`. > [!NOTE] > > Each email address (to, cc, bcc) is checked and handled separately. **attachments** `array` Filename and content of attachments (max 40MB per email, after Base64 encoding of the attachments). [See examples](/docs/dashboard/emails/attachments) **properties** **content** `buffer | string` Content of an attached file, passed as a buffer or Base64 string. **filename** `string` Name of attached file. **path** `string` Path where the attachment file is hosted Content type for the attachment, if not set will be derived from the filename property You can embed images using the content id parameter for the attachment. To show the image, you need to include the ID in the `src` attribute of the `img` tag (e.g., ``) of your HTML. [Learn about inline images](/docs/dashboard/emails/embed-inline-images). **tags** `array` Custom data passed in key/value pairs. [See examples](/docs/dashboard/emails/tags). **properties** **name** `string` *required* The name of the email tag. It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (\_), or dashes (-). It can contain no more than 256 characters. **value** `string` *required* The value of the email tag. It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (\_), or dashes (-). It can contain no more than 256 characters. **template** `object` To send using a template, provide a `template` object with: * `id`: the id *or* the alias of the published template * `variables`: an object with a key for each variable (if applicable) > [!NOTE] > > If a `template` is provided, you cannot send `html`, `text`, or `react` in the payload, otherwise the API will return a validation error. > > When sending a template, the payload for `from`, `subject`, and `reply_to` take precedence over the template's defaults for these fields. If the template does not provide a default value for these fields, you must provide them in the payload. **id** `string` *required* The id of the published email template. Required if `template` is provided. Only published templates can be used when sending emails. **variables** `object` Template variables object with key/value pairs. ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} variables: { CTA: 'Sign up now', CTA_LINK: 'https://example.com/signup' } ``` When sending the template, the HTML will be parsed. If all the variables used in the template were provided, the email will be sent. If not, the call will throw a validation error. See the [errors reference](/docs/api-reference/errors) for more details or [learn more about templates](/docs/dashboard/templates/introduction). **properties** **key** `string` *required* The key of the variable. May only contain ASCII letters (a–z, A–Z), numbers (0–9), and underscores (\_). The following variable names are reserved and cannot be used: `FIRST_NAME`, `LAST_NAME`, `EMAIL`, `UNSUBSCRIBE_URL`. It can contain no more than 50 characters. **value** `string | number` *required* The value of the variable. Observe these technical limitations: * `string`: maximum length of 2,000 characters * `number`: not greater than 2^53 - 1 ## Headers **Idempotency-Key** `string` Add an idempotency key to prevent duplicated emails. * Should be **unique per API request** * Idempotency keys expire after **24 hours** * Have a maximum length of **256 characters** [Learn more](/docs/dashboard/emails/idempotency-keys) ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.send({ from: 'Acme ', to: ['delivered@resend.dev'], subject: 'hello world', html: '

it works!

', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->send([ 'from' => 'Acme ', 'to' => ['delivered@resend.dev'], 'subject' => 'hello world', 'html' => '

it works!

' ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Emails.SendParams = { "from": "Acme ", "to": ["delivered@resend.dev"], "subject": "hello world", "html": "

it works!

" } email = resend.Emails.send(params) print(email) ``` ```rb Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { "from": "Acme ", "to": ["delivered@resend.dev"], "subject": "hello world", "html": "

it works!

" } sent = Resend::Emails.send(params) puts sent ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") params := &resend.SendEmailRequest{ From: "Acme ", To: []string{"delivered@resend.dev"}, Subject: "hello world", Html: "

it works!

", } sent, err := client.Emails.SendWithContext(ctx, params) if err != nil { panic(err) } fmt.Println(sent.Id) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::types::{CreateEmailBaseOptions}; use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let from = "Acme "; let to = ["delivered@resend.dev"]; let subject = "hello world"; let html = "

it works!

"; let email = CreateEmailBaseOptions::new(from, to, subject) .with_html(html); let _email = resend.emails.send(email).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.CreateEmailOptions; import com.resend.services.emails.model.CreateEmailResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateEmailOptions params = CreateEmailOptions.builder() .from("Acme ") .to("delivered@resend.dev") .subject("hello world") .html("

it works!

") .build(); CreateEmailResponse data = resend.emails().send(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.EmailSendAsync( new EmailMessage() { From = "Acme ", To = "delivered@resend.dev", Subject = "hello world", HtmlBody = "

it works!

", } ); Console.WriteLine( "Email Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/emails' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "from": "Acme ", "to": ["delivered@resend.dev"], "subject": "hello world", "html": "

it works!

" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "hello world" \ --html "

it works!

" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` # Share Email Source: https://resend.com/docs/api-reference/emails/share-email POST /emails/:email_id/share Create a shareable link to view a sent or received email. ## Path Parameters The Email ID. ## Body Parameters How long the link stays valid for, as a duration like `10m`, `2 hours`, or `1 day`. Defaults to `48h` and cannot exceed 48 hours. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.emails.share( '49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', { expiresIn: '2 hours' }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->emails->share('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', [ 'expires_in' => '2 hours' ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" share_params: resend.Emails.ShareParams = { "expires_in": "2 hours" } resend.Emails.share( email_id="49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", params=share_params ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Emails.share( "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", expires_in: "2 hours" ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "fmt" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") shareParams := &resend.ShareEmailRequest{ ExpiresIn: "2 hours", } shared, err := client.Emails.Share("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", shareParams) if err != nil { panic(err) } fmt.Println(shared.Url) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::types::ShareEmailOptions; use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let share = ShareEmailOptions::new() .with_expires_in("2 hours"); let _shared = resend .emails .share("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", share) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.ShareEmailOptions; import com.resend.services.emails.model.ShareEmailResponse; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ShareEmailOptions shareParams = ShareEmailOptions.builder() .expiresIn("2 hours") .build(); ShareEmailResponse data = resend .emails() .share("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", shareParams); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.EmailShareAsync( new Guid( "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" ), "2 hours" ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794/share' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "expires_in": "2 hours" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails share 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 \ --expires-in "2 hours" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "email", "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "url": "https://resend.com/shared?token=eyJhbGciOiJIUzI1NiJ9..." } ``` # Update Email Source: https://resend.com/docs/api-reference/emails/update-email PATCH /emails/:email_id Update a scheduled email. ## Path Parameters **id** `string` *required* The Email ID. ## Body Parameters Schedule email to be sent later. The date should be in ISO 8601 format (e.g: 2026-08-05T11:52:01.858Z). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const oneMinuteFromNow = new Date(Date.now() + 1000 * 60).toISOString(); const { data, error } = await resend.emails.update({ id: '49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', scheduledAt: oneMinuteFromNow, }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $oneMinuteFromNow = (new DateTime())->modify('+1 minute')->format(DateTime::ISO8601); $resend->emails->update('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', [ 'scheduled_at' => $oneMinuteFromNow ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend from datetime import datetime, timedelta resend.api_key = "re_xxxxxxxxx" one_minute_from_now = (datetime.now() + timedelta(minutes=1)).isoformat() update_params: resend.Emails.UpdateParams = { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "scheduled_at": one_minute_from_now } resend.Emails.update(params=update_params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" one_minute_from_now = (Time.now + 1 * 60).strftime("%Y-%m-%dT%H:%M:%S.%L%z") update_params = { "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "scheduled_at": one_minute_from_now } Resend::Emails.update(update_params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "time" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") oneMinuteFromNow := time.Now().Add(time.Minute * time.Duration(1)) oneMinuteFromNowIso := oneMinuteFromNow.Format("2006-01-02T15:04:05-0700") updateParams := &resend.UpdateEmailRequest{ Id: "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", ScheduledAt: oneMinuteFromNowIso, } client.Emails.Update(updateParams) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use chrono::{Local, TimeDelta}; use resend_rs::types::UpdateEmailOptions; use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let one_minute_from_now = Local::now() .checked_add_signed(TimeDelta::minutes(1)) .unwrap() .to_rfc3339(); let update = UpdateEmailOptions::new() .with_scheduled_at(&one_minute_from_now); let _email = resend .emails .update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", update) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.UpdateEmailOptions; import com.resend.services.emails.model.UpdateEmailResponse; import java.time.Instant; import java.time.temporal.ChronoUnit; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); String oneMinuteFromNow = Instant .now() .plus(1, ChronoUnit.MINUTES) .toString(); UpdateEmailOptions updateParams = UpdateEmailOptions.builder() .scheduledAt(oneMinuteFromNow) .build(); UpdateEmailResponse data = resend.emails().update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", updateParams); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.EmailRescheduleAsync( new Guid( "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" ), DateTime.UtcNow.AddMinutes( 1 ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "scheduled_at": "2026-08-05T11:52:01.858Z" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails update 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 \ --scheduled-at "2026-08-05T11:52:01.858Z" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "email", "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` # Errors Source: https://resend.com/docs/api-reference/errors Troubleshoot problems with this comprehensive breakdown of all error codes. ## Error schema Resend uses standard HTTP response codes for success and failure notifications, and errors are further classified by type. ### `invalid_idempotency_key` * **Status:** 400 * **Message:** Idempotency keys, if present, must have between 1 and 256 characters. * **Suggested action:** Retry with a valid idempotency key. ### `validation_error` * **Status:** 400 * **Message:** An error was found with one or more fields in the request. * **Suggested action:** The message will contain more details about what field and error were found. ### `validation_error` * **Status:** 400 * **Message:** API key is invalid * **Suggested action:** Check the key on the [API Keys page](https://resend.com/api-keys) and create a new one if it was deleted. Every endpoint except sending returns this for a key that doesn't exist or was deleted, and every endpoint returns it when the `Authorization` header isn't a valid key. ### `missing_api_key` * **Status:** 401 * **Message:** Missing API Key * **Suggested action:** Include the following header in the request: `Authorization: Bearer YOUR_API_KEY`. ### `restricted_api_key` * **Status:** 401 * **Message:** This API key is restricted to only send emails. * **Suggested action:** Make sure the API key has `Full access` to perform actions other than sending emails. ### `validation_error` * **Status:** 401 * **Message:** API key is invalid * **Suggested action:** Check the key on the [API Keys page](https://resend.com/api-keys) and create a new one if it was deleted. The sending endpoints return this for a key that doesn't exist, was deleted, or isn't active. ### `email_above_quota` * **Status:** 403 * **Message:** You can't retrieve this email's content because it was above quota when received. * **Suggested action:** [Upgrade your plan](https://resend.com/settings/billing) to increase your quota. ### `invalid_permission` * **Status:** 403 * **Message:** Access token is missing required scopes. * **Suggested action:** Request an access token that includes the scopes required by this endpoint. ### `restricted_api_key` * **Status:** 403 * **Message:** API key is not active * **Suggested action:** Check the API key on the [API Keys page](https://resend.com/api-keys) and create a new one if needed. ### `suspended_api_key` * **Status:** 403 * **Message:** This API key is suspended * **Suggested action:** [Contact support](https://resend.com/contact) if you believe this is a mistake. ### `validation_error` * **Status:** 403 * **Message:** You can only send testing emails to your own email address (`youremail@domain.com`). To send emails to other recipients, please verify a domain at resend.com/domains, and change the `from` address to an email using this domain. * **Suggested action:** In [Resend's Domain page](https://resend.com/domains), add and verify a domain for which you have DNS access. This allows you to send emails to addresses beyond your own. [Learn more about resolving this error](/docs/knowledge-base/403-error-resend-dev-domain). ### `validation_error` * **Status:** 403 * **Message:** The `domain.com` domain is not verified. Please, add and verify your domain. * **Suggested action:** Make sure the domain in your API request's `from` field matches a domain you've verified in Resend. Update your API request to use your verified domain, or add and verify the domain you're trying to use. [Learn more about resolving this error](/docs/knowledge-base/403-error-domain-mismatch). ### `validation_error` * **Status:** 403 * **Message:** The `example.com` domain has been registered already. * **Suggested action:** Verify you are signed in to the correct Resend account and check whether a teammate already added the domain. If you still cannot access it, [contact support](https://resend.com/help). [Learn more about resolving this error](/docs/knowledge-base/domain-already-registered). ### `validation_error` * **Status:** 403 * **Message:** You have reached the inboxes included in your plan. Enable pay-as-you-go for inboxes at [https://resend.com/settings/usage](https://resend.com/settings/usage) to add more. * **Suggested action:** Every plan includes 3 inboxes. A team admin can enable pay-as-you-go for inboxes in your [usage settings](https://resend.com/settings/usage), after which each extra inbox costs \$1 per month. ### `validation_error` * **Status:** 403 * **Message:** You have reached the inboxes included in your plan. Upgrade your Transactional plan to unlock pay-as-you-go for inboxes. * **Suggested action:** Every plan includes 3 inboxes, and pay-as-you-go for inboxes needs a paid Transactional plan. [Upgrade your plan](https://resend.com/settings/billing), then enable pay-as-you-go for inboxes in your [usage settings](https://resend.com/settings/usage). ### `validation_error` * **Status:** 403 * **Message:** You have reached the inboxes included in your plan. Pay-as-you-go for inboxes isn't available for your billing setup. * **Suggested action:** Teams billed through Vercel or Stripe Projects cannot enable pay-as-you-go for inboxes. [Contact support](https://resend.com/help) if you need more than the 3 included inboxes. ### `validation_error` * **Status:** 403 * **Message:** You have reached the inboxes included in your plan. Manage pay-as-you-go for inboxes at [https://resend.com/settings/usage](https://resend.com/settings/usage) to add more. * **Suggested action:** Every plan includes 3 inboxes. Open your [usage settings](https://resend.com/settings/usage) to enable pay-as-you-go for inboxes, which needs a paid Transactional plan. ### `not_found` * **Status:** 404 * **Message:** The requested endpoint does not exist. * **Suggested action:** Change your request URL to match a valid API endpoint. ### `method_not_allowed` * **Status:** 405 * **Message:** Method is not allowed for the requested path. * **Suggested action:** Change your API endpoint to use a valid method. ### `concurrent_idempotent_requests` * **Status:** 409 * **Message:** There is another request in progress with the same idempotency key. * **Suggested action:** Try the request again later. ### `invalid_idempotent_request` * **Status:** 409 * **Message:** This idempotency key has been used with this HTTP method and endpoint within the last 24 hours, but the request body was modified and doesn't match the original request. * **Suggested action:** Change your idempotency key or payload. ### `resource_locked` * **Status:** 409 * **Message:** Another request is already updating this resource. * **Suggested action:** Retry the request after a short delay. ### `invalid_attachment` * **Status:** 422 * **Message:** Attachment must have either a `content` or `path`. * **Suggested action:** Attachments must either have a `content` (strings, Buffer, or Stream contents) or `path` to a remote resource (better for larger attachments). ### `invalid_parameter` * **Status:** 422 * **Message:** The `parameter` must be a valid UUID. * **Suggested action:** Check the value and make sure it's valid. ### `missing_required_field` * **Status:** 422 * **Message:** The request body is missing one or more required fields. * **Suggested action:** Check the error message to see the list of missing fields. ### `missing_required_parameter` * **Status:** 422 * **Message:** The request is missing one or more required parameters. * **Suggested action:** Check the error message to see the list of missing parameters. ### `daily_quota_exceeded` * **Status:** 429 * **Message:** You have exceeded your daily email sending quota. * **Suggested action:** [Upgrade your plan](https://resend.com/settings/billing) to remove the daily quota limit or wait for the quota to reset at midnight UTC. Both sent and received emails count towards this quota. ### `monthly_quota_exceeded` * **Status:** 429 * **Message:** You have exceeded your monthly email sending quota. * **Suggested action:** [Upgrade your plan](https://resend.com/settings/billing) to increase the monthly email quota. Both sent and received emails count towards this quota. ### `rate_limit_exceeded` * **Status:** 429 * **Message:** Too many requests. Please limit the number of requests per second. Or [contact support](https://resend.com/contact) to increase rate limit. * **Suggested action:** Read the [response headers](/docs/api-reference/introduction#rate-limit) and reduce the rate at which you request the API. This can be done by introducing a queue mechanism or reducing the number of concurrent requests per second. If you have specific requirements, [contact support](https://resend.com/contact) to request a rate increase. ### `application_error` * **Status:** 500 * **Message:** An unexpected error occurred. * **Suggested action:** Try the request again later. If the error does not resolve, check our [status page](https://resend-status.com) for service updates. ### `service_unavailable` * **Status:** 503 * **Message:** API is temporarily unavailable * **Suggested action:** Try the request again later. Check our [status page](https://resend-status.com) for service updates. # Create Event Source: https://resend.com/docs/api-reference/events/create-event POST /events Create a new event that can be used to trigger automations. ## Body Parameters **name** `string` *required* The name of the event. Used to match events to automation triggers. > [!NOTE] > > The event name can be any string (e.g., `user.created`, `welcome`, > `my-custom-event`). Dot notation is a recommended convention but is not > required. If multiple enabled automations use the same event name, all of them > will be triggered. Use unique event names if you want to target a specific > automation. > [!WARNING] > > Event names cannot start with the `resend:` prefix, which is reserved for system events. **schema** `object` An optional schema definition for the event payload. Must be an object with flat key/type pairs. Supported types: `string`, `number`, `boolean`, `date`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.events.create({ name: 'user.created', schema: { plan: 'string', }, }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->events->create([ 'name' => 'user.created', 'schema' => ['plan' => 'string'], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Events.CreateParams = { "name": "user.created", "schema": { "plan": "string", }, } resend.Events.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { name: "user.created", schema: { plan: "string", }, } Resend::Events.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateEventRequest{ Name: "user.created", Schema: map[string]string{ "plan": resend.EventSchemaTypeString, }, } client.Events.Create(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{json, types::CreateEventOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = CreateEventOptions { name: "user.created".to_owned(), schema: json!({ "plan": "string", }), }; let _event = resend.events.create(opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.events.model.CreateEventOptions; import com.resend.services.events.model.CreateEventResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateEventOptions params = CreateEventOptions.builder() .name("user.created") .addSchema("plan", "string") .build(); CreateEventResponseSuccess data = resend.events().create(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; using System.Text.Json; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var schema = JsonSerializer.SerializeToElement( new { plan = "string" } ); var resp = await resend.EventCreateAsync( new EventCreateData() { Name = "user.created", Schema = schema, } ); Console.WriteLine( "EventId={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/events' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "user.created", "schema": { "plan": "string" } }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend events create --name user.created --schema '{"plan":"string"}' ``` > [!NOTE] > > Successful creation returns **201 Created** with the JSON body below. ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "event", "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" } ``` # Delete Event Source: https://resend.com/docs/api-reference/events/delete-event DELETE /events/:id Remove an existing event. ## Path Parameters The event ID or name. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.events.remove('user.created'); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->events->remove('user.created'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Events.remove("user.created") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Events.remove("user.created") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Events.Remove("user.created") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _event = resend.events.delete("user.created").await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.events.model.RemoveEventResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RemoveEventResponseSuccess data = resend.events().remove("user.created"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.EventDeleteAsync( "user.created" ); Console.WriteLine( "Deleted={0}", resp.Content.Deleted ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/events/user.created' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend events delete user.created ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "event", "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "deleted": true } ``` # Retrieve Event Source: https://resend.com/docs/api-reference/events/get-event GET /events/:id Retrieve a single event by ID or name. ## Path Parameters The event ID or name. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.events.get('user.created'); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->events->get('user.created'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Events.get("user.created") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Events.get("user.created") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Events.Get("user.created") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _event = resend.events.get("user.created").await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.events.model.Event; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); Event event = resend.events().get("user.created"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.EventRetrieveAsync( "user.created" ); Console.WriteLine( "Name={0}", resp.Content.Name ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/events/user.created' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend events get user.created ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "event", "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "user.created", "schema": { "plan": "string" }, "created_at": "2026-10-01 12:00:00.000000+00", "updated_at": "2026-10-01 12:00:00.000000+00" } ``` # List Events Source: https://resend.com/docs/api-reference/events/list-events GET /events Retrieve a list of events. ## Query Parameters **limit** `number` Number of events to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more events (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more events (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.events.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->events->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Events.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Events.list ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Events.List() } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _events = resend.events.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.events.model.ListEventsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListEventsResponseSuccess data = resend.events().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.EventListAsync(); Console.WriteLine( "Count={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/events' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend events list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "user.created", "schema": { "plan": "string" }, "created_at": "2026-10-01 12:00:00.000000+00", "updated_at": "2026-10-01 12:00:00.000000+00" }, { "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901", "name": "user.upgraded", "schema": null, "created_at": "2026-09-15 08:30:00.000000+00", "updated_at": "2026-09-20 14:00:00.000000+00" } ] } ``` # Send Event Source: https://resend.com/docs/api-reference/events/send-event POST /events/send Send a named event to trigger matching automations. ## Body Parameters **event** `string` *required* The name of the event to trigger. Must match the event name configured in an automation trigger step. Either `contact_id` or `email` must be provided, but not both. The contact ID (UUID) to associate with this event. Exactly one of `contact_id` or `email` must be provided. **email** `string` The email address to associate with this event. Exactly one of `contact_id` or `email` must be provided. If no contact with this email exists in your Audience, one will be created automatically when the automation runs. **payload** `object` An optional object containing custom data to pass to the automation. This data can be used in template variables and conditions. If the event has a schema defined, the payload values will be validated and coerced to match the schema types. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.events.send({ event: 'user.created', contactId: '7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b', // or: email: 'steve.wozniak@gmail.com', payload: { plan: 'pro', }, }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Trigger with a contact ID $resend->events->send([ 'event' => 'user.created', 'contact_id' => '7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b', 'payload' => ['plan' => 'pro'], ]); // Trigger with an email address $resend->events->send([ 'event' => 'user.created', 'email' => 'steve.wozniak@gmail.com', 'payload' => ['plan' => 'pro'], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" # Trigger with a contact ID params: resend.Events.SendParams = { "event": "user.created", "contact_id": "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", "payload": { "plan": "pro", }, } resend.Events.send(params) # Trigger with an email address params: resend.Events.SendParams = { "event": "user.created", "email": "steve.wozniak@gmail.com", "payload": { "plan": "pro", }, } resend.Events.send(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" # Trigger with a contact ID params = { event: "user.created", contact_id: "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", payload: { plan: "pro", }, } Resend::Events.send(params) # Trigger with an email address params = { event: "user.created", email: "steve.wozniak@gmail.com", payload: { plan: "pro", }, } Resend::Events.send(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") // Trigger with a contact ID params := &resend.SendEventRequest{ Event: "user.created", ContactId: "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", Payload: map[string]any{ "plan": "pro", }, } client.Events.Send(params) // Trigger with an email address params = &resend.SendEventRequest{ Event: "user.created", Email: "steve.wozniak@gmail.com", Payload: map[string]any{ "plan": "pro", }, } client.Events.Send(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ json, types::{ContactIdOrEmail, SendEventOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = SendEventOptions { event: "user.created".to_owned(), contact_id_or_email: ContactIdOrEmail::ContactId( "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b".to_owned(), ), // or: ContactIdOrEmail::Email("steve.wozniak@gmail.com".to_owned()) payload: json!({ "plan": "pro" }), }; let _event = resend.events.send(opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.events.model.SendEventOptions; import com.resend.services.events.model.SendEventResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); SendEventOptions params = SendEventOptions.builder() .event("user.created") .contactId("7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b") // or: .email("steve.wozniak@gmail.com") .addPayload("plan", "pro") .build(); SendEventResponseSuccess data = resend.events().send(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; using System.Text.Json; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var payload = JsonSerializer.SerializeToElement( new { plan = "pro" } ); // Trigger with a contact ID var resp = await resend.EventSendAsync( new EventSendData() { Event = "user.created", ContactId = new Guid( "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b" ), Payload = payload, } ); Console.WriteLine( "Event={0}", resp.Content.Event ); // Trigger with an email address await resend.EventSendAsync( new EventSendData() { Event = "user.created", Email = "steve.wozniak@gmail.com", Payload = payload, } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} # Trigger with a contact ID curl -X POST 'https://api.resend.com/events/send' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "event": "user.created", "contact_id": "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", "payload": { "plan": "pro" } }' # Trigger with an email address curl -X POST 'https://api.resend.com/events/send' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "event": "user.created", "email": "steve.wozniak@gmail.com", "payload": { "plan": "pro" } }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Trigger with a contact ID resend events send \ --event user.created \ --contact-id 7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b \ --payload '{"plan":"pro"}' # Trigger with an email address resend events send \ --event user.created \ --email steve.wozniak@gmail.com \ --payload '{"plan":"pro"}' ``` > [!NOTE] > > Successful requests return **202 Accepted** with the JSON body below. ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "event", "event": "user.created" } ``` # Update Event Source: https://resend.com/docs/api-reference/events/update-event PATCH /events/:id Update an existing event schema. ## Path Parameters The event ID or name. ## Body Parameters **schema** `object` *required* The updated schema definition for the event payload. Must be an object with flat key/type pairs, or `null` to clear the schema. Supported types: `string`, `number`, `boolean`, `date`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.events.update('user.created', { schema: { plan: 'string', trial: 'boolean', }, }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->events->update('user.created', [ 'schema' => [ 'plan' => 'string', 'trial' => 'boolean', ], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Events.UpdateParams = { "identifier": "user.created", "schema": { "plan": "string", "trial": "boolean", }, } resend.Events.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { identifier: "user.created", schema: { plan: "string", trial: "boolean", }, } Resend::Events.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.UpdateEventRequest{ Schema: map[string]string{ "plan": resend.EventSchemaTypeString, "trial": resend.EventSchemaTypeBoolean, }, } client.Events.Update("user.created", params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{json, types::UpdateEventOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = UpdateEventOptions { schema: json!({ "plan": "string", "trial": "boolean", }), }; let _event = resend.events.update("user.created", opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.events.model.UpdateEventOptions; import com.resend.services.events.model.UpdateEventResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateEventOptions params = UpdateEventOptions.builder() .identifier("user.created") .addSchema("plan", "string") .addSchema("trial", "boolean") .build(); UpdateEventResponseSuccess data = resend.events().update(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; using System.Text.Json; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var schema = JsonSerializer.SerializeToElement( new { plan = "string", trial = "boolean" } ); var resp = await resend.EventUpdateAsync( "user.created", new EventUpdateData { Schema = schema } ); Console.WriteLine( "EventId={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/events/user.created' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "schema": { "plan": "string", "trial": "boolean" } }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend events update user.created --schema '{"plan":"string","trial":"boolean"}' ``` > [!NOTE] > > Successful updates return **200 OK** with the JSON body below. ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "event", "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" } ``` # Add Thread Labels Source: https://resend.com/docs/api-reference/inboxes/add-thread-labels POST /inboxes/:inbox_id/threads/:thread_id/labels Apply one or more labels to a thread. Labels already on the thread stay on it. If any label ID is not found, the request returns a `404` and nothing changes. To replace the thread's labels instead, use [Set Thread Labels](/docs/api-reference/inboxes/set-thread-labels). ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Thread ID. ## Body Parameters **labels** `string[]` *required* The IDs of the labels to apply. Between 1 and 10 IDs, each belonging to the inbox. ## Response Fields **object** `string` Always `list`. **data** `array` Every label on the thread after the change. **properties** **id** `string` The ID of the label. **name** `string` The name of the label. **color** `string` The color of the label as an uppercase `#RRGGBB` hex code, like `#E93D82`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.labels.add({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', threadId: '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', labels: ['7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34'], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->labels->add( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', [ 'labels' => ['7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34'], ] ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Threads.Labels.AddParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "thread_id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "labels": ["7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34"], } resend.Inboxes.Threads.Labels.add(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id: "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", labels: ["7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34"] } Resend::Inboxes::Threads::Labels.add(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.AddInboxThreadLabelsRequest{ Labels: []string{"7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34"}, } client.Inboxes.Threads.Labels.Add( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", params, ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _labels = resend .inboxes .add_thread_labels( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", &["7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34"], ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.AddInboxThreadLabelsOptions; import com.resend.services.inboxes.model.AddInboxThreadLabelsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); AddInboxThreadLabelsOptions params = AddInboxThreadLabelsOptions.builder() .labels("7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34") .build(); AddInboxThreadLabelsResponseSuccess data = resend.inboxes().threads().addLabels( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadLabelAddAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" ), [ new Guid( "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34" ) ] ); Console.WriteLine( "Nr Labels={0}", resp.Content.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12/labels' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "labels": ["7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34"] }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads labels add b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12 \ --labels 7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "data": [ { "id": "2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d", "name": "Billing", "color": "#00A2C7" }, { "id": "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", "name": "Urgent", "color": "#E93D82" } ] } ``` # Create Draft Source: https://resend.com/docs/api-reference/inboxes/create-draft POST /inboxes/:inbox_id/drafts Create a draft in an inbox, either to start a new thread or reply to an existing thread. A draft lets you prepare a message before sending it. Omit `thread_id` and `reply_to_email_id` to start a new thread. Pass both for a reply draft. An email can have only one unsent reply draft. A request for an email that already has one returns a `200` with the existing Draft ID. It changes only the `attachments` of that draft. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Body Parameters At least one of `to`, `cc`, `bcc`, `subject`, `text`, `html`, or `attachments` must be non-empty. `to`, `cc`, and `bcc` combined cannot exceed 50 recipients. **to** `string | string[] | null` Recipients. For multiple addresses, send an array of strings. Each value can include a friendly name, for example `Ada Lovelace `. On a reply draft, when you omit `to` or send `null`, the draft gets the recipients of a [reply](/docs/api-reference/inboxes/reply-thread-email). Send `[]` for no recipients. **cc** `string | string[] | null` CC recipients. **bcc** `string | string[] | null` BCC recipients. **subject** `string | null` The subject. 1 to 2000 characters, with no line breaks. **html** `string | null` The HTML body. **text** `string | null` The plain-text body. **attachments** `array | null` Files to store on the draft, up to 25 MB in total, downloaded files included. All `path` downloads must finish within 20 seconds together. Drafts do not accept `content_id`. **properties** **content** `buffer | string` Content of an attached file, passed as a buffer or Base64 string. Either `content` or `path` must be provided. **path** `string` Path where the attachment file is hosted. Resend downloads it when the draft is saved, so a URL that cannot be downloaded returns an error. When both `content` and `path` are sent, `content` is used. **filename** `string` *required* Name of attached file. Content type for the attachment. Must be a valid MIME type, such as `application/pdf`. Required with `content`. With `path`, it defaults to the type of the downloaded file. The Thread ID to reply in. Must be sent with `reply_to_email_id`. The Email ID to reply to, as returned by [List Thread Emails](/docs/api-reference/inboxes/list-thread-emails) in `data[].id`. Must be sent with `thread_id`. ## Headers **Idempotency-Key** `string` Add an idempotency key to prevent duplicated drafts. * Should be **unique per API request** * Idempotency keys expire after **24 hours** * Have a maximum length of **256 characters** * A retry with the same key returns the first successful response, with the `idempotent-replayed: true` header * A failed request is not stored, so you can retry it with the same key * Reusing the key with a different body, or while the first request is still running, returns a `409` [Learn more](/docs/dashboard/emails/idempotency-keys) ## Response Fields **object** `string` Always `inbox_draft`. **id** `string` The ID of the draft. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.drafts.create({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', to: ['ada@example.org'], subject: 'Refund for order 1041', html: '

Refund issued for order 1041.

', text: 'Refund issued for order 1041.', attachments: [ { filename: 'note.txt', content: 'aGVsbG8=', contentType: 'text/plain', }, ], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->drafts->create('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', [ 'to' => ['ada@example.org'], 'subject' => 'Refund for order 1041', 'html' => '

Refund issued for order 1041.

', 'text' => 'Refund issued for order 1041.', 'attachments' => [ [ 'filename' => 'note.txt', 'content' => 'aGVsbG8=', 'content_type' => 'text/plain', ], ], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Drafts.CreateParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "to": ["ada@example.org"], "subject": "Refund for order 1041", "html": "

Refund issued for order 1041.

", "text": "Refund issued for order 1041.", "attachments": [ { "filename": "note.txt", "content": "aGVsbG8=", "content_type": "text/plain", } ], } resend.Inboxes.Drafts.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", to: ["ada@example.org"], subject: "Refund for order 1041", html: "

Refund issued for order 1041.

", text: "Refund issued for order 1041.", attachments: [{ filename: "note.txt", content: "aGVsbG8=", content_type: "text/plain" }] } Resend::Inboxes::Drafts.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateInboxDraftRequest{ To: []string{"ada@example.org"}, Subject: "Refund for order 1041", Html: "

Refund issued for order 1041.

", Text: "Refund issued for order 1041.", Attachments: []*resend.InboxDraftAttachmentInput{ { Content: []byte("hello"), Filename: "note.txt", ContentType: "text/plain", }, }, } client.Inboxes.Drafts.Create("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{CreateInboxDraftAttachment, CreateInboxDraftOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = CreateInboxDraftOptions::new() .with_to(["ada@example.org"]) .with_subject("Refund for order 1041") .with_html("

Refund issued for order 1041.

") .with_text("Refund issued for order 1041.") .with_attachment(CreateInboxDraftAttachment::new( b"hello".to_vec(), "note.txt", "text/plain", )); let _draft = resend .inboxes .create_draft("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", opts) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.Attachment; import com.resend.services.inboxes.model.CreateInboxDraftOptions; import com.resend.services.inboxes.model.CreateInboxDraftResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateInboxDraftOptions params = CreateInboxDraftOptions.builder() .to("ada@example.org") .subject("Refund for order 1041") .html("

Refund issued for order 1041.

") .text("Refund issued for order 1041.") .attachments(Attachment.builder() .fileName("note.txt") .content("aGVsbG8=") .contentType("text/plain") .build()) .build(); CreateInboxDraftResponseSuccess data = resend.inboxes().drafts() .create("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxDraftCreateAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new InboxDraftCreateData() { To = "ada@example.org", Subject = "Refund for order 1041", HtmlBody = "

Refund issued for order 1041.

", TextBody = "Refund issued for order 1041.", Attachments = [ new EmailAttachment() { Filename = "note.txt", Content = System.Text.Encoding.UTF8.GetBytes( "hello" ), ContentType = "text/plain", }, ], } ); Console.WriteLine( "Draft Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "to": ["ada@example.org"], "subject": "Refund for order 1041", "html": "

Refund issued for order 1041.

", "text": "Refund issued for order 1041.", "attachments": [ { "filename": "note.txt", "content": "aGVsbG8=", "content_type": "text/plain" } ] }' ``` ```bash Reply draft theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "thread_id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "reply_to_email_id": "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", "text": "Refund issued for order 1041." }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes drafts create b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 \ --to ada@example.org \ --subject "Refund for order 1041" \ --html "

Refund issued for order 1041.

" \ --text "Refund issued for order 1041." \ --attachment "./note.txt;type=text/plain" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_draft", "id": "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32" } ``` # Create Inbox Source: https://resend.com/docs/api-reference/inboxes/create-inbox POST /inboxes Create an inbox to send, receive and organize email. An inbox sends and receives email at an address on one of your domains, such as `support@example.com`. Without `forwarding`, the domain must have receiving enabled, with DKIM and SPF verified and the inbound MX record verified or pending. With `forwarding` set to `true`, the domain needs only DKIM and SPF verified. Otherwise, the request returns a `422`. An address that is already in use returns a `409`. A team at the inbox limit of its plan gets a `403`. ## Body Parameters The inbox email address on one of your verified domains. The part before the `@` can contain only letters, numbers, and `.`, `_`, `%`, and `-`, up to 64 characters. It cannot start or end with `.` or have two `.` in a row. To call an inbox with a `%` in its address, use the Inbox ID in the path. **name** `string` Internal name for the inbox. Recipients do not see it. Max 64 characters. Defaults to `email_address`. The name recipients see when mail is sent from this inbox. Use a plain name, without `:`, `<`, `>`, or line breaks. Max 78 characters. An email address in the name must be on one of your verified domains. **forwarding** `boolean` (default: false) When `true`, Resend provisions a receiving address so you can receive mail without adding an MX record. Read it from `receiving_address` with [Get Inbox](/docs/api-reference/inboxes/get-inbox). ## Response Fields **object** `string` Always `inbox`. **id** `string` The ID of the inbox. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.create({ emailAddress: 'support@example.com', name: 'Customer Support', fromName: 'Ada from Support', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->create([ 'email_address' => 'support@example.com', 'name' => 'Customer Support', 'from_name' => 'Ada from Support', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.CreateParams = { "email_address": "support@example.com", "name": "Customer Support", "from_name": "Ada from Support", } resend.Inboxes.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { email_address: "support@example.com", name: "Customer Support", from_name: "Ada from Support" } Resend::Inboxes.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateInboxRequest{ EmailAddress: "support@example.com", Name: "Customer Support", FromName: "Ada from Support", } client.Inboxes.Create(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{CreateInboxOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = CreateInboxOptions::new("support@example.com") .with_name("Customer Support") .with_from_name("Ada from Support"); let _inbox = resend.inboxes.create(opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.CreateInboxOptions; import com.resend.services.inboxes.model.CreateInboxResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateInboxOptions params = CreateInboxOptions.builder() .emailAddress("support@example.com") .name("Customer Support") .fromName("Ada from Support") .build(); CreateInboxResponseSuccess data = resend.inboxes().create(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxCreateAsync( new InboxCreateData() { EmailAddress = "support@example.com", Name = "Customer Support", FromName = "Ada from Support", } ); Console.WriteLine( "Inbox Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/inboxes' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "email_address": "support@example.com", "name": "Customer Support", "from_name": "Ada from Support" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes create \ --email-address support@example.com \ --name "Customer Support" \ --from-name "Ada from Support" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox", "id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" } ``` # Create Label Source: https://resend.com/docs/api-reference/inboxes/create-label POST /inboxes/:inbox_id/labels Create a label on an inbox. A label is a named, colored tag that belongs to one inbox. An inbox can have at most 100 labels. Label names are unique per inbox, compared without case. A duplicate name returns a `422`. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Body Parameters **name** `string` *required* The name of the label. Max 64 characters. **color** `string` The color of the label as a `#RRGGBB` hex code, like `#E93D82`. Defaults to a random color. ## Response Fields **object** `string` Always `inbox_label`. **id** `string` The ID of the label. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.labels.create({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', name: 'Urgent', color: '#E93D82', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->labels->create('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', [ 'name' => 'Urgent', 'color' => '#E93D82', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Labels.CreateParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "name": "Urgent", "color": "#E93D82", } resend.Inboxes.Labels.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", name: "Urgent", color: "#E93D82" } Resend::Inboxes::Labels.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateInboxLabelRequest{ Name: "Urgent", Color: "#E93D82", } client.Inboxes.Labels.Create("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{CreateInboxLabelOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = CreateInboxLabelOptions::new("Urgent").with_color("#E93D82"); let _label = resend .inboxes .create_label("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", opts) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.CreateInboxLabelOptions; import com.resend.services.inboxes.model.CreateInboxLabelResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateInboxLabelOptions params = CreateInboxLabelOptions.builder() .name("Urgent") .color("#E93D82") .build(); CreateInboxLabelResponseSuccess data = resend.inboxes().labels() .create("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxLabelCreateAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new InboxLabelCreateData() { Name = "Urgent", Color = "#E93D82", } ); Console.WriteLine( "Label Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/labels' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "Urgent", "color": "#E93D82" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes labels create b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 \ --name Urgent \ --color '#E93D82' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_label", "id": "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34" } ``` # Delete Draft Source: https://resend.com/docs/api-reference/inboxes/delete-draft DELETE /inboxes/:inbox_id/drafts/:draft_id Discard an unsent draft. Discards an unsent draft. A draft that was already sent returns a `409`. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Draft ID. ## Response Fields **object** `string` Always `inbox_draft`. **id** `string` The ID of the draft. **deleted** `boolean` Returns `true` when the draft is deleted. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.drafts.remove({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', draftId: 'c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->drafts->remove( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', 'c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Drafts.remove( inbox_id="b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", draft_id="c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", draft_id: "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32" } Resend::Inboxes::Drafts.remove(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Drafts.Remove( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _deleted = resend .inboxes .delete_draft( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.RemoveInboxDraftResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RemoveInboxDraftResponseSuccess data = resend.inboxes().drafts().remove( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.InboxDraftDeleteAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts/c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes drafts delete b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32 \ --yes ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_draft", "id": "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", "deleted": true } ``` # Delete Inbox Source: https://resend.com/docs/api-reference/inboxes/delete-inbox DELETE /inboxes/:inbox_id Remove an existing inbox. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Response Fields **object** `string` Always `inbox`. **id** `string` The ID of the inbox. **deleted** `boolean` Returns `true` when the inbox is deleted. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.remove( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->remove('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.remove("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Inboxes.remove("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Remove("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _deleted = resend .inboxes .delete("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.RemoveInboxResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RemoveInboxResponseSuccess data = resend.inboxes().remove("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.InboxDeleteAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes delete b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 --yes ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox", "id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "deleted": true } ``` # Delete Label Source: https://resend.com/docs/api-reference/inboxes/delete-label DELETE /inboxes/:inbox_id/labels/:label_id Remove an existing label from an inbox. Deletes the label and removes it from every thread that carries it. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Label ID. ## Response Fields **object** `string` Always `inbox_label`. **id** `string` The ID of the label. **deleted** `boolean` Returns `true` when the label is deleted. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.labels.remove({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', labelId: '7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->labels->remove( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Labels.remove( inbox_id="b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", label_id="7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", label_id: "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34" } Resend::Inboxes::Labels.remove(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Labels.Remove( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _deleted = resend .inboxes .delete_label( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.RemoveInboxLabelResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RemoveInboxLabelResponseSuccess data = resend.inboxes().labels().remove( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.InboxLabelDeleteAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/labels/7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes labels delete b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34 \ --yes ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_label", "id": "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", "deleted": true } ``` # Delete Thread Source: https://resend.com/docs/api-reference/inboxes/delete-thread DELETE /inboxes/:inbox_id/threads/:thread_id Move a thread to the trash folder. Deleting a thread moves it to `trash` and schedules it for deletion in 30 days. > [!NOTE] > > This is reversible. To restore a thread, [update > it](/docs/api-reference/inboxes/update-thread) back to `inbox`, `archive`, or > `spam`, which also clears the deletion deadline. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Thread ID. ## Response Fields **object** `string` Always `inbox_thread`. **id** `string` The ID of the thread. **deleted** `boolean` Returns `true` when the thread is moved to `trash`, and `false` when the thread was already there. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.remove({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', threadId: '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->remove( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Threads.remove( inbox_id="b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id="4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id: "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" } Resend::Inboxes::Threads.remove(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Threads.Remove( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _deleted = resend .inboxes .delete_thread( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.RemoveInboxThreadResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RemoveInboxThreadResponseSuccess data = resend.inboxes().threads().remove( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.InboxThreadDeleteAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads delete b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12 \ --yes ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_thread", "id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "deleted": true } ``` # Forward Thread Email Source: https://resend.com/docs/api-reference/inboxes/forward-thread-email POST /inboxes/:inbox_id/threads/:thread_id/emails/:email_id/forward Forward a message in an inbox thread to new recipients. Forwards a message from the inbox address. The attachments of the original message are sent with the forward, together with any `attachments` you add. The request fails when they exceed 25 MB of `content` in total. Files you add with `path` do not count toward it. An original attachment that was sent from a URL (`path`) cannot be forwarded, and the request returns a `422`. The whole email can be at most 40 MB. The forward carries the same `In-Reply-To` and `References` headers as a [reply](/docs/api-reference/inboxes/reply-thread-email) to the original message, so mail clients may group it with the original conversation. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Thread ID. The Email ID of the message to forward, as returned by [List Thread Emails](/docs/api-reference/inboxes/list-thread-emails) in `data[].id`. ## Body Parameters **to** `string | string[]` *required* Recipient email address. For multiple addresses, send as an array of strings. Must name at least one address. `to`, `cc`, and `bcc` combined cannot exceed 50 recipients. **cc** `string | string[] | null` CC recipient email address. **bcc** `string | string[] | null` BCC recipient email address. **html** `string` An HTML note sent above the quoted original. **text** `string` A plain-text note sent above the quoted original. **subject** `string` The subject of the forward. 1 to 2000 characters, with no line breaks. Defaults to the thread subject with a `Fwd:` prefix. **attachments** `array | null` Files to attach, as on [Send Email](/docs/api-reference/emails/send-email). **properties** **content** `buffer | string` Content of an attached file, passed as a buffer or Base64 string. **filename** `string` Name of attached file. **path** `string` Path where the attachment file is hosted. Content type for the attachment. When not set, it is derived from the `filename`. Content ID for embedding inline images with a `cid:` reference in the `html`. [Learn about inline images](/docs/dashboard/emails/embed-inline-images). **headers** `object | null` Custom headers to add to the email. You cannot set `In-Reply-To`, `References`, or `Reply-To`. ## Headers **Idempotency-Key** `string` Add an idempotency key to prevent duplicated emails. * Should be **unique per API request** * Idempotency keys expire after **24 hours** * Have a maximum length of **256 characters** * A retry with the same key returns the first successful response, with the `idempotent-replayed: true` header * A failed request is not stored, so you can retry it with the same key * Reusing the key with a different body, or while the first request is still running, returns a `409` [Learn more](/docs/dashboard/emails/idempotency-keys) ## Response Fields **id** `string` The ID of the sent email. Use it with the [emails endpoints](/docs/api-reference/emails/retrieve-email). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.emails.forward({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', threadId: '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', emailId: '5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60', to: ['colleague@example.org'], cc: ['billing@example.com'], bcc: ['records@example.com'], text: 'Flagging this refund request for you.', attachments: [ { path: 'https://resend.com/static/sample/invoice.pdf', filename: 'invoice.pdf', }, ], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->emails->forward( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', '5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60', [ 'to' => ['colleague@example.org'], 'cc' => ['billing@example.com'], 'bcc' => ['records@example.com'], 'text' => 'Flagging this refund request for you.', 'attachments' => [ [ 'path' => 'https://resend.com/static/sample/invoice.pdf', 'filename' => 'invoice.pdf', ], ], ] ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Threads.Emails.ForwardParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "thread_id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "email_id": "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", "to": ["colleague@example.org"], "cc": ["billing@example.com"], "bcc": ["records@example.com"], "text": "Flagging this refund request for you.", "attachments": [ { "path": "https://resend.com/static/sample/invoice.pdf", "filename": "invoice.pdf", } ], } resend.Inboxes.Threads.Emails.forward(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id: "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", email_id: "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", to: ["colleague@example.org"], cc: ["billing@example.com"], bcc: ["records@example.com"], text: "Flagging this refund request for you.", attachments: [{ path: "https://resend.com/static/sample/invoice.pdf", filename: "invoice.pdf" }] } Resend::Inboxes::Threads::Emails.forward(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.ForwardInboxThreadEmailRequest{ To: []string{"colleague@example.org"}, Cc: []string{"billing@example.com"}, Bcc: []string{"records@example.com"}, Text: "Flagging this refund request for you.", Attachments: []*resend.Attachment{ { Path: "https://resend.com/static/sample/invoice.pdf", Filename: "invoice.pdf", }, }, } client.Inboxes.Threads.Emails.Forward( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", params, ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{CreateAttachment, ForwardInboxThreadEmailOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = ForwardInboxThreadEmailOptions::new(["colleague@example.org"]) .with_cc(["billing@example.com"]) .with_bcc(["records@example.com"]) .with_text("Flagging this refund request for you.") .with_attachment( CreateAttachment::from_path("https://resend.com/static/sample/invoice.pdf") .with_filename("invoice.pdf"), ); let _forward = resend .inboxes .forward_thread_email( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", opts, ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.Attachment; import com.resend.services.inboxes.model.ForwardInboxThreadEmailOptions; import com.resend.services.inboxes.model.ForwardInboxThreadEmailResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ForwardInboxThreadEmailOptions params = ForwardInboxThreadEmailOptions.builder() .to("colleague@example.org") .cc("billing@example.com") .bcc("records@example.com") .text("Flagging this refund request for you.") .attachments(Attachment.builder() .fileName("invoice.pdf") .path("https://resend.com/static/sample/invoice.pdf") .build()) .build(); ForwardInboxThreadEmailResponseSuccess data = resend.inboxes().threads().emails().forward( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadEmailForwardAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" ), new Guid( "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60" ), new InboxThreadEmailForwardData() { To = "colleague@example.org", Cc = "billing@example.com", Bcc = "records@example.com", TextBody = "Flagging this refund request for you.", Attachments = [ new EmailAttachment() { Filename = "invoice.pdf", Path = "https://resend.com/static/sample/invoice.pdf", }, ], } ); Console.WriteLine( "Email Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12/emails/5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60/forward' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "to": ["colleague@example.org"], "cc": ["billing@example.com"], "bcc": ["records@example.com"], "text": "Flagging this refund request for you.", "attachments": [ { "path": "https://resend.com/static/sample/invoice.pdf", "filename": "invoice.pdf" } ] }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads emails forward b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12 5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60 \ --to colleague@example.org \ --cc billing@example.com \ --bcc records@example.com \ --text "Flagging this refund request for you." \ --attachment ./invoice.pdf ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "id": "6a0c8e58-3d9e-4f7a-8b14-2e3f4a5b6c71" } ``` # Retrieve Agent Settings Source: https://resend.com/docs/api-reference/inboxes/get-agent GET /inboxes/:inbox_id/agent Retrieve the agent settings for an inbox. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Response Fields **object** `string` Always `inbox_agent`. **instructions** `string | null` Instructions the agent follows when handling the inbox's threads. `null` when no instructions are set. **tone** `'concise_professional' | 'concise_casual' | 'expanded_professional' | 'expanded_casual' | null` Tone the agent writes in. `null` when no tone is set. * `concise_professional`: Brief responses in a professional tone. * `concise_casual`: Brief responses in a casual tone. * `expanded_professional`: Detailed responses in a professional tone. * `expanded_casual`: Detailed responses in a casual tone. **actions** `string[]` Actions the agent is allowed to take. * `draft_reply`: Draft a reply. * `forward_thread`: Forward a thread. * `add_labels`: Add labels to a thread. * `assign_thread`: Assign a thread. * `mark_as_spam`: Mark a thread as spam. * `archive`: Archive a thread. * `move_to_trash`: Move a thread to the trash. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.agent.get({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->agent->get('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Agent.get("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Inboxes::Agent.get({ inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" }) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Agent.Get("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _agent = resend .inboxes .get_agent("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.GetInboxAgentResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetInboxAgentResponseSuccess data = resend.inboxes().agent() .get("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxAgentRetrieveAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ) ); Console.WriteLine( "Agent tone={0}", resp.Content.Tone ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/agent' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes agent get b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_agent", "instructions": "Answer refund questions yourself. Escalate legal threats.", "tone": "concise_professional", "actions": ["draft_reply", "add_labels"] } ``` # Retrieve Draft Source: https://resend.com/docs/api-reference/inboxes/get-draft GET /inboxes/:inbox_id/drafts/:draft_id Retrieve a single draft by its ID. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Draft ID. ## Response Fields **object** `string` Always `inbox_draft`. **id** `string` The ID of the draft. **type** `string` `reply` when the draft replies to an email in an existing thread. `standalone` when the draft starts a new thread. **to** `string[] | null` Recipients. `null` or empty when no recipients are set. **cc** `string[]` CC recipients. **bcc** `string[]` BCC recipients. **subject** `string | null` The subject. **html** `string | null` The HTML body. **text** `string | null` The plain-text body. **thread\_id** `string | null` The Thread ID when this draft is a reply. `null` otherwise. **reply\_to\_email\_id** `string | null` The Email ID being replied to. `null` otherwise. **email\_id** `string | null` The ID of the outbound email queued when the draft was sent. `null` until the draft is sent. **created\_at** `string` ISO 8601 timestamp when the draft was created. **updated\_at** `string` ISO 8601 timestamp when the draft was last saved. **attachments** `array` The files saved on the draft. **properties** **id** `string` The ID of the attachment. **filename** `string` The filename of the attachment. **content\_type** `string` The MIME type of the attachment, such as `application/pdf`. **size** `number` The size of the attachment in bytes. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.drafts.get({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', draftId: 'c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->drafts->get( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', 'c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Drafts.get( inbox_id="b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", draft_id="c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", draft_id: "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32" } Resend::Inboxes::Drafts.get(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Drafts.Get( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _draft = resend .inboxes .get_draft( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.GetInboxDraftResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetInboxDraftResponseSuccess data = resend.inboxes().drafts().get( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxDraftRetrieveAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32" ) ); Console.WriteLine( "Draft subject={0}", resp.Content.Subject ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts/c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes drafts get b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_draft", "id": "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", "type": "standalone", "to": ["ada@example.org"], "cc": [], "bcc": [], "subject": "Refund for order 1041", "html": "

Refund issued for order 1041.

", "text": "Refund issued for order 1041.", "thread_id": null, "reply_to_email_id": null, "email_id": null, "created_at": "2026-08-05T14:12:04.110Z", "updated_at": "2026-08-05T14:12:04.110Z", "attachments": [ { "id": "9d4f2b81-6c3a-4e7d-8b12-0a5c6d7e8f90", "filename": "note.txt", "content_type": "text/plain", "size": 5 } ] } ``` # Retrieve Inbox Source: https://resend.com/docs/api-reference/inboxes/get-inbox GET /inboxes/:inbox_id Retrieve a single inbox by its ID or email address. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Response Fields **object** `string` Always `inbox`. **id** `string` The ID of the inbox. **name** `string` Internal name for the inbox. Recipients do not see it. **email\_address** `string` The address of the inbox. **domain\_id** `string` The ID of the domain that owns the address. **receiving\_address** `string | null` The address to forward mail to when forwarding is enabled. `null` otherwise. **from\_name** `string | null` The name recipients see when mail is sent from this inbox. `null` when not set. **unread** `number` The number of unread threads in the Inbox folder. **drafts** `number` The number of unsent drafts. **last\_received** `string | null` ISO 8601 timestamp of the newest received email in the Inbox folder. `null` when the folder has no received email. **created\_at** `string` ISO 8601 timestamp when the inbox was created. **updated\_at** `string` ISO 8601 timestamp when the inbox was updated. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.get( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->get('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.get("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Inboxes.get("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Get("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _inbox = resend .inboxes .get("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.GetInboxResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetInboxResponseSuccess data = resend.inboxes().get("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxRetrieveAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ) ); Console.WriteLine( "Inbox address={0}", resp.Content.EmailAddress ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes get b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox", "id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "name": "Customer Support", "email_address": "support@example.com", "domain_id": "d91cd9bd-1176-453e-8fc1-35364d380206", "receiving_address": null, "from_name": "Ada from Support", "unread": 3, "drafts": 2, "last_received": "2026-08-05T14:03:11.229Z", "created_at": "2026-08-01T09:12:44.512Z", "updated_at": "2026-08-03T16:20:05.004Z" } ``` # Retrieve Thread Source: https://resend.com/docs/api-reference/inboxes/get-thread GET /inboxes/:inbox_id/threads/:thread_id Retrieve a thread summary. The response is the thread summary. Messages are listed separately with [List Thread Emails](/docs/api-reference/inboxes/list-thread-emails). ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Thread ID. ## Response Fields **object** `string` Always `inbox_thread`. **id** `string` The ID of the thread. **subject** `string | null` The subject of the thread. **folder** `string` The folder the thread lives in. Every thread sits in exactly one folder within its inbox. You can move a thread to `inbox`, `archive`, `spam`, or `trash`. `sent` is assigned automatically. * `inbox`: The default. The thread holds at least one received message. * `archive`: The thread was archived. * `spam`: The thread was marked as spam. * `trash`: The thread is scheduled for deletion in 30 days. * `sent`: Threads whose messages are all outbound. **labels** `array` The labels attached to the thread. **properties** **id** `string` The ID of the label. **name** `string` The name of the label. **color** `string` The color of the label as an uppercase `#RRGGBB` hex code. **read** `boolean` True only when every message in the thread is read. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.get({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', threadId: '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->get( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Threads.get( inbox_id="b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id="4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id: "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" } Resend::Inboxes::Threads.get(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Threads.Get( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _thread = resend .inboxes .get_thread( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.GetInboxThreadResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetInboxThreadResponseSuccess data = resend.inboxes().threads().get( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadRetrieveAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" ) ); Console.WriteLine( "Thread folder={0}", resp.Content.Folder ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads get b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_thread", "id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "subject": "Refund for order 1041", "folder": "inbox", "labels": [ { "id": "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", "name": "Urgent", "color": "#E93D82" } ], "read": false } ``` # Retrieve Thread Email Source: https://resend.com/docs/api-reference/inboxes/get-thread-email GET /inboxes/:inbox_id/threads/:thread_id/emails/:email_id Retrieve a single message from a thread. Returns one message of a thread. Each item from [List Thread Emails](/docs/api-reference/inboxes/list-thread-emails) has this shape. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Thread ID. The Email ID, as returned by [List Thread Emails](/docs/api-reference/inboxes/list-thread-emails) in `data[].id`. ## Response Fields **id** `string` The ID of the message. **direction** `string` Whether the message was received by the inbox or sent from it. One of `inbound` or `outbound`. A message the inbox sent to itself is `inbound`, so a reply to it goes to its sender. **from** `string` Sender email address. Includes the display name when the sender has one, in the format `Name `. **to** `string[]` The recipients of the message. For a received message, these are the addresses it was delivered to, not the full `To` header. **cc** `string[]` The CC recipients of the message. **bcc** `string[]` The BCC recipients of the message. Always empty for a received message. **reply\_to** `string[]` The Reply-To addresses. **subject** `string | null` The subject of the message. **message\_id** `string | null` The Message-ID header of the message. **html** `string | null` The HTML body. **text** `string | null` The plain-text body. **attachments** `array` The attachments on the message. **properties** **id** `string` The ID of the attachment. **filename** `string | null` The filename of the attachment. **size** `number | null` The size of the attachment in bytes. **read** `boolean` Whether the message has been read. **received\_at** `string` ISO 8601 timestamp when the inbox received the message, or when the inbox sent it. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.emails.get({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', threadId: '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', emailId: '5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->emails->get( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', '5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Threads.Emails.get( inbox_id="b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id="4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", email_id="5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id: "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", email_id: "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60" } Resend::Inboxes::Threads::Emails.get(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Threads.Emails.Get( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _email = resend .inboxes .get_thread_email( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.GetInboxThreadEmailResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetInboxThreadEmailResponseSuccess data = resend.inboxes().threads().emails().get( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadEmailRetrieveAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" ), new Guid( "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60" ) ); Console.WriteLine( "Email subject={0}", resp.Content.Subject ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12/emails/5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads emails get b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12 5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "id": "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", "direction": "inbound", "from": "Ada Lovelace ", "to": ["support@example.com"], "cc": [], "bcc": [], "reply_to": ["replies@example.org"], "subject": "Refund for order 1041", "message_id": "<1041@example.org>", "html": "

Could I get a refund for order 1041?

", "text": "Could I get a refund for order 1041?", "attachments": [ { "id": "9d4f2b81-6c3a-4e7d-8b12-0a5c6d7e8f90", "filename": "receipt.pdf", "size": 20841 } ], "read": false, "received_at": "2026-08-05T14:03:11.229Z" } ``` # List Drafts Source: https://resend.com/docs/api-reference/inboxes/list-drafts GET /inboxes/:inbox_id/drafts Retrieve the unsent drafts in an inbox. Returns the unsent drafts in the inbox, most recently updated first. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Query Parameters **limit** `number` Number of drafts to return. Default is `20`, maximum is `100`, minimum is `1`. **after** `string` The ID of the last draft on the current page. Returns the next, older page. **before** `string` The ID of the first draft on the current page. Returns the previous, newer page. Cannot be combined with `after`. ## Response Fields **object** `string` Always `list`. **has\_more** `boolean` Whether more drafts exist beyond this page. Pass the last draft's `id` as `after` to continue. **data** `array` The drafts on this page. **properties** **id** `string` The ID of the draft. **type** `string` `reply` when the draft replies to an email in an existing thread. `standalone` when the draft starts a new thread. **to** `string[] | null` Recipients. `null` or empty when no recipients are set. **cc** `string[]` CC recipients. **bcc** `string[]` BCC recipients. **subject** `string | null` The subject. **snippet** `string | null` A short preview of the body. **thread\_id** `string | null` The Thread ID when this draft is a reply. `null` otherwise. **reply\_to\_email\_id** `string | null` The Email ID being replied to. `null` otherwise. **updated\_at** `string` ISO 8601 timestamp when the draft was last saved. **attachments** `array` The files saved on the draft. **properties** **id** `string` The ID of the attachment. **filename** `string` The filename of the attachment. **content\_type** `string` The MIME type of the attachment, such as `application/pdf`. **size** `number` The size of the attachment in bytes. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.drafts.list({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->drafts->list('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Drafts.list("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Inboxes::Drafts.list({ inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" }) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Drafts.List("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", nil) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _drafts = resend .inboxes .list_drafts("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", ListOptions::default()) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.ListInboxDraftsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListInboxDraftsResponseSuccess data = resend.inboxes().drafts() .list("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxDraftListAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ) ); Console.WriteLine( "Nr Drafts={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes drafts list b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", "type": "standalone", "to": ["ada@example.org"], "cc": [], "bcc": [], "subject": "Refund for order 1041", "snippet": "Refund issued for order 1041.", "thread_id": null, "reply_to_email_id": null, "updated_at": "2026-08-05T14:12:04.110Z", "attachments": [ { "id": "9d4f2b81-6c3a-4e7d-8b12-0a5c6d7e8f90", "filename": "note.txt", "content_type": "text/plain", "size": 5 } ] } ] } ``` # List Inboxes Source: https://resend.com/docs/api-reference/inboxes/list-inboxes GET /inboxes Retrieve a list of inboxes for the team. Inboxes are returned newest first. Results are paginated with cursors. See [Pagination](/docs/api-reference/pagination) for how `after` and `before` work. The cursors take an inbox ID. A value that is not a UUID returns a `422`, and an unknown ID returns a `404`. The list items carry fewer fields than a single inbox. [Retrieve an inbox](/docs/api-reference/inboxes/get-inbox) to get all its fields. ## Query Parameters **limit** `number` Number of inboxes to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more inboxes (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more inboxes (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ## Response Fields **object** `string` Always `list`. **has\_more** `boolean` Whether more inboxes exist beyond this page. **data** `array` The inboxes on this page. **properties** **id** `string` The ID of the inbox. **name** `string | null` Internal name for the inbox. Recipients do not see it. **email\_address** `string` The address of the inbox. **from\_name** `string | null` The name recipients see when mail is sent from this inbox. `null` when not set. **unread** `number` The number of unread threads in the Inbox folder. **last\_received** `string | null` ISO 8601 timestamp of the newest received email in the Inbox folder. `null` when the folder has no received email. **created\_at** `string` ISO 8601 timestamp when the inbox was created. **updated\_at** `string` ISO 8601 timestamp when the inbox was updated. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Inboxes.list ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.List(nil) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _inboxes = resend.inboxes.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.ListInboxesResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListInboxesResponseSuccess data = resend.inboxes().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxListAsync(); Console.WriteLine( "Nr Inboxes={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/inboxes' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "name": "Customer Support", "email_address": "support@example.com", "from_name": "Ada from Support", "unread": 3, "last_received": "2026-08-05T14:03:11.229Z", "created_at": "2026-08-01T09:12:44.512Z", "updated_at": "2026-08-03T16:20:05.004Z" }, { "id": "1c5e0f3a-6b21-4d9a-8e77-5c0a9d8b4e12", "name": "billing@example.com", "email_address": "billing@example.com", "from_name": null, "unread": 0, "last_received": null, "created_at": "2026-07-20T11:00:00.000Z", "updated_at": "2026-07-20T11:00:00.318Z" } ] } ``` # List Labels Source: https://resend.com/docs/api-reference/inboxes/list-labels GET /inboxes/:inbox_id/labels Retrieve the labels on an inbox. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Response Fields **object** `string` Always `list`. **data** `array` The labels on the inbox, oldest first. **properties** **id** `string` The ID of the label. **name** `string` The name of the label. **color** `string` The color of the label as an uppercase `#RRGGBB` hex code, like `#E93D82`. **created\_at** `string` ISO 8601 timestamp when the label was created. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.labels.list({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->labels->list('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Labels.list("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Inboxes::Labels.list({ inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" }) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Labels.List("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _labels = resend .inboxes .list_labels("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.ListInboxLabelsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListInboxLabelsResponseSuccess data = resend.inboxes().labels() .list("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxLabelListAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ) ); Console.WriteLine( "Nr Labels={0}", resp.Content.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/labels' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes labels list b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "data": [ { "id": "2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d", "name": "Billing", "color": "#00A2C7", "created_at": "2026-08-01T09:12:03.004Z" }, { "id": "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", "name": "Urgent", "color": "#E93D82", "created_at": "2026-08-05T14:07:42.881Z" } ] } ``` # List Thread Emails Source: https://resend.com/docs/api-reference/inboxes/list-thread-emails GET /inboxes/:inbox_id/threads/:thread_id/emails Retrieve the messages in a thread. Messages are returned oldest first. Each item has the same shape as [Retrieve Thread Email](/docs/api-reference/inboxes/get-thread-email). ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Thread ID. ## Query Parameters **limit** `number` Number of messages to return. Default is `20`, maximum is `100`, minimum is `1`. **after** `string` The ID of the last message on the current page. Returns the next, newer page. **before** `string` The ID of the first message on the current page. Returns the previous, older page. Cannot be combined with `after`. ## Response Fields **object** `string` Always `list`. **has\_more** `boolean` Whether more messages exist beyond this page. Pass the last message's `id` as `after` to continue. **data** `array` The messages on this page. **properties** **id** `string` The ID of the message. **direction** `string` Whether the message was received by the inbox or sent from it. One of `inbound` or `outbound`. A message the inbox sent to itself is `inbound`, so a reply to it goes to its sender. **from** `string` Sender email address. Includes the display name when the sender has one, in the format `Name `. **to** `string[]` The recipients of the message. For a received message, these are the addresses it was delivered to, not the full `To` header. **cc** `string[]` The CC recipients of the message. **bcc** `string[]` The BCC recipients of the message. Always empty for a received message. **reply\_to** `string[]` The Reply-To addresses. **subject** `string | null` The subject of the message. **message\_id** `string | null` The Message-ID header of the message. **html** `string | null` The HTML body. **text** `string | null` The plain-text body. **attachments** `array` The attachments on the message. **properties** **id** `string` The ID of the attachment. **filename** `string | null` The filename of the attachment. **size** `number | null` The size of the attachment in bytes. **read** `boolean` Whether the message has been read. **received\_at** `string` ISO 8601 timestamp when the inbox received the message, or when the inbox sent it. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.emails.list({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', threadId: '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->emails->list( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Threads.Emails.list( inbox_id="b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id="4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id: "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" } Resend::Inboxes::Threads::Emails.list(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Threads.Emails.List( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", nil, ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _emails = resend .inboxes .list_thread_emails( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", ListOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.ListInboxThreadEmailsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListInboxThreadEmailsResponseSuccess data = resend.inboxes().threads().emails().list( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadEmailListAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" ) ); Console.WriteLine( "Nr Emails={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12/emails' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads emails list b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", "direction": "inbound", "from": "Ada Lovelace ", "to": ["support@example.com"], "cc": [], "bcc": [], "reply_to": ["replies@example.org"], "subject": "Refund for order 1041", "message_id": "<1041@example.org>", "html": "

Could I get a refund for order 1041?

", "text": "Could I get a refund for order 1041?", "attachments": [ { "id": "9d4f2b81-6c3a-4e7d-8b12-0a5c6d7e8f90", "filename": "receipt.pdf", "size": 20841 } ], "read": false, "received_at": "2026-08-05T14:03:11.229Z" } ] } ``` # List Threads Source: https://resend.com/docs/api-reference/inboxes/list-threads GET /inboxes/:inbox_id/threads Retrieve the threads in an inbox, filtered by folder, label, and read status. A thread is a conversation within an inbox, made up of one or more messages. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Query Parameters **folders** `string` Comma-separated folders to list. Defaults to `inbox`, or to `inbox,archive,sent` when `labels` is set. * `inbox`: The default. The thread holds at least one received message. * `archive`: The thread was archived. * `spam`: The thread was marked as spam. * `trash`: The thread is scheduled for deletion in 30 days. * `sent`: Threads whose messages are all outbound. **labels** `string` Comma-separated label IDs. Returns threads with any of these labels. Up to `50` IDs. **read** `boolean` `true` returns threads where every email is read. `false` returns threads with at least one unread email. **limit** `number` Number of threads to return. Default is `20`, maximum is `100`, minimum is `1`. **after** `string` The ID of the last thread on the current page. Returns the next, older page. Must be a thread ID. To filter by date, use [Search Threads](/docs/api-reference/inboxes/search-threads) with `start_date`. **before** `string` The ID of the first thread on the current page. Returns the previous, newer page. Cannot be combined with `after`. Must be a thread ID. To filter by date, use [Search Threads](/docs/api-reference/inboxes/search-threads) with `end_date`. To find threads by text, sender, recipient, attachment, or date, use [Search Threads](/docs/api-reference/inboxes/search-threads). ## Response Fields **object** `string` Always `list`. **has\_more** `boolean` Whether more threads exist beyond this page. Pass the last thread's `id` as `after` to continue. **data** `array` The matching threads, most recently active first. **properties** **id** `string` The ID of the thread. **subject** `string | null` The subject of the thread. **from** `string | null` Sender email address. Can include the display name. **to** `string[]` The recipients of the most recent message. For a received email, these are the addresses it was delivered to, not the full `To` header. **cc** `string[]` The CC recipients of the most recent message. **bcc** `string[]` The BCC recipients of the most recent message. Always empty for a received email. **labels** `array` The labels attached to the thread. **properties** **id** `string` The ID of the label. **name** `string` The name of the label. **color** `string` The color of the label as an uppercase `#RRGGBB` hex code. **email\_count** `number` The number of emails in the thread. **has\_attachment** `boolean` Whether the most recent message in the thread has an attachment. **has\_draft** `boolean` Whether the thread has an unsent draft. **read** `boolean` True only when every message in the thread is read. **received\_at** `string` ISO 8601 timestamp when the thread was last active. **folder** `string` The folder the thread lives in. Every thread sits in exactly one folder within its inbox. You can move a thread to `inbox`, `archive`, `spam`, or `trash`. `sent` is assigned automatically. * `inbox`: The default. The thread holds at least one received message. * `archive`: The thread was archived. * `spam`: The thread was marked as spam. * `trash`: The thread is scheduled for deletion in 30 days. * `sent`: Threads whose messages are all outbound. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.list({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->list('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Threads.list("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Inboxes::Threads.list({ inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" }) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Threads.List("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", nil) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ list_opts::ListOptions, types::ListInboxThreadsOptions, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _threads = resend .inboxes .list_threads( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", ListInboxThreadsOptions::new(), ListOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.ListInboxThreadsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListInboxThreadsResponseSuccess data = resend.inboxes().threads() .list("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadListAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ) ); Console.WriteLine( "Nr Threads={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads list b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": true, "data": [ { "id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "subject": "Refund for order 1041", "from": "Ada Lovelace ", "to": ["support@example.com"], "cc": [], "bcc": [], "labels": [ { "id": "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", "name": "Urgent", "color": "#E93D82" } ], "email_count": 2, "has_attachment": true, "has_draft": false, "read": false, "received_at": "2026-08-05T14:03:11.229Z", "folder": "inbox" } ] } ``` # Remove Thread Label Source: https://resend.com/docs/api-reference/inboxes/remove-thread-label DELETE /inboxes/:inbox_id/threads/:thread_id/labels/:label_id Take one label off a thread. The label itself is kept, and stays on every other thread that carries it. To delete the label everywhere, use [Delete Label](/docs/api-reference/inboxes/delete-label). ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Thread ID. The Label ID. ## Response Fields **object** `string` Always `list`. **data** `array` Every label on the thread after the change. **properties** **id** `string` The ID of the label. **name** `string` The name of the label. **color** `string` The color of the label as an uppercase `#RRGGBB` hex code, like `#E93D82`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.labels.remove({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', threadId: '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', labelId: '7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->labels->remove( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', '7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Threads.Labels.remove( inbox_id="b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id="4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", label_id="7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id: "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", label_id: "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34" } Resend::Inboxes::Threads::Labels.remove(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Threads.Labels.Remove( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _labels = resend .inboxes .remove_thread_label( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.RemoveInboxThreadLabelResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RemoveInboxThreadLabelResponseSuccess data = resend.inboxes().threads().removeLabel( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadLabelRemoveAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" ), new Guid( "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34" ) ); Console.WriteLine( "Nr Labels={0}", resp.Content.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12/labels/7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads labels remove b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12 7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "data": [ { "id": "2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d", "name": "Billing", "color": "#00A2C7" } ] } ``` # Reply to Thread Email Source: https://resend.com/docs/api-reference/inboxes/reply-thread-email POST /inboxes/:inbox_id/threads/:thread_id/emails/:email_id/reply Send a reply to a message in an inbox thread. Sends a reply from the inbox address. The reply goes to the `Reply-To` addresses of the message. Without them, it goes to the sender. A reply to a message the inbox sent goes to that message's `to` recipients. Attachments can have at most 25 MB of `content` in total. Files sent with `path` do not count toward it. The whole email can be at most 40 MB. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Thread ID. The Email ID of the message to reply to, as returned by [List Thread Emails](/docs/api-reference/inboxes/list-thread-emails) in `data[].id`. ## Body Parameters At least one of `html` or `text` is required. `cc` and `bcc` combined can have at most 49 addresses, and the whole reply at most 50 recipients. **cc** `string | string[] | null` CC recipient email address. **bcc** `string | string[] | null` BCC recipient email address. **html** `string` The HTML body of the reply. **text** `string` The plain-text body of the reply. **subject** `string` The subject of the reply. 1 to 2000 characters, with no line breaks. Defaults to the thread subject with a `Re:` prefix. Reply to everyone on the original message. **attachments** `array | null` Files to attach, as on [Send Email](/docs/api-reference/emails/send-email). **properties** **content** `buffer | string` Content of an attached file, passed as a buffer or Base64 string. **filename** `string` Name of attached file. **path** `string` Path where the attachment file is hosted. Content type for the attachment. When not set, it is derived from the `filename`. Content ID for embedding inline images with a `cid:` reference in the `html`. [Learn about inline images](/docs/dashboard/emails/embed-inline-images). **headers** `object | null` Custom headers to add to the email. You cannot set `In-Reply-To`, `References`, or `Reply-To`. ## Headers **Idempotency-Key** `string` Add an idempotency key to prevent duplicated emails. * Should be **unique per API request** * Idempotency keys expire after **24 hours** * Have a maximum length of **256 characters** * A retry with the same key returns the first successful response, with the `idempotent-replayed: true` header * A failed request is not stored, so you can retry it with the same key * Reusing the key with a different body, or while the first request is still running, returns a `409` [Learn more](/docs/dashboard/emails/idempotency-keys) ## Response Fields **id** `string` The ID of the sent email. Use it with the [emails endpoints](/docs/api-reference/emails/retrieve-email). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.emails.reply({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', threadId: '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', emailId: '5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60', cc: ['billing@example.com'], bcc: ['records@example.com'], html: '

Refund issued for order 1041.

', text: 'Refund issued for order 1041.', attachments: [ { path: 'https://resend.com/static/sample/invoice.pdf', filename: 'invoice.pdf', }, ], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->emails->reply( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', '5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60', [ 'cc' => ['billing@example.com'], 'bcc' => ['records@example.com'], 'html' => '

Refund issued for order 1041.

', 'text' => 'Refund issued for order 1041.', 'attachments' => [ [ 'path' => 'https://resend.com/static/sample/invoice.pdf', 'filename' => 'invoice.pdf', ], ], ] ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Threads.Emails.ReplyParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "thread_id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "email_id": "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", "cc": ["billing@example.com"], "bcc": ["records@example.com"], "html": "

Refund issued for order 1041.

", "text": "Refund issued for order 1041.", "attachments": [ { "path": "https://resend.com/static/sample/invoice.pdf", "filename": "invoice.pdf", } ], } resend.Inboxes.Threads.Emails.reply(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id: "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", email_id: "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", cc: ["billing@example.com"], bcc: ["records@example.com"], html: "

Refund issued for order 1041.

", text: "Refund issued for order 1041.", attachments: [{ path: "https://resend.com/static/sample/invoice.pdf", filename: "invoice.pdf" }] } Resend::Inboxes::Threads::Emails.reply(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.ReplyInboxThreadEmailRequest{ Cc: []string{"billing@example.com"}, Bcc: []string{"records@example.com"}, Html: "

Refund issued for order 1041.

", Text: "Refund issued for order 1041.", Attachments: []*resend.Attachment{ { Path: "https://resend.com/static/sample/invoice.pdf", Filename: "invoice.pdf", }, }, } client.Inboxes.Threads.Emails.Reply( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", params, ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{CreateAttachment, ReplyInboxThreadEmailOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = ReplyInboxThreadEmailOptions::new() .with_cc(["billing@example.com"]) .with_bcc(["records@example.com"]) .with_html("

Refund issued for order 1041.

") .with_text("Refund issued for order 1041.") .with_attachment( CreateAttachment::from_path("https://resend.com/static/sample/invoice.pdf") .with_filename("invoice.pdf"), ); let _reply = resend .inboxes .reply_thread_email( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", opts, ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.emails.model.Attachment; import com.resend.services.inboxes.model.ReplyInboxThreadEmailOptions; import com.resend.services.inboxes.model.ReplyInboxThreadEmailResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ReplyInboxThreadEmailOptions params = ReplyInboxThreadEmailOptions.builder() .cc("billing@example.com") .bcc("records@example.com") .html("

Refund issued for order 1041.

") .text("Refund issued for order 1041.") .attachments(Attachment.builder() .fileName("invoice.pdf") .path("https://resend.com/static/sample/invoice.pdf") .build()) .build(); ReplyInboxThreadEmailResponseSuccess data = resend.inboxes().threads().emails().reply( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadEmailReplyAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" ), new Guid( "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60" ), new InboxThreadEmailReplyData() { Cc = "billing@example.com", Bcc = "records@example.com", HtmlBody = "

Refund issued for order 1041.

", TextBody = "Refund issued for order 1041.", Attachments = [ new EmailAttachment() { Filename = "invoice.pdf", Path = "https://resend.com/static/sample/invoice.pdf", }, ], } ); Console.WriteLine( "Email Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12/emails/5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60/reply' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "cc": ["billing@example.com"], "bcc": ["records@example.com"], "html": "

Refund issued for order 1041.

", "text": "Refund issued for order 1041.", "attachments": [ { "path": "https://resend.com/static/sample/invoice.pdf", "filename": "invoice.pdf" } ] }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads emails reply b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12 5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60 \ --cc billing@example.com \ --bcc records@example.com \ --html "

Refund issued for order 1041.

" \ --text "Refund issued for order 1041." \ --attachment ./invoice.pdf ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "id": "6a0c8e58-3d9e-4f7a-8b14-2e3f4a5b6c71" } ``` # Search Threads Source: https://resend.com/docs/api-reference/inboxes/search-threads GET /inboxes/:inbox_id/threads/search Find threads in an inbox by text, people, attachments, and dates. Search finds threads by the text of their emails, who sent or received them, whether they have attachments, and their dates. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Query Parameters **query** `string` Free text to search for in the subject, body, sender, recipients, and attachment names. Max 256 characters and 32 words. **from** `string` Comma-separated senders. Up to `20` values. **to** `string` Comma-separated recipients. Up to `20` values. **cc** `string` Comma-separated CC recipients. Up to `20` values. **bcc** `string` Comma-separated BCC recipients. Up to `20` values. **has\_attachment** `boolean` `true` matches emails with an attachment. `false` matches emails without one. **start\_date** `string` Matches emails sent on or after this date. Accepts a date like `2026-09-01` or an ISO 8601 timestamp, in UTC unless the timestamp has an offset. **end\_date** `string` Matches emails sent on or before this date. Same formats as `start_date`. A date covers that whole day, so `start_date=2026-09-01&end_date=2026-09-30` covers all of September. **folders** `string` Comma-separated folders to search. Defaults to `inbox`, or to `inbox,archive,sent` when `labels` is set. * `inbox`: The default. The thread holds at least one received message. * `archive`: The thread was archived. * `spam`: The thread was marked as spam. * `trash`: The thread is scheduled for deletion in 30 days. * `sent`: Threads whose messages are all outbound. **labels** `string` Comma-separated label IDs. Returns threads with any of these labels. Up to `50` IDs. **read** `boolean` `true` returns threads where every email is read. `false` returns threads with at least one unread email. **limit** `number` Number of threads to return. Default is `20`, maximum is `100`, minimum is `1`. **after** `string` The ID of the last thread on the current page. Returns the next, older page. Must be a thread ID. **before** `string` The ID of the first thread on the current page. Returns the previous, newer page. Cannot be combined with `after`. Must be a thread ID. ## How matching works * `query` matches when every word appears somewhere in the email. A quoted phrase like `"late fee"` must appear word for word, and `-word` or `-"a phrase"` excludes emails that contain it. `query=invoice -draft` finds emails that mention `invoice` but not `draft`. * A comma means any of: `from=isabella@example.com,carolina@example.com` matches emails from either. Different parameters combine, so a thread must match all of them. * `folders`, `labels`, and `read` apply to the thread. `query`, `from`, `to`, `cc`, `bcc`, `has_attachment`, `start_date`, and `end_date` must all match the same email in the thread. * When any of these email filters is set, the matching email must itself be in one of `folders`. For `sent`, that means an email the inbox sent. * When more than 10,000 threads match, search covers the 10,000 with the newest matching email. ## Response Fields **object** `string` Always `list`. **has\_more** `boolean` Whether more threads exist beyond this page. Pass the last thread's `id` as `after` to continue. **data** `array` The matching threads, most recently active first. **properties** **id** `string` The ID of the thread. **subject** `string | null` The subject of the thread. **from** `string | null` Sender email address. Can include the display name. **to** `string[]` The recipients of the most recent message. For a received email, these are the addresses it was delivered to, not the full `To` header. **cc** `string[]` The CC recipients of the most recent message. **bcc** `string[]` The BCC recipients of the most recent message. Always empty for a received email. **labels** `array` The labels attached to the thread. **properties** **id** `string` The ID of the label. **name** `string` The name of the label. **color** `string` The color of the label as an uppercase `#RRGGBB` hex code. **email\_count** `number` The number of emails in the thread. **has\_attachment** `boolean` Whether the most recent message in the thread has an attachment. **has\_draft** `boolean` Whether the thread has an unsent draft. **read** `boolean` True only when every message in the thread is read. **received\_at** `string` ISO 8601 timestamp when the thread was last active. **folder** `string` The folder the thread lives in. Every thread sits in exactly one folder within its inbox. You can move a thread to `inbox`, `archive`, `spam`, or `trash`. `sent` is assigned automatically. * `inbox`: The default. The thread holds at least one received message. * `archive`: The thread was archived. * `spam`: The thread was marked as spam. * `trash`: The thread is scheduled for deletion in 30 days. * `sent`: Threads whose messages are all outbound. **matched\_email\_id** `string | null` Identifies the email in the thread that matched the search. When `query` has words or phrases, it's the most relevant match. Otherwise, it's the newest. [Retrieve Thread Email](/docs/api-reference/inboxes/get-thread-email), reply, and forward accept it as `email_id`. It is the same `id` that [List Thread Emails](/docs/api-reference/inboxes/list-thread-emails) returns. `null` when the search index returns no matched email for the thread. ## Errors Validation errors return `422` with the name `validation_error`. | Status | Message | When | | - | - | - | | `422` | ``The `query` parameter must be at most 256 characters, but received 300.`` | `query` is longer than `256` characters. | | `422` | ``The `query` parameter must contain at most 32 words, but received 40.`` | `query` has more than `32` words. | | `422` | ``The `from` parameter must contain at most 20 values, but received 25.`` | `from`, `to`, `cc`, or `bcc` has more than `20` values. | | `422` | ``The `start_date` must be a valid ISO 8601 date.`` | `start_date` or `end_date` isn't a date or timestamp. | | `422` | ``The `start_date` must be on or before the `end_date`.`` | `end_date` is before `start_date`. | | `422` | ``The `folders` value "drafts" must be one of: inbox, archive, spam, sent, trash.`` | `folders` has an unknown folder. | | `422` | ``The `labels` value "billing" must be a valid UUID.`` | `labels` has a value that isn't a label ID. | | `422` | ``The `labels` parameter must contain at most 50 label IDs, but received 60.`` | `labels` has more than `50` IDs. | | `422` | `The pagination limit must be a number between 1 and 100. See https://resend.com/docs/api-reference/pagination for more information.` | `limit` is out of range. | | `422` | ``The `read` parameter must be `true` or `false`.`` | `read` or `has_attachment` isn't `true` or `false`. | | `422` | ``The `after` parameter must be a thread ID. To filter by date, use `GET /inboxes/:id/threads/search` with `start_date`.`` | `after` or `before` is a date. For `before`, the message names `end_date`. | | `422` | ``You can only pass one of `before` or `after` for pagination. See https://resend.com/docs/api-reference/pagination for more information.`` | Both `after` and `before` are set. | | `404` | `Inbox not found.` | The inbox doesn't exist. | | `404` | `Label "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34" not found.` | A label ID in `labels` doesn't exist in the inbox. | | `404` | `The pagination cursor references an object that does not exist. See https://resend.com/docs/api-reference/pagination for more information.` | The thread in `after` or `before` isn't in the results. | ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.search({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', query: 'invoice -draft', from: ['isabella@example.com', 'carolina@example.com'], startDate: '2026-09-01', limit: 2, }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->search('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', [ 'query' => 'invoice -draft', 'from' => ['isabella@example.com', 'carolina@example.com'], 'start_date' => '2026-09-01', 'limit' => 2, ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Threads.SearchParams = { "query": "invoice -draft", "from": ["isabella@example.com", "carolina@example.com"], "start_date": "2026-09-01", "limit": 2, } resend.Inboxes.Threads.search("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", query: "invoice -draft", from: ["isabella@example.com", "carolina@example.com"], start_date: "2026-09-01", limit: 2 } Resend::Inboxes::Threads.search(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") limit := 2 options := &resend.SearchInboxThreadsOptions{ Query: "invoice -draft", From: []string{"isabella@example.com", "carolina@example.com"}, StartDate: "2026-09-01", Limit: &limit, } client.Inboxes.Threads.Search("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", options) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ list_opts::ListOptions, types::SearchInboxThreadsOptions, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let search = SearchInboxThreadsOptions::new() .with_query("invoice -draft") .with_from(["isabella@example.com", "carolina@example.com"]) .with_start_date("2026-09-01"); let _threads = resend .inboxes .search_threads( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", search, ListOptions::default().with_limit(2), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.SearchInboxThreadsParams; import com.resend.services.inboxes.model.SearchInboxThreadsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); SearchInboxThreadsParams params = SearchInboxThreadsParams.builder() .query("invoice -draft") .from("isabella@example.com", "carolina@example.com") .startDate("2026-09-01") .limit(2) .build(); SearchInboxThreadsResponseSuccess data = resend.inboxes().threads() .search("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadSearchAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new InboxThreadSearchQuery() { Query = "invoice -draft", From = [ "isabella@example.com", "carolina@example.com" ], StartDate = "2026-09-01", Limit = 2, } ); Console.WriteLine( "Nr Threads={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl --get 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/search' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ --data-urlencode 'query=invoice -draft' \ --data-urlencode 'from=isabella@example.com,carolina@example.com' \ --data-urlencode 'start_date=2026-09-01' \ --data-urlencode 'limit=2' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads search b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 \ --query "invoice -draft" \ --from isabella@example.com carolina@example.com \ --start-date 2026-09-01 \ --limit 2 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": true, "data": [ { "id": "b1e7c9d2-5a4f-4c3e-8d2b-7f6a1e9c0b54", "subject": "September invoice", "from": "Isabella ", "to": ["billing@example.com"], "cc": [], "bcc": [], "labels": [ { "id": "0c9e4b7a-3f2d-4a1c-b8e6-5d7f2a9c1e03", "name": "Billing", "color": "#46A758" } ], "email_count": 3, "has_attachment": true, "has_draft": false, "read": false, "received_at": "2026-09-24T14:12:08.000Z", "folder": "inbox", "matched_email_id": "e8a3f1c6-2b9d-4e5a-a7c4-9d1b6f3e2a80" }, { "id": "7d2f8a3b-9c1e-4b6d-a5f2-3e8c0b7a9d16", "subject": "Re: Q3 renewal", "from": "Carolina ", "to": ["billing@example.com"], "cc": ["finance@example.com"], "bcc": [], "labels": [], "email_count": 5, "has_attachment": false, "has_draft": false, "read": true, "received_at": "2026-09-18T09:47:31.000Z", "folder": "inbox", "matched_email_id": "3c6b9e2d-7a1f-4d8c-b3e5-0f2a8d6c4b19" } ] } ``` # Send Draft Source: https://resend.com/docs/api-reference/inboxes/send-draft POST /inboxes/:inbox_id/drafts/:draft_id/send Send an existing draft from the inbox address. Sends the draft from the inbox address. The draft needs a `to` recipient and `html` or `text`. A draft that is not a reply also needs a `subject`. Otherwise, the request returns a `422`. A reply draft without a subject uses the thread subject with a `Re:` prefix. The whole email can be at most 40 MB. A draft that was already sent returns a `409`. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Draft ID. ## Body Parameters The request body is optional and takes only `headers`. Without headers, send no body. **headers** `object | null` Custom headers to add to the email. You cannot set `In-Reply-To`, `References`, or `Reply-To`. ## Headers **Idempotency-Key** `string` Add an idempotency key to prevent duplicated emails. * Should be **unique per API request** * Idempotency keys expire after **24 hours** * Have a maximum length of **256 characters** * A retry with the same key returns the first successful response, with the `idempotent-replayed: true` header * A failed request is not stored, so you can retry it with the same key * Reusing the key with a different body, or while the first request is still running, returns a `409` [Learn more](/docs/dashboard/emails/idempotency-keys) ## Response Fields **id** `string` The ID of the sent email. Use it with the [emails endpoints](/docs/api-reference/emails/retrieve-email). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.drafts.send({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', draftId: 'c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->drafts->send( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', 'c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Inboxes.Drafts.send( inbox_id="b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", draft_id="c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", draft_id: "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32" } Resend::Inboxes::Drafts.send(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Inboxes.Drafts.Send( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", nil, ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{SendInboxDraftOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _sent = resend .inboxes .send_draft( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", SendInboxDraftOptions::new(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.SendInboxDraftResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); SendInboxDraftResponseSuccess data = resend.inboxes().drafts().send( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxDraftSendAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32" ) ); Console.WriteLine( "Email Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts/c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32/send' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes drafts send b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "id": "6a0c8e58-3d9e-4f7a-8b14-2e3f4a5b6c71" } ``` # Set Thread Labels Source: https://resend.com/docs/api-reference/inboxes/set-thread-labels PUT /inboxes/:inbox_id/threads/:thread_id/labels Replace every label on a thread. The thread ends up with exactly the labels given, in one atomic change. Labels on the thread that are not listed are taken off, and the labels themselves are kept. If any label ID is not found, the request returns a `404` and nothing changes. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Thread ID. ## Body Parameters **labels** `string[]` *required* The IDs of the labels the thread should carry. Up to 100 IDs, each belonging to the inbox. Pass an empty array to take every label off the thread. ## Response Fields **object** `string` Always `list`. **data** `array` Every label on the thread after the change. **properties** **id** `string` The ID of the label. **name** `string` The name of the label. **color** `string` The color of the label as an uppercase `#RRGGBB` hex code, like `#E93D82`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.labels.set({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', threadId: '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', labels: ['2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d'], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->labels->set( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', [ 'labels' => ['2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d'], ] ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Threads.Labels.SetParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "thread_id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "labels": ["2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d"], } resend.Inboxes.Threads.Labels.set(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id: "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", labels: ["2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d"] } Resend::Inboxes::Threads::Labels.set(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.SetInboxThreadLabelsRequest{ Labels: []string{"2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d"}, } client.Inboxes.Threads.Labels.Set( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", params, ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _labels = resend .inboxes .set_thread_labels( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", &["2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d"], ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.SetInboxThreadLabelsOptions; import com.resend.services.inboxes.model.SetInboxThreadLabelsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); SetInboxThreadLabelsOptions params = SetInboxThreadLabelsOptions.builder() .labels("2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d") .build(); SetInboxThreadLabelsResponseSuccess data = resend.inboxes().threads().setLabels( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadLabelSetAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" ), [ new Guid( "2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d" ) ] ); Console.WriteLine( "Nr Labels={0}", resp.Content.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PUT 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12/labels' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "labels": ["2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d"] }' ``` ```bash Clear all labels theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PUT 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12/labels' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "labels": [] }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads labels set b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12 \ --labels 2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "data": [ { "id": "2a8b4c6d-1e3f-4a5b-9c7d-8e0f1a2b3c4d", "name": "Billing", "color": "#00A2C7" } ] } ``` # Update Agent Settings Source: https://resend.com/docs/api-reference/inboxes/update-agent PATCH /inboxes/:inbox_id/agent Update the agent settings for an inbox. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Body Parameters Send at least one of `instructions`, `tone`, or `actions`. Omitted fields keep their current value. **instructions** `string | null` Instructions the agent follows when handling the inbox's threads. 1 to 4000 characters. Whitespace at the start and end does not count. Send `null` to clear them. **tone** `'concise_professional' | 'concise_casual' | 'expanded_professional' | 'expanded_casual' | null` Tone the agent writes in. Send `null` to clear it. * `concise_professional`: Brief responses in a professional tone. * `concise_casual`: Brief responses in a casual tone. * `expanded_professional`: Detailed responses in a professional tone. * `expanded_casual`: Detailed responses in a casual tone. **actions** `string[]` Actions the agent is allowed to take. The list replaces the current actions. Send an empty array to disable all actions. * `draft_reply`: Draft a reply. * `forward_thread`: Forward a thread. * `add_labels`: Add labels to a thread. * `assign_thread`: Assign a thread. * `mark_as_spam`: Mark a thread as spam. * `archive`: Archive a thread. * `move_to_trash`: Move a thread to the trash. ## Response Fields **object** `string` Always `inbox_agent`. **id** `string` The ID of the agent. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.agent.update({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', instructions: 'Answer refund questions yourself. Escalate legal threats.', tone: 'concise_professional', actions: ['draft_reply', 'add_labels'], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->agent->update('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', [ 'instructions' => 'Answer refund questions yourself. Escalate legal threats.', 'tone' => 'concise_professional', 'actions' => ['draft_reply', 'add_labels'], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Agent.UpdateParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "instructions": "Answer refund questions yourself. Escalate legal threats.", "tone": "concise_professional", "actions": ["draft_reply", "add_labels"], } resend.Inboxes.Agent.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", instructions: "Answer refund questions yourself. Escalate legal threats.", tone: "concise_professional", actions: ["draft_reply", "add_labels"] } Resend::Inboxes::Agent.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") instructions := "Answer refund questions yourself. Escalate legal threats." tone := resend.InboxAgentToneConciseProfessional params := &resend.UpdateInboxAgentRequest{ Instructions: &instructions, Tone: &tone, Actions: []resend.InboxAgentAction{ resend.InboxAgentActionDraftReply, resend.InboxAgentActionAddLabels, }, } client.Inboxes.Agent.Update("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{InboxAgentAction, InboxAgentTone, UpdateInboxAgentOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = UpdateInboxAgentOptions::new() .with_instructions("Answer refund questions yourself. Escalate legal threats.") .with_tone(InboxAgentTone::ConciseProfessional) .with_actions([InboxAgentAction::DraftReply, InboxAgentAction::AddLabels]); let _agent = resend .inboxes .update_agent("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", opts) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.InboxAgentAction; import com.resend.services.inboxes.model.InboxAgentTone; import com.resend.services.inboxes.model.UpdateInboxAgentOptions; import com.resend.services.inboxes.model.UpdateInboxAgentResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateInboxAgentOptions params = UpdateInboxAgentOptions.builder() .instructions("Answer refund questions yourself. Escalate legal threats.") .tone(InboxAgentTone.CONCISE_PROFESSIONAL) .actions(InboxAgentAction.DRAFT_REPLY, InboxAgentAction.ADD_LABELS) .build(); UpdateInboxAgentResponseSuccess data = resend.inboxes().agent() .update("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxAgentUpdateAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new InboxAgentUpdateData() { Instructions = "Answer refund questions yourself. Escalate legal threats.", Tone = InboxAgentTone.ConciseProfessional, Actions = [ InboxAgentAction.DraftReply, InboxAgentAction.AddLabels ], } ); Console.WriteLine( "Agent Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/agent' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "instructions": "Answer refund questions yourself. Escalate legal threats.", "tone": "concise_professional", "actions": ["draft_reply", "add_labels"] }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes agent update b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 \ --instructions "Answer refund questions yourself. Escalate legal threats." \ --tone concise_professional \ --actions draft_reply,add_labels ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_agent", "id": "a1f84a4e-6f2b-4f0a-9c1d-8a2e5b3c7d90" } ``` # Update Draft Source: https://resend.com/docs/api-reference/inboxes/update-draft PATCH /inboxes/:inbox_id/drafts/:draft_id Update an unsent draft. Updates the content of an unsent draft. A draft that was already sent returns a `409`. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Draft ID. ## Body Parameters Send at least one field. Omitted fields keep their current value. A request with `html` or `text` replaces both, and the one you leave out is saved as `null`. After the update, the draft must still have at least one non-empty field, and `to`, `cc`, and `bcc` combined cannot exceed 50 recipients. **to** `string | string[] | null` Recipients. Send `null` or `[]` to clear them. **cc** `string | string[] | null` CC recipients. Send `null` or `[]` to clear them. **bcc** `string | string[] | null` BCC recipients. Send `null` or `[]` to clear them. **subject** `string | null` The subject. 1 to 2000 characters, with no line breaks. Send `null` to clear it. **html** `string | null` The HTML body. Send `null` to clear it. **text** `string | null` The plain-text body. Send `null` to clear it. **attachments** `array | null` Files to store on the draft, up to 25 MB in total, downloaded files included. All `path` downloads must finish within 20 seconds together. Sending the field replaces every attachment on the draft. Send `null` or `[]` to remove them all. Drafts do not accept `content_id`. **properties** **content** `buffer | string` Content of an attached file, passed as a buffer or Base64 string. Either `content` or `path` must be provided. **path** `string` Path where the attachment file is hosted. Resend downloads it when the draft is saved, so a URL that cannot be downloaded returns an error. When both `content` and `path` are sent, `content` is used. **filename** `string` *required* Name of attached file. Content type for the attachment. Must be a valid MIME type, such as `application/pdf`. Required with `content`. With `path`, it defaults to the type of the downloaded file. ## Response Fields **object** `string` Always `inbox_draft`. **id** `string` The ID of the draft. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.drafts.update({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', draftId: 'c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32', subject: 'Refund issued for order 1041', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->drafts->update( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', 'c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32', ['subject' => 'Refund issued for order 1041'] ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Drafts.UpdateParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "id": "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", "subject": "Refund issued for order 1041", } resend.Inboxes.Drafts.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", draft_id: "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", subject: "Refund issued for order 1041" } Resend::Inboxes::Drafts.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") subject := "Refund issued for order 1041" params := &resend.UpdateInboxDraftRequest{ Subject: &subject, } client.Inboxes.Drafts.Update( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", params, ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{UpdateInboxDraftOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = UpdateInboxDraftOptions::new().with_subject("Refund issued for order 1041"); let _draft = resend .inboxes .update_draft( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", opts, ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.UpdateInboxDraftOptions; import com.resend.services.inboxes.model.UpdateInboxDraftResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateInboxDraftOptions params = UpdateInboxDraftOptions.builder() .subject("Refund issued for order 1041") .build(); UpdateInboxDraftResponseSuccess data = resend.inboxes().drafts().update( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxDraftUpdateAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32" ), new InboxDraftUpdateData() { Subject = "Refund issued for order 1041", } ); Console.WriteLine( "Draft Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts/c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "subject": "Refund issued for order 1041" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes drafts update b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32 \ --subject "Refund issued for order 1041" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_draft", "id": "c3a1e8b4-2d5f-4a7c-9e10-6b8d7f5a4c32" } ``` # Update Inbox Source: https://resend.com/docs/api-reference/inboxes/update-inbox PATCH /inboxes/:inbox_id Update the internal inbox name or the name recipients see when sending. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. ## Body Parameters At least one of `name` or `from_name` is required. Omitted fields keep their current value. **name** `string` New internal name for the inbox. Recipients do not see it. Between 1 and 64 characters after trimming. The name recipients see when mail is sent from this inbox. Use a plain name, without `:`, `<`, `>`, or line breaks. Max 78 characters. An email address in the name must be on one of your verified domains. Send an empty string to remove it. ## Response Fields **object** `string` Always `inbox`. **id** `string` The ID of the inbox. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.update( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', { name: 'Customer Support', fromName: 'Ada from Support' }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->update('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', [ 'name' => 'Customer Support', 'from_name' => 'Ada from Support', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.UpdateParams = { "id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "name": "Customer Support", "from_name": "Ada from Support", } resend.Inboxes.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", name: "Customer Support", from_name: "Ada from Support" } Resend::Inboxes.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") fromName := "Ada from Support" params := &resend.UpdateInboxRequest{ Name: "Customer Support", FromName: &fromName, } client.Inboxes.Update("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{UpdateInboxOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = UpdateInboxOptions::new() .with_name("Customer Support") .with_from_name("Ada from Support"); let _inbox = resend .inboxes .update("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", opts) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.UpdateInboxOptions; import com.resend.services.inboxes.model.UpdateInboxResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateInboxOptions params = UpdateInboxOptions.builder() .name("Customer Support") .fromName("Ada from Support") .build(); UpdateInboxResponseSuccess data = resend.inboxes() .update("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxUpdateAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new InboxUpdateData() { Name = "Customer Support", FromName = "Ada from Support", } ); Console.WriteLine( "Inbox Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "Customer Support", "from_name": "Ada from Support" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes update b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 \ --name "Customer Support" \ --from-name "Ada from Support" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox", "id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" } ``` # Update Label Source: https://resend.com/docs/api-reference/inboxes/update-label PATCH /inboxes/:inbox_id/labels/:label_id Rename or recolor an existing label. ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Label ID. ## Body Parameters Omitted fields keep their current value. **name** `string` A new name for the label. Max 64 characters. A name that another label in the inbox already uses, compared without case, returns a `422`. **color** `string` A new color for the label as a `#RRGGBB` hex code, like `#E93D82`. ## Response Fields **object** `string` Always `inbox_label`. **id** `string` The ID of the label. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.labels.update({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', labelId: '7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34', color: '#F76B15', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->labels->update( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34', ['color' => '#F76B15'] ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Labels.UpdateParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "id": "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", "color": "#F76B15", } resend.Inboxes.Labels.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", label_id: "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", color: "#F76B15" } Resend::Inboxes::Labels.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.UpdateInboxLabelRequest{ Color: "#F76B15", } client.Inboxes.Labels.Update( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", params, ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{UpdateInboxLabelOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = UpdateInboxLabelOptions::new().with_color("#F76B15"); let _label = resend .inboxes .update_label( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", opts, ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.UpdateInboxLabelOptions; import com.resend.services.inboxes.model.UpdateInboxLabelResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateInboxLabelOptions params = UpdateInboxLabelOptions.builder() .color("#F76B15") .build(); UpdateInboxLabelResponseSuccess data = resend.inboxes().labels().update( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.InboxLabelUpdateAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34" ), new InboxLabelUpdateData() { Color = "#F76B15", } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/labels/7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "color": "#F76B15" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes labels update b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34 \ --color '#F76B15' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_label", "id": "7f9c1d2e-4a6b-4c3d-8e15-9b0a7c6d5e34" } ``` # Update Thread Source: https://resend.com/docs/api-reference/inboxes/update-thread PATCH /inboxes/:inbox_id/threads/:thread_id Mark a thread read or unread, or move it to another folder. To change a thread's labels, use [Add Thread Labels](/docs/api-reference/inboxes/add-thread-labels), [Set Thread Labels](/docs/api-reference/inboxes/set-thread-labels), or [Remove Thread Label](/docs/api-reference/inboxes/remove-thread-label). ## Path Parameters The Inbox ID or the inbox email address, such as `support@example.com`. The Thread ID. ## Body Parameters At least one of `read` or `folder` is required. Omitted fields keep their current value. **read** `boolean` Marks every message in the thread read or unread. **folder** `string` Moves the thread to this folder. Every thread sits in exactly one folder within its inbox. `sent` is assigned automatically and cannot be set. * `inbox`: The default. The thread holds at least one received message. * `archive`: The thread was archived. * `spam`: The thread was marked as spam. * `trash`: The thread is scheduled for deletion in 30 days. ## Response Fields **object** `string` Always `inbox_thread`. **id** `string` The ID of the thread. **subject** `string | null` The subject of the thread. **folder** `string` The folder the thread lives in after the update. * `inbox`: The default. The thread holds at least one received message. * `archive`: The thread was archived. * `spam`: The thread was marked as spam. * `trash`: The thread is scheduled for deletion in 30 days. * `sent`: Threads whose messages are all outbound. **labels** `array` The labels attached to the thread. **properties** **id** `string` The ID of the label. **name** `string` The name of the label. **color** `string` The color of the label as an uppercase `#RRGGBB` hex code. **read** `boolean` True only when every message in the thread is read. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.inboxes.threads.update({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', threadId: '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', read: true, folder: 'spam', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->inboxes->threads->update( 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', '4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12', [ 'read' => true, 'folder' => 'spam', ] ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Inboxes.Threads.UpdateParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "read": True, "folder": "spam", } resend.Inboxes.Threads.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", thread_id: "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", read: true, folder: "spam" } Resend::Inboxes::Threads.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") read := true params := &resend.UpdateInboxThreadRequest{ Read: &read, Folder: resend.InboxMoveThreadFolderSpam, } client.Inboxes.Threads.Update( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", params, ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{UpdateInboxThreadFolder, UpdateInboxThreadOptions}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = UpdateInboxThreadOptions::new() .with_read(true) .with_folder(UpdateInboxThreadFolder::Spam); let _thread = resend .inboxes .update_thread( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", opts, ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.inboxes.model.MoveInboxThreadFolder; import com.resend.services.inboxes.model.UpdateInboxThreadOptions; import com.resend.services.inboxes.model.UpdateInboxThreadResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateInboxThreadOptions params = UpdateInboxThreadOptions.builder() .read(true) .folder(MoveInboxThreadFolder.SPAM) .build(); UpdateInboxThreadResponseSuccess data = resend.inboxes().threads().update( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.InboxThreadUpdateAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new Guid( "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12" ), new InboxThreadUpdateData() { IsRead = true, Folder = InboxMoveFolder.Spam, } ); Console.WriteLine( "Thread folder={0}", resp.Content.Folder ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "read": true, "folder": "spam" }' ``` ```bash Restore a trashed thread theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/threads/4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "folder": "inbox" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads update b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12 \ --read \ --folder spam ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "inbox_thread", "id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "subject": "Refund for order 1041", "folder": "spam", "labels": [], "read": true } ``` # Introduction Source: https://resend.com/docs/api-reference/introduction Understand general concepts, response codes, and authentication strategies. > [!NOTE] > > For most use cases, we recommend using an [official Resend SDK](/docs/sdks) instead > of calling the API directly. The SDKs handle authentication, required headers, > and error handling for you. See [Resend API vs SDK](/docs/api-vs-sdk) to decide > which fits your project. ## Base URL The Resend API is built on **REST** principles. **HTTPS** is enforced in every request to improve data security, integrity, and privacy. The API does not support **HTTP**. All requests contain the following base URL: ``` https://api.resend.com ``` ## Authentication To authenticate you need to add an *Authorization* header with the contents of the header being `Bearer re_xxxxxxxxx` where `re_xxxxxxxxx` is your [API Key](https://resend.com/api-keys). ``` Authorization: Bearer re_xxxxxxxxx ``` ## User-Agent All API requests must include a `User-Agent` header. Requests without this header will be rejected with a `403` status code. Most HTTP clients, all [Resend SDKs](/docs/sdks), and the [Resend CLI](/docs/cli) include this header automatically, but if you're making direct HTTP requests, make sure to set it: ``` User-Agent: my-app/1.0 ``` > [!NOTE] > > If you're getting a `403` error with error code `1010` despite having a valid > API key, a missing `User-Agent` header is likely the cause. See [Error > 1010](/docs/knowledge-base/403-error-1010) for more details. ## Response codes Resend uses standard HTTP codes to indicate the success or failure of your requests. In general, `2xx` HTTP codes correspond to success, `4xx` codes are for user-related failures, and `5xx` codes are for infrastructure issues. | Status | Description | | - | - | | `200` | Successful request. | | `400` | Check that the parameters were correct. | | `401` | The API key used was missing. | | `403` | The API key used was invalid. | | `404` | The resource was not found. | | `429` | The rate limit was exceeded. | | `5xx` | Indicates an error with Resend servers. | > [!NOTE] > > Check [Error Codes](/docs/api-reference/errors) for a comprehensive breakdown of > all possible API errors. ## Rate limit The default maximum rate limit is **10 requests per second per team**. This limit applies across all API keys associated with your team. This number can be increased for trusted senders by request. You can view your team's current rate limit on the [Settings Usage page](https://resend.com/settings/usage). After that, you'll hit the rate limit and receive a `429` response error code. Learn more about our [rate limits](/docs/api-reference/rate-limit). ## FAQ > [accordion] How does pagination work with the API? > > Some endpoints support cursor-based pagination to help you browse through > large datasets efficiently. Check our [pagination > guide](/docs/api-reference/pagination) for detailed information on how to use > pagination parameters. > [accordion] How do you handle API versioning? > > Currently, there's no versioning system in place. We plan to add versioning > via calendar-based headers in the future. # List Logs Source: https://resend.com/docs/api-reference/logs/list-logs GET /logs Retrieve a list of API request logs. ## Query Parameters **limit** `number` Number of logs to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more logs (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more logs (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.logs.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->logs->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Logs.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" logs = Resend::Logs.list puts logs ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") logs, err := client.Logs.ListWithOptions(ctx, nil) if err != nil { panic(err) } if logs.HasMore { opts := &resend.ListOptions{ After: &logs.Data[len(logs.Data)-1].Id, } client.Logs.ListWithOptions(ctx, opts) } } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _logs = resend .logs .list(ListOptions::default()) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); resend.logs().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; using System.Linq; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.LogListAsync(); Console.WriteLine( "Count={0}", resp.Content.Data.Count ); if ( resp.Content.HasMore ) { var lastId = resp.Content.Data.Last().Id; await resend.LogListAsync( new PaginatedQuery() { After = lastId.ToString(), } ); } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/logs' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend logs list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "37e4414c-5e25-4dbc-a071-43552a4bd53b", "created_at": "2026-03-30 13:43:54.622865+00", "endpoint": "/emails", "method": "POST", "response_status": 200, "user_agent": "resend-node:6.0.3" }, { "id": "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d", "created_at": "2026-03-30 12:15:00.123456+00", "endpoint": "/emails/4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "method": "GET", "response_status": 200, "user_agent": "curl/8.7.1" } ] } ``` # Retrieve Log Source: https://resend.com/docs/api-reference/logs/retrieve-log GET /logs/:log_id Retrieve a single API request log. ## Path Parameters **log\_id** `string` *required* The Log ID. > [!NOTE] > > The `request_body` and `response_body` fields vary depending on the original > API request that was logged. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.logs.get( '37e4414c-5e25-4dbc-a071-43552a4bd53b', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->logs->get('37e4414c-5e25-4dbc-a071-43552a4bd53b'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Logs.get("37e4414c-5e25-4dbc-a071-43552a4bd53b") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" log = Resend::Logs.get("37e4414c-5e25-4dbc-a071-43552a4bd53b") puts log ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Logs.Get("37e4414c-5e25-4dbc-a071-43552a4bd53b") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _logs = resend .logs .get("37e4414c-5e25-4dbc-a071-43552a4bd53b") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); resend.logs().get("37e4414c-5e25-4dbc-a071-43552a4bd53b"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.LogRetrieveAsync( new Guid( "37e4414c-5e25-4dbc-a071-43552a4bd53b" ) ); Console.WriteLine( "Endpoint={0}", resp.Content.Endpoint ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/logs/37e4414c-5e25-4dbc-a071-43552a4bd53b' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend logs get 37e4414c-5e25-4dbc-a071-43552a4bd53b ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "log", "id": "37e4414c-5e25-4dbc-a071-43552a4bd53b", "created_at": "2026-03-30 13:43:54.622865+00", "endpoint": "/emails", "method": "POST", "response_status": 200, "user_agent": "resend-node:6.0.3", "request_body": { "from": "Acme ", "to": ["delivered@resend.dev"], "subject": "Hello World" }, "response_body": { "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" } } ``` # Authorize Source: https://resend.com/docs/api-reference/oauth/authorize GET /oauth/authorize Start the OAuth authorization code + PKCE flow. This is a browser redirect endpoint, not a JSON API call. Open this URL in the user's browser. Don't fetch it from a backend or CLI process and follow the redirect yourself, since the user has to see and approve the consent screen. The flow: 1. The client opens `/oauth/authorize` in the user's browser. 2. Resend redirects (`302`) to the Resend dashboard consent screen, which handles login if needed. 3. The user reviews and approves (or denies) the request. 4. The dashboard redirects the browser back to the client's `redirect_uri` with a `code` and the original `state`. ## Query Parameters **client\_id** `string` *required* The `client_id` from [registration](/docs/api-reference/oauth/register), or the HTTPS URL of a [Client ID Metadata Document](#client-id-metadata-documents). Resend tells the two apart by the `https://` prefix. **response\_type** `string` *required* Must be `"code"`. **redirect\_uri** `string` *required* Must exactly match one of the client's registered redirect URIs. The only exception is loopback URIs (`127.0.0.1`, `localhost`, `[::1]`), where the port is allowed to differ from what was registered. **scope** `string` Space-delimited list of requested scopes. If omitted, defaults to the client's full registered scope set. ### Scopes * `emails:send` is enough for send-only routes: `POST /emails`, `POST /email`, `POST /emails/sending`, `POST /email/sending`, and `POST /broadcasts/:broadcastId/send`. * `full_access` is required for every other API route. Also satisfies any `emails:send`-scoped check. **state** `string` An opaque value round-tripped back on the callback unchanged. Use it to bind the callback to the request that started the flow. Recommended, not required by the server, but a client that skips it can't detect CSRF on the callback. Maximum 1024 characters. **code\_challenge** `string` *required* Base64url-encoded SHA-256 hash of a [code\_verifier](/docs/api-reference/oauth/token#param-code-verifier) your client generates. **code\_challenge\_method** `string` *required* Must be `"S256"`. Resend does not support the `plain` method. > [!NOTE] > > A `resource` parameter (RFC 8707) is accepted but ignored. Resend does not > support resource indicators yet. ### Client ID Metadata Documents A `client_id` that starts with `https://` is read as the URL of a JSON document describing the client, so the client never registers. This follows the [OAuth Client ID Metadata Document](https://datatracker.ietf.org/doc/draft-ietf-oauth-client-id-metadata-document/) draft. This is the only endpoint that fetches the document. See [Client ID Metadata Documents](/docs/guides/building-a-resend-oauth-client#client-id-metadata-documents) for the document fields and for how Resend fetches and caches it. ```bash Browser navigation theme={"theme":{"light":"github-light","dark":"vesper"}} GET https://api.resend.com/oauth/authorize?client_id=550e8400-e29b-41d4-a716-446655440000&response_type=code&redirect_uri=http%3A%2F%2F127.0.0.1%3A49152%2Foauth%2Fcallback&scope=emails%3Asend&state=STATE_VALUE&code_challenge=CODE_CHALLENGE_VALUE&code_challenge_method=S256 ``` ```http Response theme={"theme":{"light":"github-light","dark":"vesper"}} HTTP/1.1 302 Found Location: https://resend.com/oauth/authorize/3f9c1e2a-... ``` ## Errors Before `client_id` and `redirect_uri` are validated (unknown `client_id`, invalid or unregistered `redirect_uri`), Resend returns a JSON error body, since it can't safely redirect to an unvalidated URL. Once Resend validates `client_id` and `redirect_uri`, errors redirect (`302`) back to `redirect_uri` with `error`, `error_description`, and (if provided) `state` as query parameters only when the `redirect_uri` is trusted: a loopback address, a private-use URI scheme, or a verified client. An unverified `https` callback gets a JSON error body instead, which prevents the endpoint from being used as an open redirect. Handle both. | `error` | When | | - | - | | `invalid_request` | `response_type` isn't `code`, or `code_challenge_method` isn't `S256`. | | `invalid_client` | Unknown or disabled `client_id`. Also a metadata document that couldn't be fetched or didn't validate. | | `unauthorized_client` | The client isn't registered for the `authorization_code` grant. | | `invalid_scope` | No scope requested, a scope isn't supported, or a scope isn't in the client's registered `scopes_allowed`. | | `server_error` | Resend failed to persist the authorization request. | # List Grants Source: https://resend.com/docs/api-reference/oauth/list-grants GET /oauth/grants Retrieve a list of OAuth grants for the authenticated team. Returns all of the team's OAuth grants, including revoked ones. A grant's `revoked_at` and `revoked_reason` are `null` while it is active. They are set once the grant is revoked. ## Query Parameters **limit** `number` Number of OAuth grants to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more OAuth grants (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more OAuth grants (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.oauthGrants.list(); ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _data = resend.oauth.list(ListOptions::default()).await?; Ok(()) } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/oauth/grants' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend oauth-grants list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "650e8400-e29b-41d4-a716-446655440001", "client_id": "430eed87-632a-4ea6-90db-0aace67ec228", "scopes": ["emails:send"], "resource": null, "created_at": "2026-04-08 00:11:13.110779+00", "revoked_at": null, "revoked_reason": null, "client": { "name": "Resend CLI", "logo_uri": "https://example.com/logo.png" } }, { "id": "650e8400-e29b-41d4-a716-446655440002", "client_id": "430eed87-632a-4ea6-90db-0aace67ec228", "scopes": ["emails:send", "domains:read"], "resource": "https://api.resend.com", "created_at": "2026-04-07 00:11:13.110779+00", "revoked_at": "2026-04-09 00:11:13.110779+00", "revoked_reason": "revoked_from_api", "client": { "name": "Resend CLI", "logo_uri": "https://example.com/logo.png" } } ] } ``` # Register Client Source: https://resend.com/docs/api-reference/oauth/register POST /oauth/register Dynamically register an OAuth client for the authorization code + PKCE flow (RFC 7591). Unauthenticated (no API key). Rate-limited to 20 registrations per hour per IP address. > [!NOTE] > > Prefer a [Client ID Metadata > Document](/docs/guides/building-a-resend-oauth-client#client-id-metadata-documents) > if the client can host a static JSON file. See [Building an OAuth > client](/docs/guides/building-a-resend-oauth-client) for choosing a registration > method and client type. ## Body Parameters **client\_name** `string` *required* A human-readable name for the client. Maximum 200 characters. **redirect\_uris** `string[]` *required* 1 to 10 URIs, each up to 2048 characters. See [Allowed redirect URIs](#allowed-redirect-uris). **grant\_types** `string[]` (default: \["authorization\_code", "refresh\_token"]) Must include `authorization_code`. `refresh_token` is also supported. **response\_types** `string[]` (default: \["code"]) Only `code` is supported. Validated if present but not stored; the response always echoes back `["code"]`. **scope** `string` Space-delimited list of scopes, e.g. `"emails:send"`. Must be a subset of the [supported scopes](/docs/api-reference/oauth/authorize#scopes). If omitted, the client is registered with every supported scope. **token\_endpoint\_auth\_method** `string` (default: none) How the client authenticates at the [token](/docs/api-reference/oauth/token) and [revocation](/docs/api-reference/oauth/revoke) endpoints. `none` registers a public client (PKCE only). `client_secret_basic` and `client_secret_post` register a confidential client and issue a `client_secret` in the response. See [Confidential clients](#confidential-clients). PKCE is required on every authorization code exchange regardless of method. **client\_uri** `string` A URL for the client's homepage. Echoed back, not otherwise used. **logo\_uri** `string` A URL for the client's logo. Shown on the consent screen. ### Confidential clients Registering with `token_endpoint_auth_method` set to `client_secret_basic` or `client_secret_post` returns two extra fields, documented in [Response Fields](#response-fields) below. ### Allowed redirect URIs * `https://` URIs are unrestricted. * `http://` is only allowed for loopback addresses (`127.0.0.1`, `localhost`, `[::1]`). * Private-use URI schemes (e.g. `cursor://`, `vscode://`) are allowed. * `file`, `ftp`, `data`, `javascript`, `blob`, `about`, and `vbscript` schemes are rejected. No URI may include a fragment. ## Response Fields The response echoes back the registered client metadata along with the issued `client_id`. Registering a [confidential client](#confidential-clients) returns two extra fields: **client\_secret** `string` The generated client secret. Returned **only once**, in this response. Resend stores a hash and can't show it again, so persist it securely at registration time. If it's lost, register a new client. **client\_secret\_expires\_at** `number` Unix time at which the secret expires. Always `0`: the secret does not expire. ```bash Public client theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/register' \ -H 'Content-Type: application/json' \ -d $'{ "client_name": "Example OAuth Client", "redirect_uris": ["http://127.0.0.1/oauth/callback"], "grant_types": ["authorization_code", "refresh_token"], "response_types": ["code"], "token_endpoint_auth_method": "none", "scope": "emails:send" }' ``` ```bash Confidential client theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/register' \ -H 'Content-Type: application/json' \ -d $'{ "client_name": "Example OAuth Client", "redirect_uris": ["http://127.0.0.1/oauth/callback"], "grant_types": ["authorization_code", "refresh_token"], "response_types": ["code"], "token_endpoint_auth_method": "client_secret_basic", "scope": "emails:send" }' ``` ```json Public client theme={"theme":{"light":"github-light","dark":"vesper"}} { "client_id": "550e8400-e29b-41d4-a716-446655440000", "client_id_issued_at": 1750000000, "client_name": "Example OAuth Client", "redirect_uris": ["http://127.0.0.1/oauth/callback"], "grant_types": ["authorization_code", "refresh_token"], "response_types": ["code"], "token_endpoint_auth_method": "none", "scope": "emails:send" } ``` ```json Confidential client theme={"theme":{"light":"github-light","dark":"vesper"}} { "client_id": "550e8400-e29b-41d4-a716-446655440000", "client_id_issued_at": 1750000000, "client_name": "Example OAuth Client", "redirect_uris": ["http://127.0.0.1/oauth/callback"], "grant_types": ["authorization_code", "refresh_token"], "response_types": ["code"], "token_endpoint_auth_method": "client_secret_basic", "scope": "emails:send", "client_secret": "3vProAFw7...store-this-now...KpQ", "client_secret_expires_at": 0 } ``` ## Errors Errors use the standard OAuth shape (`{"error": "...", "error_description": "..."}`) rather than Resend's usual [error format](/docs/api-reference/errors). | Status | `error` | When | | - | - | - | | `400` | `invalid_request` | A required field is missing, malformed, or a redirect URI is disallowed. | | `400` | `invalid_scope` | `scope` includes a value outside the supported scope set. | | `429` | `too_many_requests` | More than 20 registrations from this IP in the last hour. | # Revoke Token Source: https://resend.com/docs/api-reference/oauth/revoke POST /oauth/revoke Disconnect a client by revoking its refresh token. RFC 7009 token revocation. Revoking a refresh token revokes the entire grant: every access and refresh token issued under it stops working. Access tokens can't be revoked individually. Revoke the grant's refresh token instead. Per RFC 7009, this endpoint always returns `200` with an empty body. Confidential clients must authenticate the same way they do at the [token endpoint](/docs/api-reference/oauth/token#client-authentication), using `client_secret_basic`, `client_secret_post`, or `private_key_jwt`. Public clients (`none`) send only `client_id`. ## Body Parameters **token** `string` *required* The refresh token to revoke. **client\_id** `string` Required, except with `client_secret_basic`, where the `Authorization` header already carries it, and with `private_key_jwt`, where the assertion does. **client\_secret** `string` Required for a confidential client using `client_secret_post`. Omit for public clients and for `client_secret_basic` (send the secret in the `Authorization` header instead). **client\_assertion\_type** `string` Required with `private_key_jwt`. Must be `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`. **client\_assertion** `string` Required with `private_key_jwt`: a newly signed JWT, as at the [token endpoint](/docs/api-reference/oauth/token#client-authentication). **token\_type\_hint** `string` Optional per RFC 7009. If set to `"access_token"`, the request fails: access token revocation isn't supported. Any other value (including `"refresh_token"`) is accepted and ignored. Unknown hints don't affect behavior. ```bash Public client theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/revoke' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'client_id=550e8400-e29b-41d4-a716-446655440000&token=JcL7aYfE7S9h3L4qv0o2e1w8m6n5b3x9RkP2tD4uV6Q&token_type_hint=refresh_token' ``` ```bash Client Secret Basic theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/revoke' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -u '550e8400-e29b-41d4-a716-446655440000:CLIENT_SECRET' \ -d 'token=JcL7aYfE7S9h3L4qv0o2e1w8m6n5b3x9RkP2tD4uV6Q&token_type_hint=refresh_token' ``` ```bash Client Secret Post theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/revoke' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'client_id=550e8400-e29b-41d4-a716-446655440000&client_secret=CLIENT_SECRET&token=JcL7aYfE7S9h3L4qv0o2e1w8m6n5b3x9RkP2tD4uV6Q&token_type_hint=refresh_token' ``` ```bash Private Key JWT theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/revoke' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer&client_assertion=SIGNED_JWT&token=JcL7aYfE7S9h3L4qv0o2e1w8m6n5b3x9RkP2tD4uV6Q&token_type_hint=refresh_token' ``` ```http Response theme={"theme":{"light":"github-light","dark":"vesper"}} HTTP/1.1 200 OK ``` ## Errors | Status | `error` | When | | - | - | - | | `400` | `invalid_request` | `token` is missing, `client_id` is missing and neither a Basic header nor a `client_assertion` carries it, `token_type_hint` is `"access_token"`, or the client sent credentials via more than one mechanism. | | `401` | `invalid_client` | Unknown or disabled `client_id`, or a confidential client failed authentication (missing or wrong `client_secret`, a missing, invalid, expired, or replayed `client_assertion`, or a key set that can't be used). | | `503` | `temporarily_unavailable` | A `private_key_jwt` client's key set host timed out or answered with `429` or `5xx`, or the assertion couldn't be checked for replay. Retry the request. | # Revoke Grant Source: https://resend.com/docs/api-reference/oauth/revoke-grant DELETE /oauth/grants/:oauth_grant_id Revoke an OAuth grant for the authenticated team. Revoking a grant invalidates every access and refresh token issued under it. Any team API key can revoke any of the team's grants. Returns `404` if the grant does not exist or was already revoked. ## Path Parameters The OAuth grant ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.oauthGrants.revoke( '650e8400-e29b-41d4-a716-446655440001', ); ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _data = resend .oauth .revoke("650e8400-e29b-41d4-a716-446655440001") .await?; Ok(()) } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/oauth/grants/650e8400-e29b-41d4-a716-446655440001' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend oauth-grants revoke 650e8400-e29b-41d4-a716-446655440001 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "oauth_grant", "id": "650e8400-e29b-41d4-a716-446655440001", "revoked_at": "2026-04-08T00:11:13.110Z", "revoked_reason": "revoked_from_api" } ``` # Token Source: https://resend.com/docs/api-reference/oauth/token POST /oauth/token Exchange an authorization code for tokens, or refresh an access token. Handles two grants, selected by the `grant_type` body field: `authorization_code` (with mandatory PKCE) and `refresh_token` (with rotation and reuse detection). Accepts both `application/json` and `application/x-www-form-urlencoded`. Prefer form encoding, since that's what most OAuth libraries send by default. Access tokens are JWTs signed with `ES256`, valid for 900 seconds. Refresh tokens are opaque strings, valid for 60 days from whenever they were last issued, and rotate on every use. ## Client authentication How the client proves its identity depends on the `token_endpoint_auth_method` it [registered](/docs/api-reference/oauth/register#param-token-endpoint-auth-method) with: * **Public clients (`none`)** don't send a secret. PKCE (`code_verifier`) is the only proof. This is the default and covers native, CLI, and other clients that can't keep a secret. * **Confidential clients** additionally authenticate, on top of PKCE: * `client_secret_basic`: send `client_id` and `client_secret` in the HTTP `Authorization: Basic` header (each URL-encoded, joined with `:`, base64-encoded). With this method `client_id` can be omitted from the body. * `client_secret_post`: send `client_secret` as a body parameter alongside `client_id`. * `private_key_jwt`: send a JWT signed with the client's private key as `client_assertion`, with `client_assertion_type` set to `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`. With this method `client_id` can be omitted from the body. See [`private_key_jwt`](/docs/guides/building-a-resend-oauth-client#private-key-jwt) for the claims the JWT must carry. A client must use exactly one mechanism. Sending more than one, such as a Basic header and a body `client_secret`, fails with `invalid_request`. ## PKCE Before starting the [authorization request](/docs/api-reference/oauth/authorize), generate: * `code_verifier`: a high-entropy random string, 43–128 characters, from the unreserved character set (`A-Z`, `a-z`, `0-9`, `-`, `.`, `_`, `~`). Keep it client-side only. * `code_challenge`: the base64url-encoded SHA-256 hash of `code_verifier`, sent during authorization. ```javascript theme={"theme":{"light":"github-light","dark":"vesper"}} import { createHash, randomBytes } from 'node:crypto'; function base64url(input) { return Buffer.from(input).toString('base64url'); } const codeVerifier = base64url(randomBytes(64)); const codeChallenge = base64url( createHash('sha256').update(codeVerifier).digest(), ); ``` ## Authorization code grant ### Body Parameters **grant\_type** `string` *required* Must be `"authorization_code"`. **client\_id** `string` Required, except with `client_secret_basic`, where the `Authorization` header already carries it, and with `private_key_jwt`, where the assertion does. **client\_secret** `string` Required for a confidential client using `client_secret_post`. Omit for public clients and for `client_secret_basic` (send the secret in the `Authorization` header instead). See [Client authentication](#client-authentication). **client\_assertion\_type** `string` Required with `private_key_jwt`. Must be `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`. **client\_assertion** `string` Required with `private_key_jwt`: a JWT signed with the client's private key. See [Client authentication](#client-authentication). **code** `string` *required* The code from the `/oauth/authorize` callback. Single-use: redeeming it twice fails with `invalid_grant`. Expires 10 minutes after it was issued. **redirect\_uri** `string` *required* Must exactly match the `redirect_uri` used in the authorization request. **code\_verifier** `string` *required* The original value that [code\_challenge](/docs/api-reference/oauth/authorize#param-code-challenge) was derived from. ```bash Public client theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=authorization_code&client_id=550e8400-e29b-41d4-a716-446655440000&code=AUTHORIZATION_CODE&redirect_uri=http%3A%2F%2F127.0.0.1%3A49152%2Foauth%2Fcallback&code_verifier=CODE_VERIFIER_VALUE' ``` ```bash Client Secret Basic theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -u '550e8400-e29b-41d4-a716-446655440000:CLIENT_SECRET' \ -d 'grant_type=authorization_code&code=AUTHORIZATION_CODE&redirect_uri=http%3A%2F%2F127.0.0.1%3A49152%2Foauth%2Fcallback&code_verifier=CODE_VERIFIER_VALUE' ``` ```bash Client Secret Post theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=authorization_code&client_id=550e8400-e29b-41d4-a716-446655440000&client_secret=CLIENT_SECRET&code=AUTHORIZATION_CODE&redirect_uri=http%3A%2F%2F127.0.0.1%3A49152%2Foauth%2Fcallback&code_verifier=CODE_VERIFIER_VALUE' ``` ```bash Private Key JWT theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=authorization_code&client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer&client_assertion=SIGNED_JWT&code=AUTHORIZATION_CODE&redirect_uri=https%3A%2F%2Fexample.com%2Foauth%2Fcallback&code_verifier=CODE_VERIFIER_VALUE' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "access_token": "eyJhbGciOiJFUzI1NiIsImtpZCI6Im9hdXRoX2tleSIsInR5cCI6ImF0K2p3dCJ9...", "token_type": "Bearer", "expires_in": 900, "refresh_token": "JcL7aYfE7S9h3L4qv0o2e1w8m6n5b3x9RkP2tD4uV6Q", "scope": "emails:send" } ``` ### Body Parameters **grant\_type** `string` *required* Must be `"refresh_token"`. **client\_id** `string` Required, except with `client_secret_basic`, where the `Authorization` header already carries it, and with `private_key_jwt`, where the assertion does. **client\_secret** `string` Required for a confidential client using `client_secret_post`. Omit for public clients and for `client_secret_basic`. See [Client authentication](#client-authentication). **client\_assertion\_type** `string` Required with `private_key_jwt`. Must be `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`. **client\_assertion** `string` Required with `private_key_jwt`: a JWT signed with the client's private key. See [Client authentication](#client-authentication). **refresh\_token** `string` *required* **scope** `string` Optionally narrow the scope of the new access token. Must be a subset of what the grant already has. You can't use this to escalate scope. ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/oauth/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=refresh_token&client_id=550e8400-e29b-41d4-a716-446655440000&refresh_token=JcL7aYfE7S9h3L4qv0o2e1w8m6n5b3x9RkP2tD4uV6Q' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "access_token": "eyJhbGciOiJFUzI1NiIsImtpZCI6Im9hdXRoX2tleSIsInR5cCI6ImF0K2p3dCJ9...", "token_type": "Bearer", "expires_in": 900, "refresh_token": "N3wRefreshTokenValue...", "scope": "emails:send" } ``` ## Errors | Status | `error` | When | | - | - | - | | `400` | `invalid_request` | A required field is missing or malformed, or the client sent credentials via more than one mechanism (for example, both a Basic header and a body `client_secret`). | | `400` | `invalid_scope` | Refresh requests a scope outside what the grant already has. | | `400` | `invalid_grant` | The code/refresh token is invalid, expired, already used, or reused after rotation (which also revokes the grant). Also returned when PKCE verification fails or `redirect_uri` doesn't match. | | `401` | `invalid_client` | Unknown or disabled `client_id`, or a confidential client failed authentication (missing or wrong `client_secret`, `client_id` in the Basic header doesn't match the request, a missing, invalid, expired, or replayed `client_assertion`, or a key set that can't be used). | | `400` | `unauthorized_client` | The client isn't registered for the grant type it's using. | | `503` | `temporarily_unavailable` | A `private_key_jwt` client's key set host timed out or answered with `429` or `5xx`, or the assertion couldn't be checked for replay. Retry the request. | # Pagination Source: https://resend.com/docs/api-reference/pagination Learn how pagination works in the Resend API. ## Overview Several Resend API endpoints support **cursor-based pagination** to help you efficiently browse through large datasets. You can safely navigate lists with guaranteed stability, even if new objects are created or deleted while you're still requesting pages. Paginated endpoints responses include: * `object`: always set to `list`. * `has_more`: indicates whether there are more elements available. * `data`: the list of returned items. You can navigate through the results using the following parameters: * `limit`: the number of items to return per page. * `after`: the cursor to use to get the next page of results. * `before`: the cursor to use to get the previous page of results. Use the `id` of objects as the cursor for pagination. The cursor itself is *excluded* from the results. For an example, see [pagination strategies below](#strategies). ## Supported endpoints The following list endpoints support cursor-based pagination. ### Endpoints that default to 20 items Most paginated endpoints return 20 items by default when `limit` is not provided: * [List Automations](/docs/api-reference/automations/list-automations) * [List Automation Runs](/docs/api-reference/automations/list-automation-runs) * [List Broadcast Clicked Links](/docs/api-reference/broadcasts/list-broadcast-clicked-links) * [List Broadcast Recipients](/docs/api-reference/broadcasts/list-broadcast-recipients) * [List Contact Properties](/docs/api-reference/contact-properties/list-contact-properties) * [List Contacts](/docs/api-reference/contacts/list-contacts) * [List Contact Segments](/docs/api-reference/contacts/list-contact-segments) * [Get Contact Topics](/docs/api-reference/contacts/get-contact-topics) * [List Emails](/docs/api-reference/emails/list-emails) * [List Email Attachments](/docs/api-reference/emails/list-email-attachments) * [List Receiving Emails](/docs/api-reference/emails/list-received-emails) * [List Receiving Email Attachments](/docs/api-reference/emails/list-received-email-attachments) * [List Events](/docs/api-reference/events/list-events) * [List Inboxes](/docs/api-reference/inboxes/list-inboxes) * [List Threads](/docs/api-reference/inboxes/list-threads) * [Search Threads](/docs/api-reference/inboxes/search-threads) * [List Thread Emails](/docs/api-reference/inboxes/list-thread-emails) * [List Drafts](/docs/api-reference/inboxes/list-drafts) * [List Logs](/docs/api-reference/logs/list-logs) * [List OAuth Grants](/docs/api-reference/oauth/list-grants) * [List Suppressions](/docs/api-reference/suppressions/list-suppressions) * [List Templates](/docs/api-reference/templates/list-templates) * [List Topics](/docs/api-reference/topics/list-topics) * [List Webhooks](/docs/api-reference/webhooks/list-webhooks) * [List Webhook Events](/docs/api-reference/webhooks/list-events) * [List Event Attempts](/docs/api-reference/webhooks/list-event-attempts) ### Endpoints that return all items by default The following endpoints return all items in a single response when `limit` is not provided. Pass `limit` to paginate and set the page size. The `after` and `before` parameters only take effect together with `limit`. * [List API Keys](/docs/api-reference/api-keys/list-api-keys) * [List Audiences](/docs/api-reference/audiences/list-audiences) (deprecated, alias for Segments) * [List Broadcasts](/docs/api-reference/broadcasts/list-broadcasts) * [List Domains](/docs/api-reference/domains/list-domains) * [List Segments](/docs/api-reference/segments/list-segments) * [List Segment Contacts](/docs/api-reference/segments/list-segment-contacts) ### Other endpoints * [List Contact Imports](/docs/api-reference/contacts/list-contact-imports) defaults to **10 items** when `limit` is not provided ## Parameters Paginated endpoints accept the following query parameters: **limit** `number` The number of items to return per page. The maximum is `100` and the minimum is `1`. The default depends on the endpoint. See [Supported endpoints](#supported-endpoints). **after** `string` The cursor after which to start retrieving items. To get the next page, use the ID of the last item from the current page. This will return the page that **starts after** the object with this ID (excluding the passed ID itself). **before** `string` The cursor before which to start retrieving items. To get the previous page, use the ID of the first item from the current page. This will return the page that **ends before** the object with this ID (excluding the passed ID itself). [List Webhook Events](/docs/api-reference/webhooks/list-events) and [List Event Attempts](/docs/api-reference/webhooks/list-event-attempts) do not support `before`. > [!WARNING] > > You can only use either `after` or `before`, not both simultaneously. ## Response Fields Paginated endpoints return responses in the following format: ```json Response Format theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": true, "data": [/* Array of resources */] } ``` **object** `string` Always set to `list` for paginated responses. **has\_more** `boolean` Indicates whether there are more items available beyond the current page. **data** `array` An array containing the actual resources for the current page. ## Strategies ### Forward Pagination To paginate forward through results (newer to older items), use the `after` parameter with the ID of the **last item** from the current page: ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} const resend = new Resend('re_xxxxxxxxx'); // First page const { data: firstPage } = await resend.contacts.list({ limit: 50 }); // Second page (if has_more is true) if (firstPage.has_more) { const lastId = firstPage.data[firstPage.data.length - 1].id; const { data: secondPage } = await resend.contacts.list({ limit: 50, after: lastId, }); } ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // First page $firstPage = $resend->contacts->list(['limit' => 50]); // Second page (if has_more is true) if ($firstPage['has_more']) { $lastId = end($firstPage['data'])['id']; $secondPage = $resend->contacts->list([ 'limit' => 50, 'after' => $lastId ]); } ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" # First page first_page = resend.Contacts.list(limit=50) # Second page (if has_more is true) if first_page['has_more']: last_id = first_page['data'][-1]['id'] second_page = resend.Contacts.list(limit=50, after=last_id) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} Resend.api_key = "re_xxxxxxxxx" # First page first_page = Resend::Contacts.list(limit: 50) # Second page (if has_more is true) if first_page['has_more'] last_id = first_page['data'].last['id'] second_page = Resend::Contacts.list(limit: 50, after: last_id) end ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") // First page firstPage, err := client.Contacts.List(&resend.ListContactsRequest{ Limit: 50, }) // Second page (if has_more is true) if firstPage.HasMore { lastId := firstPage.Data[len(firstPage.Data)-1].ID client.Contacts.List(&resend.ListContactsRequest{ Limit: 50, After: lastId, }) } } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, types::ListContactOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); // First page let list_opts = ListContactOptions::default().with_limit(50); let first_page = resend.emails.list(list_opts).await?; // Second page (if has_more is true) if first_page.has_more { let last_id = &first_page.data.last().unwrap().id; let list_opts = ListContactOptions::default() .with_limit(10) .list_after(last_id); let second_page = resend.contacts.list(list_opts).await?; } Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.*; public class Main { public static void main(String[] args) { Resend resend = new Resend("re_xxxxxxxxx"); // First page ListEmailsResponse firstPage = resend.emails().list(10); // Second page (if has_more is true) if (firstPage.getHasMore()) { String lastId = firstPage.getData().get(firstPage.getData().size() - 1).getId(); ListContactsResponse secondPage = resend.contacts().list(50, lastId, null); } } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; using System.Linq; IResend resend = ResendClient.Create("re_xxxxxxxxx"); // First page var firstPage = await resend.EmailListAsync( new PaginatedQuery() { Limit = 50, }); // Second page (if has_more is true) if (firstPage.Content.HasMore) { var lastId = firstPage.Content.Data.Last().Id; var secondPage = await resend.EmailListAsync( new PaginatedQuery() { Limit = 50, After = lastId.ToString(), }); } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} # First page curl -X GET 'https://api.resend.com/contacts?limit=50' \ -H 'Authorization: Bearer re_xxxxxxxxx' # Second page curl -X GET 'https://api.resend.com/contacts?limit=50&after=LAST_ID_FROM_PREVIOUS_PAGE' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ### Backward Pagination To paginate backward through results (older to newer items), use the `before` parameter with the ID of the **first item** from the current page (or the most recent ID you have in your system): ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} const resend = new Resend('re_xxxxxxxxx'); // Start from a specific point and go backward const page = await resend.contacts.list({ limit: 50, before: 'some-contact-id', }); if (page.data.has_more) { const firstId = page.data.data[0].id; const previousPage = await resend.contacts.list({ limit: 50, before: firstId, }); } ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Start from a specific point and go backward $page = $resend->contacts->list([ 'limit' => 50, 'before' => 'some-contact-id' ]); if ($page['has_more']) { $firstId = $page['data'][0]['id']; $previousPage = $resend->contacts->list([ 'limit' => 50, 'before' => $firstId ]); } ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" # Start from a specific point and go backward page = resend.Contacts.list(limit=50, before="some-contact-id") if page["has_more"]: first_id = page["data"][0]["id"] previous_page = resend.Contacts.list(limit=50, before=first_id) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} Resend.api_key = "re_xxxxxxxxx" # Start from a specific point and go backward page = Resend::Contacts.list(limit: 50, before: 'some-contact-id') if page['has_more'] first_id = page['data'].first['id'] previous_page = Resend::Contacts.list(limit: 50, before: first_id) end ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") // Start from a specific point and go backward page, err := client.Contacts.List(&resend.ListContactsRequest{ Limit: resend.Int(50), Before: resend.String("some-contact-id"), }) if page.HasMore { firstId := page.Data[0].ID client.Contacts.List(&resend.ListContactsRequest{ Limit: resend.Int(50), Before: resend.String(firstId), }) } } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, types::ListContactOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); // Start from a specific point and go backward let list_opts = ListContactOptions::default() .with_limit(50) .list_before("some-email-id"); let page = resend.contacts.list(list_opts).await?; if page.has_more { let first_id = &page.data.first().unwrap().id; let list_opts = ListContactOptions::default() .with_limit(10) .list_before(first_id); let previous_page = resend.contacts.list(list_opts).await?; } Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.*; public class Main { public static void main(String[] args) { Resend resend = new Resend("re_xxxxxxxxx"); // Start from a specific point and go backward ListContactsResponse page = resend.contacts().list(50, null, "some-contact-id"); if (page.getHasMore()) { String firstId = page.getData().get(0).getId(); ListContactsResponse previousPage = resend.contacts().list(50, null, firstId); } } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; using System.Linq; IResend resend = ResendClient.Create("re_xxxxxxxxx"); // Start from a specific point and go backward var page = await resend.EmailListAsync( new PaginatedQuery() { Limit = 50, Before = "some-email-id", }); if (page.Content.HasMore) { var firstId = page.Content.Data.First().Id; var prevPage = await resend.EmailListAsync( new PaginatedQuery() { Limit = 50, Before = firstId.ToString(), }); } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/contacts?limit=50&before=some-contact-id' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ## Best Practices > [accordion] Use appropriate page sizes > > Choose a `limit` that balances performance and usability. Smaller pages are good for real-time applications, while larger pages > (hundreds of items) work better for bulk processing. > [accordion] Handle pagination gracefully > > Always check the `has_more` field before attempting to fetch additional pages. > This prevents unnecessary API calls when you've reached the end of the > dataset. > [accordion] Consider rate limits > > Be mindful of API rate limits when paginating through large datasets. > Implement appropriate delays or batching strategies if processing many > pages. ## Error Handling Pagination requests may return the following validation errors: | Error | Description | | - | - | | `validation_error` | Invalid cursor format or limit out of range (1–100) | | `validation_error` | Both `before` and `after` parameters provided | Example error response: ```json Error Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "name": "validation_error", "statusCode": 422, "message": "The pagination limit must be a number between 1 and 100. See https://resend.com/docs/pagination for more information." } ``` # Usage Limits Source: https://resend.com/docs/api-reference/rate-limit Learn about API rate limits, email sending quotas, and contact quotas. The Resend API enforces three types of limits: **rate limits** control how many API requests you can make per second, **email quotas** control the total number of emails you can send per day and month, and **contact quotas** control how many marketing contacts you can store. ## Rate Limits ### Response Headers The response headers describe your current rate limit following every request in conformance with the [sixth IETF standard draft](https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-ratelimit-headers-06): | Header name | Description | | - | - | | `ratelimit-limit` | Maximum number of requests allowed within a window. | | `ratelimit-remaining` | How many requests you have left within the current window. | | `ratelimit-reset` | How many seconds until the limits are reset. | | `retry-after` | How many seconds to wait before making a follow-up request. | The default maximum rate limit is **10 requests per second per team**. This limit applies across all API keys associated with your team. This number can be increased for trusted senders upon request. You can view your team's current rate limit on the [Settings Usage page](https://resend.com/settings/usage). After that, you'll hit the rate limit and receive a `429` response error code. You can find all 429 responses by filtering for 429 at the [Resend Logs page](https://resend.com/logs?status=429). To prevent this, reduce the rate at which you request the API. This can be done by introducing a queue mechanism or reducing the number of concurrent requests per second. If you have specific requirements, [contact support](https://resend.com/help) to request a rate increase. ## Email Quotas ### Response Headers In addition to rate limits, the API returns headers that track your email sending quotas: | Header name | Description | | - | - | | `x-resend-daily-quota` | Your used daily email sending quota. Only sent to free plan users. | | `x-resend-monthly-quota` | Your used monthly email sending quota. | These headers help you monitor your usage and avoid hitting quota limits. The daily quota applies only to the Free plan. It is a UTC calendar day (00:00–24:00 UTC) and resets at midnight UTC — not a rolling 24-hour window. Paid sending plans have no daily quota, only the monthly limit. When you exceed your quota limits, you'll receive a `429` response error code with one of the following error types: * **`daily_quota_exceeded`** - You have reached your daily email quota. [Upgrade your plan](https://resend.com/settings/billing) to remove the daily quota limit or wait for the quota to reset at midnight UTC. * **`monthly_quota_exceeded`** - You have reached your monthly email quota. [Upgrade your plan](https://resend.com/settings/billing) to increase the monthly email quota. Both sent and received emails count towards these quotas. See the full list of [error codes](/docs/api-reference/errors) for more details. ## Contact Quotas Contact quotas restrict the number of contacts you can store for marketing emails and broadcasts. You can add more contacts beyond your plan's limit, but you won't be able to send broadcasts until you upgrade your plan or remove contacts to get back within the limit. When you attempt to send a broadcast after reaching your contact limit, you'll receive a `403` response error code with a `validation_error` type and the message: "You have reached your contacts quota. Please upgrade your plan to send more emails." To increase your contact limit, [upgrade your Marketing plan](https://resend.com/settings/billing). # Create Segment Source: https://resend.com/docs/api-reference/segments/create-segment POST /segments Create a new segment for contacts to be added to. ## Body Parameters **name** `string` *required* The name of the segment you want to create. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.segments.create({ name: 'Registered Users', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->segments->create([ 'name' => 'Registered Users', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' params: resend.Segments.CreateParams = { "name": "Registered Users", } segment = resend.Segments.create(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { name: "Registered Users", } segment = Resend::Segments.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateSegmentRequest{ Name: "Registered Users", } segment, err := client.Segments.CreateWithContext(ctx, params) if err != nil { panic(err) } fmt.Println(segment) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _segment = resend.segments.create("Registered Users").await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.segments.model.CreateSegmentOptions; import com.resend.services.segments.model.CreateSegmentResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateSegmentOptions options = CreateSegmentOptions.builder() .name("Registered Users") .build(); CreateSegmentResponseSuccess response = resend.segments().create(options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.SegmentCreateAsync( new SegmentData() { Name = "Registered Users", } ); Console.WriteLine( "Segment Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/segments' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "Registered Users" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend segments create --name "Registered Users" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "segment", "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Registered Users" } ``` # Delete Segment Source: https://resend.com/docs/api-reference/segments/delete-segment DELETE /segments/:segment_id Remove an existing segment. ## Path Parameters The Segment ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.segments.remove( '78261eea-8f8b-4381-83c6-79fa7120f1cf', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->segments->remove('78261eea-8f8b-4381-83c6-79fa7120f1cf'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' segment = resend.Segments.remove(id='78261eea-8f8b-4381-83c6-79fa7120f1cf') ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Segments.remove("78261eea-8f8b-4381-83c6-79fa7120f1cf") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") segment, err := client.Segments.RemoveWithContext(ctx, "78261eea-8f8b-4381-83c6-79fa7120f1cf") if err != nil { panic(err) } fmt.Println(segment) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _segment = resend .segments .delete("78261eea-8f8b-4381-83c6-79fa7120f1cf") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.segments.model.RemoveSegmentResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RemoveSegmentResponseSuccess response = resend.segments().remove("78261eea-8f8b-4381-83c6-79fa7120f1cf"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.SegmentDeleteAsync( new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend segments delete 78261eea-8f8b-4381-83c6-79fa7120f1cf ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "segment", "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "deleted": true } ``` # Retrieve Segment Source: https://resend.com/docs/api-reference/segments/get-segment GET /segments/:segment_id Retrieve a single segment. ## Path Parameters The Segment ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.segments.get( '78261eea-8f8b-4381-83c6-79fa7120f1cf', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->segments->get('78261eea-8f8b-4381-83c6-79fa7120f1cf'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' segment = resend.Segments.get('78261eea-8f8b-4381-83c6-79fa7120f1cf') ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" segment = Resend::Segments.get("78261eea-8f8b-4381-83c6-79fa7120f1cf") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") segment, err := client.Segments.GetWithContext(ctx, "78261eea-8f8b-4381-83c6-79fa7120f1cf") if err != nil { panic(err) } fmt.Println(segment) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _segment = resend .segments .get("78261eea-8f8b-4381-83c6-79fa7120f1cf") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.segments.model.GetSegmentResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetSegmentResponseSuccess response = resend.segments().get("78261eea-8f8b-4381-83c6-79fa7120f1cf"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.SegmentRetrieveAsync( new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ) ); Console.WriteLine( "Segment Id={0}", resp.Content.Id ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend segments get 78261eea-8f8b-4381-83c6-79fa7120f1cf ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "segment", "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Registered Users", "created_at": "2026-10-06 22:59:55.977+00" } ``` # Retrieve Metrics Source: https://resend.com/docs/api-reference/segments/get-segment-metrics GET /segments/metrics Retrieve segment metrics. > [!WARNING] > > Segment metrics are currently in private beta and only available to a limited > number of users. The response shape might change before GA. [Get in > touch](https://resend.com/help) if you're interested in testing this > feature. > > Once you have access, upgrade your Resend SDK to use the methods on this > page: > > ```bash Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} > npm install resend@6.31.1-preview-headless-dashboard.0 > ``` Contact counts for your account, optionally broken down by segment. Works across your whole account by default, or scoped to specific segments via `segment_id`. > [!NOTE] > > Responses are cached for up to 15 minutes, so repeating the same request may > return slightly stale data within that window. All parameters are optional. With none, the response covers your whole account, includes every metric, and returns only `totals`. There's no date range, so counts are a point-in-time snapshot rather than a historical window. ## Query Parameters List-type query parameters below accept a comma-separated value, the parameter repeated (`segment_id=a&segment_id=b`), or a mix of both. List of metrics to include in `totals` and `data`. Omit for all. See [Metrics](#metrics). List of dimensions to break `data` down by. Omit for only `totals`, with no `data`. Possible values: * `segment`: one row per segment, using its current contact counts. List of segment IDs. Narrows `totals` (and `data`, when requested) to just these segments, without double-counting contacts that belong to more than one. > [!NOTE] > > When `dimensions` includes `segment`, `data` is ordered by each segment's > creation date, newest first. ## Metrics Every metric counts contacts, not emails. | Metric | Description | | - | - | | `all_contacts` | Every contact. Sum of `subscribers` and `unsubscribers`. | | `subscribers` | Contacts with `unsubscribed` set to `false`. | | `unsubscribers` | Contacts with `unsubscribed` set to `true`. | > [!NOTE] > > `totals` counts each contact once. `data` counts a contact in every segment it > belongs to. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.segments.metrics({ dimensions: ['segment'], metrics: ['all_contacts'], }); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/segments/metrics?dimensions=segment&metrics=all_contacts' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "metrics", "metrics": ["all_contacts"], "dimensions": ["segment"], "totals": { "all_contacts": 12450 }, "data": [ { "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Registered Users", "all_contacts": 4300 } ] } ``` # List Segment Contacts Source: https://resend.com/docs/api-reference/segments/list-segment-contacts GET /segments/:segment_id/contacts Retrieve a list of contacts in a segment. ## Path Parameters The Segment ID. ## Query Parameters If `limit` is not provided, all contacts will be returned in a single response. Pass `limit` to paginate. `after` and `before` only take effect together with `limit`. **limit** `number` Number of contacts to retrieve.
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more contacts (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more contacts (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.contacts.list({ segmentId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->contacts->list([ 'segment_id' => '78261eea-8f8b-4381-83c6-79fa7120f1cf', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' contacts = resend.Contacts.list(segment_id='78261eea-8f8b-4381-83c6-79fa7120f1cf') ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' contacts = Resend::Contacts.list(segment_id: '78261eea-8f8b-4381-83c6-79fa7120f1cf') ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") contacts, err := client.Contacts.ListWithContext(ctx, &resend.ListContactsOptions{ SegmentId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", }) if err != nil { panic(err) } fmt.Println(contacts) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _contacts = resend .segments .list_contacts( "78261eea-8f8b-4381-83c6-79fa7120f1cf", ListOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.contacts.model.ListContactsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListContactsResponseSuccess response = resend.contacts().list("78261eea-8f8b-4381-83c6-79fa7120f1cf"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.SegmentListContactsAsync( new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ) ); Console.WriteLine( "Nr Contacts={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf/contacts' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend segments contacts 78261eea-8f8b-4381-83c6-79fa7120f1cf ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "email": "steve.wozniak@gmail.com", "first_name": "Steve", "last_name": "Wozniak", "created_at": "2026-10-06 23:47:56.678+00", "unsubscribed": false } ] } ``` # List Segments Source: https://resend.com/docs/api-reference/segments/list-segments GET /segments Retrieve a list of segments. ## Query Parameters If `limit` is not provided, all segments will be returned in a single response. Pass `limit` to paginate. `after` and `before` only take effect together with `limit`. **limit** `number` Number of segments to retrieve.
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more segments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more segments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.segments.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->segments->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' segments = resend.Segments.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" segments = Resend::Segments.list ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") segments, err := client.Segments.ListWithContext(ctx) if err != nil { panic(err) } fmt.Println(segments) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _segments = resend.segments.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.segments.model.ListSegmentsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListSegmentsResponseSuccess response = resend.segments().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.SegmentListAsync(); Console.WriteLine( "Nr Segments={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/segments' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend segments list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Registered Users", "created_at": "2026-10-06 22:59:55.977+00" } ] } ``` # Update Segment Source: https://resend.com/docs/api-reference/segments/update-segment PATCH /segments/:segment_id Update an existing segment. ## Path Parameters The Segment ID. ## Body Parameters **name** `string` *required* The name of the segment. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.segments.update( '78261eea-8f8b-4381-83c6-79fa7120f1cf', { name: 'Active Users', }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->segments->update('78261eea-8f8b-4381-83c6-79fa7120f1cf', [ 'name' => 'Active Users', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' params: resend.Segments.UpdateParams = { "name": "Active Users", } segment = resend.Segments.update('78261eea-8f8b-4381-83c6-79fa7120f1cf', params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" params = { segment_id: "78261eea-8f8b-4381-83c6-79fa7120f1cf", name: "Active Users" } Resend::Segments.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "fmt" "github.com/resend/resend-go/v4" ) func main() { ctx := context.TODO() client := resend.NewClient("re_xxxxxxxxx") params := &resend.UpdateSegmentRequest{ Name: "Active Users", } segment, err := client.Segments.UpdateWithContext(ctx, "78261eea-8f8b-4381-83c6-79fa7120f1cf", params) if err != nil { panic(err) } fmt.Println(segment) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _segment = resend .segments .update("78261eea-8f8b-4381-83c6-79fa7120f1cf", "Active Users") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.segments.model.UpdateSegmentOptions; import com.resend.services.segments.model.UpdateSegmentResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateSegmentOptions options = UpdateSegmentOptions.builder() .name("Active Users") .build(); UpdateSegmentResponseSuccess response = resend.segments().update("78261eea-8f8b-4381-83c6-79fa7120f1cf", options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.SegmentUpdateAsync( new Guid( "78261eea-8f8b-4381-83c6-79fa7120f1cf" ), new SegmentData() { Name = "Active Users", } ); Console.WriteLine( "Segment Id={0}", resp.Content.Id ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "Active Users" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend segments update 78261eea-8f8b-4381-83c6-79fa7120f1cf --name "Active Users" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "segment", "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf" } ``` # Add Batch Suppressions Source: https://resend.com/docs/api-reference/suppressions/add-batch-suppressions POST /suppressions/batch/add Add up to 100 email addresses to the suppression list at once. ## Body Parameters **emails** `array` *required* The email addresses to suppress. Must contain between 1 and 100 email addresses. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.suppressions.batch.add({ emails: ['steve.wozniak@example.com', 'susan.kare@example.com'], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->suppressions->batch->add([ 'emails' => ['steve.wozniak@example.com', 'susan.kare@example.com'], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Suppressions.Batch.AddParams = { "emails": ["steve.wozniak@example.com", "susan.kare@example.com"], } resend.Suppressions.Batch.add(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Suppressions::Batch.add( emails: ["steve.wozniak@example.com", "susan.kare@example.com"] ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.BatchAddSuppressionsRequest{ Emails: []string{"steve.wozniak@example.com", "susan.kare@example.com"}, } client.Suppressions.Batch.Add(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::types::BatchAddSuppressionOptions; use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = BatchAddSuppressionOptions::from(vec!["steve.wozniak@example.com", "susan.kare@example.com"]); let _data = resend.suppressions.batch_add(opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.suppressions.model.AddSuppressionsOptions; import java.util.List; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); AddSuppressionsOptions options = AddSuppressionsOptions.builder() .emails(List.of("steve.wozniak@example.com", "susan.kare@example.com")) .build(); resend.suppressions().batch().add(options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.SuppressionBatchAddAsync( new[] { "steve.wozniak@example.com", "susan.kare@example.com", } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/suppressions/batch/add' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "emails": ["steve.wozniak@example.com", "susan.kare@example.com"] }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend suppressions batch add --file suppressions.json ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "data": [ { "object": "suppression", "id": "e169aa45-1ecf-4183-9955-b1499d5701d3" }, { "object": "suppression", "id": "520784e2-887d-4c25-b53c-4ad46ad38100" } ] } ``` # Add Suppression Source: https://resend.com/docs/api-reference/suppressions/add-suppression POST /suppressions Add an email address to the suppression list. ## Body Parameters **email** `string` *required* The email address to suppress. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.suppressions.add({ email: 'steve.wozniak@example.com', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->suppressions->add([ 'email' => 'steve.wozniak@example.com', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" params: resend.Suppressions.AddParams = { "email": "steve.wozniak@example.com", } resend.Suppressions.add(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Suppressions.add(email: "steve.wozniak@example.com") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.AddSuppressionRequest{ Email: "steve.wozniak@example.com", } client.Suppressions.Add(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::types::AddSuppressionOptions; use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = AddSuppressionOptions::new().with_email("steve.wozniak@example.com"); let _data = resend.suppressions.add(opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.suppressions.model.AddSuppressionOptions; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); AddSuppressionOptions options = AddSuppressionOptions.builder() .email("steve.wozniak@example.com") .build(); resend.suppressions().add(options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); var resp = await resend.SuppressionAddAsync( "steve.wozniak@example.com" ); Console.WriteLine( "Suppression Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/suppressions' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "email": "steve.wozniak@example.com" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend suppressions add steve.wozniak@example.com ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "suppression", "id": "e169aa45-1ecf-4183-9955-b1499d5701d3" } ``` # Retrieve Suppression Source: https://resend.com/docs/api-reference/suppressions/get-suppression GET /suppressions/:suppression Retrieve a single suppression by ID or email. A suppression can be retrieved either by its ID or by the suppressed email address. ## Path Parameters **suppression** `email | id` *required* The Suppression ID or email address. The `source_id` in the response references the email that triggered the suppression. For suppressions with a `manual` origin, `source_id` is `null`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.suppressions.get( 'e169aa45-1ecf-4183-9955-b1499d5701d3', // or: 'steve.wozniak@example.com' ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Retrieve by suppression id $resend->suppressions->get( 'e169aa45-1ecf-4183-9955-b1499d5701d3' ); // Retrieve by email $resend->suppressions->get( 'steve.wozniak@example.com' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" # Retrieve by suppression id resend.Suppressions.get("e169aa45-1ecf-4183-9955-b1499d5701d3") # Retrieve by email resend.Suppressions.get("steve.wozniak@example.com") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" # Retrieve by suppression id Resend::Suppressions.get("e169aa45-1ecf-4183-9955-b1499d5701d3") # Retrieve by email Resend::Suppressions.get("steve.wozniak@example.com") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") // Retrieve by suppression id client.Suppressions.Get("e169aa45-1ecf-4183-9955-b1499d5701d3") // Retrieve by email client.Suppressions.Get("steve.wozniak@example.com") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _data = resend .suppressions .get("e169aa45-1ecf-4183-9955-b1499d5701d3") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); // Retrieve by suppression id resend.suppressions().get("e169aa45-1ecf-4183-9955-b1499d5701d3"); // Retrieve by email resend.suppressions().get("steve.wozniak@example.com"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Retrieve by suppression id await resend.SuppressionRetrieveAsync( "e169aa45-1ecf-4183-9955-b1499d5701d3" ); // Retrieve by email await resend.SuppressionRetrieveAsync( "steve.wozniak@example.com" ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} # Retrieve by suppression id curl -X GET 'https://api.resend.com/suppressions/e169aa45-1ecf-4183-9955-b1499d5701d3' \ -H 'Authorization: Bearer re_xxxxxxxxx' # Retrieve by email curl -X GET 'https://api.resend.com/suppressions/steve.wozniak@example.com' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Retrieve by suppression id resend suppressions get e169aa45-1ecf-4183-9955-b1499d5701d3 # Retrieve by email resend suppressions get steve.wozniak@example.com ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "suppression", "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "email": "steve.wozniak@example.com", "origin": "bounce", "source_id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "created_at": "2026-10-06 23:47:56.678+00" } ``` # List Suppressions Source: https://resend.com/docs/api-reference/suppressions/list-suppressions GET /suppressions Show all suppressions. ## Query Parameters **limit** `number` Number of suppressions to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more suppressions (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more suppressions (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. **origin** `bounce | complaint | manual` Filter suppressions by origin. Possible values: * `bounce`: emails suppressed automatically after a bounce * `complaint`: emails suppressed due to a user complaint * `manual`: emails suppressed by your team manually ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.suppressions.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->suppressions->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Suppressions.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Suppressions.list ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Suppressions.List(&resend.ListSuppressionsOptions{}) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, list_opts::ListOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _data = resend.suppressions.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); resend.suppressions().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); await resend.SuppressionListAsync(); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/suppressions' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend suppressions list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "email": "steve.wozniak@example.com", "origin": "manual", "source_id": null, "created_at": "2026-10-06 23:47:56.678+00" }, { "id": "520784e2-887d-4c25-b53c-4ad46ad38100", "email": "susan.kare@example.com", "origin": "bounce", "source_id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "created_at": "2026-10-07 08:12:03.412+00" } ] } // The `source_id` in the response references the email that triggered the suppression. For suppressions with a `manual` origin, `source_id` is `null`. ``` # Remove Batch Suppressions Source: https://resend.com/docs/api-reference/suppressions/remove-batch-suppressions POST /suppressions/batch/remove Remove up to 100 suppressions from the suppression list at once. ## Body Parameters Provide either `emails` or `ids`, but not both. **emails** `array` The email addresses to remove from the suppression list. Must contain between 1 and 100 email addresses. **ids** `array` The suppression IDs to remove from the suppression list. Must contain between 1 and 100 IDs. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.suppressions.batch.remove({ ids: ['e169aa45-1ecf-4183-9955-b1499d5701d3'], // or: emails: ['steve.wozniak@example.com', 'susan.kare@example.com'], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Remove by suppression ids $resend->suppressions->batch->remove([ 'ids' => ['e169aa45-1ecf-4183-9955-b1499d5701d3'], ]); // Remove by emails $resend->suppressions->batch->remove([ 'emails' => ['steve.wozniak@example.com', 'susan.kare@example.com'], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" # Remove by suppression ids ids_params: resend.Suppressions.Batch.RemoveParams = { "ids": ["e169aa45-1ecf-4183-9955-b1499d5701d3"], } resend.Suppressions.Batch.remove(ids_params) # Remove by emails emails_params: resend.Suppressions.Batch.RemoveParams = { "emails": ["steve.wozniak@example.com", "susan.kare@example.com"], } resend.Suppressions.Batch.remove(emails_params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" # Remove by suppression ids Resend::Suppressions::Batch.remove( ids: ["e169aa45-1ecf-4183-9955-b1499d5701d3"] ) # Remove by emails Resend::Suppressions::Batch.remove( emails: ["steve.wozniak@example.com", "susan.kare@example.com"] ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") // Remove by suppression ids client.Suppressions.Batch.Remove(&resend.BatchRemoveSuppressionsRequest{ Ids: []string{"e169aa45-1ecf-4183-9955-b1499d5701d3"}, }) // Remove by emails client.Suppressions.Batch.Remove(&resend.BatchRemoveSuppressionsRequest{ Emails: []string{"steve.wozniak@example.com", "susan.kare@example.com"}, }) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result, types::BatchRemoveSuppressionOptions}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); // Remove by email let opt_emails = BatchRemoveSuppressionOptions::new() .add_emails(vec!["steve.wozniak@example.com", "susan.kare@example.com"]); let _data = resend.suppressions.batch_remove(opt_emails).await?; // Remove by id let opt_ids = BatchRemoveSuppressionOptions::new().add_ids(vec!["e169aa45-1ecf-4183-9955-b1499d5701d3"]); let _data = resend.suppressions.batch_remove(opt_ids).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.suppressions.model.RemoveSuppressionsOptions; import java.util.List; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); // Remove by suppression ids RemoveSuppressionsOptions byIds = RemoveSuppressionsOptions.builder() .ids(List.of("e169aa45-1ecf-4183-9955-b1499d5701d3")) .build(); resend.suppressions().batch().remove(byIds); // Remove by emails RemoveSuppressionsOptions byEmails = RemoveSuppressionsOptions.builder() .emails(List.of("steve.wozniak@example.com", "susan.kare@example.com")) .build(); resend.suppressions().batch().remove(byEmails); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Remove by suppression ids await resend.SuppressionBatchRemoveAsync( new[] { new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" ), } ); // Remove by emails await resend.SuppressionBatchRemoveAsync( new[] { "steve.wozniak@example.com", "susan.kare@example.com", } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} # Remove by suppression ids curl -X POST 'https://api.resend.com/suppressions/batch/remove' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "ids": ["e169aa45-1ecf-4183-9955-b1499d5701d3"] }' # Remove by emails curl -X POST 'https://api.resend.com/suppressions/batch/remove' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "emails": ["steve.wozniak@example.com", "susan.kare@example.com"] }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Remove by email resend suppressions batch remove --file suppressions.json # Remove by id resend suppressions batch remove --file suppression-ids.json --ids ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "data": [ { "object": "suppression", "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "deleted": true } ] } ``` # Remove Suppression Source: https://resend.com/docs/api-reference/suppressions/remove-suppression DELETE /suppressions/:suppression Remove a single suppression by ID or email. ## Path Parameters **suppression** `email | id` *required* The Suppression ID or email address. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.suppressions.remove( 'e169aa45-1ecf-4183-9955-b1499d5701d3', // or: 'steve.wozniak@example.com' ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); // Remove by suppression id $resend->suppressions->remove( 'e169aa45-1ecf-4183-9955-b1499d5701d3' ); // Remove by email $resend->suppressions->remove( 'steve.wozniak@example.com' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" # Remove by suppression id resend.Suppressions.remove("e169aa45-1ecf-4183-9955-b1499d5701d3") # Remove by email resend.Suppressions.remove("steve.wozniak@example.com") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" # Remove by suppression id Resend::Suppressions.remove("e169aa45-1ecf-4183-9955-b1499d5701d3") # Remove by email Resend::Suppressions.remove("steve.wozniak@example.com") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") // Remove by suppression id client.Suppressions.Remove("e169aa45-1ecf-4183-9955-b1499d5701d3") // Remove by email client.Suppressions.Remove("steve.wozniak@example.com") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); // Remove by suppression id let _data = resend .suppressions .remove("e169aa45-1ecf-4183-9955-b1499d5701d3") .await?; // Remove by email let _data = resend .suppressions .remove("steve.wozniak@example.com") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); // Remove by suppression id resend.suppressions().remove("e169aa45-1ecf-4183-9955-b1499d5701d3"); // Remove by email resend.suppressions().remove("steve.wozniak@example.com"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Remove by suppression id await resend.SuppressionRemoveAsync( "e169aa45-1ecf-4183-9955-b1499d5701d3" ); // Remove by email await resend.SuppressionRemoveAsync( "steve.wozniak@example.com" ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} # Remove by suppression id curl -X DELETE 'https://api.resend.com/suppressions/e169aa45-1ecf-4183-9955-b1499d5701d3' \ -H 'Authorization: Bearer re_xxxxxxxxx' # Remove by email curl -X DELETE 'https://api.resend.com/suppressions/steve.wozniak@example.com' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} # Remove by suppression id resend suppressions delete e169aa45-1ecf-4183-9955-b1499d5701d3 # Remove by email resend suppressions delete steve.wozniak@example.com ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "suppression", "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "deleted": true } ``` # Create Template Source: https://resend.com/docs/api-reference/templates/create-template POST /templates Create a new template with optional variables. ## Body Parameters **name** `string` *required* The name of the template. **html** `string` *required* The HTML version of the template. **alias** `string` The alias of the template. **from** `string` Sender email address. To include a friendly name, use the format `"Your Name "`. If provided, this value can be overridden when sending an email using the template. **subject** `string` Default email subject. This value can be overridden when sending an email using the template. Default Reply-to email address. For multiple addresses, send as an array of strings. This value can be overridden when sending an email using the template. **text** `string` The plain text version of the message. > [!NOTE] > > If not provided, the HTML will be used to generate a plain text version. You can opt out of this behavior by setting value to an empty string. **react** `React.ReactNode` The React component used to write the template. *Only available in the Node.js SDK.* **variables** `array` The array of variables used in the template. Each template may contain up to 50 variables. Each variable is an object with the following properties: **properties** **key** `string` *required* The key of the variable. We recommend capitalizing the key (e.g. `PRODUCT_NAME`). The following variable names are reserved and cannot be used: `FIRST_NAME`, `LAST_NAME`, `EMAIL`, `RESEND_UNSUBSCRIBE_URL`, `contact`, and `this`. **type** `'string' | 'number'` *required* The type of the variable. Can be `'string'` or `'number'` The fallback value of the variable. The value must match the type of the variable. If no fallback value is provided, you must provide a value for the variable when sending an email using the template. > [!NOTE] > > Before you can use a template, you must publish it first. To publish a > template, use the [Templates dashboard](https://resend.com/templates) or > [publish template API](/docs/api-reference/templates/publish-template). > > [Learn more about Templates](/docs/dashboard/templates/introduction). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.templates.create({ name: 'order-confirmation', html: '

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

', variables: [ { key: 'PRODUCT', type: 'string', fallbackValue: 'item', }, { key: 'PRICE', type: 'number', fallbackValue: 25, }, ], }); // Or create and publish a template in one step const { data: published, error: publishError } = await resend.templates .create({ name: 'order-confirmation', html: '

Thanks for your order!

', }) .publish(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->templates->create([ 'name' => 'order-confirmation', 'html' => '

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

', 'variables' => [ [ 'key' => 'PRODUCT', 'type' => 'string', 'fallback_value' => 'item', ], [ 'key' => 'PRICE', 'type' => 'number', 'fallback_value' => 25, ] ], ]); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Templates.create({ "name": "order-confirmation", "html": "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", "variables": [ { "key": "PRODUCT", "type": "string", "fallback_value": "item", }, { "key": "PRICE", "type": "number", "fallback_value": 25, } ], }) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Templates.create( name: "order-confirmation", html: "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", variables: [ { key: "PRODUCT", type: "string", fallback_value: "item" }, { key: "PRICE", type: "number", fallback_value: 25 } ] ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Templates.CreateWithContext(context.TODO(), &resend.CreateTemplateRequest{ Name: "order-confirmation", Html: "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", Variables: []*resend.TemplateVariable{ { Key: "PRODUCT", Type: resend.VariableTypeString, FallbackValue: "item", }, { Key: "PRICE", Type: resend.VariableTypeNumber, FallbackValue: 25, }, }, }) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{CreateTemplateOptions, Variable, VariableType}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let name = "order-confirmation"; let html = "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

"; let variables = [ Variable::new("PRODUCT", VariableType::String).with_fallback("item"), Variable::new("PRICE", VariableType::Number).with_fallback(25) ]; let opts = CreateTemplateOptions::new(name, html).with_variables(&variables); let template = resend.templates.create(opts).await?; let _published = resend.templates.publish(&template.id).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.templates.model.CreateTemplateOptions; import com.resend.services.templates.model.CreateTemplateResponseSuccess; import com.resend.services.templates.model.Variable; import com.resend.services.templates.model.VariableType; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateTemplateOptions params = CreateTemplateOptions.builder() .name("order-confirmation") .html("

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

") .addVariable(new Variable("PRODUCT", VariableType.STRING, "item")) .addVariable(new Variable("PRICE", VariableType.NUMBER, 25)) .build(); CreateTemplateResponseSuccess data = resend.templates().create(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create("re_xxxxxxxxx"); var variables = new List() { new TemplateVariable() { Key = "PRODUCT", Type = TemplateVariableType.String, Default = "item", }, new TemplateVariable() { Key = "PRICE", Type = TemplateVariableType.Number, Default = 25, } }; var resp = await resend.TemplateCreateAsync( new TemplateData() { Name = "welcome-email", HtmlBody = "Hey, {{{PRODUCT}}}, you are {{{PRICE}}} years old.", Variables = variables, } ); Console.WriteLine($"Template Id={resp.Content}"); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/templates' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "order-confirmation", "html": "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", "variables": [ { "key": "PRODUCT", "type": "string", "fallback_value": "item" }, { "key": "PRICE", "type": "number", "fallback_value": 25 } ] }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend templates create \ --name order-confirmation \ --html "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

" \ --var PRODUCT:string:item \ --var PRICE:number:25 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "object": "template" } ``` # Delete Template Source: https://resend.com/docs/api-reference/templates/delete-template DELETE /templates/:template_id Delete a template. ## Path Parameters **id | alias** `string` The ID or alias of the template to delete. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.templates.remove( '34a080c9-b17d-4187-ad80-5af20266e535', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->templates->remove('34a080c9-b17d-4187-ad80-5af20266e535'); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Templates.remove("34a080c9-b17d-4187-ad80-5af20266e535") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Templates.remove("34a080c9-b17d-4187-ad80-5af20266e535") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Templates.RemoveWithContext( context.TODO(), "34a080c9-b17d-4187-ad80-5af20266e535", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _deleted = resend .templates .delete("34a080c9-b17d-4187-ad80-5af20266e535") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.templates.model.DeleteTemplateResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); DeleteTemplateResponseSuccess data = resend.templates().remove("34a080c9-b17d-4187-ad80-5af20266e535"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.TemplateDeleteAsync( new Guid( "34a080c9-b17d-4187-ad80-5af20266e535" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/templates/34a080c9-b17d-4187-ad80-5af20266e535' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend templates delete 34a080c9-b17d-4187-ad80-5af20266e535 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "template", "id": "34a080c9-b17d-4187-ad80-5af20266e535", "deleted": true } ``` # Duplicate Template Source: https://resend.com/docs/api-reference/templates/duplicate-template POST /templates/:template_id/duplicate Duplicate a template. ## Path Parameters **id | alias** `string` The ID or alias of the template to duplicate. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.templates.duplicate( '34a080c9-b17d-4187-ad80-5af20266e535', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->templates->duplicate('34a080c9-b17d-4187-ad80-5af20266e535'); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Templates.duplicate("34a080c9-b17d-4187-ad80-5af20266e535") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Templates.duplicate("34a080c9-b17d-4187-ad80-5af20266e535") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Templates.DuplicateWithContext( context.TODO(), "34a080c9-b17d-4187-ad80-5af20266e535", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _duplicated = resend .templates .duplicate("34a080c9-b17d-4187-ad80-5af20266e535") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.templates.model.DuplicateTemplateResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); DuplicateTemplateResponseSuccess data = resend.templates().duplicate("34a080c9-b17d-4187-ad80-5af20266e535"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.TemplateDuplicateAsync( new Guid( "34a080c9-b17d-4187-ad80-5af20266e535" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/templates/34a080c9-b17d-4187-ad80-5af20266e535/duplicate' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend templates duplicate 34a080c9-b17d-4187-ad80-5af20266e535 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "template", "id": "e169aa45-1ecf-4183-9955-b1499d5701d3" } ``` # Retrieve Template Source: https://resend.com/docs/api-reference/templates/get-template GET /templates/:template_id Retrieve a template by ID. ## Path Parameters **id | alias** `string` The ID or alias of the template to retrieve. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.templates.get( '34a080c9-b17d-4187-ad80-5af20266e535', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->templates->get('34a080c9-b17d-4187-ad80-5af20266e535'); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Templates.get("34a080c9-b17d-4187-ad80-5af20266e535") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Templates.get("34a080c9-b17d-4187-ad80-5af20266e535") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Templates.GetWithContext( context.TODO(), "34a080c9-b17d-4187-ad80-5af20266e535", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _template = resend .templates .get("34a080c9-b17d-4187-ad80-5af20266e535") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.templates.model.GetTemplateResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetTemplateResponseSuccess data = resend.templates().get("34a080c9-b17d-4187-ad80-5af20266e535"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var res = await resend.TemplateRetrieveAsync( new Guid( "34a080c9-b17d-4187-ad80-5af20266e535" ) ); Console.WriteLine( "Template Name={0}", res.Content.Name ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/templates/34a080c9-b17d-4187-ad80-5af20266e535' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend templates get 34a080c9-b17d-4187-ad80-5af20266e535 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "template", "id": "34a080c9-b17d-4187-ad80-5af20266e535", "current_version_id": "b2693018-7abb-4b4b-b4cb-aadf72dc06bd", "alias": "reset-password", "name": "reset-password", "created_at": "2026-10-06 23:47:56.678+00", "updated_at": "2026-10-06 23:47:56.678+00", "status": "published", "published_at": "2026-10-06 23:47:56.678+00", "from": "John Doe ", "subject": "Hello, world!", "reply_to": null, "html": "

Hello, world!

", "text": "Hello, world!", "variables": [ { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "key": "user_name", "type": "string", "fallback_value": "John Doe", "created_at": "2026-10-06 23:47:56.678+00", "updated_at": "2026-10-06 23:47:56.678+00" } ], "has_unpublished_versions": true } ``` # List Templates Source: https://resend.com/docs/api-reference/templates/list-templates GET /templates List all templates. By default, the API will return the most recent 20 templates. You can optionally use the `limit` parameter to return a different number of templates or control the pagination of the results with the `after` or `before` parameters. ## Query Parameters **limit** `number` Number of templates to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more templates (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more templates (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.templates.list({ limit: 2, after: '34a080c9-b17d-4187-ad80-5af20266e535', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->templates->list([ 'limit' => 2, 'after' => '34a080c9-b17d-4187-ad80-5af20266e535' ]); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Templates.list({ "limit": 2, "after": "34a080c9-b17d-4187-ad80-5af20266e535", }) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Templates.list( limit: 2, after: "34a080c9-b17d-4187-ad80-5af20266e535" ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") limit := 2 after := "34a080c9-b17d-4187-ad80-5af20266e535" client.Templates.ListWithContext(context.TODO(), &resend.ListOptions{ Limit: &limit, After: &after, }) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let list_opts = ListOptions::default() .with_limit(2) .list_after("34a080c9-b17d-4187-ad80-5af20266e535"); let _list = resend.templates.list(list_opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.core.net.ListParams; import com.resend.services.templates.model.ListTemplatesResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListParams params = ListParams.builder() .limit(2) .after("34a080c9-b17d-4187-ad80-5af20266e535") .build(); ListTemplatesResponseSuccess data = resend.templates().list(params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.TemplateListAsync(); Console.WriteLine( "Nr Templates={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/templates?limit=2&after=34a080c9-b17d-4187-ad80-5af20266e535' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend templates list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "data": [ { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "name": "reset-password", "status": "draft", "published_at": null, "created_at": "2026-10-06 23:47:56.678+00", "updated_at": "2026-10-06 23:47:56.678+00", "alias": "reset-password" }, { "id": "b7f9c2e1-1234-4abc-9def-567890abcdef", "name": "welcome-message", "status": "published", "published_at": "2026-10-06 23:47:56.678+00", "created_at": "2026-10-06 23:47:56.678+00", "updated_at": "2026-10-06 23:47:56.678+00", "alias": "welcome-message" } ], "has_more": false } ``` # Publish Template Source: https://resend.com/docs/api-reference/templates/publish-template POST /templates/:template_id/publish Publish a template. ## Path Parameters **id | alias** `string` The ID or alias of the template to publish. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.templates.publish( '34a080c9-b17d-4187-ad80-5af20266e535', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->templates->publish('34a080c9-b17d-4187-ad80-5af20266e535'); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Templates.publish("34a080c9-b17d-4187-ad80-5af20266e535") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Templates.publish("34a080c9-b17d-4187-ad80-5af20266e535") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Templates.PublishWithContext( context.TODO(), "34a080c9-b17d-4187-ad80-5af20266e535", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _published = resend .templates .publish("34a080c9-b17d-4187-ad80-5af20266e535") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.templates.model.PublishTemplateResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); PublishTemplateResponseSuccess data = resend.templates().publish("34a080c9-b17d-4187-ad80-5af20266e535"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.TemplatePublishAsync( new Guid( "34a080c9-b17d-4187-ad80-5af20266e535" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/templates/34a080c9-b17d-4187-ad80-5af20266e535/publish' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend templates publish 34a080c9-b17d-4187-ad80-5af20266e535 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "template", "id": "34a080c9-b17d-4187-ad80-5af20266e535" } ``` # Update Template Source: https://resend.com/docs/api-reference/templates/update-template PATCH /templates/:template_id Update a template. ## Path Parameters **id | alias** `string` The ID or alias of the template to duplicate. ## Body Parameters **name** `string` The name of the template. **html** `string` The HTML version of the template. **alias** `string` The alias of the template. **from** `string` Sender email address. To include a friendly name, use the format `"Your Name "`. If provided, this value can be overridden when sending an email using the template. **subject** `string` Default email subject. This value can be overridden when sending an email using the template. Default Reply-to email address. For multiple addresses, send as an array of strings. This value can be overridden when sending an email using the template. **text** `string` The plain text version of the message. > [!NOTE] > > If not provided, the HTML will be used to generate a plain text version. You can opt out of this behavior by setting value to an empty string. **react** `React.ReactNode` The React component used to write the template. *Only available in the Node.js SDK.* **variables** `array` The array of variables used in the template. Each template may contain up to 50 variables. Each variable is an object with the following properties: **properties** **key** `string` *required* The key of the variable. We recommend capitalizing the key (e.g. `PRODUCT_NAME`). The following variable names are reserved and cannot be used: `FIRST_NAME`, `LAST_NAME`, `EMAIL`, `RESEND_UNSUBSCRIBE_URL`, `contact`, and `this`. **type** `'string' | 'number'` *required* The type of the variable. Can be `'string'` or `'number'` The fallback value of the variable. The value must match the type of the variable. If no fallback value is provided, you must provide a value for the variable when sending an email using the template. > [!NOTE] > > Before you can use a template, you must publish it first. To publish a > template, use the [Templates dashboard](https://resend.com/templates) or > [publish template API](/docs/api-reference/templates/publish-template). > > [Learn more about Templates](/docs/dashboard/templates/introduction). ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.templates.update( '34a080c9-b17d-4187-ad80-5af20266e535', { name: 'order-confirmation', html: '

Total: {{{PRICE}}}

Name: {{{PRODUCT}}}

', }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->templates->update('34a080c9-b17d-4187-ad80-5af20266e535', [ 'name' => 'order-confirmation', 'html' => '

Total: {{{PRICE}}}

Name: {{{PRODUCT}}}

', ]); ``` ```py Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Templates.update({ "id": "34a080c9-b17d-4187-ad80-5af20266e535", "name": "order-confirmation", "html": "

Total: {{{PRICE}}}

Name: {{{PRODUCT}}}

", }) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Templates.update("34a080c9-b17d-4187-ad80-5af20266e535", { name: "order-confirmation", html: "

Total: {{{PRICE}}}

Name: {{{PRODUCT}}}

" }) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Templates.UpdateWithContext(context.TODO(), "34a080c9-b17d-4187-ad80-5af20266e535", &resend.UpdateTemplateRequest{ Name: "order-confirmation", Html: "

Total: {{{PRICE}}}

Name: {{{PRODUCT}}}

", }) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::UpdateTemplateOptions, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let name = "order-confirmation"; let html = "

Total: {{{PRICE}}}

Name: {{{PRODUCT}}}

"; let update = UpdateTemplateOptions::new(name, html); let _template = resend .templates .update("34a080c9-b17d-4187-ad80-5af20266e535", update) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.templates.model.UpdateTemplateOptions; import com.resend.services.templates.model.UpdateTemplateResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateTemplateOptions params = UpdateTemplateOptions.builder() .name("order-confirmation") .html("

Total: {{{PRICE}}}

Name: {{{PRODUCT}}}

") .build(); UpdateTemplateResponseSuccess data = resend.templates().update("34a080c9-b17d-4187-ad80-5af20266e535", params); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.TemplateUpdateAsync( templateId: new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" ), new TemplateData() { HtmlBody = "

Total: {{{PRICE}}}

Name: {{{PRODUCT}}}

", } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/templates/34a080c9-b17d-4187-ad80-5af20266e535' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "order-confirmation", "html": "

Total: {{{PRICE}}}

Name: {{{PRODUCT}}}

" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend templates update 34a080c9-b17d-4187-ad80-5af20266e535 \ --name order-confirmation \ --html "

Total: {{{PRICE}}}

Name: {{{PRODUCT}}}

" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "template", "id": "34a080c9-b17d-4187-ad80-5af20266e535" } ``` # Create Topic Source: https://resend.com/docs/api-reference/topics/create-topic POST /topics Create and email topics to segment your audience. ## Body Parameters **name** `string` *required* The topic name. Max length is `50` characters. The default subscription preference for new contacts. Possible values: `opt_in` or `opt_out`. > [!NOTE] > > This value cannot be changed later. **description** `string` The topic description. Max length is `200` characters. The visibility of the topic on the unsubscribe page. Possible values: `public` or `private`. * `private`: only contacts who are opted in to the topic can see it on the unsubscribe page. * `public`: all contacts can see the topic on the unsubscribe page. If not specified, defaults to `private`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.topics.create({ name: 'Weekly Newsletter', defaultSubscription: 'opt_in', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->topics->create([ 'name' => 'Weekly Newsletter', 'default_subscription' => 'opt_in', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Topics.create({ "name": "Weekly Newsletter", "default_subscription": "opt_in", "description": "Subscribe to our weekly newsletter for updates", }) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Topics.create( name: "Weekly Newsletter", default_subscription: "opt_in" ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Topics.CreateWithContext(context.TODO(), &resend.CreateTopicRequest{ Name: "Weekly Newsletter", DefaultSubscription: resend.DefaultSubscriptionOptIn, }) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ types::{CreateTopicOptions, SubscriptionType}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = CreateTopicOptions::new("Weekly Newsletter", SubscriptionType::OptIn); let _topic = resend.topics.create(opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.topics.model.CreateTopicOptions; import com.resend.services.topics.model.CreateTopicResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateTopicOptions createTopicOptions = CreateTopicOptions.builder() .name("Weekly Newsletter") .defaultSubscription("opt_in") .build(); CreateTopicResponseSuccess response = resend.topics().create(createTopicOptions); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.TopicCreateAsync( new TopicData() { Name = "Weekly Newsletter", Description = "Weekly newsletter for our subscribers", SubscriptionDefault = SubscriptionType.OptIn, } ); Console.WriteLine( "Topic Id={0}", resp.Content ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/topics' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "Weekly Newsletter", "default_subscription": "opt_in" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend topics create --name "Weekly Newsletter" --default-subscription opt_in ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "topic", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" } ``` # Delete Topic Source: https://resend.com/docs/api-reference/topics/delete-topic DELETE /topics/:topic_id Remove an existing topic. ## Path Parameters The topic ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.topics.remove( 'b6d24b8e-af0b-4c3c-be0c-359bbd97381e', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->topics->remove('b6d24b8e-af0b-4c3c-be0c-359bbd97381e'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Topics.remove(id="b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Topics.remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Topics.RemoveWithContext( context.TODO(), "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _deleted = resend.topics.delete("delete").await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.topics.model.RemoveTopicResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RemoveTopicResponseSuccess response = resend.topics().remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.TopicDeleteAsync( new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/topics/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend topics delete b6d24b8e-af0b-4c3c-be0c-359bbd97381e ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "topic", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "deleted": true } ``` # Retrieve Topic Source: https://resend.com/docs/api-reference/topics/get-topic GET /topics/:topic_id Retrieve a topic by its ID. ## Path Parameters The Topic ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.topics.get( 'b6d24b8e-af0b-4c3c-be0c-359bbd97381e', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->topics->get('b6d24b8e-af0b-4c3c-be0c-359bbd97381e'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Topics.get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Topics.get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Topics.GetWithContext( context.TODO(), "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _topic = resend .topics .get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.topics.model.GetTopicResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetTopicResponseSuccess topic = resend.topics().get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.TopicRetrieveAsync( new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ) ); Console.WriteLine( "Topic Id={0}", resp.Content.Id ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/topics/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend topics get b6d24b8e-af0b-4c3c-be0c-359bbd97381e ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "topic", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "name": "Weekly Newsletter", "description": "Weekly newsletter for our subscribers", "default_subscription": "opt_in", "visibility": "public", "created_at": "2026-04-08 00:11:13.110779+00" } ``` # List Topics Source: https://resend.com/docs/api-reference/topics/list-topics GET /topics Retrieve a list of topics for the authenticated user. ## Query Parameters **limit** `number` Number of topics to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more topics (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more topics (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.topics.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->topics->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Topics.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Topics.list() ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Topics.ListWithContext(context.TODO(), nil) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _list = resend.topics.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.topics.model.ListTopicsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListTopicsResponseSuccess response = resend.topics().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.TopicListAsync(); Console.WriteLine( "Nr Topics={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/topics' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend topics list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "name": "Weekly Newsletter", "description": "Weekly newsletter for our subscribers", "default_subscription": "opt_in", "visibility": "public", "created_at": "2026-04-08 00:11:13.110779+00" } ] } ``` # Update Topic Source: https://resend.com/docs/api-reference/topics/update-topic PATCH /topics/:topic_id Update an existing topic. ## Path Parameters The Topic ID. ## Body Parameters **name** `string` The topic name. Max length is `50` characters. **description** `string` The topic description. Max length is `200` characters. The visibility of the topic on the unsubscribe page. Possible values: `public` or `private`. * `private`: only contacts who are opted in to the topic can see it on the unsubscribe page. * `public`: all contacts can see the topic on the unsubscribe page. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.topics.update({ id: 'b6d24b8e-af0b-4c3c-be0c-359bbd97381e', name: 'Weekly Newsletter', description: 'Weekly newsletter for our subscribers', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->topics->update('b6d24b8e-af0b-4c3c-be0c-359bbd97381e', [ 'name' => 'Weekly Newsletter', 'description' => 'Weekly newsletter for our subscribers', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = "re_xxxxxxxxx" resend.Topics.update( id="b6d24b8e-af0b-4c3c-be0c-359bbd97381e", params={ "name": "Weekly Newsletter", "description": "Weekly newsletter for our subscribers", } ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require "resend" Resend.api_key = "re_xxxxxxxxx" Resend::Topics.update( topic_id: "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", name: "Weekly Newsletter", description: "Weekly newsletter for our subscribers" ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import ( "context" "github.com/resend/resend-go/v4" ) func main() { client := resend.NewClient("re_xxxxxxxxx") client.Topics.UpdateWithContext(context.TODO(), "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", &resend.UpdateTopicRequest{ Name: "Weekly Newsletter", Description: "Weekly newsletter for our subscribers", }) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{types::UpdateTopicOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let update = UpdateTopicOptions::new() .with_name("Weekly Newsletter") .with_description("Weekly newsletter for our subscribers"); let _topic = resend .topics .update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", update) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.topics.model.UpdateTopicOptions; import com.resend.services.topics.model.UpdateTopicResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateTopicOptions updateTopicOptions = UpdateTopicOptions.builder() .name("Weekly Newsletter") .description("Weekly newsletter for our subscribers") .build(); UpdateTopicResponseSuccess response = resend.topics().update( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", updateTopicOptions ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.TopicUpdateAsync( new Guid( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" ), new TopicData() { Name = "Weekly Newsletter", Description = "Weekly newsletter for our subscribers", } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/topics/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "name": "Weekly Newsletter", "description": "Weekly newsletter for our subscribers" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend topics update b6d24b8e-af0b-4c3c-be0c-359bbd97381e \ --name "Weekly Newsletter" \ --description "Weekly newsletter for our subscribers" ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "topic", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" } ``` # Create Webhook Source: https://resend.com/docs/api-reference/webhooks/create-webhook POST /webhooks Create a webhook to receive real-time notifications about email events. ## Body Parameters **endpoint** `string` *required* The URL where webhook events will be sent. **events** `string[]` *required* Array of event types to subscribe to. See [event types](/docs/webhooks/event-types) for available options. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.webhooks.create({ endpoint: 'https://example.com/handler', events: ['email.sent'], }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->webhooks->create([ 'endpoint' => 'https://example.com/handler', 'events' => ['email.sent'], ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' params: resend.Webhooks.CreateParams = { "endpoint": "https://example.com/handler", "events": ["email.sent"], } webhook = resend.Webhooks.create(params=params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' params = { endpoint: 'https://example.com/handler', events: ['email.sent'] } webhook = Resend::Webhooks.create(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateWebhookRequest{ Endpoint: "https://example.com/handler", Events: []string{"email.sent"}, } client.Webhooks.Create(params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ events::EmailEventType::{EmailSent}, types::CreateWebhookOptions, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let events = [EmailSent]; let opts = CreateWebhookOptions::new("https://example.com/handler", events); let _webhook = resend.webhooks.create(opts).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.webhooks.model.CreateWebhookOptions; import com.resend.services.webhooks.model.CreateWebhookResponseSuccess; import static com.resend.services.webhooks.model.WebhookEvent.*; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateWebhookOptions options = CreateWebhookOptions.builder() .endpoint("https://example.com/handler") .events(EMAIL_SENT) .build(); CreateWebhookResponseSuccess response = resend.webhooks().create(options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var data = new WebhookData() { EndpointUrl = "https://example.com/handler", Events = [ WebhookEventType.EmailSent ], Status = WebhookStatus.Disabled, }; var resp = await resend.WebhookCreateAsync( data ); Console.WriteLine( "Webhook Id={0}", resp.Content.Id ); Console.WriteLine( "Signing secret={0}", resp.Content.SigningSecret ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/webhooks' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "endpoint": "https://example.com/handler", "events": ["email.sent"] }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks create \ --endpoint https://example.com/handler \ --events email.sent ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "webhook", "id": "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "signing_secret": "whsec_xxxxxxxxxx" } ``` # Delete Webhook Source: https://resend.com/docs/api-reference/webhooks/delete-webhook DELETE /webhooks/:webhook_id Remove an existing webhook. ## Path Parameters The Webhook ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.webhooks.remove( '4dd369bc-aa82-4ff3-97de-514ae3000ee0', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->webhooks->remove('4dd369bc-aa82-4ff3-97de-514ae3000ee0'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' webhook = resend.Webhooks.remove(webhook_id='4dd369bc-aa82-4ff3-97de-514ae3000ee0') ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' webhook = Resend::Webhooks.remove('4dd369bc-aa82-4ff3-97de-514ae3000ee0') ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Webhooks.Remove("4dd369bc-aa82-4ff3-97de-514ae3000ee0") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _deleted = resend .webhooks .delete("4dd369bc-aa82-4ff3-97de-514ae3000ee0") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.webhooks.model.RemoveWebhookResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RemoveWebhookResponseSuccess response = resend.webhooks().remove("4dd369bc-aa82-4ff3-97de-514ae3000ee0"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.WebhookDeleteAsync( new Guid( "d91cd9bd-1176-453e-8fc1-35364d380206" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X DELETE 'https://api.resend.com/webhooks/4dd369bc-aa82-4ff3-97de-514ae3000ee0' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks delete 4dd369bc-aa82-4ff3-97de-514ae3000ee0 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "webhook", "id": "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "deleted": true } ``` # Retrieve Event Source: https://resend.com/docs/api-reference/webhooks/get-event GET /webhooks/:webhook_id/events/:event_id Retrieve the details of a single event delivered to a webhook. ## Path Parameters The Webhook ID. The Webhook Event ID. ## Response Fields **object** `string` Always `webhook_event`. **id** `string` The event ID. **type** `string` The event type, for example `email.sent`. **created\_at** `string` When the event was created. **status** `string` Delivery status of the event to this webhook: `success`, `failed`, `attempting`, or `pending`. **next\_attempt\_at** `string | null` When the next delivery attempt is scheduled. `null` once the event reaches `success` or `failed`. **payload** `object` The event payload that was sent to your endpoint. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.webhooks.events.get({ eventId: 'msg_1srOrx2ZWZBpBUvZwXKQmoEYga2', webhookId: '4dd369bc-aa82-4ff3-97de-514ae3000ee0', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $event = $resend->webhooks->events->get( '4dd369bc-aa82-4ff3-97de-514ae3000ee0', 'msg_1srOrx2ZWZBpBUvZwXKQmoEYga2' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' event = resend.Webhooks.get_event( webhook_id='4dd369bc-aa82-4ff3-97de-514ae3000ee0', event_id='msg_1srOrx2ZWZBpBUvZwXKQmoEYga2', ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' event = Resend::Webhooks.get_event( '4dd369bc-aa82-4ff3-97de-514ae3000ee0', 'msg_1srOrx2ZWZBpBUvZwXKQmoEYga2' ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Webhooks.GetEvent( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _event = resend .webhooks .get_event( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.webhooks.model.GetWebhookEventResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetWebhookEventResponseSuccess event = resend.webhooks().getEvent( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2" ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.WebhookEventRetrieveAsync( new Guid( "4dd369bc-aa82-4ff3-97de-514ae3000ee0" ), "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2" ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/webhooks/4dd369bc-aa82-4ff3-97de-514ae3000ee0/events/msg_1srOrx2ZWZBpBUvZwXKQmoEYga2' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "webhook_event", "id": "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2", "type": "email.sent", "created_at": "2026-08-22T15:28:00.000Z", "status": "attempting", "next_attempt_at": "2026-08-22T15:33:00.000Z", "payload": { "type": "email.sent", "created_at": "2026-08-22T15:28:00.000Z", "data": { "email_id": "571f1f42-1c2d-4b1f-8f8e-8b3b5b3b5b3b", "from": "onboarding@resend.dev", "to": ["delivered@resend.dev"], "subject": "Welcome", "created_at": "2026-08-22T15:27:59.000Z" } } } ``` # Retrieve Webhook Source: https://resend.com/docs/api-reference/webhooks/get-webhook GET /webhooks/:webhook_id Retrieve a single webhook for the authenticated user. ## Path Parameters The Webhook ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.webhooks.get( '4dd369bc-aa82-4ff3-97de-514ae3000ee0', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->webhooks->get('4dd369bc-aa82-4ff3-97de-514ae3000ee0'); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' webhook = resend.Webhooks.get(webhook_id='4dd369bc-aa82-4ff3-97de-514ae3000ee0') ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' webhook = Resend::Webhooks.get('4dd369bc-aa82-4ff3-97de-514ae3000ee0') ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Webhooks.Get("4dd369bc-aa82-4ff3-97de-514ae3000ee0") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _webhook = resend .webhooks .get("4dd369bc-aa82-4ff3-97de-514ae3000ee0") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.webhooks.model.GetWebhookResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); GetWebhookResponseSuccess webhook = resend.webhooks().get("4dd369bc-aa82-4ff3-97de-514ae3000ee0"); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.WebhookRetrieveAsync( new Guid( "559ac32e-9ef5-46fb-82a1-b76b840c0f7b" ) ); Console.WriteLine( "Endpoint={0}", resp.Content.EndpointUrl ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/webhooks/4dd369bc-aa82-4ff3-97de-514ae3000ee0' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks get 4dd369bc-aa82-4ff3-97de-514ae3000ee0 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "webhook", "id": "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "created_at": "2026-08-22 15:28:00.000+00", "status": "enabled", "endpoint": "https://example.com/handler", "events": ["email.sent"], "signing_secret": "whsec_xxxxxxxxxx" } ``` # List Attempts Source: https://resend.com/docs/api-reference/webhooks/list-event-attempts GET /webhooks/:webhook_id/events/:event_id/attempts Retrieve the delivery attempts for a single webhook event. ## Path Parameters The Webhook ID. The Webhook Event ID. ## Query Parameters **limit** `number` Number of attempts to return. Between `1` and `100`. Defaults to `20`. **after** `string` The attempt ID to fetch the next page after. The `before` parameter is not supported for this endpoint. ## Response Fields **object** `string` Always `list`. **has\_more** `boolean` Whether more attempts exist beyond this page. **data** `array` The delivery attempts for this event, most recent first. **properties** **id** `string` The attempt ID. **http\_status\_code** `number` The HTTP status code your endpoint returned for this attempt. **response** `string` The response body your endpoint returned for this attempt. **sent\_at** `string` When this attempt was sent. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.webhooks.events.attempts.list({ eventId: 'msg_1srOrx2ZWZBpBUvZwXKQmoEYga2', webhookId: '4dd369bc-aa82-4ff3-97de-514ae3000ee0', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $attempts = $resend->webhooks->events->attempts->list( '4dd369bc-aa82-4ff3-97de-514ae3000ee0', 'msg_1srOrx2ZWZBpBUvZwXKQmoEYga2' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' attempts = resend.Webhooks.list_event_attempts( webhook_id='4dd369bc-aa82-4ff3-97de-514ae3000ee0', event_id='msg_1srOrx2ZWZBpBUvZwXKQmoEYga2', ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' attempts = Resend::Webhooks.list_event_attempts( '4dd369bc-aa82-4ff3-97de-514ae3000ee0', 'msg_1srOrx2ZWZBpBUvZwXKQmoEYga2' ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Webhooks.ListEventAttempts( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _attempts = resend .webhooks .list_event_attempts( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2", ListOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.webhooks.model.ListWebhookEventAttemptsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListWebhookEventAttemptsResponseSuccess attempts = resend.webhooks().listEventAttempts( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2" ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.WebhookEventAttemptListAsync( new Guid( "4dd369bc-aa82-4ff3-97de-514ae3000ee0" ), "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2" ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/webhooks/4dd369bc-aa82-4ff3-97de-514ae3000ee0/events/msg_1srOrx2ZWZBpBUvZwXKQmoEYga2/attempts' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "atmpt_1srOrx2ZWZBpBUvZwXKQmoEYga2", "http_status_code": 200, "response": "{\"ok\":true}", "sent_at": "2026-08-22T15:33:12.000Z" }, { "id": "atmpt_2ZbUCwvGmIT4mLIN6d3Yz0Ainbd", "http_status_code": 500, "response": "Internal Server Error", "sent_at": "2026-08-22T15:28:05.000Z" } ] } ``` # List Events Source: https://resend.com/docs/api-reference/webhooks/list-events GET /webhooks/:webhook_id/events Retrieve a list of events delivered to a webhook. ## Path Parameters The Webhook ID. ## Query Parameters **limit** `number` Number of events to return. Between `1` and `100`. Defaults to `20`. **after** `string` The event ID to fetch the next page after. The `before` parameter is not supported for this endpoint. ## Response Fields **object** `string` Always `list`. **has\_more** `boolean` Whether more events exist beyond this page. **data** `array` The events delivered to this webhook, most recent first. **properties** **id** `string` The event ID. Use this to [retrieve its details](/docs/api-reference/webhooks/get-event) or [list its attempts](/docs/api-reference/webhooks/list-event-attempts). **type** `string` The event type, for example `email.sent`. **created\_at** `string` When the event was created. **status** `string` Delivery status of the event to this webhook: `success`, `failed`, `attempting`, or `pending`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.webhooks.events.list({ webhookId: '4dd369bc-aa82-4ff3-97de-514ae3000ee0', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $events = $resend->webhooks->events->list( '4dd369bc-aa82-4ff3-97de-514ae3000ee0' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' events = resend.Webhooks.list_events( webhook_id='4dd369bc-aa82-4ff3-97de-514ae3000ee0' ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' events = Resend::Webhooks.list_events('4dd369bc-aa82-4ff3-97de-514ae3000ee0') ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Webhooks.ListEvents("4dd369bc-aa82-4ff3-97de-514ae3000ee0") } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _events = resend .webhooks .list_events( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", ListOptions::default(), ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.webhooks.model.ListWebhookEventsResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListWebhookEventsResponseSuccess events = resend.webhooks().listEvents( "4dd369bc-aa82-4ff3-97de-514ae3000ee0" ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.WebhookEventListAsync( new Guid( "4dd369bc-aa82-4ff3-97de-514ae3000ee0" ) ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/webhooks/4dd369bc-aa82-4ff3-97de-514ae3000ee0/events' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "msg_1srOsB4mXhCqCVwAxYRNnpFZhb3", "type": "email.delivered", "created_at": "2026-08-22T15:28:00.000Z", "status": "failed" }, { "id": "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2", "type": "email.sent", "created_at": "2026-08-22T15:27:42.000Z", "status": "success" } ] } ``` # List Webhooks Source: https://resend.com/docs/api-reference/webhooks/list-webhooks GET /webhooks Retrieve a list of webhooks for the authenticated user. ## Query Parameters **limit** `number` Number of webhooks to retrieve.
  • Default value: `20`
  • Maximum value: `100`
  • Minimum value: `1`
**after** `string` The ID *after* which we'll retrieve more webhooks (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. **before** `string` The ID *before* which we'll retrieve more webhooks (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. > [!NOTE] > > You can only use either `after` or `before` > parameter, not both. See our > [pagination guide](/docs/api-reference/pagination) for more > information. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.webhooks.list(); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->webhooks->list(); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' webhooks = resend.Webhooks.list() ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' webhooks = Resend::Webhooks.list ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Webhooks.List() } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{list_opts::ListOptions, Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _webhooks = resend.webhooks.list(ListOptions::default()).await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.webhooks.model.ListWebhooksResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ListWebhooksResponseSuccess response = resend.webhooks().list(); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.WebhookListAsync(); Console.WriteLine( "Nr Webhooks={0}", resp.Content.Data.Count ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X GET 'https://api.resend.com/webhooks' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks list ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "list", "has_more": false, "data": [ { "id": "7ab123cd-ef45-6789-abcd-ef0123456789", "created_at": "2026-09-10 10:15:30.000+00", "status": "disabled", "endpoint": "https://first-webhook.example.com/handler", "events": ["email.sent"] }, { "id": "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "created_at": "2026-08-22 15:28:00.000+00", "status": "enabled", "endpoint": "https://second-webhook.example.com/receive", "events": ["email.received"] } ] } ``` # Replay Event Source: https://resend.com/docs/api-reference/webhooks/replay-event POST /webhooks/:webhook_id/events/:event_id/replay Queue an additional delivery attempt for a webhook event. > [!NOTE] > > Replaying an event queues one additional delivery immediately. It's the same > action as the [dashboard's Replay > button](/docs/webhooks/retries-and-replays#manual-replays) and does not affect the > [automatic retry schedule](/docs/webhooks/retries-and-replays#automatic-retries) > already running for that event. ## Path Parameters The Webhook ID. The Webhook Event ID. ## Response Fields **object** `string` Always `webhook_event`. **id** `string` The event ID. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.webhooks.events.replay({ eventId: 'msg_1srOrx2ZWZBpBUvZwXKQmoEYga2', webhookId: '4dd369bc-aa82-4ff3-97de-514ae3000ee0', }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $event = $resend->webhooks->events->replay( '4dd369bc-aa82-4ff3-97de-514ae3000ee0', 'msg_1srOrx2ZWZBpBUvZwXKQmoEYga2' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' replayed = resend.Webhooks.replay_event( webhook_id='4dd369bc-aa82-4ff3-97de-514ae3000ee0', event_id='msg_1srOrx2ZWZBpBUvZwXKQmoEYga2', ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' replayed = Resend::Webhooks.replay_event( '4dd369bc-aa82-4ff3-97de-514ae3000ee0', 'msg_1srOrx2ZWZBpBUvZwXKQmoEYga2' ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Webhooks.ReplayEvent( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _replayed = resend .webhooks .replay_event( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2", ) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.webhooks.model.ReplayWebhookEventResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); ReplayWebhookEventResponseSuccess replayed = resend.webhooks().replayEvent( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2" ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.WebhookEventReplayAsync( new Guid( "4dd369bc-aa82-4ff3-97de-514ae3000ee0" ), "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2" ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/webhooks/4dd369bc-aa82-4ff3-97de-514ae3000ee0/events/msg_1srOrx2ZWZBpBUvZwXKQmoEYga2/replay' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "webhook_event", "id": "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2" } ``` # Rotate Signing Secret Source: https://resend.com/docs/api-reference/webhooks/rotate-signing-secret POST /webhooks/:webhook_id/signing-secret/rotate Generate a new signing secret for a webhook. > [!NOTE] > > For 24 hours after the rotation, payloads are signed with both the new and the > previous secret, so either one verifies them. After that, only the new secret > does. Use that window to update the secret your application uses to [verify > requests](/docs/webhooks/verify-webhooks-requests) without dropping events. ## Path Parameters The Webhook ID. ## Response Fields **object** `string` Always `webhook`. **id** `string` The Webhook ID. **signing\_secret** `string` The new signing secret. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.webhooks.rotateSigningSecret( '4dd369bc-aa82-4ff3-97de-514ae3000ee0', ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $webhook = $resend->webhooks->rotateSigningSecret( '4dd369bc-aa82-4ff3-97de-514ae3000ee0' ); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' webhook = resend.Webhooks.rotate_signing_secret( webhook_id='4dd369bc-aa82-4ff3-97de-514ae3000ee0', ) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' webhook = Resend::Webhooks.rotate_signing_secret( '4dd369bc-aa82-4ff3-97de-514ae3000ee0' ) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") client.Webhooks.RotateSigningSecret( "4dd369bc-aa82-4ff3-97de-514ae3000ee0", ) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{Resend, Result}; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let _webhook = resend .webhooks .rotate_signing_secret("4dd369bc-aa82-4ff3-97de-514ae3000ee0") .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.webhooks.model.RotateWebhookSigningSecretResponseSuccess; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); RotateWebhookSigningSecretResponseSuccess webhook = resend.webhooks().rotateSigningSecret( "4dd369bc-aa82-4ff3-97de-514ae3000ee0" ); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI var resp = await resend.WebhookRotateSigningSecretAsync( new Guid( "4dd369bc-aa82-4ff3-97de-514ae3000ee0" ) ); Console.WriteLine( "Signing secret={0}", resp.Content.SigningSecret ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST 'https://api.resend.com/webhooks/4dd369bc-aa82-4ff3-97de-514ae3000ee0/signing-secret/rotate' \ -H 'Authorization: Bearer re_xxxxxxxxx' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks rotate-signing-secret 4dd369bc-aa82-4ff3-97de-514ae3000ee0 ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "webhook", "id": "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "signing_secret": "whsec_xxxxxxxxxx" } ``` # Update Webhook Source: https://resend.com/docs/api-reference/webhooks/update-webhook PATCH /webhooks/:webhook_id Update an existing webhook configuration. ## Path Parameters The Webhook ID. ## Body Parameters **endpoint** `string` The URL where webhook events will be sent. **events** `string[]` Array of event types to subscribe to. See [event types](/docs/webhooks/event-types) for available options. **status** `string` The webhook status. Can be either `enabled` or `disabled`. ```ts Node.js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Resend } from 'resend'; const resend = new Resend('re_xxxxxxxxx'); const { data, error } = await resend.webhooks.update( '430eed87-632a-4ea6-90db-0aace67ec228', { endpoint: 'https://new-webhook.example.com/handler', events: ['email.sent', 'email.delivered'], status: 'enabled', }, ); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}} $resend = Resend::client('re_xxxxxxxxx'); $resend->webhooks->update('430eed87-632a-4ea6-90db-0aace67ec228', [ 'endpoint' => 'https://new-webhook.example.com/handler', 'events' => ['email.sent', 'email.delivered'], 'status' => 'enabled', ]); ``` ```python Python theme={"theme":{"light":"github-light","dark":"vesper"}} import resend resend.api_key = 're_xxxxxxxxx' params: resend.Webhooks.UpdateParams = { "webhook_id": "430eed87-632a-4ea6-90db-0aace67ec228", "endpoint": "https://new-webhook.example.com/handler", "events": ["email.sent", "email.delivered"], "status": "enabled", } webhook = resend.Webhooks.update(params) ``` ```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}} require 'resend' Resend.api_key = 're_xxxxxxxxx' params = { webhook_id: '430eed87-632a-4ea6-90db-0aace67ec228', endpoint: 'https://new-webhook.example.com/handler', events: ['email.sent', 'email.delivered'], status: 'enabled' } webhook = Resend::Webhooks.update(params) ``` ```go Go theme={"theme":{"light":"github-light","dark":"vesper"}} package main import "github.com/resend/resend-go/v4" func main() { client := resend.NewClient("re_xxxxxxxxx") endpoint := "https://new-webhook.example.com/handler" status := "enabled" params := &resend.UpdateWebhookRequest{ Endpoint: &endpoint, Events: []string{"email.sent", "email.delivered"}, Status: &status, } client.Webhooks.Update("430eed87-632a-4ea6-90db-0aace67ec228", params) } ``` ```rust Rust theme={"theme":{"light":"github-light","dark":"vesper"}} use resend_rs::{ events::EmailEventType::{EmailDelivered, EmailSent}, types::{UpdateWebhookOptions, WebhookStatus}, Resend, Result, }; #[tokio::main] async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let events = [EmailSent, EmailDelivered]; let opts = UpdateWebhookOptions::default() .with_endpoint("https://new-webhook.example.com/handler") .with_events(events) .with_status(WebhookStatus::Enabled); let _webhook = resend .webhooks .update("430eed87-632a-4ea6-90db-0aace67ec228", opts) .await?; Ok(()) } ``` ```java Java theme={"theme":{"light":"github-light","dark":"vesper"}} import com.resend.Resend; import com.resend.core.exception.ResendException; import com.resend.services.webhooks.model.UpdateWebhookOptions; import com.resend.services.webhooks.model.UpdateWebhookResponseSuccess; import com.resend.services.webhooks.model.WebhookStatus; import static com.resend.services.webhooks.model.WebhookEvent.*; public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); UpdateWebhookOptions options = UpdateWebhookOptions.builder() .endpoint("https://new-webhook.example.com/handler") .events(EMAIL_SENT, EMAIL_DELIVERED) .status(WebhookStatus.ENABLED) .build(); UpdateWebhookResponseSuccess response = resend.webhooks() .update("430eed87-632a-4ea6-90db-0aace67ec228", options); } } ``` ```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}} using Resend; IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI await resend.WebhookUpdateAsync( new Guid( "430eed87-632a-4ea6-90db-0aace67ec228" ), new WebhookData() { EndpointUrl = "https://new-webhook.example.com/handler", Events = [ WebhookEventType.EmailSent ], Status = WebhookStatus.Disabled, } ); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X PATCH 'https://api.resend.com/webhooks/430eed87-632a-4ea6-90db-0aace67ec228' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "endpoint": "https://new-webhook.example.com/handler", "events": ["email.sent", "email.delivered"], "status": "enabled" }' ``` ```bash CLI theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks update 430eed87-632a-4ea6-90db-0aace67ec228 \ --endpoint https://new-webhook.example.com/handler \ --events email.sent email.delivered \ --status enabled ``` ```json Response theme={"theme":{"light":"github-light","dark":"vesper"}} { "object": "webhook", "id": "430eed87-632a-4ea6-90db-0aace67ec228" } ``` # Resend API vs SDK Source: https://resend.com/docs/api-vs-sdk For most use cases, the Resend SDK offers a better developer experience. For most use cases, **the Resend SDK offers a better developer experience** than calling the raw HTTP API directly. Resend maintains official, open source SDKs for Node.js, PHP, Python, Ruby, Go, Rust, Java, and .NET. > [!NOTE] > > **Recommendation:** Use a [Resend SDK](/docs/sdks) for your language. Call the [raw > API](/docs/api-reference/introduction) directly only when no SDK exists for your > stack. ## Choosing between the SDK and API Reach for the SDK unless you have a specific reason not to. It handles authentication, the required `User-Agent` header, request serialization, typed responses, and error handling for you. That leaves less boilerplate to get wrong. | | Resend SDK (recommended) | Raw HTTP API | | - | - | - | | Auth & headers | Handled automatically | Set `Authorization` and `User-Agent` manually | | Types & autocomplete | Built in | None | | Errors | Structured error objects | Parse status codes and JSON yourself | | Maintained by | Resend | You | ## When to use the raw API directly Calling the API directly is a good fit when: * There's **no official SDK** for your language or runtime. * You're making a one-off request and don't want to add a dependency. * You're building your own integration or wrapper. If you do call the API directly, remember to set the required [`User-Agent` header](/docs/api-reference/introduction#user-agent). ## Next steps > [card] [Official SDKs](/docs/sdks) > > Install the SDK for your language. > [card] [Quickstart](/docs/introduction) > > Send your first email in minutes. > [card] [API Reference](/docs/api-reference/introduction) > > Full HTTP API documentation. > [card] [MCP Server](/docs/mcp-server) > > Give your AI agent access to Resend. # Send emails with Appwrite and Resend Source: https://resend.com/docs/appwrite-integration Learn how to send emails through Resend using Appwrite Messaging. [Appwrite](https://appwrite.io) is an open-source development platform for building and scaling applications faster, offering Auth, Databases, Storage, Functions, Messaging, Realtime, and web hosting, all in one place. Appwrite Messaging includes a native Resend provider, so you can send emails to your app's users through Resend without writing any delivery code. ## Prerequisites To get the most out of this guide, you'll need to: * [Create an API key](https://resend.com/api-keys) * [Verify your domain](https://resend.com/domains) You'll also need an [Appwrite project](https://cloud.appwrite.io) with at least one user. ## 1. Add Resend as an email provider In the Appwrite Console, navigate to **Messaging** > **Providers** > **Add provider** > **Email**. Give your provider a name, choose **Resend**, and click **Save and continue**. > [!NOTE] > > The provider will be saved to your project, but not enabled until you complete > its configuration. In the **Configure** step, you will need to provide details from your Resend dashboard to connect your Appwrite project: | Field | Description | | - | - | | API key | Head to API Keys > Create API Key. You can also follow [Resend's instructions](/docs/dashboard/api-keys/introduction) to create an API key. | | Sender email | The provider sends emails from this sender email. The sender email needs to be an email under a [verified domain](/docs/dashboard/domains/introduction) in Resend. | | Sender name | The sender name that appears in the emails sent from this provider. | | Reply-to email | The reply-to email that appears in the emails sent from this provider. | | Reply-to name | The reply-to name that appears in the emails sent from this provider. | After adding these details, click **Save and continue** to enable the provider. ## 2. Add recipients Appwrite Messaging delivers messages to **targets**, the different ways a user can be reached: their email addresses, phone numbers, and devices with your app installed. Targets can subscribe to **topics**, so when a message is published to a topic, all subscribed targets receive it. Users with verified emails who signed up with [email password](https://appwrite.io/docs/products/auth/email-password), [magic URL](https://appwrite.io/docs/products/auth/magic-url), [email OTP](https://appwrite.io/docs/products/auth/email-otp), or [OAuth2](https://appwrite.io/docs/products/auth/oauth2) login already have an email target. You can also add targets to existing users by navigating to **Authentication** > **Users** > select a user > **Targets**. To message groups of users, navigate to **Messaging** > **Topics** > **Create topic** and subscribe their targets to the topic. Learn more about [topics](https://appwrite.io/docs/products/messaging/topics) and [targets](https://appwrite.io/docs/products/messaging/targets) in the Appwrite documentation. ## 3. Send your first email To send a test email from the Appwrite Console, navigate to **Messaging** > **Messages** > **Create message** > **Email**. Add your message and in the targets step, select one of your test targets. Set the schedule to **Now** and click **Send**. Verify that you can receive the message in your inbox. If not, check for logs in the Appwrite Console or in your [Resend dashboard](https://resend.com/emails). To send emails programmatically, use an [Appwrite Server SDK](https://appwrite.io/docs/sdks#server): ```js theme={"theme":{"light":"github-light","dark":"vesper"}} import { Client, Messaging, ID } from 'node-appwrite'; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API endpoint .setProject('') // Your project ID .setKey(''); // Your secret API key const messaging = new Messaging(client); const message = await messaging.createEmail({ messageId: ID.unique(), subject: 'Welcome aboard!', content: 'Thanks for signing up. We are happy to have you.', topics: [''], }); ``` Emails can be sent immediately or scheduled for a later time. # Send emails with Base44 and Resend Source: https://resend.com/docs/base44-integration Learn how to add the Resend integration to your Base44 project. [Base44](https://base44.com/) is a platform for building apps with AI. You can add Resend in a Base44 project by asking the chat to add email sending with Resend. > [!NOTE] > > This integration requires backend functions, a feature available only on > Builder tier and above. Learn more about [Base44 > pricing](https://base44.com/pricing). ## Guide **1. Add the Resend integration in Base44** **If starting a new app:** 1. Click **Integration** in the top nav. 2. Search for **Resend**, select it, and choose **Use This Integration**. ![Resend Integration page](https://mintcdn.com/resend/ABWmVTZIHGIFNTFD/images/base44-integration.png?fit=max\&auto=format\&n=ABWmVTZIHGIFNTFD\&q=85\&s=f98f8dda5a22d0a0aa0aadc40c9324f3) **If adding Resend to an existing app:** 1. Enable backend functions. 2. Ask the chat: "Add the Resend email integration to my app. Prompt me to provide the API key and send a welcome email to new users." > [!NOTE] > > See the [Base44 > documenation](https://docs.base44.com/Integrations/Resend-integration) for > more information. **2. Add your Resend API key** However you add Resend to your project, you'll need to add a Resend API key, which you can create in the [Resend Dashboard](https://resend.com/api-keys). Do not share your API key with others or expose it in the browser or other client-side code. Copy the API key and paste it into the **RESEND\_API\_KEY** field in Base44. ![Adding your Resend API key to Base44](https://mintcdn.com/resend/ABWmVTZIHGIFNTFD/images/base44-integration-1.png?fit=max\&auto=format\&n=ABWmVTZIHGIFNTFD\&q=85\&s=e10a7a52b06dde106b7a2db585bb7b30) **3. Add a custom domain to your Resend account** By default, you can only send emails to your own email address. To send emails to other email addresses: 1. Add a [custom domain to your Resend account](/docs/add-a-domain). 2. Add the custom domain to the `from` field in the `resend` function in the Base44 backend function (or ask the chat to update these fields). Get more help adding a custom domain in [Resend's documentation](/docs/dashboard/domains/introduction). # Send emails with Bolt.new and Resend Source: https://resend.com/docs/bolt-new-integration Learn how to add the Resend integration to your Bolt.new project. [Bolt.new](https://bolt.new) is a platform for building full-stack web and mobile apps via chat. You can add Resend in a Bolt.new project by asking the chat to add email sending with Resend. ![adding the Resend integration to a Bolt.new chat](https://mintcdn.com/resend/ABWmVTZIHGIFNTFD/images/bolt-new-integration.png?fit=max\&auto=format\&n=ABWmVTZIHGIFNTFD\&q=85\&s=702a20abddc5efbf7b7d0b3e25c431ed) ## Guide **1. Add your Resend API key** To use Resend with Bolt.new, you'll need to add a Resend API key, which you can create in the [Resend Dashboard](https://resend.com/api-keys). Do not share your API key with others or expose it in the browser or other client-side code. > [!NOTE] > > To safely store your Resend API key, use a `.env` file. You may need to > include this instruction in your prompt to bolt.new. Learn more about > [handling API keys](/docs/knowledge-base/how-to-handle-api-keys). **2. Add a custom domain to your Resend account** By default, you can only send emails to your own email address. To send emails to other email addresses: 1. Add a [custom domain to your Resend account](/docs/add-a-domain). 2. Add the custom domain to the `from` field in the `resend` function in Bolt.new (or ask the chat to update these fields). Get more help adding a custom domain in [Resend's documentation](/docs/dashboard/domains/introduction). # Chat SDK Source: https://resend.com/docs/chat-sdk Build conversational email experiences using the Vercel Chat SDK and Resend. Use this pre-built prompt with your AI agent to build with the Resend Chat SDK adapter. # Resend Chat SDK Adapter **Purpose:** Instructions for building bidirectional email bots using the `@resend/chat-sdk-adapter` package with the Vercel Chat SDK. *** ## Setup ### Prerequisites * Resend API key stored in `RESEND_API_KEY` env var * Verified domain at [https://resend.com/domains](https://resend.com/domains) * Webhook configured for `email.received` events, or `inbox.email.received` events when you set `inboxId` or `inboxEmailAddress` (see [https://resend.com/docs/webhooks/introduction](https://resend.com/docs/webhooks/introduction)) * Inbound email receiving enabled (see [https://resend.com/docs/dashboard/receiving/introduction](https://resend.com/docs/dashboard/receiving/introduction)) ### Install ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} npm install @resend/chat-sdk-adapter chat @chat-adapter/state-memory # or: yarn add / pnpm add / bun add ``` ### Initialize ```typescript theme={"theme":{"light":"github-light","dark":"vesper"}} import { createResendAdapter } from '@resend/chat-sdk-adapter'; import { MemoryStateAdapter } from '@chat-adapter/state-memory'; import { Chat } from 'chat'; const resend = createResendAdapter({ fromAddress: 'bot@example.com', fromName: 'My Bot', // optional // apiKey: "re_...", // or set RESEND_API_KEY env var // webhookSecret: "whsec_..." // or set RESEND_WEBHOOK_SECRET env var }); const chat = new Chat({ userName: 'email-bot', adapters: { resend }, state: new MemoryStateAdapter(), }); ``` ### Handle Inbound Emails ```typescript theme={"theme":{"light":"github-light","dark":"vesper"}} // New email (new thread) chat.onNewMention(async (thread, message) => { await thread.subscribe(); await thread.post(`Got your email: ${message.text}`); }); // Follow-up email in a subscribed thread chat.onSubscribedMessage(async (thread, message) => { await thread.post(`Reply: ${message.text}`); }); ``` ### Forward Webhooks Point Resend webhooks to your server's `/webhook` endpoint. The adapter handles verification and parsing. ```typescript theme={"theme":{"light":"github-light","dark":"vesper"}} // Inside your HTTP server handler for POST /webhook const result = await chat.webhooks.resend(request); ``` `request` must be a Web `Request` object. If you're using Node.js `http`, convert `IncomingMessage` to a `Request` first. *** ## Configuration | Parameter | Type | Required | Description | | - | - | - | - | | `fromAddress` | `string` | Yes | Sender email address | | `fromName` | `string` | No | Display name for the From header | | `apiKey` | `string` | No | Resend API key. Falls back to `RESEND_API_KEY` env var | | `webhookSecret` | `string` | No | Webhook signing secret. Falls back to `RESEND_WEBHOOK_SECRET` env var | | `inboxId` | `string` | No | Resend inbox ID. Handles `inbox.email.received` and replies in the inbox thread | | `inboxEmailAddress` | `string` | No | Resend inbox email address. Works as `inboxId` does. Set one, not both | *** ## Threading Threads are resolved automatically using `Message-ID`, `In-Reply-To`, and `References` headers. Reply chains are grouped into Chat SDK threads with no extra configuration. Set `inboxId` or `inboxEmailAddress` to use an inbox, not both. With `inboxEmailAddress`, the adapter gets the inbox ID with `resend.inboxes.get()` on the first `inbox.email.received` event and keeps it. Each inbox thread maps to one Chat SDK thread with the ID `resend:{inboxId}:{threadId}`. The adapter fetches each email with `resend.inboxes.threads.emails.get()` and posts with `resend.inboxes.threads.emails.reply()`. Events for other inboxes and `email.received` events are ignored. A sender can set `Reply-To` to any address, so check `message.raw.replyTo` before replying with anything sensitive. *** ## Card Emails Send rich HTML emails using Card elements: ```typescript theme={"theme":{"light":"github-light","dark":"vesper"}} await thread.post({ card: { type: 'card', title: 'Order Confirmed', children: [ { type: 'text', content: 'Your order #1234 has been shipped.' }, { type: 'divider' }, { type: 'actions', children: [ { type: 'link-button', label: 'Track Order', url: 'https://example.com/track/1234', }, ], }, ], }, fallbackText: 'Order #1234 confirmed', }); ``` Cards render to HTML via `react-email`. Always include `fallbackText` for plain-text clients. *** ## Proactive Outreach Start a new email thread without waiting for inbound: ```typescript theme={"theme":{"light":"github-light","dark":"vesper"}} const threadId = await resend.openDM('user@example.com'); await resend.postMessage(threadId, 'Hello from the bot!'); ``` *** ## Attachments Inbound email attachments are available on `message.raw.attachments`: ```typescript theme={"theme":{"light":"github-light","dark":"vesper"}} import type { ResendRawMessage } from '@resend/chat-sdk-adapter'; chat.onNewMention(async (thread, message) => { const raw = message.raw as ResendRawMessage; const attachments = raw.attachments ?? []; for (const file of attachments) { console.log(file.filename, file.contentType); } }); ``` For an inbox email, each attachment has `id`, `filename`, `size` and `contentType`. The `contentType` is always `application/octet-stream`. *** ## Unsupported Operations Email is immutable. These operations throw `NotImplementedError`: * `editMessage` / `deleteMessage` * `addReaction` / `removeReaction` * `startTyping` *** ## AI Model Instructions 1. **Always** use `createResendAdapter` from `@resend/chat-sdk-adapter` 2. **Always** store API keys in env vars, never hardcode 3. **Always** call `thread.subscribe()` in `onNewMention` if you want to receive follow-ups 4. **Always** include `fallbackText` when sending card emails 5. **Never** attempt `editMessage`, `deleteMessage`, `addReaction`, `removeReaction`, or `startTyping` — email does not support these 6. The webhook handler expects a Web `Request` object — convert Node.js `IncomingMessage` if needed 7. The adapter name in Chat config must be `"resend"` for thread routing to work For the full Resend docs: [https://resend.com/docs/llms-full.txt](https://resend.com/docs/llms-full.txt) The `@resend/chat-sdk-adapter` package is a [Vercel Chat SDK](https://github.com/nichochar/chat) adapter that turns email into a two-way communication channel via Resend. Receive inbound emails through webhooks, reply through the Resend API, and let the adapter handle threading automatically. The adapter is open source and [available on GitHub](https://github.com/resend/resend-chat-sdk). ## Prerequisites To get started, you'll need to: * [Create an API key](https://resend.com/api-keys) * [Verify your domain](https://resend.com/domains) * [Set up webhooks](/docs/webhooks/introduction) for `email.received` events, or for `inbox.email.received` events when you [use an inbox](#use-an-inbox) * [Enable receiving](/docs/dashboard/receiving/introduction) on your domain ## Guide **1. Install** ```bash npm theme={"theme":{"light":"github-light","dark":"vesper"}} npm install @resend/chat-sdk-adapter chat @chat-adapter/state-memory ``` ```bash yarn theme={"theme":{"light":"github-light","dark":"vesper"}} yarn add @resend/chat-sdk-adapter chat @chat-adapter/state-memory ``` ```bash pnpm theme={"theme":{"light":"github-light","dark":"vesper"}} pnpm add @resend/chat-sdk-adapter chat @chat-adapter/state-memory ``` ```bash bun theme={"theme":{"light":"github-light","dark":"vesper"}} bun add @resend/chat-sdk-adapter chat @chat-adapter/state-memory ``` **2. Configure the adapter** Create a Resend adapter and pass it with [adapter configuration options](#configuration-options) to the Chat SDK. ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} import { createResendAdapter } from '@resend/chat-sdk-adapter'; import { MemoryStateAdapter } from '@chat-adapter/state-memory'; import { Chat } from 'chat'; const resend = createResendAdapter({ fromAddress: 'bot@example.com', fromName: 'My Bot', }); const chat = new Chat({ userName: 'email-bot', adapters: { resend }, state: new MemoryStateAdapter(), }); ``` > [!NOTE] > > Set `RESEND_API_KEY` and `RESEND_WEBHOOK_SECRET` as environment variables. You can also pass `apiKey` and `webhookSecret` directly in the config — explicit values take precedence over env vars. **3. Handle inbound emails** Register handlers for incoming emails. `onNewMention` fires when a new thread starts, and `onSubscribedMessage` fires for follow-up emails in threads you've subscribed to. ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} chat.onNewMention(async (thread, message) => { console.log(`New email from ${message.author.userId}: ${message.text}`); await thread.subscribe(); await thread.post(`Got your email: ${message.text}`); }); chat.onSubscribedMessage(async (thread, message) => { await thread.post(`Reply: ${message.text}`); }); ``` **4. Forward webhooks** Point your Resend webhooks to your server's `/webhook` endpoint. The adapter verifies the signature and parses the payload. ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} if (req.method === 'POST' && req.url === '/webhook') { const result = await chat.webhooks.resend(request); res.writeHead(result.status); res.end(); } ``` The handler expects a Web `Request` object. If you're using Node.js `http`, convert `IncomingMessage` to a `Request` first. See the [basic example](https://github.com/resend/resend-chat-sdk/tree/main/examples/basic) for a full working server. For webhook setup details, see [Managing Webhooks](/docs/webhooks/introduction) and [Verify Webhook Requests](/docs/webhooks/verify-webhooks-requests). ## How threading works The adapter resolves threads using standard `Message-ID`, `In-Reply-To`, and `References` email headers. Reply chains are automatically grouped into Chat SDK threads, with no extra configuration needed. > [!WARNING] > > Email is immutable. The following operations throw `NotImplementedError`: `editMessage`, `deleteMessage`, `addReaction`, `removeReaction`, and `startTyping`. ## Configuration options | Parameter | Type | Required | Description | | - | - | - | - | | `fromAddress` | `string` | Yes | Sender email address | | `fromName` | `string` | No | Display name for the From header | | `apiKey` | `string` | No | Resend API key. Falls back to `RESEND_API_KEY` env var | | `webhookSecret` | `string` | No | Webhook signing secret. Falls back to `RESEND_WEBHOOK_SECRET` env var | | `inboxId` | `string` | No | Resend inbox ID. Handles `inbox.email.received` and replies in the inbox thread | | `inboxEmailAddress` | `string` | No | Resend inbox email address. Works as `inboxId` does. Set one, not both | ## Use an inbox Set `inboxId` or `inboxEmailAddress` to build the bot on a Resend [Inbox](/docs/api-reference/inboxes/create-inbox). The inbox groups email into threads, and the bot replies inside the thread. Resend sets the recipients and the threading headers. ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} const resend = createResendAdapter({ fromAddress: 'agent@example.com', // the inbox address inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', }); ``` You can also select the inbox by its email address: ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} const resend = createResendAdapter({ fromAddress: 'agent@example.com', inboxEmailAddress: 'agent@example.com', }); ``` Set `inboxId` or `inboxEmailAddress`, not both. Setting both is a type error, and the adapter throws `Set inboxId or inboxEmailAddress, not both.` The `inbox.email.received` payload identifies the inbox by its ID. With `inboxEmailAddress`, the adapter gets the inbox ID with `resend.inboxes.get()` on the first `inbox.email.received` event and keeps it. Subscribe your webhook to `inbox.email.received`. With an inbox set, the adapter: * Handles `inbox.email.received` events for that inbox only, and ignores other inboxes and `email.received` events. * Maps each inbox thread to one Chat SDK thread. * Gives each attachment `id`, `filename`, `size` and `contentType` on `message.raw.attachments`. The `contentType` is always `application/octet-stream`. * Replies to the last received email of the thread. The reply goes to the email's `Reply-To` addresses, or to its sender when it has none. It is sent from the inbox address, so `fromName` does not apply to it. A sender can set `Reply-To` to any address. Check `message.raw.replyTo` before the bot replies with anything sensitive. `openDM()` still sends with `resend.emails.send()` from `fromAddress`. The inbox mode needs `@resend/chat-sdk-adapter` 0.5.0 or later and `resend` 6.34.1 or later. ## Features > [card] [Card Emails](/docs/chat-sdk-card-emails) > > Send rich HTML emails with structured card elements. > [card] [Attachments](/docs/chat-sdk-attachments) > > Handle inbound email attachments. > [card] [Proactive Outreach](/docs/chat-sdk-proactive-outreach) > > Start new email threads without waiting for inbound. ## Examples > [card] [Basic](https://github.com/resend/resend-chat-sdk/tree/main/examples/basic) > > Echo bot that replies to every email > [card] [Welcome Cards](https://github.com/resend/resend-chat-sdk/tree/main/examples/welcome-cards) > > Styled card email on first contact > [card] [Notifications](https://github.com/resend/resend-chat-sdk/tree/main/examples/notifications) > > Proactive outbound via openDM and HTTP POST > [card] [Support Bot](https://github.com/resend/resend-chat-sdk/tree/main/examples/support-bot) > > Multi-turn conversations with subscribe/unsubscribe > [card] [Attachments](https://github.com/resend/resend-chat-sdk/tree/main/examples/attachments) > > Detect attachments and reply with a summary # Chat SDK Attachments Source: https://resend.com/docs/chat-sdk-attachments Handle inbound email attachments with the Chat SDK adapter. When someone sends an email with file attachments, the adapter makes them available on `message.raw.attachments`. The adapter does not download the attachment content. * An attachment of an `email.received` email has `filename` and `contentType`. * An attachment of an inbox email has `id`, `filename`, `size` and `contentType`. The inbox API does not return the MIME type, so `contentType` is always `application/octet-stream`. ## Attachment shape ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} interface ResendAttachment { content?: string; contentType: string; filename: string; id?: string; size?: number; url?: string; } ``` | Field | Type | Description | | - | - | - | | `content` | `string` | Base64-encoded content. The adapter does not set it | | `contentType` | `string` | MIME type (e.g., `application/pdf`). Always `application/octet-stream` for an inbox email | | `filename` | `string` | Original filename (e.g., `invoice.pdf`) | | `id` | `string` | Attachment ID. Set on inbox emails only | | `size` | `number` | Size in bytes. Set on inbox emails only | | `url` | `string` | Download URL. The adapter does not set it | ## Detecting and processing attachments ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} import type { ResendRawMessage } from '@resend/chat-sdk-adapter'; chat.onNewMention(async (thread, message) => { const raw = message.raw as ResendRawMessage; const attachments = raw.attachments ?? []; if (attachments.length === 0) { await thread.subscribe(); await thread.post('Got your email. No attachments found.'); return; } const summary = attachments .map((a) => `${a.filename} (${a.contentType})`) .join(', '); await thread.subscribe(); await thread.post(`Received ${attachments.length} attachment(s): ${summary}`); }); ``` For more on receiving email attachments outside the Chat SDK, see [Receiving Attachments](/docs/dashboard/receiving/attachments). ## Try it yourself > [card] [Attachments Example](https://github.com/resend/resend-chat-sdk/tree/main/examples/attachments) > > Detects attachments and replies with a summary # Chat SDK Card Emails Source: https://resend.com/docs/chat-sdk-card-emails Send rich HTML card emails using the Chat SDK and React Email. The Chat SDK adapter renders Card elements into styled HTML emails using `react-email`. This lets you send structured, branded messages without writing raw HTML. ## Card structure A card has a `type`, `title`, optional `subtitle`, and `children` array. Children can be text blocks, dividers, link buttons, or action groups. ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} import type { CardElement } from 'chat'; const card: CardElement = { type: 'card', title: 'Order Confirmed', subtitle: 'Order #1234', children: [ { type: 'text', content: 'Your order has been shipped.' }, { type: 'divider' }, { type: 'actions', children: [ { type: 'link-button', label: 'Track Order', url: 'https://example.com/track/1234', }, ], }, ], }; ``` ### Child element types | Type | Fields | Description | | - | - | - | | `text` | `content` | Plain text paragraph | | `divider` | `n/a` | Horizontal rule | | `link-button` | `label`, `url` | Clickable button that opens a URL | | `actions` | `children` | Container for link buttons | ## Sending a card Pass the card object and a `fallbackText` string to `thread.post()`. The fallback is used by email clients that don't render HTML. ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} chat.onNewMention(async (thread, message) => { await thread.subscribe(); await thread.post({ card: { type: 'card', title: 'Welcome!', subtitle: 'Thanks for reaching out', children: [ { type: 'text', content: "Hi! Thanks for emailing us. We'll get back to you shortly.", }, { type: 'divider' }, { type: 'actions', children: [ { type: 'link-button', label: 'Visit our website', url: 'https://resend.com', }, ], }, ], }, fallbackText: 'Welcome! Thanks for reaching out.', }); }); ``` > [!NOTE] > > Always include `fallbackText`. Some email clients strip HTML entirely, and the fallback text is what recipients will see in that case. ## Try it yourself > [card] [Welcome Cards Example](https://github.com/resend/resend-chat-sdk/tree/main/examples/welcome-cards) > > Full working example that sends a styled card on first contact # Chat SDK Proactive Outreach Source: https://resend.com/docs/chat-sdk-proactive-outreach Start new email conversations proactively with the Chat SDK adapter. By default, the Chat SDK adapter responds to inbound emails. With `openDM`, you can go the other way and start a new email thread with any address, without waiting for them to email you first. ## Sending a proactive email Call `openDM` on the adapter from `createResendAdapter` to create a new thread. Then call `postMessage` to send a message to the thread. ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} const threadId = await resend.openDM('user@example.com'); await resend.postMessage(threadId, 'Hello from the bot!'); ``` You can also send card emails in proactive threads. The same card structure from [Card Emails](/docs/chat-sdk-card-emails) works here. ## Triggering via HTTP A common pattern is exposing an HTTP endpoint that triggers outbound emails. This lets external systems (cron jobs, webhooks from other services, admin dashboards) send emails through your bot. ```ts theme={"theme":{"light":"github-light","dark":"vesper"}} import type { IncomingMessage, ServerResponse } from 'node:http'; async function readBody(req: IncomingMessage): Promise { const chunks: Buffer[] = []; for await (const chunk of req) { chunks.push(Buffer.from(chunk)); } return Buffer.concat(chunks).toString(); } async function handleNotify(req: IncomingMessage, res: ServerResponse) { const { to, message } = JSON.parse(await readBody(req)); const threadId = await resend.openDM(to); await resend.postMessage(threadId, message); res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ ok: true, threadId })); } ``` Then call it: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} curl -X POST http://localhost:3000/notify \ -H "Content-Type: application/json" \ -d '{"to": "user@example.com", "message": "Your order has shipped!"}' ``` ## When to use this * Welcome emails when a user signs up * Order confirmations and shipping updates * Alert notifications (monitoring, billing, security) * Scheduled digests or reminders If the recipient replies, the response arrives through the normal `onNewMention` or `onSubscribedMessage` handlers, and the threading is handled automatically. ## Try it yourself > [card] [Notifications Example](https://github.com/resend/resend-chat-sdk/tree/main/examples/notifications) > > Proactive outbound emails via openDM and an HTTP POST endpoint # Resend CLI Source: https://resend.com/docs/cli The official command-line tool for Resend. Send emails, manage your account, and develop locally from the terminal. The [Resend CLI](https://github.com/resend/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 > [tab] cURL > > ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} > curl -fsSL https://resend.com/install.sh | bash > ``` > [tab] npm > > ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} > npm install -g resend-cli > ``` > [tab] Homebrew > > ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} > brew install resend/cli/resend > ``` > [tab] PowerShell (Windows) > > ```powershell theme={"theme":{"light":"github-light","dark":"vesper"}} > irm https://resend.com/install.ps1 | iex > ``` ## Authentication 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 login`** Log in and save your credentials locally. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend login ``` In a terminal, the command asks how to log in. You can approve the login in the browser, or enter an API key through a masked input. The CLI validates an API key against the Resend API before it saves the key. In non-interactive environments (CI, pipes, AI agents), pass `--web` or `--key`. `--web` logs in through the browser with no prompts: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend login --web ``` The command tries to open the browser and prints the login URL to stderr. It then waits up to 5 minutes for you to approve the login. The browser must run on the same machine as the CLI. Without `--profile`, the login is saved to the `default` profile. `--key` saves an API key: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} 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 | | - | - | | `--web` | Log in through the browser with no prompts. Can't be combined with `--key`. | | `--key ` | API key to store. Required in non-interactive mode, unless you pass `--web`. | **`resend logout`** Remove your saved API key. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend logout ``` **Switch between profiles** If you work across multiple Resend teams or accounts, switch between profiles without logging in and out: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend auth switch ``` Use the global `--profile` flag on any command to run it with a specific profile: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains list --profile production ``` Other profile management commands: | Command | Description | | - | - | | `resend auth list` | List all profiles | | `resend auth switch [name]` | Switch the active profile | | `resend auth rename [old] [new]` | Rename a profile | | `resend auth remove [name]` | Remove a profile | | `resend whoami` | Show current authentication status | ## 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. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "Hello World" \ --text "It works!" ``` | Flag | Required | Description | | - | - | - | | `--from
` | Yes \* | Sender email address (must be from a verified domain) | | `--to ` | Yes | One or more recipient email addresses (space-separated) | | `--subject ` | Yes \* | Email subject line | | `--text ` | One of text/html | Plain text body | | `--text-file ` | One of text/html | Path to a plain text file (use `-` for stdin) | | `--html ` | One of text/html | HTML body as a string | | `--html-file ` | One of text/html | Path to an HTML file (use `-` for stdin) | | `--react-email ` | One of text/html | Path to a React Email template (`.tsx`) to render and send | | `--cc ` | No | CC recipients | | `--bcc ` | No | BCC recipients | | `--reply-to
` | No | Reply-to email address | | `--scheduled-at ` | No | Schedule for later (ISO 8601 or natural language) | | `--attachment ` | No | File path(s) to attach | | `--headers ` | No | Custom headers as key=value pairs | | `--tags ` | No | Email tags as name=value pairs | | `--idempotency-key ` | No | Deduplicate this send request | | `--template ` | No | Template ID to use | | `--var ` | No | Template variables as key=value pairs | \* Not required when using `--template`, which provides them. **Examples:** ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} # HTML from a file resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "Hello World" \ --html-file ./welcome.html # Multiple recipients with CC, BCC, and reply-to resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "Hello World" \ --text "It works!" \ --cc manager@example.com \ --bcc archive@example.com \ --reply-to noreply@example.com # Send a React Email template resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "Hello World" \ --react-email ./emails/welcome.tsx # Send with a template resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --template tmpl_xxxxx \ --var "name=Alice" --var "company=Acme" ``` **`resend emails batch`** Send up to 100 emails in a single API request from a JSON file. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails batch --file ./emails.json ``` | Flag | Required | Description | | - | - | - | | `--file ` | Yes | Path to JSON file containing array of email objects (use `-` for stdin) | | `--react-email ` | No | Path to a React Email template (`.tsx`). Rendered HTML applies to every email in the batch | | `--idempotency-key ` | No | Deduplicate this batch request | | `--batch-validation ` | No | `strict` (default, entire batch fails on any error) or `permissive` | Each email in the JSON array supports the same fields as `resend emails send`, including per-email `scheduled_at` (natural language or ISO 8601) and `tags`. The `attachments` field is not supported in batch sends. ```json emails.json theme={"theme":{"light":"github-light","dark":"vesper"}} [ { "from": "Acme ", "to": ["foo@gmail.com"], "subject": "hello world", "html": "

it works!

", "scheduled_at": "in 1 min", "tags": [{ "name": "category", "value": "welcome" }] }, { "from": "Acme ", "to": ["bar@outlook.com"], "subject": "world hello", "html": "

it works!

", "scheduled_at": "in 5 min" } ] ``` **Other email commands** ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails list # List sent emails resend emails get # Retrieve a sent email by ID resend emails cancel # Cancel a scheduled email resend emails update # Update a scheduled email's send time ``` ## Receiving Process inbound emails, download attachments, and stream incoming messages. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails receiving list # List received (inbound) emails resend emails receiving get # Retrieve a received email with full details resend emails receiving listen # Poll for new inbound emails as they arrive resend emails receiving forward # Forward a received email resend emails receiving attachments # List attachments for a received email resend emails receiving attachment # Download a specific attachment ``` ## Domains Manage your sending and receiving domains. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend domains create --name example.com --region us-east-1 resend domains list # List all domains resend domains get # Retrieve domain with DNS records resend domains verify # Trigger DNS verification resend domains update # Update TLS, tracking, or receiving settings resend domains delete # Delete a domain ``` ## API Keys Create, list, and revoke API keys for programmatic access. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend api-keys create --name "Production" --permission full_access resend api-keys list # List all API keys resend api-keys delete # Delete an API key ``` ## Broadcasts Create and send broadcast emails to segments. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend broadcasts create \ --from "Acme " \ --subject "Product update" \ --segment-id seg_xxxxx \ --html-file ./broadcast.html \ --send resend broadcasts list # List all broadcasts resend broadcasts get # Retrieve broadcast details resend broadcasts send # Send a draft broadcast resend broadcasts update # Update a draft broadcast resend broadcasts delete # Delete a broadcast resend broadcasts open [id] # Open a broadcast in the dashboard ``` ## Contacts Manage contacts, segment membership, and topic subscriptions. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend contacts create --email steve.wozniak@gmail.com --first-name Steve resend contacts list # List all contacts resend contacts get # Retrieve a contact by ID or email resend contacts update # Update contact properties resend contacts delete # Delete a contact resend contacts segments # List segments a contact belongs to resend contacts add-segment # Add a contact to a segment resend contacts remove-segment # Remove from a segment resend contacts topics # List topic subscriptions resend contacts update-topics # Update topic subscriptions resend contacts imports create --file ./contacts.csv # Import contacts from CSV resend contacts imports get # Retrieve import status and counts resend contacts imports list # List past contact imports ``` **`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 ` to check processing status. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend contacts imports create \ --file ./contacts.csv \ --column-map '{"email":"Email","firstName":"First Name","lastName":"Last Name"}' \ --on-conflict upsert ``` | Flag | Required | Description | | - | - | - | | `--file ` | Yes | Path to the CSV file to import. Maximum file size is 200MB | | `--column-map ` | No | JSON object mapping CSV headers to contact fields | | `--on-conflict ` | No | `upsert` to update existing contacts or `skip` to leave them unchanged | | `--segment-id ` | No | Segment IDs to add imported contacts to. Repeat the flag for multiple segments | | `--topics ` | No | JSON array of topic subscriptions with `id` and `subscription` fields | 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`. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} # Import contacts and add them to a segment resend contacts imports create \ --file ./contacts.csv \ --segment-id 78261eea-8f8b-4381-83c6-79fa7120f1cf # Map custom properties and topic subscriptions resend contacts imports create \ --file ./contacts.csv \ --column-map '{"email":"Email","properties":{"plan":{"column":"Plan","type":"string"}}}' \ --topics '[{"id":"b6d24b8e-af0b-4c3c-be0c-359bbd97381e","subscription":"opt_in"}]' ``` **`resend contacts imports get`** Retrieve a contact import by ID, including status and row counts. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend contacts imports get 479e3145-dd38-476b-932c-529ceb705947 ``` **`resend contacts imports list`** List contact imports. The default limit is `10`. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend contacts imports list --status completed ``` | Flag | Required | Description | | - | - | - | | `--limit ` | No | Maximum number of imports to return. Must be between `1` and `100` | | `--after ` | No | Return imports after this contact import ID | | `--before ` | No | Return imports before this contact import ID | | `--status ` | No | Filter by `queued`, `in_progress`, `completed`, or `failed` | ## Contact Properties Define custom properties to store additional data on contacts. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend contact-properties create --key "company" --type string resend contact-properties list | get | update | delete ``` ## Segments Group contacts into targetable segments for broadcasts. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend segments create --name "VIPs" resend segments list # List all segments resend segments get # Retrieve a segment by ID resend segments contacts # List contacts in a segment resend segments delete # Delete a segment ``` ## Topics Manage subscription topics that contacts can opt in or out of. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend topics create --name "Product updates" resend topics list | get | update | delete ``` ## Suppressions Manage the suppression list. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend suppressions list # List suppressed addresses (alias: ls) resend suppressions list --origin bounce # Filter by origin: bounce | complaint | manual resend suppressions add spam@example.com # Suppress a single address resend suppressions get spam@example.com # Retrieve by ID or email resend suppressions delete spam@example.com --yes # Remove by ID or email (alias: rm) resend suppressions batch add --file ./emails.json # Suppress up to 100 from a JSON array of emails resend suppressions batch remove --file ./emails.json # Remove up to 100 (add --ids to treat entries as IDs) ``` ## Templates Create and manage email templates. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend templates create --name "Welcome" --subject "Welcome to Acme" --react-email ./emails/welcome.tsx resend templates list # List all templates resend templates get # Retrieve a template by ID or alias resend templates update # Update a template resend templates publish # Publish a draft template resend templates duplicate # Duplicate a template resend templates delete # Delete a template resend templates open [id] # Open a template in the dashboard ``` ## Logs View API request logs. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend logs list # List API request logs resend logs get # Retrieve a log with full request/response bodies resend logs open [id] # Open logs in the dashboard ``` ## Webhooks Register endpoints and listen for email event notifications. **`resend webhooks create`** Register a webhook endpoint. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks create \ --endpoint https://example.com/webhook \ --events email.sent email.delivered ``` | Flag | Required | Description | | - | - | - | | `--endpoint ` | Yes | HTTPS URL to receive events | | `--events ` | Yes | Event types to subscribe to (use `all` for all events) | **`resend webhooks listen`** Listen for webhook events locally during development. Starts a server, registers a temporary webhook, streams events, and cleans up on exit. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks listen \ --url https://hostname.tailnet-name.ts.net \ --events email.received ``` | Flag | Required | Description | | - | - | - | | `--url ` | Yes | Your public URL (e.g., Tailscale Funnel URL) | | `--events ` | No | Event types to listen for (default: `all`) | | `--forward-to ` | No | Forward payloads to a local server (passes original Svix headers) | | `--port ` | No | Local server port (default: 4318) | > [!NOTE] > > See the [webhook events documentation](/docs/webhooks/event-types) for the full > list of available event types. For agent-specific webhook patterns, see [CLI > for AI Agents](/docs/cli-agents#closing-the-loop-with-webhooks). **Other webhook commands** ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks list # List all webhook endpoints resend webhooks get # Retrieve a webhook configuration resend webhooks update # Update endpoint URL, events, or status resend webhooks delete # Delete a webhook endpoint ``` > [!TIP] > > Run `resend --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. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations create --file ./automation.json ``` | Flag | Required | Description | | - | - | - | | `--name ` | Yes \* | Automation name | | `--status ` | No | Initial status: `enabled` or `disabled` (default: `disabled`) | | `--steps ` | Yes \* | Steps array as JSON string | | `--connections ` | Yes \* | Connections array as JSON string | | `--file ` | Yes \* | Path to JSON file with full automation payload (use `-` for stdin) | \* Provide `--file`, or `--name` with `--steps` and `--connections`. When using `--file`, other flags override file values. **Other automation commands** ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations list # List all automations resend automations get # Retrieve an automation with steps and connections resend automations update # Update an automation's status (enable or disable) resend automations duplicate # Duplicate an automation resend automations stop # Stop an enabled automation resend automations delete # Delete an automation resend automations open [id] # Open an automation in the dashboard ``` **Automation runs** ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend automations runs list # List runs for an automation resend automations runs list --status running # Filter by status resend automations runs get --automation-id --run-id # Retrieve a specific run ``` | Flag | Required | Description | | - | - | - | | `--status ` | No | Filter by status: `running`, `completed`, `failed`, `cancelled` (comma-separated) | ## Inboxes Create and manage inboxes, and read, reply to, and organize the email threads they receive. Every flag below uses kebab-case, for example `--inbox-id`. Commands that act on an inbox, thread, email, draft, or label also accept the IDs as positional arguments, in that order, so `resend inboxes threads get --inbox-id --thread-id ` and `resend inboxes threads get ` are the same. Run any command with `--help` for the full list of flags. **`resend inboxes create`** Create an inbox at one of your verified domains. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes create \ --email-address hello@yourdomain.com \ --name "Hello" \ --from-name "Team Hello" ``` | Flag | Required | Description | | - | - | - | | `--email-address
` | Yes | Email address for the inbox, e.g. [support@yourdomain.com](mailto:support@yourdomain.com) | | `--name ` | No | Inbox name shown in the Dashboard. Recipients don't see it | | `--from-name ` | No | Name used when sending from this inbox, e.g. "Ada from Support" (a plain name, not "Name \") | | `--forwarding` | No | Receive mail without an MX record. Resend returns a receiving address to forward mail to | The domain must have receiving enabled, unless you pass `--forwarding`. With `--forwarding`, run `resend inboxes get ` to read the `receiving_address`. **Other inbox commands** ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes list # List all inboxes (alias: ls) resend inboxes get # Retrieve an inbox by ID or email address resend inboxes update --name "Support" # Update an inbox's name or from name resend inboxes delete --yes # Delete an inbox and its threads (alias: rm) ``` ### Threads Received emails are grouped into threads. Every thread command takes `--inbox-id`. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads list --inbox-id # List threads, newest activity first (alias: ls) resend inboxes threads list --inbox-id --unread --folders archive # Filter by read state, folders, or labels resend inboxes threads search --inbox-id --query invoice # Search by text, people, attachments, and dates resend inboxes threads get --inbox-id --thread-id # Retrieve a thread summary resend inboxes threads update --inbox-id --thread-id --read # Mark read or unread, or move to a folder resend inboxes threads delete --inbox-id --thread-id --yes # Move a thread to trash (alias: rm) ``` Flags for `list` and `search`: | Flag | Required | Description | | - | - | - | | `--inbox-id ` | Yes | Inbox ID | | `--folders ` | No | Folders to include: `inbox`, `archive`, `spam`, `sent`, `trash` | | `--labels ` | No | Only threads with any of these label IDs | | `--read` / `--unread` | No | Filter by read state | | `--limit ` | No | Threads per page, 1 to 100 | | `--after ` | No | Pass the last thread ID of the previous page to fetch the next page | `threads search` also accepts `--query`, `--from`, `--to`, `--cc`, `--bcc`, `--has-attachment`, `--without-attachment`, `--start-date`, and `--end-date`. Search can be up to about a minute behind new emails. Flags for `update`: | Flag | Required | Description | | - | - | - | | `--read` / `--unread` | No | Mark every email in the thread read or unread | | `--folder ` | No | Move the thread to `inbox`, `archive`, `spam`, or `trash` | `threads update` needs `--read`, `--unread`, or `--folder`. To change a thread's labels, use the [thread labels](#thread-labels) commands. `threads delete` moves the thread to `trash` and schedules it for deletion in 30 days. To restore it, move it to another folder with `threads update --folder`. ### Thread emails Read, reply to, and forward the individual emails in a thread. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads emails list --inbox-id --thread-id # List emails, oldest first (alias: ls) resend inboxes threads emails get --inbox-id --thread-id --email-id # Retrieve a single email resend inboxes threads emails reply --inbox-id --thread-id --email-id \ --text "Thanks!" # Reply from the inbox address resend inboxes threads emails forward --inbox-id --thread-id --email-id \ --to teammate@example.com # Forward to other recipients ``` | Flag | Required | Description | | - | - | - | | `--text` / `--html` | Yes \* | Body of the reply, or an optional note to include with a forward | | `--to ` | Yes \* | Forward recipients, separated by spaces | | `--cc` / `--bcc` | No | Additional recipients, separated by spaces | | `--subject ` | No | Override the reply or forwarded subject | | `--reply-all` | No | Reply to everyone on the original email, not only its author | | `--attachment ` | No | Local files or URLs to attach. Local file content can total at most 25 MB. URLs are fetched when the email is sent | | `--idempotency-key ` | No | Deduplicate this send request using this key | \* `reply` requires `--text` or `--html`. `forward` requires `--to`. ### Labels Organize threads with labels. Apply or remove them with the [thread labels](#thread-labels) commands. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes labels list --inbox-id # List all labels in an inbox (alias: ls) resend inboxes labels create --inbox-id --name "Billing" --color '#12A594' # Create a label (random color when omitted) resend inboxes labels update --inbox-id --label-id --name "Invoices" # Update a label's name or color resend inboxes labels delete --inbox-id --label-id --yes # Delete a label and remove it from threads (alias: rm) ``` ### Thread labels Change the labels on a thread. Every command takes `--inbox-id` and `--thread-id`, and prints every label on the thread after the change. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes threads labels add --inbox-id --thread-id --labels # Add labels, keeping existing ones resend inboxes threads labels set --inbox-id --thread-id --labels # Replace every label on the thread resend inboxes threads labels remove --inbox-id --thread-id --label-id # Remove one label from the thread ``` | Flag | Required | Description | | - | - | - | | `--labels ` | Yes \* | Label IDs, separated by spaces or commas. `add` takes 1 to 10, `set` takes 0 to 100 | | `--label-id ` | Yes \* | The label to remove | \* `add` and `set` require `--labels`. `remove` requires `--label-id`. Pass `--labels ""` to `set` to remove every label from the thread. Removing a label from a thread does not delete the label. ### Drafts Create unsent emails in an inbox, then send them later. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes drafts list --inbox-id # List drafts (alias: ls) resend inboxes drafts create --inbox-id --to user@example.com \ --subject "Hello" --text "Body" # Create a standalone draft resend inboxes drafts get --inbox-id --draft-id # Retrieve a draft resend inboxes drafts update --inbox-id --draft-id --subject "Hi" # Replace recipients, subject, or body resend inboxes drafts send --inbox-id --draft-id # Send a draft from the inbox address resend inboxes drafts delete --inbox-id --draft-id --yes # Delete a draft (alias: rm) ``` To create a reply draft, pass `--thread-id` and `--reply-to-email-id` together. When you omit `--to`, the draft is addressed to the sender of the email it replies to, or to its `Reply-To` address. If the inbox sent that email, it is addressed to that email's recipients instead. `--cc` and `--bcc` are never filled in. If you omit `--subject`, the draft is sent with the subject of the thread, prefixed with `Re:`. An email can have only one unsent reply draft, and creating a second one returns the existing draft. `drafts send` requires the draft to have at least one recipient, a subject, and a text or HTML body. ### Agent Configure the instructions, tone, and actions for an inbox's agent. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend inboxes agent get --inbox-id # Retrieve the agent settings resend inboxes agent update --inbox-id --tone concise_professional # Update instructions, tone, or actions ``` | Flag | Required | Description | | - | - | - | | `--instructions ` | No | Instructions the agent follows (max 4000 characters) | | `--tone ` | No | Tone the agent writes in: `concise_professional`, `concise_casual`, `expanded_professional`, or `expanded_casual`. See [tone](/docs/guides/inboxes/agent#using-the-api) | | `--actions ` | No | Replaces the full set of actions: `draft_reply`, `forward_thread`, `add_labels`, `assign_thread`, `mark_as_spam`, `archive`, `move_to_trash`. See [actions](/docs/guides/inboxes/agent#actions) | `agent update` needs at least one flag. Omitted fields keep their current value. Pass `--instructions ""` or `--tone ""` to clear a value. List several actions separated by spaces or commas, for example `--actions draft_reply add_labels`. Pass `--actions ""` to disable all actions. ## Events Define and send events that trigger automations. **`resend events send`** Send an event to trigger matching automations for a contact. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend events send \ --event user.created \ --email steve.wozniak@gmail.com \ --payload '{"plan":"pro"}' ``` | Flag | Required | Description | | - | - | - | | `--event ` | Yes | Event name (e.g. `user.created`) | | `--contact-id ` | One of contact | Contact ID (mutually exclusive with `--email`) | | `--email ` | One of contact | Contact email (mutually exclusive with `--contact-id`) | | `--payload ` | No | Event payload as JSON string | **Other event commands** ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend events create --name user.created --schema '{"plan":"string"}' resend events list # List all event definitions resend events get # Retrieve an event by ID or name resend events update # Update an event's schema resend events delete # Delete an event definition resend events open # Open events in the dashboard ``` ## 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. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend doctor ``` | Check | Pass | Warn | Fail | | - | - | - | - | | **CLI Version** | Running latest | Update available | N/A | | **API Key** | Key found (shows masked key + source) | N/A | No key found | | **Credential Storage** | Secure backend (e.g., macOS Keychain) | Plaintext file fallback | N/A | | **API Validation** | Verified domains exist | Sending-only key, no domains, or all pending | API key invalid | ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} # JSON output resend doctor --json ``` ```json theme={"theme":{"light":"github-light","dark":"vesper"}} { "ok": true, "checks": [ { "name": "CLI Version", "status": "pass", "message": "v1.7.0 (latest)" }, { "name": "API Key", "status": "pass", "message": "re_...xxxx (source: env)" }, { "name": "Credential Storage", "status": "pass", "message": "macOS Keychain" }, { "name": "Domains", "status": "pass", "message": "2 verified, 0 pending" } ] } ``` Exits `0` when all checks pass or warn. Exits `1` if any check fails. **Other utility commands** | Command | Description | | - | - | | `resend whoami` | Show current authentication status | | `resend open` | Open the Resend dashboard in your browser | | `resend update` | Check for available CLI updates | | `resend completion [shell]` | Generate shell completion scripts (bash, zsh, fish, powershell) | | `resend completion --install` | Auto-install completions into your shell profile | ## Global options These flags work on every command: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend [global options] [command options] ``` | Flag | Description | | - | - | | `--api-key ` | Override API key for this invocation | | `-p, --profile ` | Profile to use (overrides `RESEND_PROFILE` env var) | | `--json` | Force JSON output even in interactive terminals | | `-q, --quiet` | Suppress spinners and status output (implies `--json`) | | `--insecure-storage` | Save API key as plaintext instead of secure storage | | `--version` | Print version and exit | | `--help` | Show help text | ## Output behavior The CLI has two output modes that switch automatically: | Mode | When | Stdout | Stderr | | - | - | - | - | | **Interactive** | Terminal (TTY) | Formatted text | Spinners, prompts | | **Machine** | Piped, CI, or `--json` | JSON | Nothing | Pipe to another command and JSON output activates: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend doctor | jq '.checks[].name' resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "Hello World" \ --text "It works!" | jq '.id' ``` Errors always exit with code `1` and output structured JSON: ```json theme={"theme":{"light":"github-light","dark":"vesper"}} { "error": { "message": "No API key found", "code": "auth_error" } } ``` ## CI/CD Set `RESEND_API_KEY` as an environment variable, with no `resend login` needed: ```yaml theme={"theme":{"light":"github-light","dark":"vesper"}} # GitHub Actions env: RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }} steps: - run: | resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "Deploy complete" \ --text "Version ${{ github.sha }} deployed." ``` ## Configuration | Item | Path | Notes | | - | - | - | | Config directory | `~/.config/resend/` | Respects `$XDG_CONFIG_HOME` on Linux, `%APPDATA%` on Windows | | Credentials | System secure storage | macOS Keychain, Windows Credential Manager, or Linux secret service | | Install directory | `~/.resend/bin/` | Respects `$RESEND_INSTALL` | > [card] [Using the CLI with AI Agents](/docs/cli-agents) > > Learn about Agent Skills, non-interactive mode, and local webhook development > for AI agents. # Resend CLI for AI Agents Source: https://resend.com/docs/cli-agents How to use the Resend CLI in AI agent workflows. The [Resend CLI](/docs/cli) works out of the box for AI agents and CI/CD pipelines. This page covers agent-specific behavior. See the [CLI reference](/docs/cli) for installation, commands, and full documentation. ## Agent Skills The Resend CLI includes built-in Agent Skills that help AI agents understand how to use the CLI effectively. Install the skill using the following command: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} npx skills add resend/resend-cli ``` ## Non-interactive mode When the CLI detects a non-TTY environment (piped output, CI runner, or the `--json` flag), it automatically switches to machine-readable mode: * **Output:** JSON to stdout, no progress indicators * **Exit codes:** `0` for success, `1` for errors * **Errors:** Always include `message` and `code` fields ```json theme={"theme":{"light":"github-light","dark":"vesper"}} { "error": { "message": "No API key found", "code": "auth_error" } } ``` All required flags must be provided. Interactive prompts are disabled. Missing flags cause an error listing what's needed. ## Authentication Set `RESEND_API_KEY` in the agent's environment. If no key is available, the agent can log in through the browser with `--web`: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend login --web ``` The command prints the login URL to stderr, and the agent shows that URL to the user. The command waits up to 5 minutes for the user to approve the login, so agents run it in the background. The browser must run on the same machine as the CLI. To save the login to a profile other than `default`, pass `--profile `. Never pass a literal API key to `--key`. It stays in the shell history and in the agent's logs. ## Piping from stdin Agents generate content on the fly. Pass `-` to read from stdin instead of writing temp files: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} echo "Your order has shipped." | resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "Order update" \ --text-file - ``` This works with `--html-file -` on send and `--file -` on [batch commands](/docs/cli#emails). ## Batch sending Send up to 100 emails in a single request by piping a JSON array into `emails batch`: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} cat emails.json | resend emails batch --file - ``` ## Safe retries Add `--idempotency-key` to prevent duplicates when your agent retries a failed request: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "Welcome" \ --text "Hello!" \ --idempotency-key "welcome-user-123" ``` This flag is available on both `emails send` and `emails batch`. ## Scheduling The `--scheduled-at` flag accepts ISO 8601 timestamps and natural language: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "Your trial ends soon" \ --text "Your free trial expires in 3 days." \ --scheduled-at "tomorrow at 9am ET" ``` Cancel or reschedule with `resend emails cancel ` and `resend emails update --scheduled-at `. ## Reading inbound emails Agents can process incoming email as an input source. Stream inbound emails as NDJSON with `emails receiving listen`: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails receiving listen --json ``` Or fetch a specific email with full content and attachments: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails receiving get ``` This requires a [verified domain](/docs/dashboard/domains/introduction) with receiving enabled. ## Closing the loop with webhooks When an agent sends an email, it often needs to know what happened next: was it delivered, did it bounce, did the recipient reply? The `webhooks listen` command gives your agent a real-time feedback loop by streaming [webhook events](/docs/webhooks/event-types) directly to the terminal. ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks listen \ --url https://hostname.tailnet-name.ts.net \ --events email.delivered email.bounced email.received ``` The CLI registers a temporary webhook, streams matching events as JSON to stdout, and deletes the webhook when you exit (`Ctrl+C`). Use `--forward-to` to pipe payloads to a local server for processing: ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend webhooks listen \ --url https://hostname.tailnet-name.ts.net \ --forward-to http://localhost:4321/api/webhook ``` The `--url` flag takes any public URL that points to the local server port (`4318` by default). Use any tunnel, such as [Tailscale Funnel](https://tailscale.com/kb/1223/funnel), [ngrok](https://ngrok.com/), or [localtunnel](https://theboringtech.io/). > [!TIP] > > For a permanent setup, deploy a webhook handler and register it via `resend > webhooks create` pointing to your production URL. # Send emails with Resend CLI Source: https://resend.com/docs/cli-quickstart Learn how to send your first email using the Resend CLI. ## Prerequisites Before you start, you'll need: * A Resend [API key](/docs/create-an-api-key) * A [verified domain](/docs/add-a-domain) ## Guide **1. Install** > [tab] cURL > > ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} > curl -fsSL https://resend.com/install.sh | bash > ``` > [tab] npm > > ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} > npm install -g resend-cli > ``` > [tab] Homebrew > > ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} > brew install resend/cli/resend > ``` > [tab] PowerShell (Windows) > > ```powershell theme={"theme":{"light":"github-light","dark":"vesper"}} > irm https://resend.com/install.ps1 | iex > ``` **2. Authenticate** ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend login ``` **3. Send email** ```bash theme={"theme":{"light":"github-light","dark":"vesper"}} resend emails send \ --from "Acme " \ --to delivered@resend.dev \ --subject "Hello World" \ --text "Sent from my terminal." ``` ## Next steps > [card] [CLI Reference](/docs/cli) > > Explore the full command reference, authentication options, and CI/CD > examples. # Create an API key Source: https://resend.com/docs/create-an-api-key Get started sending emails by creating an API key ## Resend API keys API Keys are secret tokens used to authenticate your requests. They are unique to your account and must be kept confidential. You must create at least one API key to use the Resend platform through code (e.g., SDKs, API, command-line interface (CLI), or AI tools). ## Create an API Key You can create API keys in four ways: * in the [**API keys** Dashboard page](/docs/dashboard/api-keys/introduction) * using the [Resend API](/docs/api-reference/api-keys/create-api-key) * with a [Resend CLI command](/docs/cli#api-keys) * with the [Resend MCP server](/docs/mcp-server) To create a new API Key from the Resend Dashboard: **1. In your Resend Dashboard, navigate to the API keys page.** **2. Click the Create API Key button.** **3. Provide a name for your API Key.** Choose a name (maximum 50 characters) to identify your key. **4. Select a permission for your API key.** Choose **"Sending access"** to grant access to only sending emails unless your key needs full access to Resend’s API to create, delete, get, and update any resource. This [API key permission](/docs/api-reference/api-keys/create-api-key#param-permission) can be updated at any time [in the Dashboard](/docs/dashboard/api-keys/introduction#edit-api-key-details). **5. (Optional) Restrict sending to a specific domain** If you selected **"Sending access"**, you can further choose the domain you want to restrict access to. ![Add API Key modal in the Resend Dashboard](https://mintcdn.com/resend/ABWmVTZIHGIFNTFD/images/dashboard-api-keys-add.png?fit=max\&auto=format\&n=ABWmVTZIHGIFNTFD\&q=85\&s=1ecfaf7a2d2a780b826f941078e427b5) > [!NOTE] > > For security reasons, you can only view the API Key once. Learn more about > [API key best practices](/docs/knowledge-base/how-to-handle-api-keys). ## Use the API key in your code Authenticate your requests by adding your Resend API key to your project as an environment variable. You can check the [quickstart guides](/docs/introduction) or [AI builder guides](/docs/ai-onboarding#ai-builder-guides) for specific examples of passing your API key to your project. **1. Create and store an environment variable** Store your API key as an environment variable in your project. This is commonly done inside a special file or configuration panel and will depend on your language, framework, or development platform. For example, Node.js projects commonly store both public and secret variables in a `.env` file at the root of your project: ```sh .env theme={"theme":{"light":"github-light","dark":"vesper"}} RESEND_API_KEY=re_xxxxxxxxx ``` > [!TIP] > > If you are storing your secrets in a project file, you may need to add this file to your `.gitignore` file to prevent it from being committed to version control. > > Many frameworks add `.env` to the `.gitignore` file by default, so this may already exist. > > ```ts .gitignore theme={"theme":{"light":"github-light","dark":"vesper"}} > .env > ``` **2. Pass the environment variable to your code** Your project environment variables are not automatically available to Resend. You must explicitly pass your API key value to your Resend code. For example, whenever you create a new Resend instance in a Node.js project, you must pass the environment variable on `process.env`: ```ts app.ts theme={"theme":{"light":"github-light","dark":"vesper"}} const resend = new Resend(process.env.RESEND_API_KEY); ``` > [!NOTE] > > On Node.js `v20` and later, you can pass your `.env` file's variables to your script using the `--env-file=.env` flag. Alternatively, you can use the `dotenv` package to load the variables. ## Learn more > [card] [Manage API keys](/docs/dashboard/api-keys/introduction) > > View, create, edit, delete, and manage your API keys. > [card] [API key best practices](/docs/knowledge-base/how-to-handle-api-keys) > > Learn about best practices for managing your API keys. ## Next steps > [card] [Add a domain](/docs/add-a-domain) > > Add and verify a domain you own to start sending emails. > [card] [Quickstart tutorials](/docs/introduction) > > Send your first transactional email with a quick tutorial for your language > or framework. # Manage API keys Source: https://resend.com/docs/dashboard/api-keys/introduction Learn how to view, edit, and delete your API keys in Resend. ## API keys API keys are secret tokens used to authenticate your requests. They are unique to your account and must be kept confidential. You can use multiple keys to isolate different application actions to different API keys. This allows you to [view logs per key](#view-api-key-logs), detect possible abuse, and control any damage that may be done accidentally or maliciously. ## API key management You can view and manage your API keys from the [**API keys** Dashboard page](https://resend.com/api-keys). You can also manage your API keys programmatically using the [API](/docs/api-reference/api-keys/create-api-key) or the [Resend CLI](/docs/cli#api-keys): * [Create](/docs/api-reference/api-keys/create-api-key) a new API key with a name, permission, and optional domain restriction * [List](/docs/api-reference/api-keys/list-api-keys) all API keys in your account * [Update](/docs/api-reference/api-keys/update-api-key) an API key's name (other properties can only be edited in the Dashboard) * [Delete](/docs/api-reference/api-keys/delete-api-key) an API key ## View all API keys The [API Dashboard](https://resend.com/api-keys) shows you all the API keys you have created along with their details, including the **last time you used** an API key. Different color indicators let you quickly scan and detect which API keys are being used and which are not. ![View All API keys](https://mintcdn.com/resend/ABWmVTZIHGIFNTFD/images/dashboard-api-keys-view-all.jpg?fit=max\&auto=format\&n=ABWmVTZIHGIFNTFD\&q=85\&s=f195ef7f60a110407e2739f30c10ca2a) ## Edit API key details After [creating an API key](/docs/create-an-api-key), you can edit the following details: * [Name](/docs/api-reference/api-keys/create-api-key#param-name) * [Permission](/docs/api-reference/api-keys/create-api-key#param-permission) * [Domain](/docs/api-reference/api-keys/create-api-key#domain-id) > [!NOTE] > > You cannot view or edit an API key value after it has been created. To edit an API key in the Resend Dashboard, click the **More options** button and then **Edit API key**. You can also rename an API key programmatically using the [Update API key endpoint](/docs/api-reference/api-keys/update-api-key). The API only updates the key's name, while permission and domain can only be edited in the Dashboard. ![View Inactive API key](https://mintcdn.com/resend/ABWmVTZIHGIFNTFD/images/dashboard-api-keys-edit.jpeg?fit=max\&auto=format\&n=ABWmVTZIHGIFNTFD\&q=85\&s=7abe8e055cf311a7f66a40477db7946a) ## Delete inactive API keys If an API key **hasn't been used in the last 30 days**, consider deleting it to keep your account secure. ![View Inactive API key](https://mintcdn.com/resend/ABWmVTZIHGIFNTFD/images/dashboard-api-keys-view-inactive.jpg?fit=max\&auto=format\&n=ABWmVTZIHGIFNTFD\&q=85\&s=fa99650454696902100e03b669d3a9c1) You can delete an API key by clicking the **More options** button and then **Remove API key**. ![Delete API key](https://mintcdn.com/resend/ABWmVTZIHGIFNTFD/images/dashboard-api-keys-remove.jpeg?fit=max\&auto=format\&n=ABWmVTZIHGIFNTFD\&q=85\&s=9fc76ff5dc4cd38f465539cd3a435706) > [!TIP] > > See more [API key security practices](/docs/knowledge-base/how-to-handle-api-keys). ## View API key logs When visualizing an active API key, you can see the **total number of requests** made to the key. For more detailed logging information, select the underlined number of requests to view all logs for that API key. ![View Active API key](https://mintcdn.com/resend/ABWmVTZIHGIFNTFD/images/dashboard-api-keys-view-active.jpg?fit=max\&auto=format\&n=ABWmVTZIHGIFNTFD\&q=85\&s=e0c0584545565e1e78e460b240d2c221) ## Export your data Admins can download your data in CSV format for the following resources: * Emails * Broadcasts * Contacts * Segments * Domains * Logs * API keys > [!NOTE] > > Currently, exports are limited to admin users of your team. To start, apply filters to your data and click on the "Export" button. Confirm your filters before exporting your data.