# Introduction URL: https://eusend.dev/docs EU-native transactional and marketing email API. Your email data never leaves the European Union — built with GDPR in mind. eusend is a transactional and marketing email API built on EU infrastructure, from European providers. Your email data never leaves the European Union — built with GDPR in mind. The supporting services we use around the product are listed on our [sub-processors page](https://eusend.dev/legal/subprocessors). - **REST API** — Simple HTTP API. One POST to send an email. - **EU Infrastructure** — All email data in EU data centres. Germany & Finland. - **React Templates** — Design emails in React, send server-rendered HTML. Coming from another provider? [Migrating from Resend takes minutes](/migrate) — the SDK mirrors Resend's field-for-field. # Audiences URL: https://eusend.dev/docs/audiences Named contact lists used as targets for broadcasts. Create multiple audiences to segment your contacts. Audiences are named contact lists used as targets for broadcasts. Create multiple audiences to segment your contacts. `POST /audiences` | Parameter | Type | Description | | --- | --- | --- | | `name` (required) | `string` | Display name for the audience (e.g. "Newsletter subscribers"). | ```bash title="create audience" curl -X POST https://api.eusend.dev/audiences \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "name": "Newsletter subscribers" }' ``` ```json title="response — 201 Created" { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Newsletter subscribers", "createdAt": "2026-05-20T10:00:00.000Z" } ``` The rest of the audience surface: `GET /audiences` List audiences. `GET /audiences/:id` Get one audience with its contact count. `PATCH /audiences/:id` Rename an audience — send `{ "name": "..." }`. `DELETE /audiences/:id` Delete an audience. # Contacts URL: https://eusend.dev/docs/audiences/contacts Add and manage individual contacts within an audience. Contacts can also be imported via CSV in the dashboard. Add and manage individual contacts within an audience. Contacts can also be imported via CSV in the dashboard. `POST /audiences/:id/contacts` Add a single contact to an audience. If the email already exists in the audience the record is updated (upsert). | Parameter | Type | Description | | --- | --- | --- | | `email` (required) | `string` | Contact email address. | | `first_name` | `string` | Contact first name. | | `last_name` | `string` | Contact last name. | | `properties` | `object` | Custom properties, usable as {{key}} in a broadcast body. Replaces the stored properties — see below. | ## Custom properties [#custom-properties] Anything you store on a contact under `properties` becomes a variable in a broadcast, so a contact written with `{ "plan": "pro" }` renders `{{plan}}` as `pro`. Combined with the fallback syntax, `Hi {{first_name|there}}, you are on the {{plan|free}} plan` covers the contacts that are missing the value. You do not have to declare a property before setting one — an unknown key registers itself as a string. Declaring it in [Contact properties](/docs/audiences/properties) is what gives it a type and a fallback value that every broadcast picks up. The rules are deliberately narrow, because every value ends up substituted into an email: * **Values are strings.** A number or a date would need a formatting and locale decision that a merge tag has nowhere to express, so make it yourself and send the result. A property declared `number` is checked on write, but still renders exactly as sent. * **Names are lowercase** letters, digits and underscores, starting with a letter, at most 40 characters. Up to 20 properties per contact, each value at most 500 characters. * **`email`, `name`, `first_name`, `last_name` and `full_name` are built in** and are rejected as property names. `{{email}}` always resolves to the contact's real address. > [!WARNING] > **`POST` replaces, `PATCH` replaces, an import merges.** Sending `properties` to `POST > /audiences/:id/contacts` or `PATCH /audiences/:id/contacts/:contactId` replaces the whole object, > which is what lets you remove a key. The batch endpoint merges instead, so a CSV carrying only > `plan` will not drop a `company` an earlier import set. ```bash title="a contact with custom properties" curl -X POST https://api.eusend.dev/audiences/550e8400-e29b-41d4-a716-446655440000/contacts \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "email": "alice@example.com", "first_name": "Alice", "properties": { "plan": "pro", "company": "Acme", "renews_on": "3 March 2026" } }' ``` `POST /audiences/:id/contacts/batch` Upsert up to 1,000 contacts at once. Existing contacts (matched by email) are updated; new ones are inserted. This is what the dashboard's CSV import calls. | Parameter | Type | Description | | --- | --- | --- | | `contacts` (required) | `array` | Array of contact objects. Each has email (required), plus optional first_name, last_name, properties, unsubscribed, and created_at. | | `contacts[].unsubscribed` | `boolean` | Marks the contact opted out, so a list migrated from another provider keeps its unsubscribes. An import can only ADD an opt-out — see below. | | `contacts[].created_at` | `string (ISO 8601)` | Original signup time. Applied on insert only; an existing contact keeps the date it already has. | | `contacts[].properties` | `object` | Custom properties. Merged into what the contact already has, not replaced — see Custom properties above. | An upsert only ever adds or corrects — it will not blank a field the payload does not carry, so importing `email` alone will not wipe the names of the contacts it touches. > [!WARNING] > **A batch write cannot re-subscribe anyone.** `unsubscribed: false` will not clear an existing > opt-out, and neither will omitting the field. If an address occurs more than once in a batch, any > `unsubscribed: true` occurrence preserves the opt-out. Re-subscribing is a consent decision and > lives on `PATCH /audiences/:id/contacts/:contactId`, one contact at a time — so a stale > spreadsheet can never put somebody back on a list they left. > [!NOTE] > Stored contacts are capped by volume — 1,000 on Free, rising to 1,000,000 at 2M emails a month > (see [plans](/docs/reference/plans)) — counted across every audience in the organization. A write > that would exceed the cap returns `403` with code `PLAN_LIMIT_EXCEEDED`. See [Plans & > Limits](/docs/reference/plans). ```bash title="batch upsert contacts" curl -X POST https://api.eusend.dev/audiences/550e8400-e29b-41d4-a716-446655440000/contacts/batch \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "contacts": [ { "email": "alice@example.com", "first_name": "Alice" }, { "email": "bob@example.com", "unsubscribed": true, "created_at": "2024-02-01T10:00:00.000Z" } ] }' ``` `POST /audiences/:id/contacts/batch-delete` Delete up to 1,000 contacts from an audience in one call. | Parameter | Type | Description | | --- | --- | --- | | `contact_ids` (required) | `string[]` | 1 to 1,000 contact ids. Ids from another audience are ignored, not deleted. | Returns `{ "deleted": n }`. That count can be lower than the number of ids you sent — an id may already be gone, or may not belong to this audience — so a retry after a dropped response settles at `0` rather than failing. It takes ids rather than addresses on purpose: ids come from a list you have just read, so a stale address in a script cannot delete somebody who re-subscribed under it since. > [!NOTE] > Deleting a contact is not an unsubscribe. It removes them from the audience; it does not add them > to your [suppression list](/docs/emails/suppressions), and anyone already suppressed stays > suppressed. To stop mailing somebody while keeping the record, set `unsubscribed` on the contact > instead. ```bash title="bulk delete contacts" curl -X POST https://api.eusend.dev/audiences/550e8400-e29b-41d4-a716-446655440000/contacts/batch-delete -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" -H "Content-Type: application/json" -d '{ "contact_ids": ["9a8b7c6d-1111-2222-3333-444455556666"] }' ``` The rest of the contacts surface: `GET /audiences/:id/contacts` List contacts. Use `limit` (1–1,000, default 50) and the response's `nextCursor` as `cursor` to walk all pages. `search` matches a literal substring of the email address, first name, or last name, ignoring case. Set `subscribed=true` or `subscribed=false` to filter by subscription status. `GET /audiences/:id/contacts/:contactId` Get a contact. `PATCH /audiences/:id/contacts/:contactId` Update contact (name, unsubscribed, properties). `DELETE /audiences/:id/contacts/:contactId` Remove a contact. # Contact properties URL: https://eusend.dev/docs/audiences/properties Declare the custom fields your contacts carry, give them a type and a fallback value, and manage them from the API or the dashboard. Contact properties are the custom fields your contacts carry — `plan`, `company`, `renews_on` — and the `{{variables}}` they render as in a broadcast. This page is about the **definitions**; setting a value on a contact is covered in [Contacts](/docs/audiences/contacts). > [!NOTE] > **Declaring a property is optional.** A property you send on a contact that has never been > declared registers itself as a `string`, so an existing integration needs no changes. Declaring > one up front is what gives it a type and a fallback value. Definitions belong to the organization, not to one audience: `signup_plan` means the same thing wherever the contact sits, so a contact moved between lists does not change shape. Properties are also listed in the dashboard under **Audiences → Properties**, where the same add, edit and delete operations are available. ## Fallback values [#fallback-values] A declared property can carry a fallback, substituted into `{{key}}` for contacts that have no value of their own: ```bash title="everyone without a plan reads as 'free'" curl -X POST https://api.eusend.dev/contact-properties \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "key": "plan", "type": "string", "fallback_value": "free" }' ``` This is the durable version of the inline `{{plan|free}}` syntax: set it once and every broadcast picks it up, instead of each body having to remember the default. A property with no fallback renders empty, which is what an unset `{{key}}` has always done. ## Types [#types] `string` or `number`. Values are carried and rendered as strings either way — `number` is a **write-time check**, not a formatting instruction. A merge tag has nowhere to say which thousands separator or which locale it wanted, so `{{order_total}}` substitutes exactly the characters you sent. What the type buys is catching a mistyped value where it is cheap to fix, rather than in an email somebody already received. `POST /contact-properties` | Parameter | Type | Description | | --- | --- | --- | | `key` (required) | `string` | Lowercase letters, digits and underscores, starting with a letter, at most 40 characters. "email", "name", "first_name", "last_name" and "full_name" are built in and are rejected. Cannot be changed later. | | `type` | `string` | "string" (default) or "number". Cannot be changed later. | | `fallback_value` | `string \| null` | Rendered for contacts carrying no value of their own. Must match the type. At most 500 characters. | Returns `409 CONFLICT` if a property with that name already exists. An organization can define up to 100 properties. `GET /contact-properties` Every property the organization has defined, ordered by name. Unpaginated — the registry is capped at 100 entries, and a variable picker wants all of them. ```json title="response" { "data": [ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "key": "plan", "type": "string", "fallbackValue": "free", "createdAt": "2026-09-21T10:14:52.110Z", "updatedAt": "2026-09-21T10:14:52.110Z" } ] } ``` `GET /contact-properties/:id` One property definition by id. `PATCH /contact-properties/:id` | Parameter | Type | Description | | --- | --- | --- | | `fallback_value` (required) | `string \| null` | The new fallback. Send null to clear it. | > [!WARNING] > **The name and type cannot be changed.** Renaming would have to rewrite every contact *and* every > broadcast body that spells the old merge tag — and we will not edit your drafts. Changing either > is a delete and a create, done deliberately. `DELETE /contact-properties/:id` Deletes the definition **and** strips the key from every contact in the organization. The response reports how many contacts were rewritten: ```json title="response" { "deleted": true, "contactsUpdated": 1240 } ``` > [!WARNING] > **This cannot be undone.** Leaving the values behind was the alternative and a worse one: the > property would keep rendering in broadcasts, and the next contact write carrying that key would > register it again — so a delete you watched succeed would silently undo itself. Any broadcast > using that merge tag renders it empty afterwards. ## In the dashboard [#in-the-dashboard] **Audiences → Properties** lists every declared property with the number of contacts using it, and is where you add, edit and delete them. The count is what makes a delete legible: removing a field nothing uses is a different decision from removing one on 1,240 people. ## SDKs [#sdks] ```ts title="Node.js" await eusend.contactProperties.create({ key: 'plan', type: 'string', fallbackValue: 'free' }) const { data } = await eusend.contactProperties.list() ``` ```python title="Python" eusend.ContactProperties.create({"key": "plan", "type": "string", "fallback_value": "free"}) properties = eusend.ContactProperties.list() ``` ```go title="Go" fallback := "free" client.ContactProperties.Create(&eusend.CreateContactPropertyRequest{ Key: "plan", Type: "string", FallbackValue: &fallback, }) ``` # Topics URL: https://eusend.dev/docs/audiences/topics Named categories of email your contacts can subscribe to and leave independently, so an unsubscribe becomes a preference change instead of losing the contact entirely. A topic is a kind of email — "Monthly newsletter", "Product updates", "Beta programme" — that a contact can join or leave on its own. Scope a broadcast to a topic and it reaches only the people who want that kind of mail. Without topics, a recipient who likes the monthly newsletter but not the weekly product blast has exactly one lever: leave. The lever they reach for when leaving feels too blunt is the spam button, and that costs every sender on the shared IPs — which is the real reason this feature exists. Topics belong to the organization, not to one audience, so "Product updates" means the same thing wherever the contact sits. ## Opt-in or opt-out [#opt-in-or-opt-out] Every topic has a default that decides what a contact who has never expressed a preference receives: | Default | A contact who has never chosen | | --------- | --------------------------------------------------- | | `opt_in` | **receives** it, until they explicitly unsubscribe | | `opt_out` | **does not** receive it, until they explicitly join | Use `opt_in` for mail the list signed up for — your newsletter is the obvious case. Use `opt_out` for anything a contact has to ask for: a beta programme, a high-frequency digest, a regional announcement. > [!WARNING] > **The default cannot be changed after creation.** Flipping an `opt_out` topic to `opt_in` would > start mailing every contact who never asked for it, and nothing stored anywhere says which of them > would have agreed. It is a consent decision, so changing it means creating a new topic. Because a new `opt_in` topic reaches everyone immediately and a new `opt_out` topic reaches nobody, neither needs a backfill — only explicit choices are stored. ## The global subscription still wins [#the-global-subscription-still-wins] A contact whose subscription is off receives **nothing**, whatever their topic preferences say. Topics narrow who gets a broadcast; they never widen it. Unsubscribing from every topic is also not the same as unsubscribing from the list — see [Unsubscribes](/docs/audiences/unsubscribe). ## Visibility [#visibility] `private` (the default) or `public`, controlling whether the topic is listed on the hosted unsubscribe page to a contact who is **not** already opted in. Keep a topic private when its name is an internal one. Advertising "Enterprise outreach" to someone who is not on it tells them something you probably did not mean to, and the natural response to an unfamiliar name on an unsubscribe page is to untick it. A `public` topic is one you are happy for anyone to discover and join. A private topic is always shown to a contact who explicitly opted in — otherwise they would have no way to leave it. ## Sending to a topic [#sending-to-a-topic] Pass `topic_id` when creating a broadcast: ```bash title="only the people who want product updates" curl -X POST https://api.eusend.dev/broadcasts \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "name": "October product update", "audience_id": "550e8400-e29b-41d4-a716-446655440000", "topic_id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "from": "hello@acme.com", "subject": "What shipped in October", "html": "
Hi {{first_name}}…
" }' ``` The recipient count shown on the broadcast reflects the topic, so it matches what is actually sent. PATCH `topic_id` to `null` on a draft to widen it back to the whole audience. A broadcast sent under a topic also carries a **topic-scoped unsubscribe link**: the footer link and the `List-Unsubscribe` header both retire that topic rather than the whole list, so one-click unsubscribe in Gmail becomes a preference change. > [!NOTE] > Topics scope **broadcasts only.** `POST /emails` is untouched — a receipt or a password reset must > never be filtered by a marketing preference. `POST /topics` | Parameter | Type | Description | | --- | --- | --- | | `name` (required) | `string` | What the recipient sees on the unsubscribe page if the topic is visible to them. At most 50 characters, unique within the organization. | | `default_subscription` (required) | `string` | "opt_in" or "opt_out". Cannot be changed later. | | `description` | `string \| null` | Shown under the name on the unsubscribe page. At most 200 characters. Worth writing — it is what tells a recipient whether to keep the box ticked. | | `visibility` | `string` | "private" (default) or "public". | ```json title="response — 201 Created" { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "name": "Product updates", "description": "New features and changes.", "defaultSubscription": "opt_in", "visibility": "public", "subscriberCount": 0, "createdAt": "2026-09-22T10:14:52.110Z", "updatedAt": "2026-09-22T10:14:52.110Z" } ``` Returns `409 CONFLICT` if a topic with that name already exists, and `403 PLAN_LIMIT_EXCEEDED` past 100 topics. `GET /topics` Every topic in the organization, ordered by name. Unpaginated — the list is capped at 100 and both the composer's picker and the unsubscribe page want all of it. `subscriberCount` is the number of contacts who have **explicitly opted in**. For an `opt_out` topic that is the whole reachable audience; for an `opt_in` topic it is not, since everyone who never chose is also subscribed. `GET /topics/:id` One topic by id. `PATCH /topics/:id` | Parameter | Type | Description | | --- | --- | --- | | `name` | `string` | At most 50 characters. | | `description` | `string \| null` | Send null to clear it. | | `visibility` | `string` | "public" or "private". | `default_subscription` is rejected here — see the warning above. `DELETE /topics/:id` ```json title="response" { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "deleted": true } ``` Every stored preference for the topic goes with it. A **draft** broadcast scoped to it widens back to its whole audience. While a broadcast scoped to it is scheduled, sending, paused or held, the delete is refused with `409 CONFLICT` — cancel it first, so a send that is about to go out can never reach contacts who opted out of the topic. Broadcasts already sent keep their recipient records. ## Setting a contact's preference [#setting-a-contacts-preference] `PUT /topics/:id/contacts/:contactId` ```bash title="subscribe a contact" curl -X PUT https://api.eusend.dev/topics/b6d24b8e/contacts/9f1c2d3e \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "subscribed": true }' ``` `DELETE /topics/:id/contacts/:contactId` Clears the override so the contact falls back to the topic's default. This is different from `{ "subscribed": false }`: it forgets that they ever chose, so on an `opt_in` topic they start receiving it again. ## On the unsubscribe page [#on-the-unsubscribe-page] A recipient who clicks unsubscribe gets a checkbox per visible topic and a **Save preferences** button, alongside the usual unsubscribe-from-everything button. No JavaScript, no login — it is the same hosted page, branded the same way. Organizations with no topics see exactly the page they saw before. ## SDKs [#sdks] ```ts title="Node.js" const { data: topic } = await eusend.topics.create({ name: 'Product updates', defaultSubscription: 'opt_in', visibility: 'public', }) await eusend.topics.subscribe(topic.id, contactId, true) ``` ```python title="Python" topic = eusend.Topics.create({"name": "Product updates", "default_subscription": "opt_in"}) eusend.Topics.subscribe(topic["id"], contact_id, True) ``` ```go title="Go" topic, _ := client.Topics.Create(&eusend.CreateTopicRequest{ Name: "Product updates", DefaultSubscription: "opt_in", }) client.Topics.Subscribe(topic.Id, contactId, true) ``` # Unsubscribe URL: https://eusend.dev/docs/audiences/unsubscribe Broadcast emails include a one-click unsubscribe link pointing to a hosted unsubscribe page. Broadcast emails include a footer unsubscribe link pointing to a hosted unsubscribe page, so recipients can opt out with a single click. ## How it works [#how-it-works] When a recipient clicks "Unsubscribe", they're directed to a hosted page at `https://api.eusend.dev/unsubscribe/:token`. Confirming removes them from the audience and prevents future broadcasts. The contact record is retained — only the subscription status changes. > [!WARNING] > Unsubscribed contacts are excluded from all future broadcast sends to that audience. They are > **not** automatically suppressed from transactional emails sent via `POST /emails`. ## Branding the page [#branding-the-page] Settings → **Unsubscribe page** styles the hosted page for your whole organization: background, text and accent colors, a logo, and the wording of both the confirmation and the success screen. A live preview renders the same page the recipient will see. Colors must be hex values, and the logo is uploaded there — the page loads images from our asset host only, so a recipient's unsubscribe never fetches a third party. Copy is plain text; the confirm button itself can be relabelled but not removed, because a link scanner following the URL must not be able to opt someone out on their behalf. The "Powered by eusend" footer can be switched off on any paid plan. ## Suppression list [#suppression-list] Hard bounces and spam complaints automatically add addresses to your suppression list. Suppressed addresses are silently skipped on all future sends (including transactional emails). See [Suppressions](/docs/emails/suppressions) for reading, importing, and removing entries. # Broadcasts URL: https://eusend.dev/docs/broadcasts Campaigns sent to an entire audience. Create a broadcast as a draft, then send or schedule it. > [!NOTE] > **Sending a broadcast to an audience requires a paid plan.** On Free you can create audiences, > build and preview broadcasts, and send test copies to your own account email or an address on a > verified domain — `POST /broadcasts/:id/send` returns `403` with code `PLAN_LIMIT_EXCEEDED`. Broadcasts are campaigns sent to an entire audience (contact list). Create a broadcast as a draft, then send it when ready. In-flight broadcasts can be cancelled. ## Lifecycle [#lifecycle] `draft` → `scheduled` → `sending` → `sent` → `cancelled` A broadcast can also move to `paused` if sending is halted partway — for example it reaches your monthly or daily send limit, the sender domain is no longer verified, or platform-wide sending is paused. Resume it by sending again (`POST /broadcasts/:id/send`) once the underlying issue is resolved — it continues from where it stopped. ### Review on early list sends [#review-on-early-list-sends] New accounts can reach **500 recipients** by broadcast before we've reviewed the account. Most first campaigns are smaller than that and go out in full, with nothing to do. If your audience is larger, the first 500 are delivered immediately and the broadcast moves to `held` with the rest queued behind a quick manual review. You'll get an email when it's released, and the broadcast continues from where it stopped — nothing is lost and nobody is emailed twice. Unlike `paused`, a held broadcast can't be resumed by sending again; `POST /broadcasts/:id/send` returns `403` with code `BROADCAST_HELD` until the review clears. The same allowance applies to very large `POST /emails/batch` sends, which return `LIST_SEND_HELD` on the items beyond it. This is a one-time step per account, not a recurring limit. It exists so one bad actor can't damage the sending reputation that every customer on the platform shares. If you're on a deadline, email `support@eusend.dev` and we'll clear it. > [!NOTE] > Sending from a domain registered in the last 30 days? The same 500-recipient allowance applies to > broadcasts until the account is reviewed. Transactional sending through `POST /emails` is > unaffected — send from a brand-new domain from day one. ## API endpoints [#api-endpoints] `POST /broadcasts` | Parameter | Type | Description | | --- | --- | --- | | `name` (required) | `string` | Internal name for the campaign. | | `audience_id` (required) | `string (UUID)` | The audience (contact list) this broadcast is sent to. | | `subject` (required) | `string` | Email subject line. | | `from` (required) | `string` | Sender address. Accepts a bare email or a display name, e.g. "AcmeHere'"'"'s what'"'"'s new...
" }' ``` `POST /broadcasts/:id/send` Send a draft broadcast immediately, or schedule it for a future time by passing `scheduled_at`. This endpoint also **resumes a paused broadcast** — it continues from where it stopped, skipping recipients already sent. The audience is set when creating the broadcast. Broadcasts can also be pre-scheduled via `PATCH /broadcasts/:id` without triggering a send; that runs the same checks as this endpoint, so a broadcast that could not be sent cannot be scheduled either. Unsubscribed and suppressed contacts are skipped. So are contacts at a domain that can never receive mail — no mail server that can be reached, such as a parked typo like `gmaii.com`, or a reserved name like `example.com`. Each of those gets an email with status `failed` and the reason, and an `email.failed` webhook, instead of being sent and bouncing against your reputation; they use none of your quota. | Parameter | Type | Description | | --- | --- | --- | | `scheduled_at` | `string (ISO 8601)` | Future UTC datetime to deliver the broadcast. Omit to send immediately. Sets status to scheduled until the delivery time. | ```bash title="schedule a broadcast" curl -X POST https://api.eusend.dev/broadcasts/3fa85f64-5717-4562-b3fc-2c963f66afa6/send \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "scheduled_at": "2026-06-01T09:00:00Z" }' ``` `POST /broadcasts/:id/test` Send yourself a copy of the broadcast before it goes to the audience — the real message, through the real sending path, so you see exactly what a recipient sees. **Available on every plan, including Free.** This is how you evaluate a broadcast without a paid subscription. Recipients must be inboxes you already control: a team member's account email, or an address on a **domain you have verified**. A test send puts real mail on the wire without the plan gate, so pass an address anywhere else and you get `403` with code `DOMAIN_NOT_VERIFIED`. | Parameter | Type | Description | | --- | --- | --- | | `to` (required) | `string[]` | Between 1 and 5 addresses, each a team member's account email or on a domain this organization has verified. Duplicates are collapsed. | What a test send does and does not do: * Subject is prefixed with `[Test]`, so a test copy is never mistaken for the campaign. * Contact variables render with sample values (`{{first_name}}` becomes `Alex`), rather than collapsing to an empty string and hiding a greeting that will look wrong later. [Custom properties](/docs/audiences/contacts#custom-properties) are borrowed from a real contact in the audience, since only your data knows what `{{plan}}` should look like. * The unsubscribe footer is included so you can see it, but its link is inert — there is no contact behind a test send to unsubscribe. * It counts against your daily and monthly sending limits, because it is a real send. * Addresses on your suppression list are skipped and cost nothing. If every address is suppressed, the request fails with `422 ALL_SUPPRESSED`. * It does **not** change the broadcast's status, its recipient list, or its stats. Send as many tests as you like; the campaign stays a draft until you send it. ```bash title="send a test copy to yourself" curl -X POST https://api.eusend.dev/broadcasts/3fa85f64-5717-4562-b3fc-2c963f66afa6/test \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "to": ["you@yourdomain.com"] }' ``` > [!WARNING] > A test-mode key (`eu_test_`) cannot call this endpoint. "Test" here means a dress rehearsal, not a > sandbox — the message really is delivered, so it needs a live key. `POST /broadcasts/:id/cancel` Cancel a scheduled or in-flight broadcast. Emails already sent are not recalled. The rest of the broadcast surface: `GET /broadcasts` List broadcasts. `GET /broadcasts/:id` Get broadcast details. `PATCH /broadcasts/:id` Update draft / set `scheduled_at`. # Contacts CSV URL: https://eusend.dev/docs/dashboard/contacts-csv Import and export contacts in bulk from any audience detail page, with automatic column mapping. Audiences support bulk contact management via CSV import and export, from any audience detail page. ## Importing [#importing] Choose **Import CSV** and pick a file. Nothing is sent until you have confirmed the mapping. ### 1. We read your header row [#1-we-read-your-header-row] The file is parsed in your browser. The delimiter is detected rather than assumed — comma, semicolon, tab and pipe all work, so a spreadsheet exported by Excel in a European locale (which uses `;`) imports without you having to convert it first. Quoted fields are handled properly, so a value like `"Doe, Jane"` stays one field. ### 2. We map the columns for you [#2-we-map-the-columns-for-you] Each column is matched to a eusend property, and you get a table showing the column name, a sample value from your file, and the property we chose. Every row is editable: change a mapping, or untick a column to leave it out. Matching is case- and punctuation-insensitive, so `Email`, `email_address` and `E-Mail Address` all find `email`. Columns we don't recognise are left unmapped rather than guessed at. | Property | Required | Description | | ------------ | -------- | ------------------------------------------------------------------------------------- | | `email` | yes | Contact email address. Rows without a valid address are skipped and counted. | | `first_name` | no | Used in `{{first_name}}` template variables. | | `last_name` | no | Used in `{{last_name}}`. | | `subscribed` | no | `false`, `no`, `0` or `unsubscribed` opts the contact out. Anything else is opted in. | | `created_at` | no | Original signup time. Applied to new contacts only. | Any other column can be brought in as a [custom property](/docs/audiences/contacts#custom-properties): pick **Custom property** in that column's dropdown and it is stored under a name derived from the header, so `Plan Name` becomes `plan_name` and renders as `{{plan_name}}` in a broadcast. A header that would collide with a built-in variable is prefixed rather than refused — a column headed `Email` mapped as a property becomes `custom_email`. A contact holds at most 20 properties; columns past that are left out rather than failing the import, and values longer than 500 characters are truncated. Empty cells are skipped, not written as blanks — see the rules below. ### 3. Import [#3-import] Contacts are upserted in chunks of 1,000, so a list of any size imports in one go. Addresses are lowercased and de-duplicated — if the same address appears twice, the last row wins, and the summary tells you how many were merged. ## What an import will never do [#what-an-import-will-never-do] Re-importing a list is a normal thing to do, and it is safe. Two rules make it so: * **An unmapped column changes nothing.** Importing a file of just `email,subscribed` will not blank the names of the contacts it touches. * **An empty cell changes nothing either.** Properties merge rather than replace, so a blank `plan` cell leaves whatever `plan` the contact already had. To clear a property, edit the contact. * **An import can add an opt-out, never remove one.** If somebody has unsubscribed, a spreadsheet saying otherwise will not put them back on the list — not with `subscribed,true`, and not by omitting the column. Re-subscribing is a consent decision, so it lives on the contact itself (or `PATCH /audiences/:id/contacts/:contactId`), one person at a time. ## Exporting [#exporting] Exported files use the full column set and can be re-imported without losing anything — including who has unsubscribed and when each contact joined. ```csv title="export column order" email,first_name,last_name,subscribed,created_at ``` Every custom property present in the exported contacts is appended as its own column, named exactly as the property is. Those names round-trip: re-importing the file matches each one straight back onto the property it came from. ## Editing one contact [#editing-one-contact] The bulk paths are for lists. To change a single contact — its name, whether it is subscribed, or its custom properties — use the pencil on its row in the contacts table. Unlike an import, that editor **replaces** the property set, so removing a row there removes the property from the contact. ## Importing through the API [#importing-through-the-api] The dashboard is doing what you could do yourself: ```ts await client.audiences.batchCreateContacts(audienceId, { contacts: [ { email: 'alice@example.com', firstName: 'Alice', lastName: 'Smith' }, { email: 'bob@example.com', unsubscribed: true, createdAt: '2024-02-01T10:00:00.000Z' }, ], }) ``` Up to 1,000 contacts per call. See [Audiences and contacts](/docs/audiences/contacts) for the full endpoint. # Domain Setup (UI) URL: https://eusend.dev/docs/dashboard/domain-setup Adding a domain from the dashboard walks you through a 3-step wizard — no API calls needed. Adding a domain from the dashboard walks you through a 3-step wizard. No API calls needed — DNS records are generated and shown inline with copy buttons. ### Enter your domain [#enter-your-domain] Type your domain name (e.g. acme.com) and click Add Domain. eusend generates a 2048-bit RSA DKIM keypair immediately. ### Add DNS records [#add-dns-records] The records are shown with one-click copy. Only the DKIM TXT record is required to verify the domain and start sending; DMARC is recommended, and the two Return-Path records are optional and enable SPF alignment. Adding them by hand? [DNS providers](/docs/domains/registrars) gives the exact field values for the most common DNS panels, and the mistakes each one invites. ### Verify [#verify] Click "I've added these records" to trigger verification. eusend polls your DNS until the records propagate and marks the domain verified — or reports which records are missing. > [!NOTE] > DNS propagation typically takes under an hour but can take up to 48 hours. The dashboard polls > automatically after you click verify — you don't need to stay on the page. The domain status > updates to **verified** once all records are found. ## DNS records added [#dns-records-added] | Record | Type | Purpose | | ---------------------------- | ----- | ------------------------------------------------------------------------- | | `eusend._domainkey.acme.com` | `TXT` | DKIM — enables cryptographic email signing. Required | | `_dmarc.acme.com` | `TXT` | DMARC — policy for failed SPF/DKIM checks. Recommended | | `send.acme.com` | `TXT` | SPF for the Return-Path subdomain. Optional — enables SPF alignment | | `send.acme.com` | `MX` | Routes delayed bounces back to us. Optional — pairs with the record above | > [!WARNING] > There is no SPF record on your root domain, deliberately. A domain may publish only one, and > adding a second breaks SPF for every service that sends from it — your own mailbox provider > included. See [DNS records](/docs/domains/dns-records) for why it isn't needed. # Logs URL: https://eusend.dev/docs/dashboard/logs Every request your API keys make, with the request and response of the ones that failed. The **Logs** page at [`/logs`](/logs) lists every request made with one of your API keys: method, path, status code, duration, which key made it, and when. Use it to find out why an integration is failing without adding logging to your own code. * **Filter** by status (success, 4xx, 5xx), API key, path, and period (24 hours, 7 days or 30 days). * **Click a row** to see the request ID, the client's user agent (the SDKs send their name and version), and — for failed requests — the request body you sent and the error response you got back. * **Share the request ID** with support. It is the same value returned in the `X-Request-Id` response header, so it links a failing call to our own logs. ## What is and isn't logged [#what-is-and-isnt-logged] * Only requests authenticated with an API key are logged, including test-mode keys. Requests with a missing or invalid key have no workspace to be logged under, and actions you take in the dashboard are not listed. * Request and response bodies are kept only for failed requests (status 400 or above). Attachment content is replaced with `[omitted]`, and bodies over 16 KB are truncated. * Headers are never stored, so your API key does not appear in the logs. * Logs are kept for **30 days** on every plan, then deleted. * New requests appear within a few seconds. # Overview URL: https://eusend.dev/docs/dashboard/overview The eusend dashboard lets you do everything the API does — no code required. The eusend dashboard at [eusend.dev](/login) lets you do everything the API does — no code required. Here's what each section is for. | Path | Section | Purpose | | ------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | | `/overview` | Overview | Volume against your plan, recent activity, bounce and complaint rates, delivery by recipient domain, and anything that needs fixing. | | `/emails` | Emails | Full log of every send. Filter by status, sender, or recipient. Click any row for the event timeline (sent → delivered → opened → clicked). | | `/analytics` | Analytics | Charts for send volume, open rate, and click rate over time. Filterable by time period and domain. | | `/templates` | Templates | Create and edit email templates in a visual editor with live preview. Reference templates by ID in any send. | | `/audiences` | Audiences | Manage contact lists. Import and export contacts via CSV. Used as the target for broadcasts. | | `/broadcasts` | Broadcasts | Compose and schedule marketing campaigns. Send immediately or set a future delivery time. | | `/domains` | Domains | Add sending domains and copy the generated DNS records. A 3-step wizard walks you through setup and verification. | | `/api-keys` | API Keys | Create and revoke live (`eu_live_`) and test (`eu_test_`) keys. Free plan allows 1 live and 1 test key; paid plans are unlimited. | | `/webhooks` | Webhooks | Register HTTPS endpoints to receive real-time delivery events. The signing secret is shown at creation and can be revealed again later. | | `/logs` | Logs | Every request made with your API keys, with the request and response of failed ones. See [Logs](/docs/dashboard/logs). | | `/settings/billing` | Settings → Billing | Upgrade, downgrade, or cancel your plan. Current usage and monthly quota shown inline. | | `/settings/team` | Settings → Team | Invite team members by email, set their role, and see who has two-factor enabled. See [Teams & Workspaces](/docs/teams). | # Template Editor URL: https://eusend.dev/docs/dashboard/templates Write and preview email templates in real time. The rendered HTML is stored and used at send time. The template editor at `/templates` lets you write and preview email templates in real time. The rendered HTML is stored and used at send time. ## Variables [#variables] Use `{{variable_name}}` anywhere in the subject or HTML body to create a variable. The editor detects them automatically and shows a panel where you can enter sample values for the preview. At send time, pass the actual values via the `variables` field. > [!NOTE] > Variable values are HTML-escaped when substituted, so they always render as text — a value like ` hi` shows literally rather than as bold. Any HTML structure (links, formatting) must live > in the template body, not in the variable values you pass. ```html title="template HTML"Your order #{{order_id}} has shipped.
``` ```bash title="send with variables" curl -X POST https://api.eusend.dev/emails \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "from": "orders@acme.com", "to": "alice@example.com", "template_id": "550e8400-e29b-41d4-a716-446655440000", "variables": { "first_name": "Alice", "order_id": "1234", "tracking_url": "https://track.example.com/1234" } }' ``` > [!NOTE] > Templates are rendered once when saved (not at send time), so the preview you see in the editor is > exactly what will be sent. Variable substitution is the only step that happens per send. ## Editor layout [#editor-layout] The canvas is a visual editor — you write the email as it will look, with a style inspector alongside it for the block you have selected. Two mode tabs sit above it: | Mode | What it shows | | --------- | ------------------------------------------------------------------------------------ | | **Write** | The visual editor. Type `{{` to insert a variable. | | **HTML** | The underlying HTML, editable directly for anything the visual editor doesn't cover. | Below the canvas, **Variables** lists every `{{placeholder}}` detected in the template, **Preview with sample data** gives you an input per variable and renders the result live, and **Use in API** shows the `POST /emails` body for sending this template. Saving stores the rendered HTML plus the editor document, so reopening a template gives you back the visual editor rather than raw markup. Editing the HTML mode directly and saving drops the stored editor document — the HTML you wrote stays authoritative. # Domain Setup URL: https://eusend.dev/docs/domains Add your own sending domain to sign outbound emails with your DKIM key, improving deliverability and brand trust. Add your own sending domain to sign outbound emails with your DKIM key, improving deliverability and brand trust. eusend auto-generates a 2048-bit RSA DKIM keypair for your domain. `POST /domains` | Parameter | Type | Description | | --- | --- | --- | | `name` (required) | `string` | Your domain name (e.g. acme.com), without the part before an @. Domains of mailbox providers such as gmail.com cannot be added — you can only send from a domain you control. | ```bash title="add domain" curl -X POST https://api.eusend.dev/domains \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "name": "acme.com" }' ``` ```json title="response — 201 Created" { "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "name": "acme.com", "dkim": { "type": "TXT", "name": "eusend._domainkey.acme.com", "value": "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgK..." }, "dmarc": { "type": "TXT", "name": "_dmarc.acme.com", "value": "v=DMARC1; p=none; rua=mailto:dmarc@acme.com" } } ``` Creating a domain starts checking its DNS for you — eusend polls in the background and flips the domain to `verified` as soon as your records resolve, so publishing them is usually all you need to do. `POST /domains/:id/verify` Start a fresh check right now. Use it when you published the records late, or corrected them after a `failed`: eusend re-checks your DNS and updates the domain status to `verified` or `failed`. The rest of the domains surface: `GET /domains` List domains. `GET /domains/:id` Get domain details, including the DNS records to publish and a `diagnostic` object when a check found something wrong with what is already published — the record sitting under your domain twice because the panel appends it, a key cut off at the 255-character limit for one DNS string, or a DKIM key we did not issue on the same selector. It names the DNS host when your nameservers identify one, and is `null` whenever the only thing missing is propagation. ```json title="response — 200 OK, a record published at the wrong name" { "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "name": "acme.com", "status": "pending", "diagnostic": { "code": "doubled_domain", "foundAt": "eusend._domainkey.acme.com.acme.com", "provider": { "id": "namecheap", "label": "Namecheap", "guide": "/docs/domains/registrars/namecheap" } } } ``` See [DNS providers](/docs/domains/registrars) for the panel-by-panel instructions the `guide` path points at. `DELETE /domains/:id` Delete domain. # DMARC URL: https://eusend.dev/docs/domains/dmarc Tell receiving mail servers how to handle messages that fail authentication — protecting your domain from spoofing. DMARC lets you tell receiving mail servers how to handle messages that fail authentication checks for your domain — protecting your domain from being used in phishing and spoofing attacks. ## How it works with eusend [#how-it-works-with-eusend] DMARC passes when either DKIM or SPF is aligned with your sending domain — it doesn't require both. Because eusend signs every outbound email with your own DKIM key (set up during domain verification), DKIM alignment passes automatically. You can add a DMARC record to your domain straight away without any additional infrastructure changes. ## Add a DMARC record [#add-a-dmarc-record] Add the following TXT record to your domain's DNS. Start with a `p=none` policy so you can monitor results before enforcing anything. | Type | Host / Name | Value | | ----- | ----------------- | ---------------------------------------------- | | `TXT` | `_dmarc.acme.com` | `v=DMARC1; p=none; rua=mailto:dmarc@acme.com;` | > [!NOTE] > Replace `dmarc@acme.com` with a real address you control. Receiving servers send aggregate reports > to this address — XML digests of authentication results across all email from your domain, > typically once a day. ## Tightening the policy [#tightening-the-policy] Once you've confirmed your emails are passing DMARC (check the `Authentication-Results` header in any received email, or wait for aggregate reports), you can switch to a stricter policy: | Policy | Effect | | -------------- | ----------------------------------------------------------------------------- | | `p=none` | No action taken. Reports are still sent. Use this while monitoring. | | `p=quarantine` | Failing messages go to spam. A good middle ground once delivery is confirmed. | | `p=reject` | Failing messages are bounced outright. Maximum protection. | > [!TIP] > Only move to `p=reject` once you're certain all legitimate email from your domain passes DKIM or > SPF. Any service sending on your behalf — transactional email, marketing tools, CRMs — needs to be > authenticated before you enforce rejection. ## DMARCbis: the updated standard [#dmarcbis-the-updated-standard] In May 2026 DMARC was revised and promoted to a full IETF standard — **DMARCbis** (RFC 9989–9991, replacing the original RFC 7489). Nothing you've already published breaks: the record eusend generates uses only long-stable tags and is fully DMARCbis-compatible. A few tags did change, though. ### Deprecated tags — don't add them [#deprecated-tags--dont-add-them] | Tag | Status | | ----- | ------------------------------------------------------------------------------------- | | `pct` | Removed. Percentage-based enforcement is gone; use `t=y` (below) for testing instead. | | `rf` | Removed. Reports are XML-only. | | `ri` | Removed. Receivers choose their own report interval. | If an older tutorial tells you to add `pct=100`, skip it — it's a no-op that some validators now flag. ### `np` — block non-existent subdomains [#np--block-non-existent-subdomains] The headline DMARCbis addition is `np`, a policy for mail from **subdomains that don't exist**. Attackers love spoofing addresses like `billing.acme.com` even when you've never created that subdomain. Because a non-existent subdomain never sends legitimate mail, you can set `np=reject` safely — even while your main policy is still `p=none` for monitoring: | Type | Host / Name | Value | | ----- | ----------------- | --------------------------------------------------------- | | `TXT` | `_dmarc.acme.com` | `v=DMARC1; p=none; np=reject; rua=mailto:dmarc@acme.com;` | `np` only applies to subdomains with no DNS records at all. A sending subdomain you've verified in eusend (it carries a DKIM record, so it "exists") is unaffected and follows your `sp`/`p` policy instead. ### `t` — testing mode [#t--testing-mode] `t=y` marks a policy as testing: receivers evaluate `p`/`sp`/`np` and send reports but take no action, the way `pct=0` used to. Use it to trial a stricter policy without risking delivery, then remove it to enforce. > [!NOTE] > These tags are optional hardening. The record eusend gives you at domain verification already > follows the safe `p=none` → `p=quarantine` → `p=reject` path; adding `np=reject` is the one change > worth making early, since it costs nothing and closes the subdomain-spoofing gap. # DNS Records URL: https://eusend.dev/docs/domains/dns-records Add these records to your domain's DNS to enable DKIM signing and improve deliverability. Add these records to your domain's DNS to enable DKIM signing and improve deliverability. If you want click-by-click instructions for the panel you are actually looking at — Cloudflare, Namecheap, Route 53, Squarespace, Porkbun, OVHcloud, Gandi or IONOS — see [DNS providers](/docs/domains/registrars). ## DKIM record [#dkim-record] The DKIM public key is returned when you add a domain. Add it as a TXT record: | Type | Host / Name | Value | | ----- | ---------------------------- | ------------------------------------- | | `TXT` | `eusend._domainkey.acme.com` | `v=DKIM1; k=rsa; p=Just testing if this goes to spam.
" } ``` ```json title="representative" { "from": "AcmeHi Sam,
Thanks for getting in touch. We've received your request and will reply within one business day.
In the meantime, our setup guide covers the most common issues: acme.com/help.
— The Acme team
" } ``` ### Note the folder, then read the headers [#note-the-folder-then-read-the-headers] Check each inbox, then open the raw message: in Gmail, **⋮ → Show original**; in Outlook, **… → View → View message source**. ## Reading the headers [#reading-the-headers] Start with `Authentication-Results`. All three should pass: ```text Authentication-Results: mx.google.com; dkim=pass header.i=@acme.com; spf=pass smtp.mailfrom=bounce@eusend.dev; dmarc=pass header.from=acme.com ``` | Result | What it means | | --------------------------- | ------------------------------------------------------------------------------------------------------- | | `dkim=fail` or missing | The DKIM record is missing or changed. Re-check it under [Domains](/docs/domains). | | `spf=pass` but `dmarc=fail` | Neither DKIM nor SPF is aligned with your From domain — usually DKIM. See [DMARC](/docs/domains/dmarc). | | All pass | Authentication is fine. The filter is judging content or reputation, covered below. | Outlook adds its own verdict: | Header | Inbox | Junk | | -------------------------------- | ----------- | ------------- | | `X-MS-Exchange-Organization-SCL` | `-1` to `4` | `5` and above | | `X-Forefront-Antispam-Report` | `SFV:NSPM` | `SFV:SPM` | In Gmail, a message in Spam usually carries a grey banner explaining why — "similar to messages identified as spam" points at content, "the sender's reputation" points at your domain. ## Isolate the cause [#isolate-the-cause] When one message is filtered and another isn't, change **one thing at a time** — recipient, content or From address — and send again. Placement depends on all three, so comparing two messages that differ in several ways tells you nothing. > [!NOTE] > One message in spam is a data point, not a verdict. Look for a pattern across a few sends and > providers before changing anything. ## Common causes [#common-causes] | Cause | Fix | | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | | Test-looking content | Send real copy with a specific subject, a greeting and a few sentences. | | Generic sender | Use a recognisable display name and a real mailbox (`support@`, `billing@`), not `test@` or `noreply@test`. | | Mostly images or a single link | Keep a reasonable amount of text, and link to your own domain rather than URL shorteners. | | No plain-text part | eusend generates one from `html` when you don't pass `text`. Pass your own for full control. | | New domain or subdomain | Providers have no history for it yet. Start with low volume to engaged recipients and let it build. | | Marketing mixed with transactional | Send newsletters from a separate subdomain (`news.acme.com`), so complaints about them don't affect your password resets. | | Mail people didn't ask for | Only email people who expect it, and honour unsubscribes. Spam complaints weigh more than anything else on this page. | ## Track it over time [#track-it-over-time] A single test shows you one day. To watch your domain's reputation as it builds: * **[Google Postmaster Tools](https://postmaster.google.com)** shows your domain's reputation and spam-complaint rate at Gmail. Verify your sending domain there; data appears once you send roughly a hundred messages a day to Gmail users. * **[Open and click rates](/docs/tracking)** are the earliest warning. A sudden drop usually means mail is landing in spam, well before it shows up as bounces. * **[Bounces and complaints](/docs/emails/suppressions)** — eusend suppresses recipients who bounce or mark you as spam, so a growing suppression list is a signal to look at what you send and to whom. # DNS Providers URL: https://eusend.dev/docs/domains/registrars Step-by-step guides for publishing your eusend DNS records at the most common DNS providers, and the four mistakes that account for most failed verifications. The records eusend gives you are the same everywhere. What differs is what each control panel expects you to type into its fields — and getting that wrong is the reason most domains fail to verify. Pick your provider below, or read [the four traps](#the-four-traps) first if yours is not listed. - [**Cloudflare**](/docs/domains/registrars/cloudflare) — Free plan included. Splits long values for you. - [**Namecheap**](/docs/domains/registrars/namecheap) — Never put your domain in the Host field. - [**Amazon Route 53**](/docs/domains/registrars/route53) — Quote the DKIM value and split it yourself. - [**Squarespace Domains**](/docs/domains/registrars/squarespace) — Formerly Google Domains. Appends your domain. - [**Porkbun**](/docs/domains/registrars/porkbun) — Leave Host blank for the root domain. - [**OVHcloud**](/docs/domains/registrars/ovhcloud) — Trailing dot on the MX target, or it breaks. - [**Gandi**](/docs/domains/registrars/gandi) — Split the DKIM value into quoted strings. - [**IONOS**](/docs/domains/registrars/ionos) — One-click setup available. Selector only in Host name. ## Which guide do I need? [#which-guide-do-i-need] Not your registrar — your **DNS host**. If you bought the domain at Namecheap but moved it to Cloudflare's nameservers, the records go in Cloudflare and the Namecheap panel will do nothing. Ask your domain who is in charge: ```bash title="find your DNS host" dig +short NS acme.com ``` The answer names the provider whose guide you want. If it is a host with no guide here, the [four traps](#the-four-traps) cover everything you need — the field labels are the only thing that changes. > [!NOTE] > Some providers can publish the records for you. If yours supports [Domain > Connect](https://www.domainconnect.org/), the dashboard shows a **Set up automatically** button on > the domain page — one click, their consent screen, done. Nothing below is needed in that case. ## The four traps [#the-four-traps] ### 1. The Host field almost never wants your domain [#1-the-host-field-almost-never-wants-your-domain] Most panels append your domain to whatever you type. eusend shows you the full record name, `eusend._domainkey.acme.com`, because that is what has to exist in DNS — but pasting all of it into a field that appends gives you `eusend._domainkey.acme.com.acme.com`, which resolves to nothing. In those panels you enter `eusend._domainkey` and stop. Each guide below says exactly what its panel does. To check whether this is what went wrong: ```bash title="did the domain get doubled?" dig +short TXT eusend._domainkey.acme.com.acme.com ``` An answer here means the record exists at the wrong name. Edit the record and remove the domain from the Host field. ### 2. The root domain is spelled differently everywhere [#2-the-root-domain-is-spelled-differently-everywhere] `@`, blank, or the domain itself, depending on the panel. This only matters for DMARC if you are publishing it at the apex — the eusend records all sit on subdomains (`eusend._domainkey`, `_dmarc`, `send`), so you will usually not need it. ### 3. The DKIM value is longer than a single DNS string may be [#3-the-dkim-value-is-longer-than-a-single-dns-string-may-be] A single string in a TXT record may hold 255 characters. Your DKIM value is around 400, because a 2048-bit RSA public key is long. The record is therefore stored as two strings, and resolvers join them back together — this is normal DNS, not a workaround. Most panels do the splitting for you when you paste the value whole. Two in this list do not: **Route 53** and **Gandi** expect you to split it yourself and wrap each piece in double quotes. Their guides show how. If a panel rejects your value as too long, that is what it is asking for. Never shorten or truncate the key — DKIM breaks. ### 4. MX targets sometimes need a trailing dot [#4-mx-targets-sometimes-need-a-trailing-dot] The optional Return-Path MX record points at `feedback.eusend.dev`. Some panels — OVHcloud notably — append your own domain to any target that does not end in a dot, turning it into `feedback.eusend.dev.acme.com`. Where that is the case the guide says to type `feedback.eusend.dev.` with the dot. ## What you are publishing [#what-you-are-publishing] Only the first record is required. The full reasoning for each — including why there is deliberately **no SPF record on your root domain** — is in [DNS records](/docs/domains/dns-records). | Record | Type | Value | Required | | ---------------------------- | ----- | --------------------------------------------- | ----------- | | `eusend._domainkey.acme.com` | `TXT` | `v=DKIM1; k=rsa; p=…` | Yes | | `_dmarc.acme.com` | `TXT` | `v=DMARC1; p=none; rua=mailto:dmarc@acme.com` | Recommended | | `send.acme.com` | `TXT` | `v=spf1 include:_spf.eusend.dev ~all` | Optional | | `send.acme.com` | `MX` | `feedback.eusend.dev` (priority `10`) | Optional | ## After you save [#after-you-save] Publishing is all you have to do — eusend polls your DNS in the background and flips the domain to `verified` on its own. If you want to check the records yourself first: ```bash title="verify from your machine" dig +short TXT eusend._domainkey.acme.com dig +short TXT _dmarc.acme.com ``` > [!NOTE] > Propagation is usually minutes, but a provider may take up to 48 hours. If `dig` shows the record > and eusend still has not verified, hit **Verify** on the domain page to check again immediately. # Cloudflare URL: https://eusend.dev/docs/domains/registrars/cloudflare Publish your eusend DNS records in Cloudflare DNS — the Name field, the automatic quoting of long DKIM values, and the proxy setting you can ignore. Cloudflare is the most forgiving panel in this list: it strips your zone name from the Name field if you paste it, and it splits long TXT values for you. > [!NOTE] > This is your DNS host, not necessarily your registrar. If `dig +short NS acme.com` returns > `*.ns.cloudflare.com`, this is the right guide regardless of where you bought the domain. ## Add the records [#add-the-records] ### Open the DNS editor [#open-the-dns-editor] In the [Cloudflare dashboard](https://dash.cloudflare.com), select your account, then your domain, then **DNS** → **Records**. Click **Add record**. ### DKIM — required [#dkim--required] | Field | Value | | ----------- | ------------------------------------------------------- | | **Type** | `TXT` | | **Name** | `eusend._domainkey` | | **Content** | the full `v=DKIM1; k=rsa; p=…` value from the dashboard | | **TTL** | Auto | Click **Save**. ### DMARC — recommended [#dmarc--recommended] | Field | Value | | ----------- | --------------------------------------------- | | **Type** | `TXT` | | **Name** | `_dmarc` | | **Content** | `v=DMARC1; p=none; rua=mailto:dmarc@acme.com` | Use an address you actually read for `rua` — see [DMARC](/docs/domains/dmarc). ### Return-Path — optional, both or neither [#return-path--optional-both-or-neither] | Field | Value | | ----------- | ------------------------------------- | | **Type** | `TXT` | | **Name** | `send` | | **Content** | `v=spf1 include:_spf.eusend.dev ~all` | Then a second record: | Field | Value | | --------------- | --------------------- | | **Type** | `MX` | | **Name** | `send` | | **Mail server** | `feedback.eusend.dev` | | **Priority** | `10` | Publish both and eusend switches your mail to a bounce address on your own domain, so SPF passes and aligns. One without the other does nothing. ## Cloudflare specifics [#cloudflare-specifics] **The Name field.** Cloudflare appends your zone, so `eusend._domainkey` becomes `eusend._domainkey.acme.com`. It also recognises and removes your zone name if you paste the full record name, which makes Cloudflare the one panel here where copying the name straight out of the eusend dashboard is safe. The saved record is displayed with its full name either way — glance at it once to confirm it does not read `…acme.com.acme.com`. **Long DKIM values are split for you.** Save the value whole. Cloudflare stores it as two quoted strings and the record list will show it that way, with the quotes visible and a break somewhere in the middle of the key. That is correct and resolvers join it back together; do not try to repair it. Cloudflare also adds the double quotes itself if you save a value without them. **Proxy status does not apply.** Neither TXT nor MX records have a proxy toggle — the orange cloud only appears for A, AAAA and CNAME records. There is nothing to turn off. **Existing SPF at the apex.** Do not add one. If Cloudflare Email Routing is enabled on this domain it already manages MX and SPF records at the apex; the eusend records live on the `send` and `eusend._domainkey` subdomains and will not collide with them. ## Check it [#check-it] ```bash title="verify" dig +short TXT eusend._domainkey.acme.com ``` Cloudflare's nameservers usually answer within a minute of saving. Official documentation: [Manage DNS records](https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/). # Gandi URL: https://eusend.dev/docs/domains/registrars/gandi Publish your eusend DNS records in Gandi LiveDNS — splitting the DKIM value into quoted strings, and the text editor that makes it a one-liner. Gandi will not split your DKIM value for you. Its documentation is explicit: "a TXT record is limited to 255 characters per string. In order to insert a TXT record with more than 255 characters you will need to break your record into strings that are 255 characters or less each, then surround each of those sections in quotes." Your DKIM value is around 400 characters, so this applies to it. The fastest way to do it is Gandi's text editor. ## The quick way: the text editor [#the-quick-way-the-text-editor] ### Build the record line [#build-the-record-line] Paste your DKIM value into this: ```bash title="build the zone line" echo -n 'v=DKIM1; k=rsa; p=MIIBIjANBgkq…' \ | fold -w 255 | sed 's/.*/"&"/' | tr '\n' ' ' \ | sed 's/^/eusend._domainkey 300 IN TXT /' ``` It prints one line, ready to paste: ``` eusend._domainkey 300 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkq…" "…rest of the key…" ``` ### Paste it into the zone [#paste-it-into-the-zone] After logging in, click **Domain** in the left navigation, click your domain, and open the **DNS Records** tab. Click **Edit DNS Records** to edit the whole zone as text, add your line at the end, and save. While you are there, the other records are one line each: ``` _dmarc 300 IN TXT "v=DMARC1; p=none; rua=mailto:dmarc@acme.com" send 300 IN TXT "v=spf1 include:_spf.eusend.dev ~all" send 300 IN MX 10 feedback.eusend.dev. ``` The two `send` records are optional, but publish both or neither — one alone does nothing. Use an address you actually read for `rua`; see [DMARC](/docs/domains/dmarc). ## The form, if you prefer it [#the-form-if-you-prefer-it] Click **Add** above the record table and fill in the dialog: **Type** `TXT`, **Name** `eusend._domainkey`, **TTL** `300`, and the value. For the DKIM record the value must be the split, quoted form from the command above — pasted whole, it is over the 255-character string limit. Short values like DMARC need no quotes. Repeat for `_dmarc`, and for `send` if you are adding the Return-Path records. For the MX record, choose type `MX` and give the target as `feedback.eusend.dev.` with the trailing dot, priority `10`. ## Gandi specifics [#gandi-specifics] **The Name field takes the subdomain only.** `eusend._domainkey`, `_dmarc`, `send`. The root domain is `@` — Gandi's documentation: "Most of the time, you will want it to be associated with the bare domain, which is represented by the @ symbol." None of the eusend records need it. **300 seconds is the floor.** Gandi enforces a minimum TTL of 300 seconds on LiveDNS. Anything lower is rejected. **Quotes: only where they are needed.** Gandi asks for TXT values without quotation marks — the exception is the multi-string case above, where the quotes are what separates the strings. **LiveDNS only.** These instructions are for Gandi's LiveDNS nameservers (`ns-*.gandi.net`). If your domain points elsewhere, so do your records. ## Check it [#check-it] ```bash title="verify" dig +short TXT eusend._domainkey.acme.com ``` You will see the value printed as two quoted strings. That is correct — resolvers join them back together, and eusend parses either form. Official documentation: [How do I update my DNS records?](https://docs.gandi.net/en/domain_names/common_operations/dns_records.html) and [What are TXT records?](https://docs.gandi.net/en/domain_names/faq/record_types/txt_record.html) # IONOS URL: https://eusend.dev/docs/domains/registrars/ionos Publish your eusend DNS records at IONOS — the one-click path that skips the form entirely, and the Host name field that takes the selector only. IONOS is a Domain Connect provider, so you probably do not have to do any of this by hand. > [!NOTE] > **Try the automatic route first.** On the domain page in eusend, a **Set up automatically** button > appears when your DNS provider can publish the records for us — IONOS can. You are sent to IONOS, > you approve the change on their own screen, and you come back done. We never hold credentials for > your zone. The manual steps below are the fallback. ## Add the records [#add-the-records] ### Open DNS settings [#open-dns-settings] Log in to IONOS and go to **Domains & SSL**. For the domain you want, click the gear symbol under **Actions** and select **DNS**. Click **Add record** and choose the record type. ### DKIM — required [#dkim--required] | Field | Value | | ------------- | ------------------------------------------------------- | | **Type** | `TXT` | | **Host name** | `eusend._domainkey` | | **Value** | the full `v=DKIM1; k=rsa; p=…` value from the dashboard | | **TTL** | leave as-is | Click **Save**. ### DMARC — recommended [#dmarc--recommended] | Field | Value | | ------------- | --------------------------------------------- | | **Type** | `TXT` | | **Host name** | `_dmarc` | | **Value** | `v=DMARC1; p=none; rua=mailto:dmarc@acme.com` | Use an address you actually read for `rua` — see [DMARC](/docs/domains/dmarc). ### Return-Path — optional, both or neither [#return-path--optional-both-or-neither] | Field | Value | | ------------- | ------------------------------------- | | **Type** | `TXT` | | **Host name** | `send` | | **Value** | `v=spf1 include:_spf.eusend.dev ~all` | Then a second record: | Field | Value | | ------------- | --------------------- | | **Type** | `MX` | | **Host name** | `send` | | **Points to** | `feedback.eusend.dev` | | **Priority** | `10` | Publish both and eusend switches your mail to a bounce address on your own domain, so SPF passes and aligns. One without the other does nothing. ## IONOS specifics [#ionos-specifics] **The Host name field takes the selector only.** IONOS's own DKIM documentation uses `s1-ionos._domainkey` — the selector and `_domainkey`, with no domain after it. Yours is `eusend._domainkey`. The root domain is `@`, which none of the eusend records need. **If IONOS rejects the DKIM value as too long**, it is asking you to split it. A single DNS string holds 255 characters and your value is around 400, so break it into two quoted pieces on one line: ```bash title="split the DKIM value" echo -n 'v=DKIM1; k=rsa; p=MIIBIjANBgkq…' | fold -w 255 | sed 's/.*/"&"/' | tr '\n' ' ' ``` Paste the result — `"first piece" "second piece"` — into the Value field. Never shorten the key to make it fit; resolvers rejoin the pieces, but a truncated key breaks DKIM permanently. **Your IONOS mailboxes are unaffected.** If this domain receives mail through IONOS, leave the MX records at the apex exactly as they are. The eusend MX record sits on `send`, a subdomain with no mail of its own. **TTL is optional.** IONOS applies changes to its own nameservers immediately; there is no reason to set one for these records. **Only when IONOS runs your DNS.** If the domain's nameservers point elsewhere, so do your records — check with `dig +short NS acme.com`. ## Check it [#check-it] ```bash title="verify" dig +short TXT eusend._domainkey.acme.com ``` If that is empty, check whether the domain ended up in the Host name field: ```bash dig +short TXT eusend._domainkey.acme.com.acme.com ``` Official documentation: [Managing TXT records](https://www.ionos.com/help/domains/configuring-txt-and-srv-records/managing-txt-records/) and [Email authentication with DKIM](https://www.ionos.com/help/domains/configuring-mail-servers-and-other-related-records/email-authentication-with-dkim/). # Namecheap URL: https://eusend.dev/docs/domains/registrars/namecheap Publish your eusend DNS records in Namecheap's Advanced DNS — why the Host field must never contain your domain, and the Mail Settings switch that blocks MX records. Two things catch people out at Namecheap: the Host field silently appends your domain, and MX records live in a separate section that is switched off by default. > [!WARNING] > Namecheap's own documentation is explicit about the first one: "The domain name itself should not > be included in the Host field" — even if your provider showed you the full name. That is us. Enter > `eusend._domainkey`, not `eusend._domainkey.acme.com`. ## Add the records [#add-the-records] ### Open Advanced DNS [#open-advanced-dns] Sign in, click **Domain List** in the left sidebar, click **Manage** next to your domain, then open the **Advanced DNS** tab. ### DKIM — required [#dkim--required] Under **Host Records**, click **Add New Record**. | Field | Value | | --------- | ------------------------------------------------------- | | **Type** | `TXT Record` | | **Host** | `eusend._domainkey` | | **Value** | the full `v=DKIM1; k=rsa; p=…` value from the dashboard | | **TTL** | Automatic | Save with the green tick at the end of the row. ### DMARC — recommended [#dmarc--recommended] | Field | Value | | --------- | --------------------------------------------- | | **Type** | `TXT Record` | | **Host** | `_dmarc` | | **Value** | `v=DMARC1; p=none; rua=mailto:dmarc@acme.com` | Use an address you actually read for `rua` — see [DMARC](/docs/domains/dmarc). ### Return-Path SPF — optional [#return-path-spf--optional] | Field | Value | | --------- | ------------------------------------- | | **Type** | `TXT Record` | | **Host** | `send` | | **Value** | `v=spf1 include:_spf.eusend.dev ~all` | ### Return-Path MX — optional, pairs with the record above [#return-path-mx--optional-pairs-with-the-record-above] MX records are not in Host Records. Scroll down to **Mail Settings** and set the dropdown to **Custom MX** first — while it is on `Email Forwarding`, `Private Email` or `Gmail`, Namecheap manages the MX records itself and you cannot add your own. | Field | Value | | ------------ | --------------------- | | **Host** | `send` | | **Value** | `feedback.eusend.dev` | | **Priority** | `10` | Publish this and the SPF record above together, or neither — one alone does nothing. > [!WARNING] > Switching Mail Settings to **Custom MX** removes the MX records Namecheap was managing. If this > domain receives mail through Namecheap Private Email or email forwarding, note those MX records > first and re-enter them alongside the `send` record, or skip the two optional Return-Path records > entirely. Your domain sends fine without them. ## Namecheap specifics [#namecheap-specifics] **The Host field never takes your domain.** `eusend._domainkey`, `_dmarc`, `send` — that is all. Namecheap appends `acme.com` when it writes the record. **Only on Namecheap's nameservers.** The Advanced DNS tab edits records only if the domain uses `BasicDNS`, `PremiumDNS` or Namecheap's hosting nameservers. Check the **Nameservers** section on the Domain tab; if it says Custom DNS, your records belong wherever those nameservers point. **Propagation.** Namecheap's documentation gives around 30 minutes for a new record to become active — slower than most, so give it time before assuming something is wrong. ## Check it [#check-it] ```bash title="verify" dig +short TXT eusend._domainkey.acme.com ``` If that is empty, check for the doubled name before changing anything else: ```bash title="the classic Namecheap mistake" dig +short TXT eusend._domainkey.acme.com.acme.com ``` An answer there means the domain went into the Host field. Edit the record and remove it. Official documentation: [How do I add TXT/SPF/DKIM/DMARC records for my domain?](https://www.namecheap.com/support/knowledgebase/article.aspx/317/2237/how-do-i-add-txtspfdkimdmarc-records-for-my-domain/) and [How can I set up MX records?](https://www.namecheap.com/support/knowledgebase/article.aspx/322/2237/how-can-i-set-up-mx-records-required-for-mail-service/) # OVHcloud URL: https://eusend.dev/docs/domains/registrars/ovhcloud Publish your eusend DNS records in an OVHcloud DNS zone — the trailing dot that decides whether your MX record works, and the record types to avoid picking. OVHcloud has one rule that matters more than anything else here: a target without a trailing dot gets your own domain appended to it. ## Add the records [#add-the-records] ### Open the DNS zone [#open-the-dns-zone] In the OVHcloud Control Panel, go to **Web Cloud** → **Domain names**, select your domain, and open the **DNS zone** tab. Click **Add an entry** above the table. ### DKIM — required [#dkim--required] Choose **TXT** as the entry type. | Field | Value | | ------------- | ------------------------------------------------------- | | **Subdomain** | `eusend._domainkey` | | **TTL** | By default | | **Value** | the full `v=DKIM1; k=rsa; p=…` value from the dashboard | Click **Next**, then **Confirm**. > [!NOTE] > OVH's type list also offers dedicated **DKIM** and **SPF** entries, which build the record from > separate fields instead of one value. Plain **TXT** is what these instructions assume and is the > simpler path — you already have the finished value. ### DMARC — recommended [#dmarc--recommended] | Field | Value | | ------------- | --------------------------------------------- | | **Type** | `TXT` | | **Subdomain** | `_dmarc` | | **Value** | `v=DMARC1; p=none; rua=mailto:dmarc@acme.com` | Use an address you actually read for `rua` — see [DMARC](/docs/domains/dmarc). ### Return-Path — optional, both or neither [#return-path--optional-both-or-neither] | Field | Value | | ------------- | ------------------------------------- | | **Type** | `TXT` | | **Subdomain** | `send` | | **Value** | `v=spf1 include:_spf.eusend.dev ~all` | Then the MX record — and mind the dot: | Field | Value | | ------------- | ---------------------- | | **Type** | `MX` | | **Subdomain** | `send` | | **Priority** | `10` | | **Target** | `feedback.eusend.dev.` | Publish both and eusend switches your mail to a bounce address on your own domain, so SPF passes and aligns. One without the other does nothing. ## OVHcloud specifics [#ovhcloud-specifics] > [!WARNING] > **The trailing dot on the MX target is not optional.** OVH's documentation: when the target is a > domain, "punctuate it. Otherwise, your domain name gets appended to the target." Enter > `feedback.eusend.dev` without the final dot and OVH stores `feedback.eusend.dev.acme.com`, which > does not exist — bounces then go nowhere and SPF alignment never switches on. **The Subdomain field takes the subdomain only.** `eusend._domainkey`, `_dmarc`, `send`. Leave it empty for the root domain. OVH adds your domain when it writes the record, the same way it does to an unpunctuated target. **TTL.** Leave it on **By default**, or pick **Customised** and set a value in seconds. There is no reason to change it for these records. **Never use "Reset the DNS zone".** The button sits near the zone editor and restores OVH's default records, deleting everything you added — including your DKIM record. If you are trying to fix one bad record, edit that row instead: open the `⋮` menu on it and choose **Edit the entry**. **Only when the domain uses OVH's nameservers.** If the **Server** tab shows nameservers elsewhere, the DNS zone tab here is not what the internet reads. **Propagation.** OVH's own documentation allows up to 24 hours. In practice it is much faster, but it is the slowest provider in this list to promise anything. ## Check it [#check-it] ```bash title="verify" dig +short TXT eusend._domainkey.acme.com dig +short MX send.acme.com ``` The second command should print `10 feedback.eusend.dev.` — if it prints `feedback.eusend.dev.acme.com.`, the trailing dot is missing from the target. Official documentation: [Editing an OVHcloud DNS zone](https://docs.ovhcloud.com/en/guides/web-cloud/domains/dns-zone-edit) and [How to add a DNS TXT record](https://docs.ovhcloud.com/en/guides/web-cloud/domains/dns-zone-txt-record-creation). # Porkbun URL: https://eusend.dev/docs/domains/registrars/porkbun Publish your eusend DNS records at Porkbun — the Host field, the Answer field, and the 600-second TTL floor. Porkbun's DNS editor is one of the plainer ones. The only thing to remember is that the target field is called **Answer**, and that the root domain is an empty Host field rather than `@`. ## Add the records [#add-the-records] ### Open the DNS editor [#open-the-dns-editor] Sign in and go to **Domain Management**. Find your domain and click its **DNS** button — or open **Details** and choose the edit icon next to **DNS Records**. Click **Add Record**. ### DKIM — required [#dkim--required] | Field | Value | | ---------- | ------------------------------------------------------- | | **Type** | `TXT - Text record` | | **Host** | `eusend._domainkey` | | **Answer** | the full `v=DKIM1; k=rsa; p=…` value from the dashboard | | **TTL** | `600` | Click **Add**. ### DMARC — recommended [#dmarc--recommended] | Field | Value | | ---------- | --------------------------------------------- | | **Type** | `TXT - Text record` | | **Host** | `_dmarc` | | **Answer** | `v=DMARC1; p=none; rua=mailto:dmarc@acme.com` | Use an address you actually read for `rua` — see [DMARC](/docs/domains/dmarc). ### Return-Path — optional, both or neither [#return-path--optional-both-or-neither] | Field | Value | | ---------- | ------------------------------------- | | **Type** | `TXT - Text record` | | **Host** | `send` | | **Answer** | `v=spf1 include:_spf.eusend.dev ~all` | Then a second record. The **Priority** field only appears once you choose MX: | Field | Value | | ------------ | --------------------- | | **Type** | `MX - Mail exchange` | | **Host** | `send` | | **Answer** | `feedback.eusend.dev` | | **Priority** | `10` | Publish both and eusend switches your mail to a bounce address on your own domain, so SPF passes and aligns. One without the other does nothing. ## Porkbun specifics [#porkbun-specifics] **Host takes the subdomain only.** Porkbun's documentation: for the root domain "you will leave this field blank" — not `@` — and for a subdomain "this is where you will enter that subdomain name". So `eusend._domainkey`, `_dmarc`, `send`, with no `.acme.com`. **600 seconds is the floor.** Porkbun's minimum and default TTL is 600 seconds. You cannot go lower, and there is no reason to. **Porkbun's own email records.** If you use Porkbun's email forwarding or hosted email, leave the MX records at the apex exactly as they are. The eusend MX record sits on `send`, which has no mail of its own, so the two never interact. **The Notes field is yours.** It is local metadata, never published. Writing `eusend DKIM` in it makes the record list readable a year from now. ## Check it [#check-it] ```bash title="verify" dig +short TXT eusend._domainkey.acme.com ``` Official documentation: [How to add DNS records on Porkbun](https://kb.porkbun.com/article/231-how-to-add-dns-records-on-porkbun). # Amazon Route 53 URL: https://eusend.dev/docs/domains/registrars/route53 Publish your eusend DNS records in Route 53 — quoting and splitting the DKIM value, the MX priority format, and the duplicate hosted zone that quietly breaks everything. Route 53 is stricter than every other panel in this list about how a TXT value is written. It will not split your DKIM key for you, and it will not add the quotes. ## Split the DKIM value first [#split-the-dkim-value-first] A single DNS string holds 255 characters; your DKIM value is around 400. Route 53 requires you to break it into pieces yourself, wrap each in double quotes, and put them on one line separated by spaces. Its own limit is 4,000 characters in total, so two pieces is always enough. Paste your value into this to get the exact string Route 53 wants: ```bash title="split the DKIM value" echo -n 'v=DKIM1; k=rsa; p=MIIBIjANBgkq…' | fold -w 255 | sed 's/.*/"&"/' | tr '\n' ' ' ``` The result looks like this, and goes into the value box as-is: ``` "v=DKIM1; k=rsa; p=MIIBIjANBgkq…" "…rest of the key…" ``` Never shorten the key to fit. Splitting changes nothing about the record — a resolver joins the strings back together — but a truncated key breaks DKIM. ## Add the records [#add-the-records] ### Open the hosted zone [#open-the-hosted-zone] In the [Route 53 console](https://console.aws.amazon.com/route53/), choose **Hosted zones** in the navigation pane, then the name of your zone. Choose **Create record**. If the console asks for a routing policy, choose **Simple routing**. ### DKIM — required [#dkim--required] | Field | Value | | --------------- | ---------------------------------- | | **Record name** | `eusend._domainkey` | | **Record type** | `TXT` | | **Value** | the quoted, split value from above | | **TTL** | `300` | The **Record name** box shows `.acme.com` beside it — that suffix is added for you, so type only `eusend._domainkey`. ### DMARC — recommended [#dmarc--recommended] | Field | Value | | --------------- | ----------------------------------------------- | | **Record name** | `_dmarc` | | **Record type** | `TXT` | | **Value** | `"v=DMARC1; p=none; rua=mailto:dmarc@acme.com"` | Short enough for one string, but the quotes are still required. Use an address you actually read for `rua` — see [DMARC](/docs/domains/dmarc). ### Return-Path — optional, both or neither [#return-path--optional-both-or-neither] | Field | Value | | --------------- | --------------------------------------- | | **Record name** | `send` | | **Record type** | `TXT` | | **Value** | `"v=spf1 include:_spf.eusend.dev ~all"` | Then a second record. Route 53 has no separate priority field — the priority and the mail server go in one value, separated by a space: | Field | Value | | --------------- | ------------------------ | | **Record name** | `send` | | **Record type** | `MX` | | **Value** | `10 feedback.eusend.dev` | Publish both and eusend switches your mail to a bounce address on your own domain, so SPF passes and aligns. One without the other does nothing. ## Route 53 specifics [#route-53-specifics] **Everything in a TXT value is quoted.** Route 53 rejects unquoted values, and a value that saved without quotes is not the value you think it is. This applies to the short records too. **To enter two separate TXT records at the same name**, put each value on its own line in the same record — not in two records. Route 53 treats one name plus one type as a single record with multiple values. **The zone apex has an empty name.** Not `@`. AWS is explicit: "If you're creating a record that has the same name as the hosted zone, don't enter a value (for example, an @ symbol) in the Name field." None of the eusend records sit at the apex, so this only comes up if you publish DMARC there. > [!WARNING] > **Check you are editing the live hosted zone.** Route 53 lets you keep several hosted zones for > the same domain name, each with its own nameservers, and only one of them is authoritative. > Records added to the wrong one are invisible to the internet and to us. Compare the NS values in > the zone against `dig +short NS acme.com` before you start — this is the single most common reason > a correct-looking Route 53 record never verifies. **Registered elsewhere?** If the domain is registered outside AWS, its nameservers at that registrar must point at this hosted zone's four NS values. Creating the zone does not do that for you. ## Check it [#check-it] ```bash title="verify" dig +short TXT eusend._domainkey.acme.com ``` Route 53 propagates to its own nameservers within about 60 seconds of saving. Official documentation: [Creating records by using the console](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-creating.html) and [TXT record type](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html#TXTFormat). # Squarespace Domains URL: https://eusend.dev/docs/domains/registrars/squarespace Publish your eusend DNS records at Squarespace Domains — formerly Google Domains. The Name field appends your domain, and the default TTL is four hours. Squarespace took over Google Domains, so domains bought from Google are managed here now. The panel appends your domain to the Name field, and its default TTL is unusually long. > [!NOTE] > You can only edit DNS here if the domain is registered with Squarespace or connected through > Nameserver Connect. If it is pointed somewhere else, the records belong at that provider — check > with `dig +short NS acme.com`. ## Add the records [#add-the-records] ### Open DNS settings [#open-dns-settings] Open the [domains dashboard](https://account.squarespace.com/domains), click your domain, then **DNS** → **DNS Settings**. Scroll to **Custom Records** and click **Add record**. You will be asked for your password or a 2FA code before the record saves. ### DKIM — required [#dkim--required] | Field | Value | | -------- | ------------------------------------------------------- | | **Type** | `TXT` | | **Name** | `eusend._domainkey` | | **Text** | the full `v=DKIM1; k=rsa; p=…` value from the dashboard | Click **Save**. ### DMARC — recommended [#dmarc--recommended] | Field | Value | | -------- | --------------------------------------------- | | **Type** | `TXT` | | **Name** | `_dmarc` | | **Text** | `v=DMARC1; p=none; rua=mailto:dmarc@acme.com` | Use an address you actually read for `rua` — see [DMARC](/docs/domains/dmarc). ### Return-Path — optional, both or neither [#return-path--optional-both-or-neither] | Field | Value | | -------- | ------------------------------------- | | **Type** | `TXT` | | **Name** | `send` | | **Text** | `v=spf1 include:_spf.eusend.dev ~all` | Then a second record: | Field | Value | | --------------- | --------------------- | | **Type** | `MX` | | **Name** | `send` | | **Priority** | `10` | | **Mail Server** | `feedback.eusend.dev` | Publish both and eusend switches your mail to a bounce address on your own domain, so SPF passes and aligns. One without the other does nothing. ## Squarespace specifics [#squarespace-specifics] **The Name field appends your domain.** Squarespace's documentation puts it plainly: "Squarespace automatically adds your domain to the Name field. This means if your provider asks you add your domain to the Name field, like yourdomain.com, you'll enter **@**." So `eusend._domainkey`, `_dmarc` and `send` — never with `.acme.com` on the end. **The default TTL is four hours.** Every custom record gets 14400 seconds unless you change it. That is fine for records you are publishing once, but it means a *correction* takes up to four hours to be seen. If you expect to fix a typo, set a shorter TTL on the way in. **Email presets can overwrite things.** Squarespace offers one-click presets for Google Workspace and other mail providers that write a batch of MX and TXT records. Applying one after you have added the eusend records can replace records at the same names — add the presets first, then the eusend records. ## Check it [#check-it] ```bash title="verify" dig +short TXT eusend._domainkey.acme.com ``` If it is empty, check whether the domain was appended twice: ```bash dig +short TXT eusend._domainkey.acme.com.acme.com ``` Official documentation: [Adding TXT records](https://support.squarespace.com/hc/en-us/articles/31120980444429-Adding-TXT-records) and [DNS records for email](https://support.squarespace.com/hc/en-us/articles/31120985010957-DNS-records-for-email). # Batch Send URL: https://eusend.dev/docs/emails/batch Send up to 100 emails in a single request. Each email is independent — failures are per-email. `POST /emails/batch` ## Request body [#request-body] An array of up to 100 email objects. Each object has the same schema as [POST /emails](/docs/emails/send), except that `attachments` and `scheduled_at` are not supported here — send or schedule those individually via `POST /emails`. ```bash title="request" curl -X POST https://api.eusend.dev/emails/batch \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '[ { "from": "noreply@acme.com", "to": "alice@example.com", "subject": "Receipt #1001", "html": "Thanks, Alice!
", "tags": { "category": "receipt" } }, { "from": "noreply@acme.com", "to": "bob@example.com", "subject": "Receipt #1002", "html": "Thanks, Bob!
" } ]' ``` ## Response [#response] One result per input email, in the same order: `data[i]` describes `emails[i]`. A queued email carries its `id`; an email that could not be queued carries `error` and `code` instead (for example an unverified sender domain, all recipients suppressed, or an exhausted quota). Failed items never fail the rest of the batch — retry just those. ```json title="response — 201 Created" { "data": [ { "id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d" }, { "error": "All recipients are suppressed", "code": "ALL_SUPPRESSED" } ] } ``` > [!WARNING] > Batch sends count toward your daily and monthly limits. A batch of 50 emails uses 50 of your > quota. ## Idempotency [#idempotency] Pass an `Idempotency-Key` header to make a retried batch safe. Each item is tracked under the key and its position, so resending the same batch returns the ids of the emails that were already queued — without sending them again — and processes only the items that failed or never ran. Keep the items in the same order when you retry. A batch whose items were all queued before answers `200 OK` with the original ids. Keys must be at most 255 characters and contain no control characters; invalid keys return `400 VALIDATION_ERROR`. Batch keys are separate from single-send keys, and test and live sends use separate key spaces. Retries matching older batch keys can return `409 CONFLICT` because the old keys cannot always be distinguished from single-send keys. No items are queued when this happens. Check the original emails' statuses before deciding whether to use a new key, since a new key may send duplicate emails. # Email Details URL: https://eusend.dev/docs/emails/details Get a single email and its full event history — opens, clicks, delivery, bounces. `GET /emails/:id` ```bash title="request" curl "https://api.eusend.dev/emails/9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d" \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" ``` ```json title="response — 200 OK" { "id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d", "from": "noreply@acme.com", "to": ["alice@example.com"], "subject": "Your order has shipped", "status": "delivered", "tags": { "category": "shipping_update" }, "scheduledAt": null, "createdAt": "2026-05-20T10:00:00.000Z", "events": [ { "type": "sent", "createdAt": "2026-05-20T10:00:01.000Z" }, { "type": "delivered", "createdAt": "2026-05-20T10:00:03.000Z" }, { "type": "opened", "createdAt": "2026-05-20T10:05:12.000Z" }, { "type": "clicked", "createdAt": "2026-05-20T10:05:30.000Z" } ] } ``` # List Emails URL: https://eusend.dev/docs/emails/list Retrieve a paginated list of emails sent from your organization. `GET /emails` ## Query parameters [#query-parameters] | Parameter | Type | Description | | --- | --- | --- | | `status` | `string` | Filter by status: queued, scheduled, canceled, sending, sent, delivered, bounced, complained, suppressed, failed. | | `from` | `string` | Filter by sender email address. | | `to` | `string` | Filter by recipient email address. | | `tag` | `string` | Filter by tag. "category:password_reset" matches that exact pair; a bare "category" matches any email carrying the tag. Repeat the parameter to require several. See Tags. | | `cursor` | `string (UUID)` | Pagination cursor — pass next_cursor from the previous response. | | `limit` | `number` | Results per page. Default: 10. Max: 100. | ```bash title="request" curl "https://api.eusend.dev/emails?status=delivered&limit=10" \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" ``` ```json title="response — 200 OK" { "data": [ { "id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d", "from": "noreply@acme.com", "to": ["alice@example.com"], "subject": "Your order has shipped", "status": "delivered", "tags": { "category": "shipping_update" }, "testMode": false, "createdAt": "2026-05-20T10:00:00.000Z" } ], "next_cursor": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d" } ``` # Scheduling URL: https://eusend.dev/docs/emails/scheduling Schedule a transactional email up to 30 days ahead, then reschedule or cancel it before it sends. Schedule a transactional email up to 30 days ahead by passing `scheduled_at` to [POST /emails](/docs/emails/send). Until it sends, the email sits in status `scheduled` and can be rescheduled or canceled. ## Schedule a send [#schedule-a-send] `scheduled_at` accepts an ISO 8601 timestamp or a natural-language time like `"in 1 hour"` or `"tomorrow at 9am"`, parsed server-side (relative phrasings resolve in UTC). It must resolve to a time in the future and at most 30 days out. All send checks — domain verification, suppression, and your daily and monthly limits — run at schedule time, and the send is debited from your monthly quota immediately (canceling refunds it). Recipients who get suppressed between scheduling and the send time are still dropped at send time. ```bash title="request" curl -X POST https://api.eusend.dev/emails \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "from": "noreply@acme.com", "to": "alice@example.com", "subject": "Your trial ends tomorrow", "html": "Reminder: your trial ends in 24 hours.
", "scheduled_at": "2026-07-03T09:00:00Z" }' ``` ```json title="response — 201 Created" { "id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d" } ``` ## Reschedule [#reschedule] `PATCH /emails/:id` Move a scheduled email to a new time. Only emails still in status `scheduled` can be rescheduled — once sending has started this returns `409 CONFLICT`. Moving it onto another day counts against that day's sending limit; if the new day is already full this returns `429 DAILY_LIMIT_EXCEEDED` and the email keeps its original time. | Parameter | Type | Description | | --- | --- | --- | | `scheduled_at` (required) | `string (ISO 8601 or natural language)` | The new send time — an ISO 8601 timestamp or natural language like "in 1 hour" (parsed server-side). Must resolve to the future, at most 30 days out. | ```bash title="request" curl -X PATCH https://api.eusend.dev/emails/9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "scheduled_at": "2026-07-04T09:00:00Z" }' ``` ```json title="response — 200 OK" { "id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d", "status": "scheduled", "scheduled_at": "2026-07-04T09:00:00.000Z" } ``` ## Cancel [#cancel] `POST /emails/:id/cancel` Cancel a scheduled email before it sends. The email moves to the terminal status `canceled` and the send is refunded to your monthly quota. Like reschedule, this returns `409 CONFLICT` once sending has started. ```bash title="request" curl -X POST https://api.eusend.dev/emails/9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d/cancel \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" ``` ```json title="response — 200 OK" { "id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d", "status": "canceled" } ``` > [!NOTE] > Scheduling is per-email and not available on the batch endpoint. For scheduling a campaign to an > audience, use [Broadcasts](/docs/broadcasts) — they have their own `scheduled_at`. # Send an Email URL: https://eusend.dev/docs/emails/send Send a single transactional email. Returns immediately with an email ID; delivery is asynchronous. `POST /emails` ## Request body [#request-body] | Parameter | Type | Description | | --- | --- | --- | | `from` (required) | `string` | Sender address. Accepts a bare email or a display name, e.g. "AcmeYour order #1234 is on its way!
", "text": "Your order #1234 is on its way!", "track_opens": true, "track_clicks": true }' ``` ```json title="response — 201 Created" { "id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d" } ``` ## Example — with an attachment [#example--with-an-attachment] Attach a file by passing its bytes base64-encoded as `content`, or point `path` at a public URL and we fetch it at send time. Set `content_id` to embed an image inline and reference it from your HTML with `Thanks! Your invoice is attached.
", "attachments": [ { "filename": "invoice.pdf", "content": "JVBERi0xLjQKJ...base64...", "content_type": "application/pdf" }, { "filename": "logo.png", "path": "https://cdn.acme.com/logo.png" } ] }' ``` ## Idempotency [#idempotency] Pass an `Idempotency-Key` request header to make retries safe. If a request with the same key has already been accepted for your organisation, the original email ID is returned immediately and no second send is queued — regardless of how many times you retry. Test and live sends use separate key spaces, as do single and batch sends. Keep the key and request body unchanged when retrying. Keys longer than 255 characters or containing control characters are rejected with `400 VALIDATION_ERROR`, rather than truncated. An ambiguous older key can return `409 CONFLICT`, including older single-send keys ending in `#` followed by a number. No new email is queued in that case. Check the existing email's status before deciding whether to use a new key, because a new key may send a second email. | Parameter | Type | Description | | --- | --- | --- | | `Idempotency-Key` | `string (header)` | Any unique string up to 255 characters. A UUID per send is a good default. Omit the header to skip idempotency checks. | ```bash title="request" curl -X POST https://api.eusend.dev/emails \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Idempotency-Key: a4f3c2b1-dead-beef-0000-000000000001" \ -H "Content-Type: application/json" \ -d '{ "from": "noreply@acme.com", "to": "alice@example.com", "subject": "Your receipt", "html": "Thanks for your order!
" }' ``` > [!NOTE] > A duplicate key returns `HTTP 200` with the original email ID. The first successful send always > returns `HTTP 201`. ## Example — with a template [#example--with-a-template] ```bash title="request" curl -X POST https://api.eusend.dev/emails \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "from": "noreply@acme.com", "to": "alice@example.com", "template_id": "550e8400-e29b-41d4-a716-446655440000", "variables": { "first_name": "Alice", "order_id": "1234", "tracking_url": "https://track.example.com/1234" } }' ``` # Statuses URL: https://eusend.dev/docs/emails/statuses Every email moves through a lifecycle of statuses as it's processed and delivered. Every email moves through a lifecycle of statuses as it's processed and delivered. | Status | Meaning | | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `queued` | Email has been accepted and is waiting to be processed by the send worker. | | `scheduled` | Email was created with `scheduled_at` and is waiting for its send time. It can still be rescheduled or canceled. | | `canceled` | A scheduled email was canceled before its send time. Terminal — it will not send, and the send is refunded to your monthly quota. | | `sending` | Email is being handed to the mail server for delivery. | | `sent` | The mail server accepted the message and it is en route to the recipient. | | `delivered` | Delivery confirmed. | | `bounced` | Email hard-bounced — the receiving server permanently rejected it (e.g. invalid address). The address is automatically suppressed. Transient (soft) failures are retried and do not set this status. | | `complained` | Recipient reported the email as spam. Address is automatically suppressed. | | `suppressed` | The recipient address is on the [suppression list](/docs/emails/suppressions) — email was not sent. | | `failed` | Unrecoverable send failure after all retry attempts. | # Suppressions URL: https://eusend.dev/docs/emails/suppressions The addresses your organization will not send to — read, add, import, export, and remove them. Every organization has a suppression list: addresses we refuse to send to. A send to a suppressed address is skipped silently and the email is recorded with status `suppressed`; if every recipient of a send is suppressed, the request fails with `ALL_SUPPRESSED`. Addresses land on the list two ways: | Reason | Added by | | ----------- | ---------------------------------------------------------------------------------- | | `bounce` | Automatically, on a hard bounce (a permanent rejection from the receiving server). | | `complaint` | Automatically, when a recipient reports the message as spam. | | `manual` | By you, via the API or the [dashboard](https://eusend.dev/emails/suppressions). | The list is per-organization and applies across every API key and sending domain you own. It is never shared between organizations. > [!WARNING] > Removing an address that hard-bounced or complained lets you mail it again. Doing that repeatedly > is what damages a sender's reputation — remove an entry when you know the address was fixed or the > complaint was a mistake, not to retry a list that is failing. Suppression applies to live sending only. Test-mode API keys can read the list but cannot modify it. ## List suppressions [#list-suppressions] `GET /suppressions` | Parameter | Type | Description | | --- | --- | --- | | `email` | `string` | Filter to addresses containing this substring. Pass a domain ("@acme.com") to see every suppressed address there. | | `reason` | `string` | Filter by reason: bounce, complaint, or manual. | | `cursor` | `string (UUID)` | Pagination cursor — pass next_cursor from the previous response. | | `limit` | `number` | Results per page. Default: 50. Max: 100. | ```bash title="request" curl "https://api.eusend.dev/suppressions?reason=bounce&limit=50" \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" ``` ```json title="response — 200 OK" { "data": [ { "id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d", "email": "invalid@example.com", "reason": "bounce", "created_at": "2026-05-20T10:00:00.000Z" } ], "next_cursor": null } ``` ## Add an address [#add-an-address] `POST /suppressions` | Parameter | Type | Description | | --- | --- | --- | | `email` (required) | `string` | The address to suppress. | | `reason` | `string` | bounce, complaint, or manual. Defaults to manual. | ```bash title="request" curl -X POST https://api.eusend.dev/suppressions \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "email": "opted-out@example.com" }' ``` Returns `201` with the new entry. If the address is already suppressed the call returns `200` with the **existing** entry — an add never overwrites the reason an address was suppressed for, so a manual add cannot mask a real bounce. ## Import a list [#import-a-list] `POST /suppressions/batch` Up to 1000 addresses per call. Items may be bare strings or objects, so a column lifted straight out of a CSV works as-is. > [!NOTE] > Addresses you add by hand — single adds and imports together — are capped at 100,000 per > organization; past it the call returns `403` with code `PLAN_LIMIT_EXCEEDED`. Bounces and > complaints are never refused, so the list always keeps recording addresses we must not mail again. > Email `support@eusend.dev` if you genuinely need a larger manual list. ```bash title="request" curl -X POST https://api.eusend.dev/suppressions/batch \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "emails": [ "one@example.com", { "email": "two@example.com", "reason": "complaint" } ] }' ``` ```json title="response — 201 Created" { "count": 2, "already_suppressed": 0, "duplicates": 0 } ``` `count` is what was written, `already_suppressed` was on the list before, and `duplicates` is how many rows the payload repeated. The three add up to the number of items you sent. Migrating from another provider? Export their suppression list and import it here **before** your first send, so addresses that already bounced or complained don't get a fresh attempt from a new IP. The dashboard has a CSV importer that handles the export formats from SendGrid, Mailgun, Postmark, and SES. ## Remove an address [#remove-an-address] `DELETE /suppressions/:id` The path accepts either the entry `id` or the address itself, so you can un-suppress from your own records without looking up an id first. ```bash title="request" curl -X DELETE https://api.eusend.dev/suppressions/invalid@example.com \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" ``` ```json title="response — 200 OK" { "deleted": 1 } ``` Returns `404` if the address is not on the list. ## Export [#export] `GET /suppressions/export` Returns the whole list as CSV (`email,reason,created_at`), streamed — safe to call on a list of any size. ```bash title="request" curl "https://api.eusend.dev/suppressions/export" \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -o suppressions.csv ``` # Tags URL: https://eusend.dev/docs/emails/tags Label your sends to filter the email log and route webhook events by category, customer, or anything else you track. Tags are key-value labels you attach to a send. They exist for two jobs: * **Filtering your log.** "Show me every password-reset send from the last 7 days" is one click in the dashboard, or one query parameter on `GET /emails`. * **Routing webhooks.** Every `email.*` event for a send carries its tags, so your handler can branch on `payload.tags.category` instead of looking the email up first. ## Adding tags to a send [#adding-tags-to-a-send] Pass `tags` as an object: ```bash title="request" curl -X POST https://api.eusend.dev/emails \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "from": "noreply@acme.com", "to": "alice@example.com", "subject": "Reset your password", "html": "Here is your reset link.
", "tags": { "category": "password_reset", "tier": "pro" } }' ``` The `[{ "name": ..., "value": ... }]` array form works identically, so a payload written against Resend's API sends here unchanged: ```json { "tags": [ { "name": "category", "value": "password_reset" }, { "name": "tier", "value": "pro" } ] } ``` Responses and webhook payloads always return the object form. Tags work on `POST /emails` and on every item of `POST /emails/batch`. | Parameter | Type | Description | | --- | --- | --- | | `Maximum tags per email` | `10` | Applies to each item of a batch send independently. | | `Allowed characters` | `A–Z a–z 0–9 _ -` | Names and values alike. No spaces, colons, dots, or non-ASCII characters — a value like an email address or a timestamp will be rejected, so hash or slugify those first. | | `Maximum name length` | `64 characters` | | | `Maximum value length` | `256 characters` | | > [!NOTE] > Tags are for grouping sends, not for carrying data. Something high-cardinality — a user ID, an > order number — makes a filter that matches exactly one email, which the email ID already does > better. Tag the *kind* of mail, and keep the identifier in your own system. ## Filtering the log [#filtering-the-log] In the dashboard, tags render as chips on the email list and detail pages. Clicking one filters the log to it. Over the API, pass `tag` to `GET /emails`: ```bash # every send tagged category=password_reset curl "https://api.eusend.dev/emails?tag=category:password_reset" \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" # every send carrying a category tag at all, whatever its value curl "https://api.eusend.dev/emails?tag=category" \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" # repeat the parameter to require several — this matches both curl "https://api.eusend.dev/emails?tag=category:welcome&tag=tier:pro" \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" ``` `tag` combines with the other filters (`status`, `from`, `to`) and with cursor pagination. ## Tags in webhooks [#tags-in-webhooks] Every `email.*` event carries the sending email's tags, as an object. Sends made without tags carry `"tags": {}` rather than omitting the field, so a handler can read `payload.tags.category` without guarding first. ```json title="email.delivered" { "type": "email.delivered", "email_id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d", "recipients": ["alice@example.com"], "tags": { "category": "password_reset", "tier": "pro" }, "timestamp": "2026-08-06T10:24:31.000Z" } ``` This makes a single webhook endpoint enough for several kinds of mail: ```ts app.post('/webhooks/eusend', (req, res) => { const { type, tags } = req.body if (type === 'email.bounced' && tags.category === 'password_reset') { // A reset mail that bounced is a locked-out user — page someone. alertOnCriticalBounce(req.body) } res.sendStatus(200) }) ``` ## Tags over SMTP [#tags-over-smtp] If you relay through the SMTP bridge rather than the API, add an `X-Eusend-Tag` header. It may repeat, and one header may carry several comma-separated pairs: ``` X-Eusend-Tag: category=password_reset X-Eusend-Tag: tier=pro, region=eu ``` Pairs that don't fit the character rules are dropped and the message still sends — unlike the API, SMTP has no useful way to hand back a validation error, and a bounced invoice is a worse outcome than an untagged one. # Auth.js (NextAuth) URL: https://eusend.dev/docs/frameworks/authjs Send Auth.js magic-link sign-in email through eusend, over SMTP with the Nodemailer provider or over HTTP with a custom provider. Auth.js sends one kind of email: the magic link for passwordless sign-in. It can send it through any SMTP server or through a function you write, and eusend works with both. Use SMTP if you want the least code; use the HTTP provider if you want your own template, or your runtime has no TCP sockets. Either way Auth.js needs a [database adapter](https://authjs.dev/getting-started/database) to store the verification token, and eusend needs a [verified domain](/docs/domains) for the `from` address. ```bash title=".env.local" EUSEND_API_KEY=eu_live_... EMAIL_FROM="AcmeIf you did not request this, you can ignore this email.
`, text: `Sign in to ${host}\n${url}\n\nIf you did not request this, you can ignore this email.`, track_clicks: false, }), }) if (!res.ok) { const { code } = await res.json() throw new Error(`eusend refused the sign-in email: ${code}`) } }, }, ], }) ``` Then start the flow with the provider's id: `signIn('http-email', { email })`. > [!WARNING] > Keep click tracking off for magic links, as above. Tracking rewrites the link through a redirect, > and a sign-in link should go straight to your app. ## Why a sign-in email fails [#why-a-sign-in-email-fails] Auth.js surfaces a thrown error as a generic sign-in failure, so check the [email log](https://eusend.dev/emails) first. The usual causes: * `DOMAIN_NOT_VERIFIED` — the `from` domain has not finished verifying. * `ALL_SUPPRESSED` — the address hard-bounced or complained before and is on your [suppression list](/docs/emails/suppressions). * `DAILY_LIMIT_EXCEEDED` — the free plan's daily cap. A sign-in flow should not be the place you find out, so watch your usage on the [dashboard](/docs/dashboard). ## See also [#see-also] * [Next.js](/docs/frameworks/nextjs) for the rest of your app's email. * [Better Auth](/docs/integrations/better-auth), which has an official eusend plugin with default templates. # FastAPI URL: https://eusend.dev/docs/frameworks/fastapi Send transactional email from FastAPI through eusend with the Python SDK — in a background task so the response is not held up, with idempotent retries and typed errors. The eusend Python SDK is synchronous and built on the standard library, so it has no HTTP client to conflict with yours. In FastAPI that means one rule: don't call it directly inside an `async def` endpoint, where it would block the event loop. Use a background task, or a plain `def` endpoint, and FastAPI runs the call in its thread pool. ## Setup [#setup] ```bash pip install eusend ``` ```bash title=".env" EUSEND_API_KEY=eu_test_... ``` The SDK reads `EUSEND_API_KEY` from the environment, so there is nothing to configure in code. An `eu_test_` key runs validation, quota and suppression checks and logs the email without delivering it. ## Send in a background task [#send-in-a-background-task] For email the caller does not need confirmed — a welcome message, a notification — respond first and send afterwards: ```python title="main.py" import logging import eusend from fastapi import BackgroundTasks, FastAPI from pydantic import BaseModel, EmailStr app = FastAPI() log = logging.getLogger(__name__) class Signup(BaseModel): name: str email: EmailStr def send_welcome(name: str, email: str) -> None: try: eusend.Emails.send({ 'from': 'AcmeHi {name}, thanks for signing up.
', }) except eusend.EusendError as e: log.warning('welcome email failed: %s %s', e.code, e.message) @app.post('/signup', status_code=201) async def signup(body: Signup, background_tasks: BackgroundTasks): background_tasks.add_task(send_welcome, body.name, body.email) return {'ok': True} ``` `EmailStr` needs `pip install "pydantic[email]"`. Escape anything user-supplied before it goes into `html` — the example above keeps it short, and `html.escape(name)` is the fix. ## Send and report the result [#send-and-report-the-result] When the caller does need to know — a receipt, a password reset — use a `def` endpoint and turn the SDK's exception into a response: ```python from fastapi import HTTPException class Receipt(BaseModel): order_id: str email: EmailStr @app.post('/receipts') def send_receipt(body: Receipt): try: email = eusend.Emails.send( { 'from': 'AcmeThanks — your order is confirmed.
', }, options={'idempotency_key': f'receipt-{body.order_id}'}, ) except eusend.EusendError as e: raise HTTPException(status_code=502, detail=e.code) return {'id': email['id']} ``` The `idempotency_key` makes a retried request return the original email instead of sending a second one. Branch on `e.code` — the [error code](/docs/reference/error-codes) — not on the message. `eusend.RateLimitError` is the subclass to catch if you want to back off on a `429`. ## Surviving a restart [#surviving-a-restart] A background task lives in the process: if the server restarts before it runs, the email is never sent. For mail that must go out, put the send on a real queue (Celery, RQ, Arq) and keep the `idempotency_key` so a retried job cannot send twice. ## Next steps [#next-steps] * [Python SDK reference](/docs/sdks/python) for attachments, scheduling and batch sends. * [Verify a domain](/docs/domains) to send to real recipients from your own address. * [Webhooks](/docs/webhooks) to learn when a message is delivered, bounced or complained about. # Next.js URL: https://eusend.dev/docs/frameworks/nextjs Send transactional email from a Next.js app through eusend — from a Server Action or a Route Handler, with React Email templates and without blocking the response. Next.js runs your sending code on the server, so the eusend SDK works as it does anywhere else in Node.js. This page covers the two places a send usually lives — a Server Action and a Route Handler — and the two things that go wrong most often: a key that leaks into the client bundle, and a serverless function frozen before the request to eusend finishes. ## Setup [#setup] ### Install the SDK [#install-the-sdk] ```bash npm install @eusend_dev/sdk ``` ### Add the API key [#add-the-api-key] Create a key under [API keys](https://eusend.dev/api-keys). Keep it out of any variable prefixed `NEXT_PUBLIC_` — those are inlined into the browser bundle. ```bash title=".env.local" EUSEND_API_KEY=eu_test_... ``` An `eu_test_` key runs validation, quota and suppression checks and shows the email in your log without delivering it. Switch to an `eu_live_` key when you deploy. ### Create one client [#create-one-client] ```ts title="lib/eusend.ts" import 'server-only' import { Eusend } from '@eusend_dev/sdk' export const eusend = new Eusend(process.env.EUSEND_API_KEY) ``` `server-only` turns an accidental import from a Client Component into a build error. ## Send from a Server Action [#send-from-a-server-action] ```ts title="app/contact/actions.ts" 'use server' import { eusend } from '@/lib/eusend' export async function sendContactMessage(formData: FormData) { const email = String(formData.get('email') ?? '') const message = String(formData.get('message') ?? '') const { error } = await eusend.emails.send({ from: 'AcmeThanks — order ${orderId} is confirmed.
`, }, { idempotencyKey: `receipt-${orderId}` }, ) if (error) return Response.json({ code: error.name }, { status: error.statusCode ?? 502 }) return Response.json({ id: data.id }) } ``` The `idempotencyKey` makes a retried request — a double click, a webhook redelivery — return the original email instead of sending a second one. ## React Email templates [#react-email-templates] Pass a component as `react` and the SDK renders it to HTML before sending: ```tsx title="app/api/welcome/route.tsx" import { eusend } from '@/lib/eusend' import { WelcomeEmail } from '@/emails/welcome' export async function POST(request: Request) { const { name, email } = await request.json() const { error } = await eusend.emails.send({ from: 'AcmeThanks — we will get back to you.
{:else} {/if} ``` The SDK returns `{ data, error }` rather than throwing. `error.name` is the [error code](/docs/reference/error-codes) — log it, and show the visitor something plainer. > [!WARNING] > Send form submissions to your own address with the visitor in `replyTo`. A form field that chooses > the recipient lets anyone send mail from your domain. ## Send from an endpoint [#send-from-an-endpoint] ```ts title="src/routes/api/receipt/+server.ts" import { json } from '@sveltejs/kit' import { eusend } from '$lib/server/eusend' import type { RequestHandler } from './$types' export const POST: RequestHandler = async ({ request }) => { const { orderId, email } = await request.json() const { data, error } = await eusend.emails.send( { from: 'AcmeThanks — order ${orderId} is confirmed.
`, }, { idempotencyKey: `receipt-${orderId}` }, ) if (error) return json({ code: error.name }, { status: error.statusCode ?? 502 }) return json({ id: data.id }) } ``` The `idempotencyKey` makes a retry return the original email instead of sending a second one. ## Next steps [#next-steps] * [Verify a domain](/docs/domains) to send to real recipients from your own address. * [Templates](/docs/templates) to keep email markup out of your routes. * [Webhooks](/docs/webhooks) to learn when a message is delivered, bounced or complained about. # Authentication URL: https://eusend.dev/docs/getting-started/authentication Authenticate with API keys in the Authorization header. All API requests must include an API key in the `Authorization` header. ```bash Authorization: Bearer eu_live_xxxxxxxxxxxx ``` ## Key types [#key-types] | Parameter | Type | Description | | --- | --- | --- | | `eu_live_...` | `string` | Production key. Emails are actually sent. | | `eu_test_...` | `string` | Test key. Emails are queued but not delivered. Use for development and CI. | > [!TIP] > Test mode keys replay the full event lifecycle — and fire the same webhooks — as live keys, > without delivering to the recipient's inbox. By default a send simulates `email.sent` → > `email.delivered` → `email.opened` → `email.clicked` (opens and clicks follow the message's > tracking settings). To simulate failures, send to `bounced@…` for a bounce or `complained@…` for a > complaint. Ideal for integration testing. ## Permissions [#permissions] Test-mode keys cannot create, update, or delete webhook endpoints, delete audiences or templates, or delete contacts individually or in bulk. These resources are shared with live sending. Use a live key or the dashboard to manage them; test sends still trigger your configured webhooks. Test-mode sends use no quota, and are capped at 10,000 per organization per day (UTC). Past that the API answers `429` with `DAILY_LIMIT_EXCEEDED` until midnight; live sends are unaffected. Every key carries a permission, chosen when you create it. It defaults to `full_access`. | Parameter | Type | Description | | --- | --- | --- | | `full_access` | `string` | Can create, read, update and delete every resource. The default. | | `sending_access` | `string` | Can only send emails. Every other endpoint returns 403 FORBIDDEN. | A `sending_access` key may call exactly these endpoints — everything else, including reading your email logs, is refused: | Method | Endpoint | | | ------- | -------------------- | --------------------------- | | `POST` | `/emails` | Send an email | | `POST` | `/emails/batch` | Send up to 100 emails | | `PATCH` | `/emails/:id` | Reschedule a scheduled send | | `POST` | `/emails/:id/cancel` | Cancel a scheduled send | SMTP submission is covered too: a `sending_access` key works as an SMTP password exactly like a full-access one, because the SMTP gateway relays through `POST /emails`. > [!NOTE] > Reads are deliberately excluded. `GET /emails/:id` returns the rendered body, the full recipient > list and the delivery event history — that's the half of a leaked key worth stealing. Give your > application server a `sending_access` key, and keep `full_access` for tooling you control. ## Restricting a key to one domain [#restricting-a-key-to-one-domain] A `sending_access` key can be pinned to a single sending domain with `domain_id`. Sends from any other domain are rejected with `403 FORBIDDEN`, including the shared onboarding sandbox domain. Omit `domain_id` and the key can send from any of your verified domains. ```bash curl -X POST https://api.eusend.dev/api-keys \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "name": "Billing service", "permission": "sending_access", "domain_id": "5e9f2c1a-..." }' ``` `domain_id` is only valid together with `sending_access` — pairing it with `full_access` returns `400 VALIDATION_ERROR`, since a full-access key can mint itself an unrestricted key anyway. The restriction applies to test-mode keys as well, so a scoped key behaves the same in CI as it will in production. > [!WARNING] > Deleting a domain also revokes every key restricted to it. A restriction that quietly widened to > "all domains" when its domain went away would be a silent privilege escalation, so the key goes > with it. ## Creating API keys [#creating-api-keys] API keys are managed in the **API Keys** section of the dashboard, which prompts for the permission and domain restriction when you create one. You can create multiple keys and revoke them individually. Free plan allows 1 live key and 1 test key; paid plans allow unlimited keys. # Quick Start URL: https://eusend.dev/docs/getting-started/quick-start Send your first email in three steps. ## 1. Get your API key [#1-get-your-api-key] Sign up at [eusend.dev/signup](https://eusend.dev/signup), then navigate to **API Keys** in the dashboard and create a new key. Your key starts with `eu_live_` for production or `eu_test_` for test mode. Test mode allows you to use the API while preventing actual email delivery — ideal for development and testing. ## 2. Verify your sending domain [#2-verify-your-sending-domain] To send to real recipients, you must [add and verify your domain](/docs/domains) in the dashboard. This sets up DKIM signing so your emails are authenticated and deliverable. Emails from unverified domains will be rejected. Verification usually completes within minutes of adding the DNS records. > [!TIP] > No DNS access handy? Skip this step for now: send from `onboarding@sandbox.eusend.dev` and eusend > will deliver it — to your own account email, or a teammate's, only. It's a shared sandbox for > trying the API, capped per day; verify your own domain to send to anyone. ## 3. Send an email [#3-send-an-email] ```bash title="request" curl -X POST https://api.eusend.dev/emails \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "from": "AcmeYour first email via eusend.
" }' ``` ```json title="response" { "id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d" } ``` > [!NOTE] > Prefer a native library? Official SDKs wrap the same API: [Node.js](/docs/sdks/nodejs), > [Python](/docs/sdks/python), and [Go](/docs/sdks/go). > [!TIP] > Prefer a UI? Everything above can be done without touching the API — see the [Dashboard > Overview](/docs/dashboard/overview) for a guided walkthrough. # Better Auth URL: https://eusend.dev/docs/integrations/better-auth Send Better Auth's verification, password-reset, OTP, magic-link and invitation email through eusend with the official plugin — branded default templates, non-blocking sends, and contact sync for verified users. Better Auth doesn't ship an email transport. It asks you for a function for each email it needs — verify an address, reset a password, send a sign-in code. `@eusend_dev/better-auth` is a Better Auth plugin that supplies those functions, with default templates you can brand or replace, and can add verified users to an eusend audience. eusend is one of the providers listed in Better Auth's [email docs](https://better-auth.com/docs/concepts/email#bring-your-own-email-provider), and the eusend dashboard runs on Better Auth too. ## Installation [#installation] ```bash npm install @eusend_dev/better-auth # or bun add @eusend_dev/better-auth ``` ## Setup [#setup] ### Verify your sending domain [#verify-your-sending-domain] Add your domain under [Domains](https://eusend.dev/domains) and publish the DNS records — eusend only sends from a verified domain. See [domains](/docs/domains) if you have not done this yet. ### Add the API key [#add-the-api-key] Create a key under [API keys](https://eusend.dev/api-keys) and put it in your environment. The plugin reads `EUSEND_API_KEY` by default. ```bash title=".env" EUSEND_API_KEY=eu_live_... ``` Use an `eu_test_` key while developing: the send goes through validation, quota and suppression checks and shows up in your email log, but nothing is delivered. ### Add the plugin [#add-the-plugin] ```ts title="lib/auth.ts" import { betterAuth } from 'better-auth' import { eusend } from '@eusend_dev/better-auth' export const auth = betterAuth({ emailAndPassword: { enabled: true, requireEmailVerification: true }, emailVerification: { sendOnSignUp: true }, plugins: [ eusend({ email: { from: 'AcmeThanks for your order!
', }) ``` Payload's own auth emails — email verification and password resets — now go the same way, and every message appears in your [email log](/docs/dashboard). ## Options [#options] | Parameter | Type | Description | | --- | --- | --- | | `apiKey` (required) | `string` | An eusend API key. | | `defaultFromAddress` (required) | `string` | Sender used when a message sets no from. Its domain must be verified on your account. | | `defaultFromName` (required) | `string` | Display name paired with defaultFromAddress. | | `overrideRecipientAddress` | `string` | Redirect every message to this address instead of its real recipients. cc and bcc are dropped along with them, so a staging environment cannot copy a real customer. | | `tags` | `RecordAttached.
', attachments: [ { filename: 'invoice.pdf', content: pdfBuffer }, { filename: 'notes.txt', content: 'plain text' }, { path: 'https://example.com/invoice.pdf' }, { path: '/var/data/invoice.pdf' }, ], }) ``` A URL is fetched by eusend at send time; a filesystem path is read by the adapter before the request. A string `content` is treated as UTF-8 text unless you pass `encoding: 'base64'` — the same rule nodemailer applies, so an attachment ported over from `@payloadcms/email-nodemailer` arrives intact. Set `cid` on an attachment to reference it from your HTML as `Thanks for your order!
", }) if err != nil { log.Fatal(err) } fmt.Println(sent.Id) // 9a8b7c6d-... ``` ### Send options [#send-options] | Field | Type | Description | | ---------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------- | | `From` | `string` | Sender address — bare email or "Name \Attached.
", Attachments: []*eusend.Attachment{ {Filename: "invoice.pdf", Content: pdf, ContentType: "application/pdf"}, }, }) ``` ### Idempotent sends [#idempotent-sends] ```go client.Emails.SendWithOptions(ctx, params, &eusend.SendEmailOptions{ IdempotencyKey: "receipt-" + orderID, }) ``` Retrying with the same key never sends a duplicate and returns the original ID. ### Batch send [#batch-send] Send up to 100 emails in a single request. Attachments and scheduling are stripped (not supported on the batch endpoint). Results map positionally to the input: queued items carry `Id`, rejected items carry `Error` and `Code`. ```go res, _ := client.Batch.Send([]*eusend.SendEmailRequest{ {From: "you@yourdomain.com", To: []string{"alice@example.com"}, Subject: "Hi", Html: "Hi
"}, {From: "you@yourdomain.com", To: []string{"bob@example.com"}, Subject: "Hi", Html: "Hi
"}, }) for _, r := range res.Data { if r.Id != "" { fmt.Println("queued", r.Id) } else { fmt.Printf("failed: %s (%s)\n", r.Error, r.Code) } } ``` `SendWithOptions` makes a batch safe to retry. The key is applied per item by position, so a retry must send the items in the same order. ```go client.Batch.SendWithOptions(ctx, emails, &eusend.BatchSendOptions{ IdempotencyKey: "digest-" + runID, }) ``` ### Scheduled sends [#scheduled-sends] `ScheduledAt` accepts an ISO 8601 string or natural language like `"in 1 hour"` (at most 30 days out), parsed server-side in UTC. ```go sent, _ := client.Emails.Send(&eusend.SendEmailRequest{ From: "you@yourdomain.com", To: []string{"customer@example.com"}, Subject: "Your trial ends tomorrow", Html: "Reminder.
", ScheduledAt: "in 1 hour", }) client.Emails.Update(&eusend.UpdateEmailRequest{Id: sent.Id, ScheduledAt: "2026-07-04T09:00:00Z"}) client.Emails.Cancel(sent.Id) ``` ### Retrieve & list emails [#retrieve--list-emails] ```go email, _ := client.Emails.Get("9a8b7c6d-...") fmt.Println(email.Status, email.Events[0].Type) page, _ := client.Emails.List(&eusend.ListEmailsOptions{Status: "delivered", Limit: 50}) for _, e := range page.Data { fmt.Println(e.Id, e.Subject) } // page.NextCursor -> pass as ListEmailsOptions{Cursor: ...} for the next page ``` ## Domains [#domains] ```go created, _ := client.Domains.Create(&eusend.CreateDomainRequest{Name: "yourdomain.com"}) for _, r := range created.Records { // every DNS record to add fmt.Println(r.Type, r.Name, r.Value) } client.Domains.Verify(created.Id) // after publishing the records client.Domains.List() client.Domains.Get(created.Id) client.Domains.Remove(created.Id) ``` ## API keys [#api-keys] ```go key, _ := client.ApiKeys.Create(&eusend.CreateApiKeyRequest{Name: "Production"}) fmt.Println(key.Key) // eu_live_... — returned only once client.ApiKeys.Create(&eusend.CreateApiKeyRequest{Name: "Sandbox", TestMode: true}) // eu_test_... key // Send-only key, restricted to one domain. Omit DomainId for any verified domain. client.ApiKeys.Create(&eusend.CreateApiKeyRequest{ Name: "Billing service", Permission: eusend.PermissionSendingAccess, DomainId: domainId, }) client.ApiKeys.List() // prefixes only client.ApiKeys.Remove(key.Id) ``` ## Templates [#templates] `{{variable}}` placeholders are substituted at send time; values are HTML-escaped. ```go tpl, _ := client.Templates.Create(&eusend.CreateTemplateRequest{ Name: "Welcome email", Subject: "Welcome, {{name}}!", Html: "Welcome to {{product}}.
", }) client.Emails.Send(&eusend.SendEmailRequest{ From: "you@yourdomain.com", To: []string{"customer@example.com"}, TemplateId: tpl.Id, Variables: map[string]any{"name": "Jane", "product": "Acme"}, }) client.Templates.List() client.Templates.Get(tpl.Id) client.Templates.Update(tpl.Id, &eusend.UpdateTemplateRequest{Subject: eusend.String("New subject")}) html, _ := client.Templates.Preview(tpl.Id, map[string]any{"first_name": "Alex"}) // rendered HTML client.Templates.Remove(tpl.Id) ``` ## Audiences & contacts [#audiences--contacts] Contact operations are grouped under `Audiences` (they live under a specific audience). ```go audience, _ := client.Audiences.Create(&eusend.CreateAudienceRequest{Name: "Newsletter"}) client.Audiences.CreateContact(audience.Id, &eusend.CreateContactRequest{ Email: "user@example.com", FirstName: "Jane", }) // Bulk upsert (up to 1,000). Unsubscribed and CreatedAt are for migrating a list // in — an import can add an opt-out but never clear one. client.Audiences.BatchCreateContacts(audience.Id, []*eusend.CreateContactRequest{ {Email: "alice@example.com", FirstName: "Alice"}, {Email: "bob@example.com", Unsubscribed: eusend.Bool(true), CreatedAt: "2024-02-01T10:00:00Z"}, }) // Bulk delete by id (up to 1,000). Removes them from the audience — not an unsubscribe. client.Audiences.BatchDeleteContacts(audience.Id, []string{contactId}) page, _ := client.Audiences.ListContacts(audience.Id, &eusend.ListContactsOptions{ Subscribed: eusend.Bool(true), Search: "gmail.com", }) contact := page.Data[0] client.Audiences.UpdateContact(audience.Id, contact.Id, &eusend.UpdateContactRequest{ Unsubscribed: eusend.Bool(true), }) client.Audiences.GetContact(audience.Id, contact.Id) client.Audiences.RemoveContact(audience.Id, contact.Id) client.Audiences.List() client.Audiences.Get(audience.Id) // includes ContactCount client.Audiences.Update(audience.Id, &eusend.UpdateAudienceRequest{Name: "Product updates"}) client.Audiences.Remove(audience.Id) ``` ## Topics [#topics] Kinds of email a contact can subscribe to and leave independently, so an unsubscribe can be a preference change. See [Topics](/docs/audiences/topics). ```go topic, _ := client.Topics.Create(&eusend.CreateTopicRequest{ Name: "Product updates", // "opt_in" reaches everyone until they leave; "opt_out" reaches nobody until they // join. Fixed at creation. DefaultSubscription: "opt_in", Description: eusend.String("New features and changes, about once a month."), Visibility: "public", }) client.Topics.List() client.Topics.Get(topic.Id) client.Topics.Update(topic.Id, &eusend.UpdateTopicRequest{Visibility: eusend.String("private")}) // Record an explicit preference for one contact. client.Topics.Subscribe(topic.Id, contactId, true) // Forget the choice entirely, back to the topic default — not the same as false. client.Topics.ClearSubscription(topic.Id, contactId) client.Topics.Remove(topic.Id) // Scope a broadcast to it. client.Broadcasts.Create(&eusend.CreateBroadcastRequest{ Name: "October update", AudienceId: audience.Id, TopicId: topic.Id, From: "hello@acme.com", Subject: "What shipped in October", Html: "Hi {{first_name}}…
", }) ``` ## Suppressions [#suppressions] Addresses the account will not send to. Hard bounces and spam complaints are added automatically — these methods cover the ones you manage yourself. See [Suppressions](/docs/emails/suppressions) for the full API. ```go // What's blocked, and why client.Suppressions.List(&eusend.ListSuppressionsOptions{ Reason: eusend.SuppressionReasonBounce, Limit: 50, }) client.Suppressions.List(&eusend.ListSuppressionsOptions{Email: "@acme.com"}) // Stop sending to an address. Already suppressed? The existing entry comes back // unchanged — a manual add never rewrites a real bounce or complaint. client.Suppressions.Create(&eusend.CreateSuppressionRequest{Email: "opted-out@example.com"}) // Import up to 1,000 per call — do this before your first send when migrating res, _ := client.Suppressions.Import([]*eusend.SuppressionImportItem{ {Email: "one@example.com"}, {Email: "two@example.com", Reason: eusend.SuppressionReasonComplaint}, }) fmt.Println(res.Count, res.AlreadySuppressed, res.Duplicates) // Un-suppress by entry id or by address; export the whole list as CSV client.Suppressions.Remove("invalid@example.com") csv, _ := client.Suppressions.Export() ``` ## Reputation [#reputation] Your bounce and complaint rates exactly as the sending limits judge them — what counted, what did not, and how far you are from a halved daily limit or a pause. See [how rates are judged](/docs/reference/rate-limits). Not available to sending-only keys. ```go r, err := client.Reputation.Get() if err != nil { log.Fatal(err) } fmt.Println(r.State) // healthy, warning, limited or paused if r.Next != nil && r.Next.Bounces != nil && *r.Next.Bounces <= 3 { log.Printf("%d more bounces would move this account to %s", *r.Next.Bounces, r.Next.State) } ``` ## Broadcasts [#broadcasts] `{{first_name}}`, `{{last_name}}`, `{{full_name}}`, and `{{email}}` are available per recipient, and RFC 8058 one-click unsubscribe headers are added automatically. ```go bc, _ := client.Broadcasts.Create(&eusend.CreateBroadcastRequest{ Name: "May newsletter", AudienceId: audience.Id, From: "SivertHi {{first_name}}, your monthly update is here...
", TrackOpens: eusend.Bool(true), // omit to use your organization default }) client.Broadcasts.Test(bc.Id, &eusend.TestBroadcastRequest{To: []string{"you@yourdomain.com"}}) // preview to your own domain client.Broadcasts.Send(bc.Id, nil) // send now client.Broadcasts.Send(bc.Id, &eusend.SendBroadcastRequest{ScheduledAt: "2026-06-01T09:00:00Z"}) // or schedule client.Broadcasts.Cancel(bc.Id) client.Broadcasts.List() client.Broadcasts.Get(bc.Id) // includes delivery stats client.Broadcasts.Update(bc.Id, &eusend.UpdateBroadcastRequest{Subject: eusend.String("Updated")}) client.Broadcasts.Remove(bc.Id) ``` ## Webhooks [#webhooks] ```go hook, _ := client.Webhooks.Create(&eusend.CreateWebhookRequest{ Url: "https://yourapp.com/webhooks/eusend", Events: []string{"email.sent", "email.delivered", "email.bounced", "email.complained"}, // or: Events: []string{"*"} to receive everything }) fmt.Println(hook.Secret) // signing secret — store it securely; GetSecret reads it again client.Webhooks.List() client.Webhooks.Get(hook.Id) // includes recent deliveries client.Webhooks.Update(hook.Id, &eusend.UpdateWebhookRequest{Events: []string{"email.bounced"}}) client.Webhooks.GetSecret(hook.Id) // current signing secret client.Webhooks.RotateSecret(hook.Id) // new secret, effective immediately client.Webhooks.Remove(hook.Id) ``` ### Verifying webhook signatures [#verifying-webhook-signatures] Every delivery is signed with HMAC-SHA256 over `{webhook-id}.{webhook-timestamp}.{body}`: ```go import ( "crypto/hmac" "crypto/sha256" "encoding/base64" ) func verify(r *http.Request, body []byte, secret string) bool { signed := r.Header.Get("webhook-id") + "." + r.Header.Get("webhook-timestamp") + "." + string(body) mac := hmac.New(sha256.New, []byte(secret)) mac.Write([]byte(signed)) expected := "v1," + base64.StdEncoding.EncodeToString(mac.Sum(nil)) return hmac.Equal([]byte(r.Header.Get("webhook-signature")), []byte(expected)) } ``` ## Error handling [#error-handling] Every method returns `(result, error)`. Any non-2xx response, and any network failure, is an `*eusend.Error`. On a `429`, `RetryAfter`, `RateLimitReset`, and `RateLimitRemaining` are populated from the response headers. ```go sent, err := client.Emails.Send(params) if err != nil { var apiErr *eusend.Error if errors.As(err, &apiErr) { fmt.Println(apiErr.Code) // "MONTHLY_LIMIT_EXCEEDED" fmt.Println(apiErr.Message) // "Monthly send limit exceeded" fmt.Println(apiErr.StatusCode) // 429 (0 for a network failure) if apiErr.Code == eusend.CodeMonthlyLimitExceeded { // back off and retry later } } return } ``` | Code constant | Wire value | Status | | -------------------------- | -------------------------- | ------------------- | | `CodeUnauthorized` | `UNAUTHORIZED` | 401 | | `CodeForbidden` | `FORBIDDEN` | 403 | | `CodeNotFound` | `NOT_FOUND` | 404 | | `CodeValidationError` | `VALIDATION_ERROR` | 400 | | `CodeBadRequest` | `BAD_REQUEST` | 400 | | `CodePayloadTooLarge` | `PAYLOAD_TOO_LARGE` | 413 | | `CodeConflict` | `CONFLICT` | 409 | | `CodeRateLimited` | `RATE_LIMITED` | 429 | | `CodeMonthlyLimitExceeded` | `MONTHLY_LIMIT_EXCEEDED` | 429 | | `CodeDailyLimitExceeded` | `DAILY_LIMIT_EXCEEDED` | 429 | | `CodePlanLimitExceeded` | `PLAN_LIMIT_EXCEEDED` | 403 | | `CodeDomainNotVerified` | `DOMAIN_NOT_VERIFIED` | 403 | | `CodeSendingSuspended` | `SENDING_SUSPENDED` | 403 | | `CodeAccountRestricted` | `ACCOUNT_RESTRICTED` | 403 | | `CodeWorkspaceInactive` | `WORKSPACE_INACTIVE` | 403 | | `CodeSenderNotPermitted` | `SENDER_NOT_PERMITTED` | 403 | | `CodeListSendHeld` | `LIST_SEND_HELD` | 403 | | `CodeBroadcastHeld` | `BROADCAST_HELD` | 403 | | `CodeAllSuppressed` | `ALL_SUPPRESSED` | 422 | | `CodeServicePaused` | `SERVICE_PAUSED` | 503 | | `CodeAttachmentStorageErr` | `ATTACHMENT_STORAGE_ERROR` | 503 | | `CodeInternalError` | `INTERNAL_ERROR` | 500 | | `CodeApplicationError` | `application_error` | — (network failure) | > [!TIP] > View the full source and changelog on [GitHub](https://github.com/eusend-dev/eusend-go). # Node.js SDK URL: https://eusend.dev/docs/sdks/nodejs Official TypeScript SDK for the eusend API. Works in Node.js 18+, Bun, and any runtime with native fetch. Official TypeScript SDK for the eusend API. Works in Node.js 18+, Bun, and any runtime that supports the native `fetch` API. - [**Node.js / TypeScript**](/docs/sdks/nodejs) — @eusend_dev/sdk - [**Python**](/docs/sdks/python) — pip install eusend - [**Go**](/docs/sdks/go) — go get github.com/eusend-dev/eusend-go ## Installation [#installation] ```bash npm install @eusend_dev/sdk # or bun add @eusend_dev/sdk ``` ## Getting started [#getting-started] Create a client with your API key. The key can also be read from the `EUSEND_API_KEY` environment variable. ```ts import { Eusend } from '@eusend_dev/sdk' const client = new Eusend('eu_live_...') // or: const client = new Eusend() // reads EUSEND_API_KEY ``` ## Sending an email [#sending-an-email] Every method returns a `{ data, error, headers }` union. On success `error` is `null`; on failure `data` is `null`. ```ts const { data, error } = await client.emails.send({ from: 'hello@yourdomain.com', to: 'customer@example.com', subject: 'Your order is confirmed', html: 'Thanks for your order!
', text: 'Thanks for your order!', }) if (error) { console.error(error.name, error.message) // 'VALIDATION_ERROR' ... } else { console.log(data.id) // 9a8b7c6d-... } ``` ### Send options [#send-options] | Field | Type | Description | | ------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `from` | `string` | Sender address — bare email or "Name \Thanks
' }, { idempotencyKey: `receipt-${orderId}` }, ) ``` ### Batch send [#batch-send] Send up to 100 emails in a single request. ```ts const { data } = await client.batch.send([ { from: 'you@domain.com', to: 'alice@example.com', subject: 'Hi Alice', html: 'Hi Alice
' }, { from: 'you@domain.com', to: 'bob@example.com', subject: 'Hi Bob', html: 'Hi Bob
' }, ]) console.log(data?.data) // [{ id: '9a8b7c6d-...' }, { id: '1f2e3d4c-...' }] ``` Pass an `idempotencyKey` as the second argument to retry a batch safely. The key is applied per item by position, so a retry must send the items in the same order. ```ts await client.batch.send(emails, { idempotencyKey: `digest-${runId}` }) ``` ### Scheduled sends [#scheduled-sends] Pass `scheduledAt` — a `Date`, an ISO 8601 string, or natural language like `"in 1 hour"` (at most 30 days out) — to schedule instead of sending immediately. While the email's status is `scheduled` you can move or cancel it; after that, both calls return a `409`. ```ts // Schedule for tomorrow morning const { data } = await client.emails.send({ from: 'you@domain.com', to: 'user@example.com', subject: 'Your trial ends tomorrow', html: 'Reminder: your trial ends in 24 hours.
', scheduledAt: new Date(Date.now() + 24 * 60 * 60 * 1000), }) // Reschedule await client.emails.update(data!.id, { scheduledAt: '2026-07-04T09:00:00Z', }) // Or cancel — the send is refunded to your monthly quota await client.emails.cancel(data!.id) ``` ### Retrieve & list emails [#retrieve--list-emails] ```ts // Get a single email with its delivery events const { data } = await client.emails.get('9a8b7c6d-...') console.log(data?.status) // 'delivered' console.log(data?.events) // [{ type: 'sent', ... }, ...] // List with filters const { data: list } = await client.emails.list({ status: 'delivered', limit: 50 }) console.log(list?.data) // array of emails console.log(list?.nextCursor) // pass as cursor for next page ``` ## Domains [#domains] ```ts // Add a domain and get DNS records const { data } = await client.domains.create('yourdomain.com') console.log(data?.records) // every record to publish, in order console.log(data?.dkim) // { type: 'TXT', name: 'eusend._domainkey...', value: '...' } console.log(data?.dmarc) // { type: 'TXT', name: '_dmarc...', value: '...' } // Creating the domain already starts checking DNS; this forces a fresh check await client.domains.verify(domainId) // List / get / delete await client.domains.list() await client.domains.get(domainId) await client.domains.delete(domainId) ``` ## API Keys [#api-keys] ```ts // Create a live key const { data } = await client.apiKeys.create({ name: 'Production' }) console.log(data?.key) // eu_live_... — only returned once // Create a test/sandbox key const { data: test } = await client.apiKeys.create({ name: 'Sandbox', testMode: true }) // test.key → 'eu_test_...' // Send-only key, restricted to one domain. Omit domainId for any verified domain. await client.apiKeys.create({ name: 'Billing service', permission: 'sending_access', domainId, }) await client.apiKeys.list() await client.apiKeys.delete(keyId) ``` ## Templates [#templates] ```tsx // Create an HTML template with {{variable}} placeholders const { data } = await client.templates.create({ name: 'Welcome email', subject: 'Welcome, {{name}}!', html: 'Welcome to {{product}}.
', }) // Using React Email — SDK renders locally before sending import { OrderConfirmation } from './emails/order-confirmation' await client.templates.create({ name: 'Order confirmation', subject: 'Order {{order_id}} confirmed', react:Hi {{first_name}}…
', }) ``` ## Suppressions [#suppressions] Addresses the account will not send to. Hard bounces and spam complaints are added automatically — these methods cover the ones you manage yourself. See [Suppressions](/docs/emails/suppressions) for the full API. ```ts // What's blocked, and why await client.suppressions.list({ reason: 'bounce', limit: 50 }) await client.suppressions.list({ email: '@acme.com' }) // Stop sending to an address. Already suppressed? The existing entry comes back // unchanged — a manual add never rewrites a real bounce or complaint. await client.suppressions.create({ email: 'opted-out@example.com' }) // Import up to 1,000 per call — do this before your first send when migrating await client.suppressions.import([ 'one@example.com', { email: 'two@example.com', reason: 'complaint' }, ]) // Un-suppress by entry id or by address await client.suppressions.remove('invalid@example.com') // The whole list as CSV const { data: csv } = await client.suppressions.export() ``` ## Reputation [#reputation] Your bounce and complaint rates exactly as the sending limits judge them — what counted, what did not, and how far you are from a halved daily limit or a pause. See [how rates are judged](/docs/reference/rate-limits). Not available to sending-only keys. ```ts const { data } = await client.reputation.get() // data.state: 'healthy' | 'warning' | 'limited' | 'paused' if (data?.next?.bounces != null && data.next.bounces <= 3) { console.warn(`${data.next.bounces} more bounces would move this account to ${data.next.state}`) } ``` ## Broadcasts [#broadcasts] ```tsx // Create a broadcast — HTML, a React Email component, or a saved template import { MayNewsletter } from './emails/may-newsletter' const { data } = await client.broadcasts.create({ name: 'May newsletter', audienceId: '550e8400-e29b-41d4-a716-446655440000', from: 'hello@yourdomain.com', subject: 'May update', react:Hi {{first_name}}...
' // or: templateId: '7c9e6679-7425-40de-944b-e07fc1f90ae7' }) // Check it first — delivers only to your own verified domains, leaves the // broadcast a draft, and works on the free plan (send() needs a paid one). await client.broadcasts.test(data!.id, { to: ['you@yourdomain.com'] }) // Send immediately await client.broadcasts.send(data!.id) // Or schedule for later await client.broadcasts.send(data!.id, { scheduledAt: '2026-06-01T09:00:00.000Z' }) // Cancel a scheduled broadcast await client.broadcasts.cancel(data!.id) await client.broadcasts.list() await client.broadcasts.get(broadcastId) // includes delivery stats await client.broadcasts.update(broadcastId, { subject: 'Updated subject' }) await client.broadcasts.delete(broadcastId) ``` ## Webhooks [#webhooks] ```ts // Subscribe to events const { data } = await client.webhooks.create({ url: 'https://yourapp.com/webhooks/eusend', events: ['email.sent', 'email.delivered', 'email.bounced', 'email.complained'], // or: events: ['*'] to receive everything }) console.log(data?.secret) // signing secret — store it securely; getSecret() reads it again await client.webhooks.list() await client.webhooks.get(webhookId) // includes recent deliveries await client.webhooks.update(webhookId, { events: ['email.bounced'] }) await client.webhooks.getSecret(webhookId) // { secret } await client.webhooks.rotateSecret(webhookId) // new secret, effective immediately await client.webhooks.delete(webhookId) ``` ### Verifying webhook signatures [#verifying-webhook-signatures] Every delivery is signed with HMAC-SHA256. Verify before processing: ```ts import { createHmac, timingSafeEqual } from 'crypto' async function verifyWebhook(req: Request, secret: string): PromiseThanks for your order!
', 'text': 'Thanks for your order!', }) print(email['id']) # 9a8b7c6d-... ``` ### Send options [#send-options] | Key | Type | Description | | ------------------------------ | ------------------ | ---------------------------------------------------------------------------- | | `from` | `str` | Sender address — bare email or "Name \Attached.
', 'attachments': [ {'filename': 'invoice.pdf', 'content': f.read(), 'content_type': 'application/pdf'}, ], }) ``` ### Idempotent sends [#idempotent-sends] Pass an `options` dict with an `idempotency_key` to safely retry without duplicating. ```python eusend.Emails.send( {'from': 'you@yourdomain.com', 'to': 'customer@example.com', 'subject': 'Receipt', 'html': 'Thanks
'}, options={'idempotency_key': f'receipt-{order_id}'}, ) ``` ### Batch send [#batch-send] Send up to 100 emails in a single request. Attachments and scheduling are not supported on the batch endpoint and are stripped from each item. The result maps positionally to the input: queued items carry `id`, rejected items carry `error` and `code`. ```python res = eusend.Batch.send([ {'from': 'you@yourdomain.com', 'to': 'alice@example.com', 'subject': 'Hi', 'html': 'Hi
'}, {'from': 'you@yourdomain.com', 'to': 'bob@example.com', 'subject': 'Hi', 'html': 'Hi
'}, ]) for item in res['data']: print(item.get('id') or f"{item['code']}: {item['error']}") ``` Pass `options={'idempotency_key': ...}` as the second argument to retry a batch safely. The key is applied per item by position, so a retry must send the items in the same order. ```python eusend.Batch.send(emails, options={'idempotency_key': f'digest-{run_id}'}) ``` ### Scheduled sends [#scheduled-sends] `scheduled_at` accepts an ISO 8601 string or natural language like `"in 1 hour"` (at most 30 days out), parsed server-side in UTC. While the email's status is `scheduled` you can reschedule or cancel it. ```python sent = eusend.Emails.send({ 'from': 'you@yourdomain.com', 'to': 'customer@example.com', 'subject': 'Your trial ends tomorrow', 'html': 'Reminder: your trial ends in 24 hours.
', 'scheduled_at': 'in 1 hour', }) eusend.Emails.update({'id': sent['id'], 'scheduled_at': '2026-07-04T09:00:00Z'}) # reschedule eusend.Emails.cancel(sent['id']) # cancel ``` ### Retrieve & list emails [#retrieve--list-emails] ```python email = eusend.Emails.get('9a8b7c6d-...') print(email['status']) # 'delivered' print(email['events'][0]['type']) page = eusend.Emails.list({'status': 'delivered', 'limit': 50}) print(page['data']) # list of emails print(page['next_cursor']) # pass as {'cursor': ...} for next page ``` ## Domains [#domains] ```python created = eusend.Domains.create('yourdomain.com') for record in created['records']: # every DNS record to add print(record['type'], record['name'], record['value']) eusend.Domains.verify(created['id']) # after publishing the records eusend.Domains.list() eusend.Domains.get(created['id']) eusend.Domains.remove(created['id']) ``` ## API keys [#api-keys] ```python key = eusend.ApiKeys.create({'name': 'Production'}) print(key['key']) # eu_live_... — returned only once eusend.ApiKeys.create({'name': 'Sandbox', 'test_mode': True}) # eu_test_... key # Send-only key, restricted to one domain. Omit domain_id for any verified domain. eusend.ApiKeys.create({ 'name': 'Billing service', 'permission': eusend.SENDING_ACCESS, 'domain_id': domain_id, }) eusend.ApiKeys.list() # prefixes only eusend.ApiKeys.remove(key['id']) ``` ## Templates [#templates] `{{variable}}` placeholders are substituted at send time; values are HTML-escaped. ```python tpl = eusend.Templates.create({ 'name': 'Welcome email', 'subject': 'Welcome, {{name}}!', 'html': 'Welcome to {{product}}.
', }) eusend.Emails.send({ 'from': 'you@yourdomain.com', 'to': 'customer@example.com', 'template_id': tpl['id'], 'variables': {'name': 'Jane', 'product': 'Acme'}, }) eusend.Templates.list() eusend.Templates.get(tpl['id']) eusend.Templates.update(tpl['id'], {'subject': 'New subject'}) html = eusend.Templates.preview(tpl['id'], {'first_name': 'Alex'}) # rendered HTML eusend.Templates.remove(tpl['id']) ``` ## Audiences & contacts [#audiences--contacts] Contact operations are grouped under `Audiences` (they live under a specific audience). ```python audience = eusend.Audiences.create('Newsletter') eusend.Audiences.create_contact(audience['id'], {'email': 'user@example.com', 'first_name': 'Jane'}) # Bulk upsert (up to 1,000) → {'count': N, 'duplicates': N} # unsubscribed / created_at are for migrating a list in — an import can add an # opt-out but never clear one. eusend.Audiences.batch_create_contacts(audience['id'], [ {'email': 'alice@example.com', 'first_name': 'Alice'}, {'email': 'bob@example.com', 'unsubscribed': True, 'created_at': '2024-02-01T10:00:00Z'}, ]) # Bulk delete by id (up to 1,000). Removes them from the audience — not an unsubscribe. eusend.Audiences.batch_delete_contacts(audience['id'], [contact_id]) page = eusend.Audiences.list_contacts(audience['id'], {'subscribed': True, 'search': 'gmail.com'}) contact = page['data'][0] eusend.Audiences.update_contact(audience['id'], contact['id'], {'unsubscribed': True}) eusend.Audiences.get_contact(audience['id'], contact['id']) eusend.Audiences.remove_contact(audience['id'], contact['id']) eusend.Audiences.list() eusend.Audiences.get(audience['id']) # includes contact_count eusend.Audiences.update(audience['id'], {'name': 'Product updates'}) eusend.Audiences.remove(audience['id']) ``` ## Topics [#topics] Kinds of email a contact can subscribe to and leave independently, so an unsubscribe can be a preference change. See [Topics](/docs/audiences/topics). ```python topic = eusend.Topics.create({ 'name': 'Product updates', # 'opt_in' reaches everyone until they leave; 'opt_out' reaches nobody until they # join. Fixed at creation. 'default_subscription': 'opt_in', 'description': 'New features and changes, about once a month.', 'visibility': 'public', }) eusend.Topics.list() eusend.Topics.get(topic['id']) eusend.Topics.update(topic['id'], {'visibility': 'private'}) # Record an explicit preference for one contact. eusend.Topics.subscribe(topic['id'], contact_id, True) # Forget the choice entirely, back to the topic default — not the same as False. eusend.Topics.clear_subscription(topic['id'], contact_id) eusend.Topics.remove(topic['id']) # Scope a broadcast to it. eusend.Broadcasts.create({ 'name': 'October update', 'audience_id': audience['id'], 'topic_id': topic['id'], 'from': 'hello@acme.com', 'subject': 'What shipped in October', 'html': 'Hi {{first_name}}…
', }) ``` ## Suppressions [#suppressions] Addresses the account will not send to. Hard bounces and spam complaints are added automatically — these methods cover the ones you manage yourself. See [Suppressions](/docs/emails/suppressions) for the full API. ```python # What's blocked, and why eusend.Suppressions.list({"reason": "bounce", "limit": 50}) eusend.Suppressions.list({"email": "@acme.com"}) # Stop sending to an address. Already suppressed? The existing entry comes back # unchanged — a manual add never rewrites a real bounce or complaint. eusend.Suppressions.create({"email": "opted-out@example.com"}) # Import up to 1,000 per call — do this before your first send when migrating. # (Named import_list because `import` is a Python keyword.) res = eusend.Suppressions.import_list([ "one@example.com", {"email": "two@example.com", "reason": "complaint"}, ]) print(res["count"], res["already_suppressed"], res["duplicates"]) # Un-suppress by entry id or by address; export the whole list as CSV bytes eusend.Suppressions.remove("invalid@example.com") csv = eusend.Suppressions.export() ``` ## Reputation [#reputation] Your bounce and complaint rates exactly as the sending limits judge them — what counted, what did not, and how far you are from a halved daily limit or a pause. See [how rates are judged](/docs/reference/rate-limits). Not available to sending-only keys. ```python r = eusend.Reputation.get() print(r["state"]) # healthy, warning, limited or paused nxt = r["next"] if nxt and nxt["bounces"] is not None and nxt["bounces"] <= 3: print(f"{nxt['bounces']} more bounces would move this account to {nxt['state']}") ``` ## Broadcasts [#broadcasts] `{{first_name}}`, `{{last_name}}`, `{{full_name}}`, and `{{email}}` are available per recipient, and RFC 8058 one-click unsubscribe headers are added automatically. ```python bc = eusend.Broadcasts.create({ 'name': 'May newsletter', 'audience_id': audience['id'], 'from': 'SivertHi {{first_name}}, your monthly update is here...
', }) eusend.Broadcasts.test(bc['id'], {'to': ['you@yourdomain.com']}) # preview to your own domain eusend.Broadcasts.send(bc['id']) # send now eusend.Broadcasts.send(bc['id'], {'scheduled_at': '2026-06-01T09:00:00Z'}) # or schedule eusend.Broadcasts.cancel(bc['id']) eusend.Broadcasts.list() eusend.Broadcasts.get(bc['id']) # includes delivery stats eusend.Broadcasts.update(bc['id'], {'subject': 'Updated subject'}) eusend.Broadcasts.remove(bc['id']) ``` ## Webhooks [#webhooks] ```python hook = eusend.Webhooks.create({ 'url': 'https://yourapp.com/webhooks/eusend', 'events': ['email.sent', 'email.delivered', 'email.bounced', 'email.complained'], # or: 'events': ['*'] to receive everything }) print(hook['secret']) # signing secret — store it securely; get_secret reads it again eusend.Webhooks.list() eusend.Webhooks.get(hook['id']) # includes recent deliveries eusend.Webhooks.update(hook['id'], {'events': ['email.bounced']}) eusend.Webhooks.get_secret(hook['id']) # {'secret': ...} eusend.Webhooks.rotate_secret(hook['id']) # new secret, effective immediately eusend.Webhooks.remove(hook['id']) ``` ### Verifying webhook signatures [#verifying-webhook-signatures] Every delivery is signed with HMAC-SHA256 over `{webhook-id}.{webhook-timestamp}.{body}`: ```python import base64 import hashlib import hmac def verify(headers, body: bytes, secret: str) -> bool: signed = f"{headers['webhook-id']}.{headers['webhook-timestamp']}.{body.decode()}" mac = hmac.new(secret.encode(), signed.encode(), hashlib.sha256) expected = 'v1,' + base64.b64encode(mac.digest()).decode() return hmac.compare_digest(headers['webhook-signature'], expected) ``` ## Error handling [#error-handling] Any non-2xx response raises a subclass of `eusend.EusendError`. Network failures that never reach the server raise `ApplicationError` (with `status_code == None`). Branch on `e.code`. ```python import eusend from eusend import EusendError, RateLimitError try: eusend.Emails.send({'from': 'you@yourdomain.com', 'to': 'customer@example.com', 'subject': 'Hi', 'html': 'Hi
'}) except RateLimitError as e: print(e.code) # 'MONTHLY_LIMIT_EXCEEDED' print(e.status_code) # 429 except EusendError as e: print(e.code, e.message, e.status_code) ``` Exception classes — all subclasses of `EusendError`: `MissingApiKeyError`, `InvalidApiKeyError`, `ValidationError`, `NotFoundError`, `RateLimitError`, `ApplicationError`. | Code | Status | Exception | | ---------------------------------- | ------ | ------------------------------------ | | `UNAUTHORIZED` | 401 | `InvalidApiKeyError` | | `FORBIDDEN` | 403 | `EusendError` | | `NOT_FOUND` | 404 | `NotFoundError` | | `VALIDATION_ERROR` / `BAD_REQUEST` | 400 | `ValidationError` | | `PAYLOAD_TOO_LARGE` | 413 | `ValidationError` | | `CONFLICT` | 409 | `EusendError` | | `RATE_LIMITED` | 429 | `RateLimitError` | | `MONTHLY_LIMIT_EXCEEDED` | 429 | `RateLimitError` | | `DAILY_LIMIT_EXCEEDED` | 429 | `RateLimitError` | | `PLAN_LIMIT_EXCEEDED` | 403 | `EusendError` | | `DOMAIN_NOT_VERIFIED` | 403 | `EusendError` | | `ALL_SUPPRESSED` | 422 | `EusendError` | | `SENDING_SUSPENDED` | 403 | `EusendError` | | `ACCOUNT_RESTRICTED` | 403 | `EusendError` | | `WORKSPACE_INACTIVE` | 403 | `EusendError` | | `SENDER_NOT_PERMITTED` | 403 | `ValidationError` | | `LIST_SEND_HELD` | 403 | `EusendError` | | `BROADCAST_HELD` | 403 | `EusendError` | | `SERVICE_PAUSED` | 503 | `EusendError` | | `ATTACHMENT_STORAGE_ERROR` | 503 | `EusendError` | | `INTERNAL_ERROR` | 500 | `ApplicationError` | | `application_error` | — | `ApplicationError` (network failure) | > [!TIP] > View the full source and changelog on [GitHub](https://github.com/eusend-dev/eusend-python). # Claude Code plugin URL: https://eusend.dev/docs/skill Install the official eusend plugin so Claude knows how eusend actually behaves — verified senders, idempotent retries, webhook signatures, and which errors to retry — before it writes a line of code. The [MCP server](/docs/mcp) gives an assistant tools: it can send mail, add a domain, read your delivery log. What it can't do is tell the assistant how eusend *behaves* — that the sender domain must be verified, that a retry without an `Idempotency-Key` double-sends, that a webhook signature covers the raw request body and not the parsed JSON. That's what a **skill** is for. The eusend plugin ships one, plus the MCP server, in a single install. ## Install [#install] ```bash title="shell" /plugin marketplace add eusend-dev/eusend-skill /plugin install eusend@eusend ``` Then set your API key so the bundled MCP server can authenticate: ```bash title="shell" export EUSEND_API_KEY=eu_live_xxxxxxxxxxxx export EUSEND_FROM=hello@yourdomain.com # optional — pins a default sender ``` > [!NOTE] > The skill itself needs no key. Only the MCP server does. Use an `eu_test_` key while you're wiring > things up — sends are accepted, recorded, and fire the full webhook lifecycle, but never reach a > real inbox. ## Using it [#using-it] Claude loads the skill on its own when a task involves eusend — a `@eusend_dev/sdk` import, an `EUSEND_API_KEY` in your env file, or just a prompt that mentions us. To invoke it directly, type `/eusend:eusend`. Things it's built for: ```text Add password reset emails to this app using eusend Why is this send returning DOMAIN_NOT_VERIFIED? Write a webhook handler for eusend bounces Set up the DNS records for acme.com ``` ## What it knows [#what-it-knows] The skill is written around the mistakes that actually reach production, not a restatement of the API reference: | Parameter | Type | Description | | --- | --- | --- | | `Verified senders` | `DOMAIN_NOT_VERIFIED` | The from address must be on a verified domain, and no retry fixes it. Includes the sandbox sender and its one real constraint — it only delivers to your own account email. | | `Idempotent retries` | `Idempotency-Key` | Derive the key from a domain object, not a UUID minted per attempt — which is the version that makes every retry a fresh send. | | `Webhook signatures` | `raw body` | Verify against the bytes received, in constant time, checking length first. Working handlers for Express, Next.js route handlers, Flask, and net/http. | | `The SPF record not to add` | `DNS` | A second SPF record on your root domain breaks SPF for every other service sending from it, including your own Google Workspace mail. eusend authenticates with DKIM and does not need one. | | `Retry policy` | `error codes` | Which codes are transient, which need a longer horizon, and which are terminal. ALL_SUPPRESSED is the system working, not an incident. | | `Per-language failure shapes` | `SDKs` | The Node SDK returns { data, error } and never throws on an API error — an unchecked await silently drops every failed send. Python raises; Go returns an error. | Detail lives in reference files the assistant loads only when it needs them, so the always-on cost is about 260 tokens. ## Other agents [#other-agents] [Agent Skills](https://agentskills.io) is an open standard, not a Claude format. This skill is written to it — spec-standard frontmatter only, no Claude-specific syntax in the body — so it works in Cursor, GitHub Copilot, VS Code, Codex, Gemini CLI, OpenCode, Goose, Amp, Roo Code and the rest of the skills-compatible ecosystem. Only the install differs. `/plugin` is Claude Code's marketplace format; elsewhere you drop the skill folder somewhere the agent scans. Cursor, Codex and Copilot all read `.agents/skills/`, so one copy covers all three: ```bash title="shell" git clone https://github.com/eusend-dev/eusend-skill mkdir -p .agents/skills cp -r eusend-skill/plugins/eusend/skills/eusend .agents/skills/ ``` Use `~/.agents/skills/` to install it once for every project instead. Agents that scan elsewhere — `.github/skills/` for Copilot, `.cursor/skills/` for Cursor — work the same way. > [!NOTE] > The [MCP server](/docs/mcp) is independent of the skill and equally portable — it speaks plain > MCP, so Cursor, Codex, Claude Desktop and any other MCP client can connect to it. Only the > bundled-in-one-install convenience is specific to Claude Code. > [!TIP] > Found something the skill gets wrong? That's a bug, and the repository takes issues. A skill that > confidently teaches the wrong thing is worse than no skill at all. # SMTP URL: https://eusend.dev/docs/smtp Send through eusend over SMTP instead of the HTTP API — a drop-in transport for anything that already speaks SMTP, from WordPress and Supabase to Django, Laravel, and Rails. Send through eusend over SMTP instead of the HTTP API — a drop-in transport for anything that already speaks SMTP: WordPress, Supabase Auth, Django, Laravel, Rails, Ghost, and most off-the-shelf software. Messages submitted over SMTP run through the exact same pipeline as the API, so DKIM signing, open and click tracking, suppression, and your sending limits all apply identically. ## Connection settings [#connection-settings] | Parameter | Type | Description | | --- | --- | --- | | `Host` (required) | `smtp.eusend.dev` | The SMTP submission server. | | `Port` (required) | `465` | Implicit TLS (SMTPS) — the connection is encrypted from the first byte. STARTTLS (587) and plain SMTP (25) are not supported. | | `Security` (required) | `SSL / TLS` | Implicit TLS on 465. Not STARTTLS. Choose "SSL" or "TLS" if your client asks. | | `Username` (required) | `eusend` | Always the literal string "eusend" — not your email address and not your key. | | `Password` (required) | `eu_live_… / eu_test_…` | Any of your eusend API keys. The key goes in the password field. | > [!WARNING] > The username is always the literal word `eusend`; your API key goes in the **password** field. > Putting the key in the username is the most common cause of a `535` authentication failure. ## Integration guides [#integration-guides] Step-by-step setup for the most common platforms. Every one uses the same host, port, username, and password above — only the location of the settings screen differs. - [**WordPress**](/docs/smtp/wordpress) — WP Mail SMTP / FluentSMTP - [**Supabase Auth**](/docs/smtp/supabase) — Custom SMTP for auth emails - [**Django**](/docs/smtp/django) — EMAIL_BACKEND settings - [**Laravel**](/docs/smtp/laravel) — config/mail.php + .env - [**Ruby on Rails**](/docs/smtp/rails) — Action Mailer delivery - [**Nodemailer**](/docs/smtp/nodemailer) — Node.js transport - [**Ghost**](/docs/smtp/ghost) — Transactional mail config - [**PHP (PHPMailer)**](/docs/smtp/phpmailer) — Plain PHP sending ## The sender address [#the-sender-address] The message `From` address must use a domain you have verified in eusend — the same rule as the API. Mail from an unverified domain is rejected at submission with a `535` carrying the reason in its text. The local part (before the `@`) can be anything. See [Domain Setup](/docs/domains) to add and verify a domain. ## Test and live keys [#test-and-live-keys] A key prefixed `eu_test_` is accepted and tracked but never delivered — ideal while you wire up an integration. Swap in an `eu_live_` key to send for real. ## Quick check — swaks (CLI) [#quick-check--swaks-cli] Before wiring SMTP into an application, confirm your key and sender domain work with a one-line send from the terminal: ```bash title="shell" swaks \ --server smtp.eusend.dev:465 --tlsc \ --auth-user eusend --auth-password eu_live_xxxxxxxxxxxx \ --from hello@yourdomain.com \ --to alice@example.com \ --header 'Subject: SMTP test' \ --body 'Hello from eusend over SMTP.' ``` ## Limits and behavior [#limits-and-behavior] | Parameter | Type | Description | | --- | --- | --- | | `Recipients` | `max 50 each` | Up to 50 addresses each across To, Cc, and Bcc. | | `Message size` | `max 15 MB` | The whole message on the wire, MIME encoding included. Larger messages are rejected with a 552. | | `Attachments` | `max 20, 10 MB` | Up to 20 attachments, 10 MB combined once decoded — the same limits as the API. Over either one, the message is rejected with a 552 rather than delivered without the files. | | `Sending limits` | `shared` | The same rate limit, monthly plan limit, and progressive daily sending ceiling as the HTTP API apply to SMTP submissions. | | `Tracking & events` | `identical` | Opens, clicks, bounces, complaints, and suppression all apply — an SMTP send appears in your dashboard and analytics like any other email. | ## Troubleshooting [#troubleshooting] | Parameter | Type | Description | | --- | --- | --- | | `535` | `auth or sender rejected` | Wrong username or invalid key — the username must be the literal "eusend" and the API key goes in the password field. An unverified From domain also lands here, so read the response text before assuming the credentials are wrong. | | `550` | `rejected` | The message itself was refused — every recipient is on your suppression list, or the content failed validation. | | `452` | `rate limited` | A rate limit, your daily sending ceiling, or your monthly quota was hit. Retry later — the response text says which; a monthly quota does not clear until the month resets or you raise it. | | `421` | `temporary` | Temporary server error or too many simultaneous connections — retry with backoff. | # Django SMTP URL: https://eusend.dev/docs/smtp/django Configure Django's email backend to send through eusend over SMTP — password resets, notifications, and any send_mail call, DKIM-signed and tracked. Django's SMTP email backend works with eusend out of the box — no extra packages. Set five settings and every `send_mail`, `EmailMessage`, password-reset, and `django.contrib.auth` email routes through eusend, DKIM-signed and tracked. ## settings.py [#settingspy] ```python title="settings.py" EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.eusend.dev' EMAIL_PORT = 465 EMAIL_USE_SSL = True # implicit TLS — not EMAIL_USE_TLS EMAIL_HOST_USER = 'eusend' # always the literal string "eusend" EMAIL_HOST_PASSWORD = os.environ['EUSEND_API_KEY'] # eu_live_… # Must be an address on a domain verified in eusend DEFAULT_FROM_EMAIL = 'AcmeOrder #1234 is on its way.
', ) ``` Test it from the shell without touching a view: ```bash python manage.py shell -c "from django.core.mail import send_mail; \ send_mail('Test', 'Body', None, ['you@example.com'])" ``` ## Connection reference [#connection-reference] | Setting | Value | | --------------------- | ------------------------------------------------ | | `EMAIL_HOST` | `smtp.eusend.dev` | | `EMAIL_PORT` | `465` | | `EMAIL_USE_SSL` | `True` | | `EMAIL_HOST_USER` | `eusend` | | `EMAIL_HOST_PASSWORD` | your eusend API key (`eu_live_…`) | | `DEFAULT_FROM_EMAIL` | an address on a [verified domain](/docs/domains) | Use an `eu_test_` key while developing — sends are accepted and tracked but never delivered. See the [SMTP overview](/docs/smtp) for limits and status codes. ## Troubleshooting [#troubleshooting] | Symptom | Cause and fix | | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive, so only set one of those settings to True.` | Both settings are `True`. eusend uses implicit TLS, so keep `EMAIL_USE_SSL = True` and remove `EMAIL_USE_TLS` or set it to `False`. | | The send hangs, then `SMTPServerDisconnected: Connection unexpectedly closed` or a timeout | `EMAIL_USE_TLS = True` makes Django start a plaintext session and ask for STARTTLS, which port 465 does not speak. Use `EMAIL_USE_SSL = True` with `EMAIL_PORT = 465`. | | `SMTPAuthenticationError: (535, …)` | Read the response text. `Invalid credentials` means the username is not the literal `eusend` or the API key is wrong. A message naming a domain means the From address is on a domain you have not [verified](/docs/domains). | | `535 Too many failed attempts` or `421 Connection rejected` | Repeated failed logins block your IP address for up to an hour. Fix the credentials, then wait before retrying. | | Nothing arrives and no error is raised | `EMAIL_BACKEND` is still the console or file backend, so mail is printed or written to disk instead of sent. Set it to `django.core.mail.backends.smtp.EmailBackend`. With an `eu_test_` key the send is accepted and shown in the dashboard but never delivered. | | Connection times out | Your host blocks outbound port 465, or the port is set to 587 or 25. eusend only accepts SMTP on 465. Ask your host to open it, or send through the [HTTP API](/docs/emails/send). | See the [SMTP overview](/docs/smtp#troubleshooting) for the full status-code table. # Ghost SMTP URL: https://eusend.dev/docs/smtp/ghost Configure your Ghost blog to send transactional email — member sign-in links, password resets, staff invites — through eusend over SMTP. Ghost sends two kinds of email: bulk newsletters (which require Mailgun) and transactional mail — member sign-in links, password resets, and staff invites. eusend handles the transactional mail through Ghost's `mail` SMTP configuration, DKIM-signed and tracked. ## config.production.json [#configproductionjson] Ghost is configured through its config file (or the equivalent environment variables). Add a `mail` block: ```json title="config.production.json" { "mail": { "transport": "SMTP", "from": "AcmeOrder #1234 is on its way.
', text: 'Order #1234 is on its way.', }) ``` Attachments, `cc`, `bcc`, `replyTo`, and custom `headers` all work as usual — Nodemailer builds the MIME message and eusend relays it. To [tag](/docs/emails/tags) a relayed send for log filtering and webhook routing, add an `X-Eusend-Tag` header: ```ts await transport.sendMail({ from: 'AcmeHere is your reset link.
', headers: { 'X-Eusend-Tag': 'category=password_reset, tier=pro' }, }) ``` ## Verify the connection [#verify-the-connection] ```ts await transport.verify() // resolves if the host, port, and auth are correct ``` ## Connection reference [#connection-reference] | Option | Value | | ----------- | ------------------------------------------------ | | `host` | `smtp.eusend.dev` | | `port` | `465` | | `secure` | `true` | | `auth.user` | `eusend` | | `auth.pass` | your eusend API key (`eu_live_…`) | | `from` | an address on a [verified domain](/docs/domains) | > [!NOTE] > For a richer typed API — batch sends, scheduling, templates, idempotency — use the [Node.js > SDK](/docs/sdks/nodejs) over the HTTP API instead. SMTP is best when a library or framework > already speaks it. ## Troubleshooting [#troubleshooting] | Symptom | Cause and fix | | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Error: Invalid login: 535 …` (`EAUTH`) | Read the response text. `Invalid credentials` means the username is not the literal `eusend` or the API key is wrong. A message naming a domain means the From address is on a domain you have not [verified](/docs/domains). | | `Error: Greeting never received` (`ETIMEDOUT`) | `secure` is `false`, so Nodemailer waits for a plaintext greeting on a TLS port. Set `secure: true` with `port: 465`. | | `Error: Connection timeout` (`ETIMEDOUT`) | Your host blocks outbound port 465, or the port is set to 587 or 25. eusend only accepts SMTP on 465. Ask your host to open it, or send through the [HTTP API](/docs/emails/send). | | `535 Too many failed attempts` or `421 Connection rejected` | Repeated failed logins block your IP address for up to an hour. Fix the credentials, then wait before retrying. | | `pass` is `undefined` | `EUSEND_API_KEY` is not set in the environment the process runs in. Nodemailer then fails the login with a 535. | | Send rejected with `452` | A rate limit or your daily sending ceiling was hit. Retry later, and reuse one transport with `pool: true` rather than opening a connection per message. | See the [SMTP overview](/docs/smtp#troubleshooting) for the full status-code table. # PHP (PHPMailer) SMTP URL: https://eusend.dev/docs/smtp/phpmailer Send email from plain PHP through eusend using PHPMailer over SMTP — implicit TLS on port 465, DKIM-signed and tracked. For a PHP app without a framework, [PHPMailer](https://github.com/PHPMailer/PHPMailer) is the standard SMTP client. Point it at eusend and your mail is DKIM-signed, tracked, and subject to the same limits as the HTTP API. ## Install [#install] ```bash composer require phpmailer/phpmailer ``` ## Send an email [#send-an-email] ```php title="send.php" use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require 'vendor/autoload.php'; $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'smtp.eusend.dev'; $mail->SMTPAuth = true; $mail->Username = 'eusend'; // the literal string "eusend" $mail->Password = getenv('EUSEND_API_KEY'); // eu_live_… $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; // implicit TLS $mail->Port = 465; // From must be on a domain verified in eusend $mail->setFrom('no-reply@yourdomain.com', 'Acme'); $mail->addAddress('alice@example.com'); $mail->isHTML(true); $mail->Subject = 'Your order has shipped'; $mail->Body = 'Order #1234 is on its way.
'; $mail->AltBody = 'Order #1234 is on its way.'; $mail->send(); } catch (Exception $e) { echo "Send failed: {$mail->ErrorInfo}"; } ``` > [!WARNING] > Use `ENCRYPTION_SMTPS` with port `465` (implicit TLS), **not** `ENCRYPTION_STARTTLS`. STARTTLS on > 587 is not supported. ## Connection reference [#connection-reference] | Property | Value | | ------------ | ------------------------------------------------ | | `Host` | `smtp.eusend.dev` | | `Port` | `465` | | `SMTPSecure` | `PHPMailer::ENCRYPTION_SMTPS` | | `Username` | `eusend` | | `Password` | your eusend API key (`eu_live_…`) | | `setFrom()` | an address on a [verified domain](/docs/domains) | Use an `eu_test_` key while developing — sends are tracked but not delivered. See the [SMTP overview](/docs/smtp) for limits and status codes. ## Troubleshooting [#troubleshooting] | Symptom | Cause and fix | | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `SMTP Error: Could not authenticate.` | Read the response text. `Invalid credentials` means the username is not the literal `eusend` or the API key is wrong. A message naming a domain means the From address is on a domain you have not [verified](/docs/domains). Set `$mail->SMTPDebug = SMTP::DEBUG_SERVER;` to print the server's response. | | `SMTP Error: Could not connect to SMTP host.` or `SMTP connect() failed` | The connection is not using implicit TLS on 465, or your host blocks the port. Set `SMTPSecure = PHPMailer::ENCRYPTION_SMTPS` and `Port = 465`. eusend does not accept SMTP on 587 or 25. | | The script hangs, then times out | `SMTPSecure` is `PHPMailer::ENCRYPTION_STARTTLS` or empty while `Port` is 465, so PHPMailer waits for a plaintext greeting. Use `ENCRYPTION_SMTPS`. | | `535 Too many failed attempts` or `421 Connection rejected` | Repeated failed logins block your IP address for up to an hour. Fix the credentials, then wait before retrying. | | `Password` is empty | `getenv('EUSEND_API_KEY')` returned `false` — the variable is not set for the PHP process (web server and CLI often have different environments). | | Send rejected with `550` | Every recipient is on your [suppression list](/docs/emails/suppressions), or the message failed validation. `$mail->ErrorInfo` carries the reason. | See the [SMTP overview](/docs/smtp#troubleshooting) for the full status-code table. # Rails SMTP URL: https://eusend.dev/docs/smtp/rails Configure Action Mailer to deliver through eusend over SMTP — mailers, Devise emails, and any deliver_now/deliver_later, DKIM-signed and tracked. Action Mailer uses SMTP for delivery, so pointing Ruby on Rails at eusend is a one-block configuration change. Every mailer, plus Devise confirmation and password-reset emails, then routes through eusend, DKIM-signed and tracked. ## config/environments/production.rb [#configenvironmentsproductionrb] ```ruby title="config/environments/production.rb" config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: 'smtp.eusend.dev', port: 465, user_name: 'eusend', # the literal string "eusend" password: ENV['EUSEND_API_KEY'], # eu_live_… authentication: :plain, tls: true, # implicit TLS on 465 enable_starttls_auto: false } # Must be an address on a domain verified in eusend config.action_mailer.default_options = { from: 'AcmeOrder #{{order_id}} confirmed.
" }' ``` ```json title="response — 201 Created" { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Order Confirmation", "createdAt": "2026-05-20T10:00:00.000Z" } ``` The rest of the template CRUD surface: `GET /templates` List all templates. `GET /templates/:id` Get a template. `PATCH /templates/:id` Update a template. `DELETE /templates/:id` Delete a template. # Open & Click Tracking URL: https://eusend.dev/docs/tracking Track email opens and link clicks — off by default, switched on per send or for your whole organization. All tracking requests pass through EU infrastructure — no data is sent to US services. eusend can track email opens and link clicks. All tracking requests pass through EU infrastructure — no data is sent to US services. ## Why eusend has tracking at all [#why-eusend-has-tracking-at-all] It is a fair question. A pixel that reports back when you read your mail is exactly the kind of thing an EU-native product is supposed to be sceptical of, and we don't pretend otherwise. Two reasons it exists anyway. The first is that open and click data is how you find out whether your mail is actually landing — a domain whose delivery is quietly rotting usually shows up as engagement falling before it shows up as bounces. The second is that a provider without it doesn't remove tracking from the world; it just keeps people on US providers who serve the same pixel from US infrastructure. Building it here means the request terminates in the EU, and that the data stops at what we describe below. So the design constraint was never *whether* to track but **how little we could get away with recording**. We could have collected far more than we do, and most of the industry does: | | Common elsewhere | eusend | | ------------------------------------- | ---------------- | --------------- | | IP address of the reader | Stored | Never stored | | Country / city / geolocation | Derived from IP | Never derived | | Device, OS and mail client breakdown | Parsed from UA | Not parsed | | Every repeat open, with timestamps | Full timeline | First open only | | Per-recipient engagement scores | Profiles built | Not built | | Reader data shared with third parties | Common | Never | There is no profile of your recipients anywhere in eusend, and nothing survives the retention window on your plan. What is left is a count of opens and clicks per message — enough to answer "is this getting through", not enough to describe a person. Tracking is **off by default**. [One switch turns it on](#turning-tracking-on) for your whole organization, including SMTP and broadcasts, or you can enable it per send. ## Why it is off by default [#why-it-is-off-by-default] Tracking costs deliverability. Click tracking rewrites every link in your message to point at eusend's tracking host instead of your own domain, and mailbox providers weigh a link domain that doesn't match the sender as a spam signal — on a sign-in link or a password reset, that is the last place you want one. The open pixel is a remote image that many filters and privacy-protecting clients treat with suspicion too. For transactional mail, the signals that actually tell you whether mail is landing are delivery, bounce and complaint events, and those are always on. Turn tracking on where you need the engagement numbers — typically broadcasts — and leave your transactional mail clean. > [!NOTE] > Organizations created before 16 October 2026 kept the setting they had, which for most is **on**. > Check **Settings → General → Email tracking** if you want to switch. ## How a setting is resolved [#how-a-setting-is-resolved] Three levels, most specific first: 1. **The `track_opens` / `track_clicks` flag on the send**, when you pass one. 2. **Your organization default**, in the dashboard under **Settings → General → Email tracking**. 3. **Off**, which is what the organization default ships as. Omitting a flag is not the same as passing `false`. Omitting it defers to your organization default; `false` turns tracking off for that send whatever the default says. The organization default is the only level that reaches every send path — [SMTP](/docs/smtp) messages have nowhere to carry a per-send flag, so for SMTP that setting *is* the control. Broadcasts resolve it once, when the broadcast is created, and keep that answer. ## Open tracking [#open-tracking] eusend injects a 1×1 transparent pixel into the HTML body, and when the recipient's email client loads the image, eusend records an `opened` event. > [!WARNING] > Open tracking is inherently imprecise. Email clients that pre-fetch images (like Apple Mail with > Mail Privacy Protection) may record false opens. Many clients also block remote images by default. ## Click tracking [#click-tracking] All `href` links in the HTML body are rewritten to pass through eusend's tracking endpoint; when clicked, a `clicked` event is recorded and the recipient is immediately redirected to the original URL. With click tracking off, your original URLs are delivered untouched. ## What we record [#what-we-record] An open stores the requesting **user agent**, and only for the **first** open — repeat opens of the same message are discarded, so there is no read timeline. A click stores the **destination URL** and the id of the link. Neither stores the recipient's IP address, and we derive no location from it. Events are deleted with the email log they belong to — 30 days on Free and the volumes up to 100,000, 90 days from 250,000 up. See [plans](/docs/reference/plans). ## Turning tracking on [#turning-tracking-on] For a single send, pass either flag as `true`: ```json { "from": "hello@acme.com", "to": "user@example.com", "subject": "...", "html": "...", "track_opens": true, "track_clicks": true } ``` For every send from your organization — API, SMTP and broadcasts alike — turn the defaults on under **Settings → General → Email tracking**. A send that passes an explicit flag still overrides it, so with the defaults on you can still pass `false` on mail like sign-in links and password resets. For one broadcast, use the **Tracking** checkboxes in the composer, or pass the flags when creating it through the API: ```json { "name": "March newsletter", "audience_id": "aud_...", "from": "hello@acme.com", "subject": "...", "html": "...", "track_opens": true, "track_clicks": true } ``` Tracking has no effect on unsubscribe links, which broadcasts always carry. ## Consent [#consent] You are the controller for the people you email, so whether you have a lawful basis to track them is your decision, not ours. In much of the EU a tracking pixel needs consent under the ePrivacy Directive (Article 5(3)), separately from whatever basis you rely on to send the message at all — a distinction that catches people out most often on marketing broadcasts. The settings above exist so that decision can live in one place rather than on every call. ## Analytics dashboard [#analytics-dashboard] Aggregate open and click stats are visualised in the **Analytics** section of the dashboard, with charts broken down by time period, status, and domain. # Webhooks URL: https://eusend.dev/docs/webhooks Subscribe to email events and receive real-time HTTP POST notifications at your endpoint. Subscribe to email events and receive real-time HTTP POST notifications at your endpoint. A failed delivery is retried with exponential back-off for about four hours (10 attempts in total) before it is marked failed. When a delivery fails for good, we email the account owner — at most once per endpoint per day. If every delivery to an endpoint has failed for three days straight, the endpoint is disabled: new events are no longer queued for it, and the owner is emailed again. Fix the endpoint, send a test event, then enable it again with `PATCH /webhooks/:id` and `{ "enabled": true }` or from the dashboard. How many endpoints you may register depends on your plan — one on the free tier, more on Production. Creating one past the cap returns `403` with code `PLAN_LIMIT_EXCEEDED`; see [pricing](/pricing) for the number on each plan. Endpoints you already have keep working if your plan changes. `POST /webhooks` | Parameter | Type | Description | | --- | --- | --- | | `url` (required) | `string` | Public HTTP(S) endpoint to receive events. Private, loopback, and internal addresses are rejected — both at creation and again (after DNS resolution) before each delivery. | | `events` (required) | `string[]` | Event types to subscribe to. Use "*" to subscribe to all events. | ```bash title="create webhook" curl -X POST https://api.eusend.dev/webhooks \ -H "Authorization: Bearer eu_live_xxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "url": "https://yourapp.com/webhooks/eusend", "events": ["email.delivered", "email.bounced", "email.complained"] }' ``` ```json title="response — 201 Created" { "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d", "url": "https://yourapp.com/webhooks/eusend", "events": ["email.delivered", "email.bounced", "email.complained"], "secret": "AbCdEfGhIjKlMnOpQrStUvWxYz0123456789ABC", "disabledAt": null, "disabledReason": null, "createdAt": "2026-05-20T10:00:00.000Z" } ``` > [!NOTE] > Store the `secret` securely — you'll need it to verify incoming webhook signatures. If you lose > it, retrieve it again with `GET /webhooks/:id/secret`, or view it on the webhook's page in the > dashboard. > [!NOTE] > Your endpoint must respond directly with a `2xx` status. Redirects (`3xx`) are not followed and > count as a failed delivery. The rest of the webhooks surface: Creating, updating, and deleting endpoints requires a live API key or the dashboard. Test-mode keys can read endpoints and deliveries, and test sends still trigger configured webhooks, but cannot change endpoints or access their signing secrets. `GET /webhooks` List webhooks. `GET /webhooks/:id` Get webhook + recent deliveries. `PATCH /webhooks/:id` Update `url`, `events`, or `enabled`. Setting `enabled` to `false` pauses the endpoint (`disabledReason: "manual"`); `true` re-enables an endpoint that was paused or disabled for failing (`disabledReason: "failing"`). Events that happen while an endpoint is disabled are not queued and are not replayed when it is enabled again. `POST /webhooks/:id/test` Send one `webhook.test` event to the endpoint, signed like any other, and return `202` with the delivery `id`. It is attempted once, so its result shows up in the delivery log within seconds. Works on a disabled endpoint, so you can confirm a fix before enabling it again. ```json title="webhook.test payload" { "type": "webhook.test", "webhook_id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d", "timestamp": "2026-05-20T10:00:00.000Z" } ``` `GET /webhooks/:id/secret` Retrieve the signing secret. `POST /webhooks/:id/rotate-secret` Replace the signing secret and return the new one. It takes effect immediately — the previous secret stops verifying on the next delivery, so update your endpoint first unless you are rotating because the old secret leaked. `DELETE /webhooks/:id` Delete webhook. # Events URL: https://eusend.dev/docs/webhooks/events Subscribe to any combination of these event types, or use * to receive all of them. Subscribe to any combination of these event types, or use `*` to receive all of them. | Event | Description | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `email.sent` | Email was accepted and is in transit. | | `email.delivered` | Delivery confirmed by the receiving mail server. | | `email.bounced` | Email hard-bounced (permanent failure) and the address was suppressed. The payload includes `bounce_type` plus the receiving server's verbatim reason — see [Reading a bounce](#reading-a-bounce). Transient/soft failures are retried and do not fire this event. | | `email.complained` | Recipient marked the email as spam. | | `email.opened` | Recipient opened the email (requires `track_opens`). Fires once per email. | | `email.clicked` | Recipient clicked a tracked link (requires `track_clicks`). Payload includes `link_id` and `url`. Repeat clicks on the same link within a minute count once, up to 20 clicks per email per hour. | | `email.failed` | The email will not be delivered and was not rejected by a recipient server: the account could not send when it was picked up, delivery was abandoned after retries, or it never reached the queue. Payload includes `reason`. | | `email.suppressed` | Recipients on your suppression list were dropped and not sent to. Fires for an email whose recipients were all suppressed, and for the record of recipients removed from a partly suppressed send. Payload includes `recipients`. | | `*` | Wildcard — subscribes to all current and future event types. | ## Payload structure [#payload-structure] ```json title="example payload (email.delivered)" { "type": "email.delivered", "email_id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d", "recipients": ["alice@example.com"], "tags": { "category": "shipping_update" }, "timestamp": "2026-05-20T10:00:03.000Z" } ``` > [!NOTE] > `timestamp` is when the event itself happened — the moment our MTA recorded the delivery, or > the arrival date on an async bounce/complaint report — not when we sent you the webhook. For > delivery time, read the `webhook-timestamp` header; the two differ when a retry or a backlog > delays the notification. > > Every payload includes `type`, `email_id`, `tags`, and `timestamp`. Some events add fields: > `provider_message_id` (sent), `recipients` (delivered, bounced, complained, suppressed), `bounce_type` + > `diagnostic` (bounced), `link_id` + `url` (clicked), and `reason` (failed). Deliveries from a test-mode send also > carry `test_mode: true`. ## Reading a bounce [#reading-a-bounce] `bounce_type` is our own classifier's bucket, and it is frequently `Uncategorized` — a real rejection we have no specific rule for. It is not enough on its own to tell an invalid mailbox from a reputation block, so a bounce payload also carries the receiving server's own words: ```json title="example payload (email.bounced)" { "type": "email.bounced", "email_id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d", "bounce_type": "Uncategorized", "smtp_code": 554, "diagnostic": "Your access to this mail system has been rejected due to poor reputation of a domain used in message transfer", "recipients": ["alice@example.com"], "counts_toward_reputation": false, "tags": {}, "timestamp": "2026-05-20T10:00:03.000Z" } ``` | Field | Notes | | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `smtp_code` | Numeric SMTP reply code (`550`, `554`, …). Absent when the bounce arrived asynchronously as a DSN rather than on the SMTP session. | | `diagnostic` | The remote server's reason, trimmed to 500 characters, with our sending IPs shown as `[sending IP]`. Absent when the remote sent no text. | | `dsn_status` | Dotted status (`5.1.1`) — present only on asynchronous DSN bounces, in place of `smtp_code`. | | `counts_toward_reputation` | `true` when the bounce counts toward your [bounce rate](/docs/reference/rate-limits). `false` when the rejection was about our sending infrastructure rather than the address — a blocked IP, an authentication failure, a temporary condition — so there is nothing to clean from your list. | > [!WARNING] > Treat both as opaque text for humans and logs. Wording varies by provider and changes without > notice, so match on `bounce_type` or `smtp_code` when you need to branch in code — never on > `diagnostic`. `tags` carries whatever [tags](/docs/emails/tags) the send was created with, as an object — `{}` when it had none, never absent — so you can route on `payload.tags.category` without checking the field exists first. # Security URL: https://eusend.dev/docs/webhooks/security Every webhook delivery includes an HMAC-SHA256 signature so you can verify it originated from eusend. Every webhook delivery includes a signature so you can verify it originated from eusend. ## Headers [#headers] | Parameter | Type | Description | | --- | --- | --- | | `webhook-id` | `string` | Unique delivery ID for this event. | | `webhook-timestamp` | `string` | Unix timestamp (seconds) of delivery time. | | `webhook-signature` | `string` | HMAC-SHA256 signature prefixed with v1,. | ## Verification [#verification] The signature is computed as `HMAC-SHA256(secret, "{webhook-id}.{webhook-timestamp}.{body}")`, then base64-encoded and prefixed with `v1,`. The `webhook-id` and `webhook-timestamp` values are the ones sent in the request headers (each delivery has a unique `webhook-id`). ```js title="node.js verification" import { createHmac, timingSafeEqual } from 'crypto' function verifyWebhook(req, secret) { const id = req.headers['webhook-id'] const timestamp = req.headers['webhook-timestamp'] const signature = req.headers['webhook-signature'] const body = req.rawBody // must be the raw string, not parsed JSON const signed = `${id}.${timestamp}.${body}` const expected = 'v1,' + createHmac('sha256', secret).update(signed).digest('base64') const received = Buffer.from(signature ?? '', 'utf8') const digest = Buffer.from(expected, 'utf8') // timingSafeEqual throws on a length mismatch, so check that first — a missing // or truncated header is exactly the case that would otherwise crash the handler. if (received.length !== digest.length || !timingSafeEqual(received, digest)) { throw new Error('Invalid webhook signature') } return JSON.parse(body) } ``` > [!TIP] > Always compare signatures with a constant-time comparison — a plain `===` leaks how much of the > signature matched. In Node.js that's `crypto.timingSafeEqual()`, guarded by the length check > above.