Live Event Stream
The live event stream pushes a workspace's events to
your client as they are recorded. It carries the same event envelopes as
webhooks and event history, over
server-sent events
(SSE), so a browser's EventSource or any HTTP client that can read a streamed
response can consume it. Use it to keep a screen or a local copy current
without polling.
GET /api/v1/workspaces/{workspaceID}/events/stream
Like event history, the stream is a changelog for integrations and live screens, not a compliance record. Events are kept for 30 days and are deleted with their workspace.
curl -N "https://api.budgetthing.com/api/v1/workspaces/wks_3fQ0mZk8Xr2Lp9Va6Ne1Ty/events/stream?type=transaction.*" \
-H "Authorization: Bearer $BUDGETTHING_TOKEN"
Authentication and authorization
The endpoint accepts a browser session or a personal access token. OAuth access tokens are accepted only on the MCP endpoint, not here.
| Caller | Requirement |
|---|---|
| Browser session | Member of the workspace. Any role can connect. |
| Personal access token | events:read, and a workspace-restricted token must be restricted to this workspace. |
events:read only opens the stream. As in event history,
each event is delivered only if the token also holds the read scope of the
resource the event describes and the member's role may read it. A token with
events:read and tags:read receives tag events and never receives category
events; a token with events:read alone receives nothing. Event types that
event history never returns (member events, import batch events and internal
events) are never streamed.
Authorization is checked once, when the stream connects, and the set of event types is fixed for that connection. If a member is removed, their role changes or a token is revoked, an open stream can keep delivering until it closes. Streams close after at most 5 minutes (see below), which bounds this, and the reconnect is authorized again.
| Status | Meaning |
|---|---|
200 | The stream is open. |
400 | A malformed since, an unknown type, or objectType without objectId. |
401 | Not signed in. |
403 | The token lacks events:read, or is restricted to another workspace. |
404 | You are not a member of the workspace. |
429 | You already have the maximum number of open streams. Retry after the Retry-After seconds. |
Errors before the stream starts are JSON problem responses
(application/problem+json).
Filters
| Query parameter | What it does |
|---|---|
type | Only these event types. Exact names (transaction.created) and wildcards (transaction.*, *) work. Repeat the parameter for several. |
objectType and objectId | Only events about one resource. Send both or neither. |
since | Where to start (RFC 3339 timestamp), see Resuming. |
Filters narrow what you are already allowed to read. They never widen it.
Message format
Each event is one SSE message:
id: MTc5NDU0ODI4MTI4NDEyM3xldnRfN1prMXBRMm1YOQ
event: transaction.created
data: {"id":"evt_7Zk1pQ2mX9","type":"transaction.created","api_version":"2026-09-01","created_at":"2026-11-13T09:12:44.120Z","workspace_id":"wks_3fQ0mZk8Xr2Lp9Va6Ne1Ty","actor":{"type":"user","id":"usr_4aB9"},"object":{"type":"transaction","id":"txn_8Hn2"},"data":{"transaction":{"id":"txn_8Hn2"}},"correlation_id":"cor_55Fq"}
| Field | Value |
|---|---|
id | An opaque cursor. Treat it as a string and send it back as Last-Event-ID. It is not the event id. |
event | The event type, for example transaction.created. In a browser, listen with addEventListener("transaction.created", ...); the message handler does not receive named events. |
data | The event envelope, unchanged. Its id is the event id. |
The stream also sends:
retry: 3000when it opens, asking the client to reconnect after 3 seconds.- A
: pingcomment every 15 seconds so proxies keep an idle connection open. Comments are ignored byEventSource. - A
resetevent when the resume point is too old.
Delivery is at least once
The stream may deliver an event more than once, and clients must deduplicate
by the envelope's id (data.id in the JSON, evt_...). Duplicates are
expected in two cases:
- Late commits. An event's time is stamped when its transaction starts writing, but it only becomes visible when the transaction commits, so a long import or bulk edit can commit an event behind events already delivered. The stream keeps looking back over a window of the last 30 seconds so it can still deliver such an event. Within one connection each event is sent once.
- Resuming. A connection that resumes with
Last-Event-IDrescans the same 30-second window behind that cursor, because events may have committed while you were disconnected. Events from just before your cursor can come again.
Events are ordered by their time, then by id, but a late event arrives after
newer ones. Do not rely on strict ordering; use created_at and the object's
current state.
Resuming
A stream starts from the first of these that is present:
- The
Last-Event-IDheader. A browser'sEventSourcesends it by itself on reconnect, set to theidof the last message it received. - The
sincequery parameter, an RFC 3339 timestamp. Events recorded at or after it are sent first. - The current time. Nothing from the past is replayed.
The start is limited to the last 24 hours (or the retention window, if
shorter). To avoid missing events when you open a stream after fetching data,
pass a since slightly earlier than your fetch, for example 30 seconds, and
deduplicate by event id.
Reset
If the resume point is older than the 24-hour limit, the stream cannot replay
what you missed. Before it carries on from the oldest point it can serve, it
sends a reset message:
id: ...
event: reset
data: {"reason":"resume_point_expired","resumeFrom":"2026-11-12T09:12:44Z","lookbackHours":24}
On reset, discard what you assumed was complete: refetch the state you show,
or page through event history (events are kept for
30 days). The stream then continues normally, and the id of the reset
message is a valid resume point.
Lifetime and reconnecting
A stream closes by itself after at most 5 minutes. This is normal and not an
error. Reconnect, sending Last-Event-ID (a browser does this automatically),
and handle duplicates as described above. If the connection drops earlier, do
the same, waiting at least the retry interval before reconnecting.
Limits
| Limit | Value |
|---|---|
| Concurrent streams | 5 per user. More answer 429. |
| Lifetime | 5 minutes |
| Events per read | 200. A larger burst is sent back to back. |
| Poll interval | About 3 seconds, so events arrive within a few seconds of being recorded. |
| Look-back | 24 hours |
Example
const seen = new Set();
const url = `/api/v1/workspaces/${workspaceId}/events/stream?type=transaction.*`;
const source = new EventSource(url, { withCredentials: true });
source.addEventListener("transaction.created", (message) => {
const envelope = JSON.parse(message.data);
if (seen.has(envelope.id)) return; // at-least-once: dedupe by event id
seen.add(envelope.id);
refreshTransaction(envelope.object.id);
});
source.addEventListener("reset", () => refetchEverything());
EventSource cannot set an Authorization header, so it works with a browser
session. From a server, use any HTTP client that streams the response with your
token.