Bank Sync Live Events
Connecting a bank account starts its first sync within seconds. This endpoint
lets a client watch that happen: it streams one connection's status, including
each mapped account's sync state, and the imported transactions a sync stages
for review, as they appear. It uses
server-sent events
(SSE), so a browser's EventSource or any HTTP client that can read a streamed
response can consume it.
GET /api/v1/workspaces/{workspaceID}/bank-sync/connections/{connectionID}/events
The stream is read-only. It does not start a sync; use
POST .../bank-sync/connections/{connectionID}/sync for that. It also isn't a replacement for
the list endpoints: when you need the full picture, fetch it, and use the stream
to stay current.
Authentication and scope
The endpoint accepts the same credentials as the rest of the API: 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 (viewers can read) |
| Personal access token | bank-sync:read, and a workspace-restricted token must be restricted to this workspace |
| Status | Meaning |
|---|---|
200 | The stream is open. |
400 | since isn't an RFC 3339 timestamp. |
401 | No valid credentials. |
403 | The token lacks bank-sync:read, or is restricted to another workspace. |
404 | You aren't a member of the workspace, or the connection isn't in it. The two cases are indistinguishable on purpose. |
429 | You already have five open streams in this process. Close one and retry. |
Browsers' EventSource can't send an Authorization header. Use it with a
browser session (new EventSource(url, {withCredentials: true})), and read the
stream with fetch when you authenticate with a token.
Events
The response is text/event-stream. The first line is retry: 3000, which tells
an EventSource to wait three seconds before reconnecting.
connection
The connection as GET .../bank-sync/connections/{connectionID} returns it:
status, lastErrorCode and lastErrorMessage, sync timestamps, and every
external account with its mapping and syncState (idle, queued, syncing
or failed).
It is sent once as soon as the stream opens, then again only when something in it changes. An unchanged connection produces no events.
imported_transactions
New or changed rows in the connection's import inbox, in the same shape the
inbox list (GET .../bank-sync/inbox) returns, including reviewStatus and transactionId.
{
"items": [
{
"id": "bsi_8Hq2YV0mZt4NwK1xRcP6Le",
"accountId": "acc_3fQ0mZk8Xr2Lp9Va6Ne1Ty",
"date": "2026-11-10",
"amountMinor": -1200,
"payeeName": "Corner Market",
"pending": false,
"reviewStatus": "unreviewed",
"transactionId": null
}
]
}
A row is sent once per change: a later update to the same row, such as a
pending transaction that posts, is sent again. A single event carries at most
200 rows; a larger backlog arrives over consecutive events. Clients should merge
by id.
These are staged rows, not ledger transactions. A transaction only reaches the budget when it is accepted or matched in the inbox.
Heartbeat
Every 15 seconds the server writes a comment line:
: ping
It carries no data and EventSource ignores it. It keeps proxies from closing a
quiet connection.
Cursors, Last-Event-ID and since
Every connection and imported_transactions event has an id: field. It is an
opaque cursor: a position in the order rows changed. Don't parse it.
EventSource remembers the last id and sends it back as the Last-Event-ID
header when it reconnects, and the stream resumes from there, so rows aren't
replayed or missed. To resume by hand, send the header yourself.
Where a new stream starts, in order of precedence:
- A valid
Last-Event-IDheader. - The optional
sincequery parameter, an RFC 3339 timestamp such as2026-11-11T14:00:00Z. Rows changed after it are sent. - The moment the stream opened. Nothing earlier is replayed.
A cursor or since older than 24 hours is treated as 24 hours ago. An
unrecognized Last-Event-ID is ignored.
Lifetime and limits
- The server closes each stream after 5 minutes. This is normal; reconnect
with the last event ID (
EventSourcedoes so automatically). - The stream also ends if the connection is deleted.
- Each user can hold 5 concurrent streams per API process. The sixth gets
429. - The response sets
Cache-Control: no-cache, no-transformandX-Accel-Buffering: noso intermediaries don't buffer it. Changes show up within about three seconds.
Example
const url = `https://api.budgetthing.com/api/v1/workspaces/${workspaceId}/bank-sync/connections/${connectionId}/events`;
const events = new EventSource(url, {withCredentials: true});
events.addEventListener('connection', (event) => {
const connection = JSON.parse(event.data);
console.log(connection.status, connection.externalAccounts.map((a) => a.mapping?.syncState));
});
events.addEventListener('imported_transactions', (event) => {
const {items} = JSON.parse(event.data);
console.log(`${items.length} new or changed rows`);
});
With a token, from a script:
curl -N https://api.budgetthing.com/api/v1/workspaces/wks_3fQ0mZk8Xr2Lp9Va6Ne1Ty/bank-sync/connections/bsc_5Jd8WmQ2LrT7YaNc0Xe4Hu/events \
-H "Authorization: Bearer $BUDGETTHING_TOKEN" \
-H "Accept: text/event-stream"
retry: 3000
id: MTc5NDc2ODQwMDAwMDAwMHw
event: connection
data: {"id":"bsc_5Jd8WmQ2LrT7YaNc0Xe4Hu","status":"connected","externalAccounts":[...]}
: ping