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

# Webhook Events

> Get notified on your server when email is sent, delivered, opened, clicked, fails, or is marked as spam.

<Tip>
  With the API you **ask**; with webhooks Notifique **tells you**. Great for marking orders delivered, measuring opens, or suppressing complainers, without polling.
</Tip>

## In brief

* Every delivery is a **POST** `application/json` to your registered URL.
* `email.*` events are **email only**, WhatsApp uses `message.*`, SMS uses `sms.*`.
* `instanceId` is **empty** (email does not use an instance).
* Enable **only** the events your integration needs.
* Respond **2xx quickly**; heavy processing goes to your queue.

General setup: [Webhooks](/en/guides/webhooks/index). Security (HMAC signature): [Webhook security](/en/guides/webhooks/seguranca).

***

## How the POST looks

```json theme={null}
{
  "event": "email.delivered",
  "workspaceId": "clxx123...",
  "instanceId": "",
  "timestamp": "2025-02-10T14:30:00.000Z",
  "data": {
    "emailId": "clxx456...",
    "to": "customer@example.com",
    "from": "noreply@yourdomain.com",
    "status": "DELIVERED",
    "deliveredAt": "2025-02-10T14:30:05.000Z"
  }
}
```

| Field         | Description                                           |
| ------------- | ----------------------------------------------------- |
| `event`       | Event name (e.g. `email.delivered`)                   |
| `workspaceId` | Workspace ID                                          |
| `instanceId`  | Always empty for email                                |
| `timestamp`   | ISO 8601, use for anti-replay                         |
| `data`        | Send fields (`emailId`, `to`, `from`, `status`, etc.) |

Headers: `X-Notifique-Signature`, `X-Notifique-Timestamp`, `X-Workspace-Id`, `X-Webhook-Event`.

***

## What your server should return

| Response                | Effect                               |
| ----------------------- | ------------------------------------ |
| **2xx** within \~10s    | Event delivered; removed from queue  |
| **4xx / 5xx / timeout** | Automatic retry (5 min, 30 min, 2 h) |

<Note>
  Slow processing? Return **200** immediately and process in the background. Above \~10 s counts as timeout and the event may be resent.
</Note>

Validate `X-Notifique-Signature` and a recent timestamp. Details: [Webhook security](/en/guides/webhooks/seguranca).

***

## Event reference

Use these events when integrating **e-commerce, ERP, or automation** with email.

### Send and engagement

| Event              | When it fires                            | What to do with it   |
| ------------------ | ---------------------------------------- | -------------------- |
| `email.sent`       | Email accepted and sent                  | Mark as sent         |
| `email.delivered`  | Provider confirmed inbox delivery        | Confirm delivery     |
| `email.opened`     | Recipient opened (first tracked open)    | Engagement, hot lead |
| `email.clicked`    | Click on a tracked link in the email     | Conversion, funnel   |
| `email.failed`     | Bounce or send error                     | Clean list, alert    |
| `email.complained` | Marked as spam                           | Suppress address     |
| `email.cancelled`  | Scheduled send cancelled before dispatch | Update campaign      |

***

## Payload per event

Full POST body. The envelope (`event`, ids, `timestamp`) matches the example above; below is what changes in `data`.

<AccordionGroup>
  <Accordion title="email.sent">
    ```json theme={null}
    {
      "event": "email.sent",
      "workspaceId": "clxx123...",
      "instanceId": "",
      "timestamp": "2025-02-10T14:29:00.000Z",
      "data": {
        "emailId": "clxx456...",
        "to": "customer@example.com",
        "from": "noreply@yourdomain.com",
        "subject": "Order confirmation",
        "status": "SENT",
        "sentAt": "2025-02-10T14:29:00.000Z"
      }
    }
    ```
  </Accordion>

  <Accordion title="email.delivered">
    ```json theme={null}
    {
      "event": "email.delivered",
      "workspaceId": "clxx123...",
      "instanceId": "",
      "timestamp": "2025-02-10T14:30:00.000Z",
      "data": {
        "emailId": "clxx456...",
        "to": "customer@example.com",
        "from": "noreply@yourdomain.com",
        "status": "DELIVERED",
        "deliveredAt": "2025-02-10T14:30:05.000Z"
      }
    }
    ```
  </Accordion>

  <Accordion title="email.opened">
    Fires on the **first** tracked open for this send.

    ```json theme={null}
    {
      "event": "email.opened",
      "workspaceId": "clxx123...",
      "instanceId": "",
      "timestamp": "2025-02-10T14:35:00.000Z",
      "data": {
        "emailId": "clxx456...",
        "to": "customer@example.com",
        "from": "noreply@yourdomain.com",
        "status": "OPENED",
        "openedAt": "2025-02-10T14:35:00.000Z"
      }
    }
    ```
  </Accordion>

  <Accordion title="email.clicked">
    Fires on the **first** click on a tracked link (or assigned short link).

    ```json theme={null}
    {
      "event": "email.clicked",
      "workspaceId": "clxx123...",
      "instanceId": "",
      "timestamp": "2025-02-10T14:36:00.000Z",
      "data": {
        "emailId": "clxx456...",
        "to": "customer@example.com",
        "from": "noreply@yourdomain.com",
        "status": "CLICKED",
        "clickedAt": "2025-02-10T14:36:00.000Z"
      }
    }
    ```
  </Accordion>

  <Accordion title="email.failed">
    ```json theme={null}
    {
      "event": "email.failed",
      "workspaceId": "clxx123...",
      "instanceId": "",
      "timestamp": "2025-02-10T14:29:30.000Z",
      "data": {
        "emailId": "clxx456...",
        "to": "customer@example.com",
        "from": "noreply@yourdomain.com",
        "status": "FAILED",
        "failedAt": "2025-02-10T14:29:30.000Z",
        "errorMessage": "bounce_hard"
      }
    }
    ```
  </Accordion>

  <Accordion title="email.complained">
    Best practice: add `to` to a suppression list when you receive this event.

    ```json theme={null}
    {
      "event": "email.complained",
      "workspaceId": "clxx123...",
      "instanceId": "",
      "timestamp": "2025-02-10T15:00:00.000Z",
      "data": {
        "emailId": "clxx456...",
        "to": "customer@example.com",
        "from": "noreply@yourdomain.com",
        "status": "COMPLAINED",
        "complainedAt": "2025-02-10T15:00:00.000Z"
      }
    }
    ```
  </Accordion>

  <Accordion title="email.cancelled">
    ```json theme={null}
    {
      "event": "email.cancelled",
      "workspaceId": "clxx123...",
      "instanceId": "",
      "timestamp": "2025-02-10T12:00:00.000Z",
      "data": {
        "emailId": "clxx456...",
        "to": "customer@example.com",
        "from": "noreply@yourdomain.com",
        "status": "CANCELLED"
      }
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Next steps

* [Quick Start](/en/emails-api/como-funciona/quick-start): first send
* [Introduction](/en/emails-api/como-funciona/introducao): status lifecycle
* [Scopes](/en/emails-api/como-funciona/escopos-da-api-key): key permissions
* [Webhooks (general guide)](/en/guides/webhooks/index)
