> ## 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.

# Reenviar (correo electrónico)

> BYOK con reenvío: su clave API, dominios alineados y respaldo si falla el reenvío.

**Reenviar** BYOK por correo electrónico. Mantienes la cuenta de Reenvío; Notifique lo envía cuando sea posible.

***

## Meta

Con una integración de reenvío **activa**, los envíos de correo electrónico prueban reenviar **primero**. Fallo → Notificar respaldo interno.

Cada envío consume **1 crédito de correo electrónico** en Notifique (o precio prepago), más el costo de su cuenta de Reenvío.

***

## Punto final externo

* Base: `https://api.resend.com`
* Enviar: `POST /emails`
* Referencia: [Reenviar, Enviar correo electrónico](https://resend.com/docs/api-reference/emails/send-email)

***

## Autenticación

**PORTADOR** con una clave API de reenvío de **acceso completo** (envío + dominios + webhooks):

<Warning>
  Las claves de solo envío devuelven `401 restricted_api_key` al enumerar dominios o crear 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.

***

## Próximos pasos

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