Docs / Developer

Real-time SSE events

Every TokenOne Delivery® project broadcasts a Server-Sent Events stream. Subscribe to see live updates · routing decisions, stage flips, connector connects, presence heartbeats · without polling.

Connecting

GET /api/tokenone/projects/:id/events
Accept: text/event-stream
Authorization: Bearer <jwt>   (via cookie or browser)

# Initial frame:
event: connected
data: { "projectId": "...", "at": "2026-04-19T22:34:12.000Z" }

# Heartbeat every 25s:
: heartbeat 1745099652000

Event types

  • stage.changed · build ↔ live flip
  • archive.changed
  • connector.connected / connector.disconnected
  • member.invited / member.removed
  • llm.call · proxy call completed (provider, model, debit, savings)
  • presence.heartbeat · a user is active on the project right now

Frame shape

{
  "type": "llm.call",
  "projectId": "uuid",
  "tenantId": "uuid",
  "actorUserId": "uuid | null",
  "at": "2026-04-19T22:34:12.000Z",
  "payload": { /* event-specific */ }
}

Client example

const source = new EventSource(
  'https://api.tokenone.io/api/tokenone/projects/<id>/events',
  { withCredentials: true },
);
source.addEventListener('llm.call', (ev) => {
  const evt = JSON.parse(ev.data);
  console.log('Saved', evt.payload.savingsTokens, 'tokens');
});
source.addEventListener('stage.changed', (ev) => {
  const evt = JSON.parse(ev.data);
  console.log('Project stage:', evt.payload);
});

Scale

v1 is single-process. Multiple API replicas don’t yet share SSE state · a client only sees events fired on the replica it connected to. v2 fans out via Redis pub/sub behind the same endpoint contract.