Studio presence API
How to use it from the Studio: Work on a screen with other engineers.
Each Studio tab reports which screen it has open; the server answers who is on the screens the caller may read and who holds each screen’s editing lock. The lock is advisory: it never changes a screen nor a save. The guard against lost updates stays the save’s revision check (If-Match; a save from an older revision is 409 stale).
Editions: every edition, Free included.
Who may call
Section titled “Who may call”| Route | Who |
|---|---|
GET /api/studio/presence |
any signed-in person |
POST /api/studio/presence (heartbeat) |
any signed-in person with the read right on the screen named; “editing” is recorded only with the edit right |
POST /api/studio/presence/lock, POST /api/studio/presence/takeover |
the edit right on the screen |
POST /api/studio/presence/release |
any signed-in person, for their own tab |
- Read right on a screen: the screen’s read permission and its Required Access Level, as the Studio’s own read of the screen (a Lead_Engineer or above is not held back by the access level).
- Edit right on a screen: Lead_Engineer or above (the Studio’s write level), the screen’s write permission (a write deny on the screen is honoured) and its read right.
- The AI co-pilot account and API tokens are refused on every route:
403 {"code": "ai_copilot_refused"}. They never appear and never hold a lock. - A refusal of the lock or a take-over for lack of the edit right is
403and is journaled in the security audit asPERMISSION_DENIED.
A session is the tab’s own id, drawn by the tab: 8 to 64 letters, digits, - or _. Screen and project ids are at most 200 characters without control characters; a screen id has no / or \. A bad value is 400 {"status": "invalid"}. Bodies are JSON, at most 4 KiB.
GET /api/studio/presence[?session=<id>]
Section titled “GET /api/studio/presence[?session=<id>]”Who is on the screens the caller may read, each screen’s lock, and, with session=, that tab’s lock flags and waiting notices. A screen the caller may not read is not in the answer, nor who is on it.
{ "screens": { "filler": { "people": [ {"user": "mkeller", "name": "Marc Keller", "state": "editing", "project": "line1"}, {"user": "sduval", "name": "Sophie Duval", "state": "viewing", "you": true, "project": "line1"} ], "lock": {"user": "mkeller", "name": "Marc Keller", "since": "2026-11-08T09:14:02Z"} } }, "notices": [], "now": "2026-11-08T09:20:11Z", "heartbeat_s": 15, "gone_s": 60, "idle_s": 120, "lock_idle_s": 600}| Field | Meaning |
|---|---|
screens |
per screen id: people and, when someone holds it, lock |
people[] |
user, name, state (editing, viewing, idle), you (the caller), project. A person’s tabs on one screen count once, in the busiest state. Sorted by name. |
state |
editing: unsaved edits reported, or this tab holds the lock; idle: nothing done for idle_s seconds; otherwise viewing |
lock |
user, name, since; mine: the calling tab holds it; you: the caller holds it, maybe in another tab |
notices |
the calling tab’s notices, each given once: screen, kind (taken_over, expired), by and by_user (who took over), at |
heartbeat_s, gone_s, idle_s, lock_idle_s |
the timings: a heartbeat every 15 s; a tab is gone after 60 s without one; idle after 2 min; a lock ends after 10 min idle |
POST /api/studio/presence
Section titled “POST /api/studio/presence”A tab’s heartbeat, sent every 15 s and on a change:
{"session": "tab-k3j9x0a7q2m5n8p1r4s6", "project": "line1", "screen": "filler", "editing": true, "active": true}| Field | Meaning |
|---|---|
session |
the tab’s id (required) |
project, screen |
what the tab has open; an empty screen removes the tab (no screen open) |
editing |
the tab has unsaved edits; ignored without the edit right |
active |
the person did something since the last heartbeat |
Answer 200: the same view as GET, plus screen and may_edit (whether the caller has the edit right on it, which the Studio uses to offer Take over). Opening another screen gives up the tab’s lock on the previous one.
| HTTP | When |
|---|---|
403 |
the caller may not read screen (not recorded) |
503 presence_full |
the server already tracks 4,096 tabs |
POST /api/studio/presence/lock
Section titled “POST /api/studio/presence/lock”{"session", "screen", "project"?}: take the screen’s lock when it is free, or keep it when this tab already holds it. The Studio sends it on the first unsaved edit.
| HTTP | Answer |
|---|---|
200 |
{"status": "locked_by_you", "screen", "lock"} |
409 |
{"status": "locked", "screen", "error": "<name> is editing this screen", "holder": {"user", "name", "since", "you"}} |
403 |
no edit right on the screen |
409 ha_standby, 503 ha_no_quorum |
an HA standby, or a primary without quorum |
POST /api/studio/presence/takeover
Section titled “POST /api/studio/presence/takeover”{"session", "screen", "confirm": true, "reason"?, "project"?}: take the lock from its holder. reason is optional, at most 500 characters kept.
- The edit right on the screen is checked (
403), thenconfirm: true(400 confirm_required), then the HA state (as for the lock). - When another tab holds the lock, the take-over is recorded in the audit trail first: category
SCREEN, actionSCREEN_EDIT_TAKEOVER, resource the screen id, old value the previous holder’s username, new value the caller’s, the reason when given. When the record cannot be written, the answer is503 {"status": "refused", "code": "AUDIT_NOT_WRITTEN"}and nothing changes. - The lock moves to the calling tab, and the previous holder’s tab gets a
taken_overnotice.
Answer 200: {"status": "locked_by_you", "screen", "taken_over", "lock", "previous"}. taken_over is false (and nothing is recorded) when the lock was free; previous is the former holder.
A take-over never touches the stored screen or its revision. The previous holder’s unsaved edits stay in their browser.
POST /api/studio/presence/release
Section titled “POST /api/studio/presence/release”{"session", "screen"}: give up the tab’s lock on screen (only the tab’s own lock is released). Without a screen, the tab leaves: its presence, lock and notices are removed. The Studio sends it when a tab closes. Answer 200 {"status": "released"}.
When a lock ends
Section titled “When a lock ends”A lock ends when its tab opens another screen, releases it, leaves, is gone (60 s without a heartbeat), or has been idle for 10 minutes; the last gives the tab an expired notice.
- Refusal
Read as text
A screen's editing lock is free until someone makes the first unsaved change, which gives that person the lock; everyone else then sees the screen read-only. The lock ends when its holder opens another screen, closes the tab, stops reporting for 60 seconds or does nothing for 10 minutes. Someone with the right to edit the screen can take over after a confirmation: the take-over is written to the audit trail first, and refused if that record cannot be written. The previous holder turns read-only and can save their changes as a copy or discard them.
States
- Free (state): nobody is editing
- Held by A (state): everyone else: read-only, "A is editing"
- Held by B (state): A: read-only, Save as copy or Discard
Transitions
- Start → Free (transition)
- Free → Held by A (transition): A's first unsaved change. Only someone with the right to edit the screen takes the lock. Another tab that asks while A holds it is answered "A is editing" and opens the screen read-only.
- Held by A → Free (transition): lock ends. A opens another screen or leaves it, closes the tab, is gone (60 seconds without reports), or does nothing for 10 minutes.
- Held by A → Held by B (transition): B: Take over, confirmed; SCREEN_EDIT_TAKEOVER first. B needs Lead_Engineer or above, the screen's write permission and its read right. The audit record is written before the lock moves. A is told and keeps the unsaved changes in the browser.
- Held by A → Held by A (refusal): take-over refused: no right, or no record. Without the right to edit the screen, or when the audit record cannot be written (or on an HA standby), the take-over is refused and the lock stays with A.
- Held by B → Free (transition): lock ends. As for A.
Live updates
Section titled “Live updates”After a change the server sends {"type": "STUDIO_PRESENCE_CHANGED"} on the Studio’s WebSocket. The message carries no content: each Studio then reads GET /api/studio/presence with its own rights.
HA clusters and remote sessions
Section titled “HA clusters and remote sessions”- The state is in memory on the server that answers, not replicated. On an HA cluster the Studio edits on the primary; a standby, or a primary without quorum, refuses the lock and the take-over. After a restart or a failover, presence rebuilds from the next heartbeats.
- Through an eaxCloud remote session,
GETis a view (V) route; the heartbeat, lock, take-over and release are engineer (E) routes, so a remote viewer does not appear.