AsyncAPI 2.6 description of InstantDB's **realtime sync** surface. Unlike a request/response REST API, InstantDB is a sync engine. The client SDK's **Reactor** opens a persistent WebSocket connection to `wss://api.instantdb.com/runtime/session` and exchanges JSON messages with the server's session manager. Each message is a JSON object whose `op` field names the operation. The client sends ops such as `init`, `add-query`, `remove-query`, `transact`, `set-presence`, `join-room`, `leave-room`, and `client-broadcast`; the server replies with and pushes ops such as `init-ok`, `add-query-ok`, `refresh-ok`, `transact-ok`, `patch-presence`, `refresh-presence`, `server-broadcast`, and `error`. The server tails the Postgres write-ahead log to detect novelty, then invalidates and re-pushes affected queries to subscribed clients via `refresh-ok` without any client polling. This is a genuine bidirectional WebSocket transport (RFC 6455), not HTTP Server-Sent Events. The companion server-side HTTP Admin API (POST /admin/query, POST /admin/transact, auth, storage) is modeled in `openapi/instantdb-openapi.yml`.
Operations the client Reactor sends to the sync server.
The single multiplexed WebSocket channel for an Instant app session. The client publishes operation messages (init, add-query, transact, presence, room, broadcast) and subscribes to the server's acknowledgements and pushed novelty. Messages are correlated with a client-generated `client-event-id`.
Messages
✉
Init
Initialize session
Authenticate and open the session.
✉
AddQuery
Subscribe to a query
Register an InstaQL query for live updates.
✉
RemoveQuery
Unsubscribe from a query
✉
Transact
Apply a transaction
Send InstaML transaction steps over the socket.
✉
JoinRoom
Join a presence room
✉
LeaveRoom
Leave a presence room
✉
SetPresence
Set presence data
Publish this client's ephemeral presence into a room.
✉
ClientBroadcast
Broadcast a topic message
Send an ephemeral topic event to others in a room.
✉
InitOk
Session initialized
✉
AddQueryOk
Query registered
Acknowledges a query subscription and returns initial results.
✉
RefreshOk
Query novelty pushed
Server-pushed updated results when underlying data changes.
✉
TransactOk
Transaction committed
✉
JoinRoomOk
Room joined
✉
PatchPresence
Presence patch
Incremental presence change for peers in a room.
✉
RefreshPresence
Full presence refresh
Full presence snapshot for a room.
✉
ServerBroadcast
Broadcast received
A topic event broadcast by another client in the room.
✉
ErrorMessage
Error
An error tied to a prior client op (by client-event-id).
Servers
wss
runtimeapi.instantdb.com/runtime/session
InstantDB realtime sync endpoint. The client Reactor connects here over a secure WebSocket (wss://) and authenticates within the `init` message by sending the app id and a refresh token. All subsequent query subscriptions, transactions, presence, and broadcasts flow over this single connection.
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.