Skip to content
open.rooms
open.rooms

The HTTP API

The routes createRooms answers, for a client written in something else. Paths are relative to mount (default /rooms). Bodies and answers are JSON. A failure is a non-2xx status with { "error": "words for the person" }.

RouteDoes
POST /Open a room. Body { options, settings? }. Answers 201 { id }. 403 if allow refused.
GET /<id>The public room, with seat (this browser's, or null) and now (the server's clock in ms).
POST /<id>/sit{ seat, name }. Sets the rooms_player cookie if the browser has none. Name is cut to 20 characters.
POST /<id>/standGive up the seat, before the game starts.
POST /<id>/bot{ seat, name?, add? }. Add a bot (or remove it with add: false), before the game starts.
POST /<id>/settings{ settings }. Change the table's settings.
POST /<id>/startDeal.
POST /<id>/act{ move }. Send a move.
POST /<id>/say{ text }. Say something. Answers the message.

The room's documents are served by the sync stream at syncMount (default /_zb/sync), which is what onRoom, onView and onChat follow.

Statuses#

StatusWhen
400A move that act refused (with its message), a seat that does not exist, or a chat message that was not accepted.
403No seat yet ("Take a seat first."), or beforeSay turned the message away.
404No such table, or an unknown route.
409The seat is taken, the game has started or has not started, or the seats are locked.
410The table was closed; the body says why.
423The game is paused by the server's admin; the body says why. Chat still works.
429Chat faster than about one message every 400 ms.

Everything except opening a room and reading it needs the seat's cookie. A request with no seat gets 403.

View this page's source