Live updates API
The experimental event stream the web app uses to hear about changes, and what its events mean.
The web app opens GET /api/v1/events, a Server-Sent Events stream that says what changed, never what it now contains. After an event, fetch the current state through the normal API.
Who can connect
- Only a signed-in browser session, from the same origin. API tokens are refused, and credentials in the URL are ignored.
- You only ever hear about your own files and runs, administrators included.
- Each user can have 8 streams open, and the server 500. Past that the request gets
429withRetry-After; open streams are never closed to make room. - A stream ends when you sign out of that session, change your password, are disabled or deleted, after 30 minutes, or when the sign-in expires. Browsers reconnect on their own.
Events
Every event's data is a JSON object. Ignore events and fields you don't know.
| Event | Means | Data |
|---|---|---|
ready | Connected. Anything may have changed since your last connection, so refetch what you show. | {} |
heartbeat | Nothing happened; the connection is alive. | {} |
files.changed | Files were added, changed, moved, tagged, restored, processed or imported. | fileIds, reasons |
files.removed | Files were trashed or deleted. | fileIds, reasons |
folders.changed | Folders were created, renamed, moved, trashed or restored. | folderIds |
runs.changed | Workflow runs started, made progress, changed state or finished, or an event was handled without starting one. fileIds is only set when a run's state changed. | runIds, workflowIds, fileIds, reasons |
tags.changed | Tags were created, renamed, merged or deleted. | {} |
fields.changed | Field definitions changed. | {} |
workflows.changed | Workflows were created, changed, enabled or disabled. | workflowIds |
quarantine.changed | An upload held by an intake workflow was quarantined, retried, released, saved, discarded or expired. | fileIds, reasons |
imports.changed | An import was created, scanned, made progress, finished or was canceled. | importRunIds |
resync | Too much changed to list. Refetch everything you show. | {} |
Changes are collected for about a quarter second and sent together, with ids listed once. reasons are hints such as created, updated, moved, tagged, fields, attachments, restored, processed, imported, trashed and deleted, and for quarantine quarantined, retried, released, saved, discarded and expired. Their order means nothing.
Events have no ids and are not replayed. An event can be missed, for example while reconnecting, which is why every connection starts with ready.
Example
event: ready
data: {}
event: files.changed
data: {"fileIds":["0193b0c4-5e1a-7c2d-9a4f-3b8e6d2c1f00"],"reasons":["created"]}
event: heartbeat
data: {}