---
title: "Events API Reference | Narwhal API"
description: "Read the Events API reference for durable event history and WebSocket delivery with replay cursors. Find how events are delivered and replayed."
url: "https://narwhalapi.com/docs/api/events"
---

# Events API reference

Durable event journal, replay cursors and live WebSocket delivery

## REST journal

`GET /v1/events` returns a cursor page. `GET /v1/events/{event_id}` returns one eligible immutable event. For `GET /v1/events`, repeat `countries` to filter by up to 50 ISO alpha-3 codes. `EMU`, the euro area, is also accepted; no other union id is. `limit` is 1–100 (default 100). Pass `cursor` to resume after the last event you processed. The response contains `events`, `next_cursor` and `cursor` (the journal's latest position, where a new poller starts). Pass `next_cursor` as `cursor` for the next page, even on the last nonempty page. It is `null` only on an empty poll at the journal's latest position. `GET /v1/events/{event_id}` returns the event itself. A field with no value is left out of an event. An unknown `event_id` returns `404 event_not_found`. An expired cursor returns `409 cursor_expired`: restart without it.

## Event fields

Each event has these fields.

| Field | Meaning |
| --- | --- |
| `cursor` | `cursor` is an opaque journal position. Store it and pass it back unchanged. |
| `event_id` | `event_id` is the stable event ID. |
| `type` | `type` is the event type listed below. |
| `family` | `family` is one of `gdp`, `prices`, `labour`, `trade`, `policy_rate`, `activity`, `survey`, `housing`, `money`, `public_finance`, `yield_curve` or `holidays`. |
| `country` | `country` is an ISO alpha-3 code, or `EMU` for the euro area. |
| `recorded_at` | `recorded_at` is when the event was recorded, in UTC without fractional seconds, such as `2026-10-21T09:00:00Z`. |
| `resource_id / resource_version` | `resource_id` and `resource_version` identify the changed resource and its version; `resource_version` is the `version_id` used to read that version of the data. `resource_id` is left out on release events. |
| `release_id` | `release_id` identifies the calendar release. It is left out when the event has no release. |
| `holiday_year / holiday_generation` | For holiday events, `holiday_year` and `holiday_generation` give the calendar's year and generation, and `country` is its country. The holiday year and generation are left out on other events. |

## WebSocket stream

Connect to `/v1/events/stream` with your API key in the `Authorization: Bearer` header. Servers and apps always connect this way; stream tickets (`POST /v1/events/stream-ticket`) are for the Narwhal website only. Every account can connect, and each connection costs one call. Subscribe with country, family, event-type and cursor filters. The server sends `ready`. Send `subscribe` as the first frame within 5 seconds. Empty `countries`, `families` or `event_types` lists select all eligible values for that filter. Client frames are capped at 2,048 bytes. The server replies with `subscribed`, then sends event objects, `heartbeat` and `pong` frames. Each carries a `cursor`. A second subscribe message closes the connection with `resubscribe_required`. Subscribe with up to 60 `countries`, 12 `families` and 9 `event_types`. Errors arrive as `{"type":"error","code":"..."}`. Codes: `stream_limit`, `rate_limited`, `subscribe_required`, `quota_unavailable`, `unauthorized`, `slow_consumer`, `feed_unavailable`, `revoked`, `resubscribe_required`, `command_limit`, `invalid_command`, `invalid_frame`, `cursor_expired`, `cursor_future` and `shutdown`. When the account already has its maximum number of concurrent stream connections, the stream sends `{"type":"error","code":"stream_limit"}` and closes, as with the prices and predictions streams.

| Code | Meaning |
| --- | --- |
| `subscribe_required` | No subscribe frame was sent within 5 seconds. |
| `quota_unavailable` | The connection could not be charged to the account's credit. |
| `unauthorized` | The API key or stream ticket is missing or invalid. |

`cursor_expired` means the replay cursor is outside retained history. Restart without it and rebuild from current snapshots. `cursor_future` means the cursor is ahead of the journal. Use a cursor returned by the server.

First frame

```
{
  "action": "subscribe",
  "countries": [],
  "families": [],
  "event_types": []
}
```

An event frame is the event object itself, as in this example.

Event frame

```
{
  "cursor": "1",
  "event_id": "2cdf117d-0000-4000-8000-000000000001",
  "type": "dataset.published",
  "country": "MEX",
  "family": "labour",
  "resource_id": "775d11a3-0000-4000-8000-000000000001",
  "resource_version": "822e107c-0000-4000-8000-000000000001",
  "recorded_at": "2026-09-25T15:44:56Z"
}
```

## Event types

The REST journal and WebSocket stream carry the event types below. Backfills and identical repeats emit no event; replay preserves each event's pinned publication version.

| Event type | Meaning |
| --- | --- |
| `release.rescheduled` | When a scheduled release moves to a new date or time |
| `release.cancelled` | When a scheduled release is cancelled |
| `release.updated` | When a calendar release carries a figure it did not carry before |
| `dataset.published` | When an accepted official publication adds a new reference period |
| `dataset.revised` | When an accepted publication changes a previously published period's value |
| `yield_curve.published` | When a new yield-curve date is accepted |
| `yield_curve.revised` | When a published yield-curve date changes |
| `holiday.calendar.revised` | When a published holiday calendar changes |

## Recovery

Persist the last acknowledged cursor. Reconnect with it to replay the gap before live delivery resumes. Expired cursors, slow consumers and revoked rights close with an explicit error and resume cursor.

Was this page helpful?
