Skip to content

Live updates API

The experimental event stream the web app uses to hear about changes, and what its events mean.

This stream is experimental. Event names and fields may change between releases. It's meant for the Avenvail web app; build on it at your own risk.

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 429 with Retry-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.

EventMeansData
readyConnected. Anything may have changed since your last connection, so refetch what you show.{}
heartbeatNothing happened; the connection is alive.{}
files.changedFiles were added, changed, moved, tagged, restored, processed or imported.fileIds, reasons
files.removedFiles were trashed or deleted.fileIds, reasons
folders.changedFolders were created, renamed, moved, trashed or restored.folderIds
runs.changedWorkflow 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.changedTags were created, renamed, merged or deleted.{}
fields.changedField definitions changed.{}
workflows.changedWorkflows were created, changed, enabled or disabled.workflowIds
quarantine.changedAn upload held by an intake workflow was quarantined, retried, released, saved, discarded or expired.fileIds, reasons
imports.changedAn import was created, scanned, made progress, finished or was canceled.importRunIds
resyncToo 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: {}