Delivery endpoint
Real-time stream
Releases pushed to you the moment we store them, with no polling loop to run.
USD release events are available without a key. Non-USD event streams require an Individual API key.
curl -N -H "X-API-Key: YOUR_API_KEY" \
"https://api.fxmacrodata.com/v1/stream/events"
import os
import requests
with requests.get(
"https://api.fxmacrodata.com/v1/stream/events",
headers={"X-API-Key": os.environ["FXMACRODATA_API_KEY"]},
stream=True,
) as response:
for line in response.iter_lines(decode_unicode=True):
if line:
print(line)
What it can do
2 routes in this endpoint
Subscribe to real-time announcement events (SSE)
Use an SSE connection for low-latency release-event delivery to browser or server clients.
GET/v1/sandbox/replay/eventsReplay past releases as a practice event stream
Use to build and test a release integration: replays real past releases as practice events with the live message shape plus replay: true, at 1x, 10x, 60x or instant speed.
Reference
Parameters and response fields
GET /v1/stream/events Subscribe to real-time announcement events (SSE)
USD release events are available without a key. Non-USD event streams require an Individual API key.
Opens a long-lived Server-Sent Events (SSE) stream. A new event is pushed to all connected clients whenever FXMacroData captures a new economic data release.
The stream payload contains event metadata and a single latest_announcement datapoint (date, val, announcement_datetime) when available. It does not include the full time-series; fetch complete history from the matching announcements endpoint after receiving an event.
Authentication: Live SSE delivery requires an active FXMacroData trial or subscription API key supplied via the `api_key query parameter or the X-API-Key` header.
Reconnection: Pass the `Last-Event-ID header (the event_id` of the last received event) to replay buffered events on reconnect.
Filtering: Use `currencies and indicators` to narrow the stream. Omit either parameter to receive all live events included in your subscription.
Payloads: `payload=compact is the default. payload=full` adds the latest announcement row fields directly to each event.
Schedule notices: Add `events=announcement,schedule_change to also receive a schedule_change frame when a publisher moves, cancels or postpones a release, or adds a time to a date-only release. The default is announcements only. A schedule notice carries no id line and is sent live only; the version history at /v1/calendar/{currency}/events/{event_id}/versions` holds every change.
WebSocket: The same events are available on `wss://api.fxmacrodata.com/v1/ws/events with the same query parameters (currencies, indicators, events, payload, last_event_id, live_only, max_age_ms) and the key in X-API-Key or api_key. Each message is JSON: connected first, then announcement, announcement_correction or schedule_change messages with type, event, id and data, a heartbeat every 15 seconds, resync_required when a cursor is no longer held, and error` before the server closes.
Parameters
| Name | In | Type | Details |
|---|---|---|---|
| currencies | query | string | Comma-separated currency codes to subscribe to, e.g. `usd,eur`. Omit to receive all live events included in your subscription. |
| indicators | query | string | Comma-separated indicator slugs, e.g. `inflation,gdp`. Omit to receive all indicators. |
| api_key | query | string | Active FXMacroData trial or subscription API key required for live delivery. Use the query parameter for browser or EventSource clients; server-side clients may use the X-API-Key header. |
| payload | query | string | Event payload shape. Use compact for the stable trigger payload or full to flatten the latest announcement row into each event. Default: compact. |
| events | query | string | Comma-separated event types: `announcement, schedule_change`. Omit to receive announcements only. |
| include | query | string | Set to `text to add a ready-to-send text object (headline and summary) to each event, and/or chart_url to add a link to the release chart image (/v1/charts/...`, fetched with your own key). Comma-separate both. Omit for the unchanged payload. |
| lang | query | string | Language of include=text: `en (default) or es`. |
| locale | query | string | Number format of include=text: es-CL, es-PE, es-UY, es-MX, es or en. |
| timezone | query | string | IANA timezone for dates and times in schedule-change text. Defaults to UTC. |
| live_only | query | boolean | Default: false. |
| max_age_ms | query | integer | |
| Last-Event-ID | header | string |
GET /v1/sandbox/replay/events Replay past releases as a practice event stream
An API key on an active trial or subscription that includes live event delivery is required. Currency-scoped keys replay only their currencies.
Replay real past releases from FXMacroData's store as a practice event stream, so an integration can be built and tested without waiting for the next live release. Messages have the same shape as /v1/stream/events and arrive in release order.
Choose what to replay. Name up to 5 currencies and optionally indicators. Give a past window with start and end (up to 31 days), or last for the last N releases (1 to 50) of each indicator. The value is the figure as first released where it is held (replay_info.value_basis=first_published), otherwise the stored figure (latest_stored).
Pace. speed=1x keeps the real gaps between releases, 10x and 60x shorten them, instant (default) sends everything at once. max_gap_seconds (0 to 3600, default 60) caps any single pause.
Output. format=sse (default) returns text/event-stream: one announcement event per release, heartbeat comments, and a final replay_complete event carrying the summary. format=json returns every message in one response. include=text with lang=en or es adds a ready-to-display text object.
Practice marker. Every message carries replay: true and replay_info with the original release times. Practice messages have no delivery receipt to acknowledge and never trigger alerts for anyone.
Access. The same as live delivery: an active trial or subscription API key that includes live events. Currency-scoped keys replay only their currencies.
Parameters
| Name | In | Type | Details |
|---|---|---|---|
| currencies | query | string | Comma-separated currency codes to replay, up to 5, for example usd or usd,mxn. Currency-scoped keys replay only their currencies. |
| indicators | query | string | Comma-separated indicator slugs, for example inflation,non_farm_payrolls. Omit to replay every announcement indicator of the currencies. |
| start | query | string | Start of a past window, as YYYY-MM-DD or an ISO 8601 UTC time. Use with end, or give last instead. |
| end | query | string | End of the window, as YYYY-MM-DD or an ISO 8601 UTC time. At most 31 days after start; defaults to seven days after start. |
| last | query | integer | Instead of a window: the last N releases (1 to 50) of each indicator. |
| speed | query | string | Replay speed: 1x keeps the real gaps between releases, 10x and 60x shorten them by that factor, instant sends everything at once. Default: instant. |
| max_gap_seconds | query | number | Longest pause between two messages, 0 to 3600 seconds (default 60), so quiet periods do not stall a 1x replay. |
| payload | query | string | Message size, as on the live stream. Default: compact. |
| format | query | string | sse (default) streams text/event-stream; json returns every message in one response at instant speed. Default: sse. |
| include | query | string | Set to text to add a ready-to-display text object to each message. |
| lang | query | string | Language of the include=text object. |
| locale | query | string | Locale for numbers and dates in the include=text object, for example es-MX. |
| api_key | query | string | Active FXMacroData trial or subscription API key required for live delivery. Use the query parameter for browser or EventSource clients; server-side clients may use the X-API-Key header. |
Response fields
| Field | Type | Details |
|---|---|---|
| replay | boolean | Always true. |
| summary | object | What one replay request sent. |
| summary.replay | boolean | Always true. |
| summary.session_id | string | One identifier per replay request. |
| summary.sent | integer | Messages sent. |
| summary.planned | integer | Messages the replay planned to send. |
| summary.skipped[] | object[] | Releases that could not be sent. |
| summary.skipped[].currency | string | Currency code of the skipped release. |
| summary.skipped[].indicator | string | Indicator slug of the skipped release. |
| summary.skipped[].date | string | Reference date of the skipped row, when known. |
| summary.skipped[].reason | string | read_failed, unusable_row or serialise_failed. |
| summary.speed | string | Replay speed: 1x, 10x, 60x or instant. |
| data[] | object[] | Every practice message, in release order. |
| data[].event_id | string | Practice event identifier, prefixed replay-. |
| data[].currency | string | Currency code. |
| data[].indicator | string | Indicator slug. |
| data[].delivery_mode | string | Always replay. |
| data[].replay | boolean | Always true on practice messages. |
| data[].replay_info | object | Replay metadata carried by every practice message. |
| data[].replay_info.original_announcement_at | string | When the release was originally scheduled to be published (ISO 8601 UTC). |
| data[].replay_info.original_published_at | string | When the publisher was confirmed to have posted the release, where recorded; otherwise null. |
| data[].replay_info.value_basis | string | first_published when the value is the figure as first released, latest_stored when only the current figure is held. |
| data[].replay_info.reference_date | string | The period the figure describes. |
| data[].replay_info.session_id | string | One identifier per replay request. |
| data[].replay_info.sequence | integer | Position of this message in the replay, from 1. |
| data[].replay_info.total | integer | Messages in the replay. |
| data[].replay_info.speed | string | Replay speed: 1x, 10x, 60x or instant. |
| data[].replay_info.window_start | string | Start of the requested window, when a window was given. |
| data[].replay_info.window_end | string | End of the requested window, when a window was given. |
| data[].replay_info.last | integer | The last-N count, when last was given. |
| data[].text | object | Ready-to-display text, when include=text. |
Works well with
Endpoints people use alongside Real-time stream
The whole API
All 24 endpoint guides
Rates and markets