> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notifique.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Resend (email)

> BYOK with Resend: your API key, aligned domains, and fallback if Resend fails.

**Resend** BYOK for email. You keep the Resend account; Notifique sends through it when possible.

***

## Goal

With an **active** Resend integration, email sends try Resend **first**. Failure → Notifique internal fallback.

Each send consumes **1 email credit** on Notifique (or prepaid price), plus your Resend account cost.

***

## External endpoint

* Base: `https://api.resend.com`
* Send: `POST /emails`
* Reference: [Resend, Send Email](https://resend.com/docs/api-reference/emails/send-email)

***

## Authentication

**BEARER** with a **full-access** Resend API key (sending + domains + webhooks):

```
Authorization: Bearer re_...
```

<Warning>
  Sending-only keys return `401 restricted_api_key` when listing domains or creating webhooks.
</Warning>

***

## Domains: connect vs send

### When saving the integration

Notifique requires **all of**:

1. At least one **verified** domain in the Notifique workspace.
2. At least one **send-ready** domain on Resend (`capabilities.sending`).
3. **Overlap**, some hostname on both sides (`www.` ignored).

Domain listing paginates through the Resend API.

### At send time

**`from`** must use a domain **approved on Notifique**.

***

## Mapping (Notifique → Resend)

* `from` + `fromName` → `Name <email@domain.com>` or email only
* `to` → one recipient on Resend
* `subject`, HTML and text → from the queue
* Header `Idempotency-Key: notifique-email/{emailId}` (prevents duplicates on retry)
* Tag `notifique_email_id` for correlation in the Resend dashboard

***

## Status webhooks

On create, Notifique registers a Resend webhook:

`POST /webhooks/email/resend/:integrationId`

Events: sent, delivered, **opened**, **clicked**, bounce, complaint, delayed, failed, **suppressed**. Secret encrypted; on remove, remote webhook is deleted when possible.

Existing integrations are auto-synced on the next workspace integrations list (Resend webhook subscription patched).

### Opens and clicks

For `email.opened` and `email.clicked` to reach Notifique:

1. Enable **open** and/or **click tracking** on the domain in Resend (verified tracking subdomain).
2. Notifique updates the send to `OPENED` / `CLICKED` and dispatches your workspace `email.opened` / `email.clicked` webhooks.

Without Resend tracking enabled, delivery/bounce still work; opens and clicks are not reported.

***

## Failover

HTTP error, timeout or transport failure on Resend:

1. External attempt marked failed
2. Next external provider (if any, by order). e.g. Amazon SES BYOK
3. Notifique **internal** chain

***

## Observability

Per send:

* `providerType`: `EXTERNAL` or `INTERNAL`
* `providerName`: integration name
* `providerResponse`: sanitized response
* Resend external ID when available

***

## Workspace setup

1. Channel: `EMAIL`
2. Provider: `Resend`
3. Credential: Resend API key

After save, credential **does not** reappear in plaintext.

***

## Next steps

* **[BYOK hub](/en/byok)**
* **[Amazon SES](/en/byok/ses)**
