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

# Events

> The Routa log of normalized events: format, types, versioning and how to consume them safely.

Every relevant change produces an **event**: an immutable fact about a resource. Webhooks, the dashboard and usage metering all read from this same log. You consume events in two ways:

* **Webhooks:** Routa sends each event to your HTTPS endpoint. See [Webhooks](https://docs.routa.chat/en/webhooks/overview.md).
* **Querying:** `GET /v1/events` lists events and is the reconciliation path if you missed deliveries.

## The event object

```json theme={null}
{
  "id": "evt_01J8ZK9M3Q7X...",
  "type": "message.delivered",
  "api_version": "v1",
  "schema_version": 1,
  "project_id": "proj_01J8...",
  "external_ref": null,
  "sequence": 918273,
  "occurred_at": "2026-09-04T13:22:41.031Z",
  "recorded_at": "2026-09-04T13:22:41.244Z",
  "data": {
    "id": "msg_01J8...",
    "channel": "chan_01J8...",
    "direction": "outbound",
    "status": "delivered",
    "...": "..."
  }
}
```

| Field | Description |
| - | - |
| `id` | Global event ID. This is the **deduplication key**, and it stays the same on redeliveries. |
| `type` | Type in the format `resource.past_tense_action`. |
| `api_version` | Version of the public format of the resource in `data`. Today, `v1`. |
| `schema_version` | Version of the event envelope. Today, `1`. |
| `project_id` | Project that owns the event. |
| `external_ref` | The ID a partner gave to a customer's project, or `null` on an ordinary project. Always present. See [Partners](https://docs.routa.chat/en/partners/overview.md). |
| `sequence` | Monotonic number, useful to detect gaps. It is **not** a promise of delivery order. |
| `occurred_at` | When the fact happened. |
| `recorded_at` | When Routa recorded the event. |
| `data` | The **full resource in its current state**, not a diff. |

Because `data` carries the full resource, a consumer that processes only the latest event of each resource converges on the correct state.

## Event types

| Type | When it happens | `data` |
| - | - | - |
| `message.accepted` | Routa accepted a message you sent. | [Message](https://docs.routa.chat/en/concepts/messages.md) |
| `message.sent` | The provider accepted the message. | Message |
| `message.delivered` | Delivery to the recipient was confirmed. | Message |
| `message.read` | The recipient read the message. | Message |
| `message.failed` | The message failed for good. | Message |
| `message.received` | A message arrived from a customer. | Message |
| `channel.status_changed` | The status of a channel changed. | `channel_id`, `status`, `previous_status`, `connection_mode`, and sometimes `reason` and `disconnection_reason` |
| `template.submitted` | A template was sent for approval. | [Template](https://docs.routa.chat/en/concepts/templates.md) |
| `template.pending` | The template is under review. | Template |
| `template.approved` | The template was approved. | Template |
| `template.rejected` | The template was rejected. | Template |
| `template.paused` | The provider paused the template. | Template |
| `template.disabled` | The provider disabled the template. | Template |
| `template.failed` | Routa could not send the template to the provider. | Template |
| `template.category_changed` | The provider changed the category of the template. | Template, plus `previous_category` |
| `template.updated` | A `failed` or `rejected` template was edited and sent for review again. | Template |
| `template.deleted` | A template was removed. | Template, in its last state |

See the details of each type in [Event types](https://docs.routa.chat/en/webhooks/event-types.md).

> [!NOTE]
>
> New event types can appear at any time. That is why each webhook endpoint subscribes to an explicit list of types (`message.delivered`, for example) or to a per-resource wildcard (`message.*`). Ignore types your code does not recognize.

## Delivery semantics

Delivery is **at least once**, with **no global ordering guarantee**. Your consumer needs to:

**1. Deduplicate by id**

Store the `id` of the events you already processed (a set with a 24-hour TTL is usually enough) and ignore repeats.

**2. Ignore the unknown**

Ignore event types and fields you do not recognize.

**3. Treat the status as monotonic**

Never downgrade a message from `read` to `sent` just because an older event arrived later. Compare the `status` or use `occurred_at`.

The official SDK already helps with this: events of unknown types are parsed as a generic event instead of raising an error. See [Webhooks in the SDK](https://docs.routa.chat/en/sdk/webhooks.md).

## Query missed events

If your server was down, you do not need to ask support for a replay. List the events from the last one you processed:

```bash cURL theme={null}
curl "https://api.routa.chat/v1/events?after=evt_01J8...&type=message.failed&limit=100" \
  -H "Authorization: Bearer $ROUTA_API_KEY"
```

```ts Node.js theme={null}
for await (const event of routa.events.list({ after: 'evt_01J8...' })) {
  console.log(event.type)
}
```

The cursor is the event ID itself (`after`). The response carries `has_more` and `next_cursor`. See [`GET /v1/events`](https://docs.routa.chat/en/api-reference/endpoint/events/list) and [Reconcile events](https://docs.routa.chat/en/webhooks/reconciliation.md).

## Retention

Events are available for **90 days**.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.