Skip to content

9Login API: events#

Get told about changes over a WebSocket instead of asking again and again.

Open a WebSocket to /v1/events?key=<key> (an Authorization header works too) to be told about changes instead of polling. Each message is one JSON text frame { "type", "ts", "data" }.

Send the text ping to get a pong. Send text frames only: a binary frame closes the connection.

Type Data
profile.status { id, phase, state }: a profile started, stopped, crashed...
profile.created { ids }: new profiles, from the API, the app or another machine
profile.updated { ids }: changed profiles, from the API, the app or another machine. A change to the fingerprint alone (regenerate-fp, ua-upgrade) is sent only when made on this machine
profile.deleted { ids }: removed profiles
job.done the finished job, as GET /v1/jobs/{id} returns it
task.run.started a task run began (schedule, Run now or run_task), as GET /v1/task-runs/{id} returns it without profiles
task.run.done a task run ended or was cancelled, with its counts
app.exiting {}: 9Login is closing or updating; the API goes away
const ws = new WebSocket("ws://127.0.0.1:37286/v1/events?key=YOUR_API_KEY");
ws.onmessage = (e) => console.log(JSON.parse(e.data));