@zaisma/game-server 1.35.0 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bench/glass.js +34 -21
- package/package.json +1 -1
- package/src/room.d.ts +8 -3
- package/src/room.js +9 -4
package/bench/glass.js
CHANGED
|
@@ -9231,15 +9231,20 @@ var GAME_SERVER_OPTIONS = [
|
|
|
9231
9231
|
];
|
|
9232
9232
|
var GAME_SERVER_LIMITS = {
|
|
9233
9233
|
/**
|
|
9234
|
-
* Every file of the game server together, code and data files.
|
|
9235
|
-
*
|
|
9234
|
+
* Every file of the game server together, code and data files. The data files stream from storage straight into the
|
|
9235
|
+
* game server's own memory (maximumMemorySizeBytes), so this leaves half of it for the runtime and the rooms' state.
|
|
9236
9236
|
*/
|
|
9237
|
-
maximumSizeBytes:
|
|
9237
|
+
maximumSizeBytes: 64 * 1024 * 1024,
|
|
9238
|
+
/**
|
|
9239
|
+
* The code alone (.js, .json and .wasm): a room holds it in its memory (128 MB, shared with other rooms) while it hands
|
|
9240
|
+
* it to the sandbox, so this is what a room carries safely.
|
|
9241
|
+
*/
|
|
9242
|
+
maximumCodeSizeBytes: 32 * 1024 * 1024,
|
|
9238
9243
|
/** Files in the zaisma-server/ folder: each is read once whenever a copy of the game server loads. */
|
|
9239
9244
|
maximumFileCount: 500,
|
|
9240
9245
|
/** CPU for one call: a tick with the messages since the last one, a join, a request, a schedule's run. */
|
|
9241
9246
|
maximumCallCpuDurationMs: 50,
|
|
9242
|
-
/** CPU for one start: loading the game server, setup, onRestored, and a real-time room's first tick after
|
|
9247
|
+
/** CPU for one start: loading the game server, setup, onRestored, and a real-time room's first tick after any of them, or after its state is put back in a fresh copy of the game server, onRestored or not. */
|
|
9243
9248
|
maximumStartCpuDurationMs: 5e3,
|
|
9244
9249
|
/** CPU for the game server's top-level code (outside its handlers) as it loads: Cloudflare's own limit. Heavy work goes in the first tick. */
|
|
9245
9250
|
maximumLoadCpuDurationMs: 1e3,
|
|
@@ -22709,14 +22714,17 @@ component({
|
|
|
22709
22714
|
is-above); over, it opens out of it, from a touch smaller. Riding the page (is-on-page), it's placed in the page's coordinates. */
|
|
22710
22715
|
.floating-pane { position: fixed; inset: auto; margin: 0; border: 0; color: var(--ink); display: flex; flex-direction: column; max-width: calc(100vw - 2 * var(--pad-frame)); --glass-tint: var(--glass-dropdown);
|
|
22711
22716
|
transition: var(--glass-transition), transform var(--motion-float) var(--ease-glide), overlay var(--motion-float) allow-discrete, display var(--motion-float) allow-discrete; }
|
|
22712
|
-
/* It fades
|
|
22713
|
-
|
|
22717
|
+
/* It fades what's on it, never itself: a pane faded as a whole blurs nothing behind it until it's whole. Its glass (::before) arrives whole,
|
|
22718
|
+
blurred from the first frame, as real glass slid into place would: glass half faded in lets the sharp page through it, so it would show
|
|
22719
|
+
unblurred until the fade ended. Leaving, the glass fades with the rest. Each fades by its own opacity, which the browser draws on the GPU,
|
|
22720
|
+
never a custom property, which would restyle all of it every frame. */
|
|
22714
22721
|
.floating-pane::before, .floating-pane > * { transition: opacity var(--motion-float); }
|
|
22722
|
+
.floating-pane:popover-open:not(.is-leaving)::before { transition: none; }
|
|
22715
22723
|
/* Its edge light fades with the rest, and keeps gliding along its edge. */
|
|
22716
22724
|
.floating-pane > .edge-light { transition: opacity var(--motion-float), var(--edge-light-glide); }
|
|
22717
22725
|
@media (prefers-reduced-motion: reduce) { .floating-pane > .edge-light { transition: opacity var(--motion-float); } }
|
|
22718
22726
|
.floating-pane:not(:popover-open):not(.in-place)::before, .floating-pane:not(:popover-open):not(.in-place) > * { opacity: 0; }
|
|
22719
|
-
@starting-style { .floating-pane:popover-open
|
|
22727
|
+
@starting-style { .floating-pane:popover-open > * { opacity: 0; } }
|
|
22720
22728
|
.floating-pane.is-on-page { position: absolute; }
|
|
22721
22729
|
/* No taller than a menu, or the room in the window (--floating-room, zaismaFloat's place): past that its body scrolls inside it, where the
|
|
22722
22730
|
rail and scroll fades find it, its head and its glass's edge staying put. What's in its body keeps its height as it scrolls. */
|
|
@@ -22727,13 +22735,14 @@ component({
|
|
|
22727
22735
|
@supports not (overlay: auto) { .floating-pane { transition: var(--glass-transition), transform var(--motion-float) var(--ease-glide); } }
|
|
22728
22736
|
/* There the script moves it (zaismaFloat): open, it starts from its closed look (is-arriving); closing, it keeps the top layer while it takes
|
|
22729
22737
|
that look again (is-leaving), then goes. */
|
|
22730
|
-
.floating-pane
|
|
22738
|
+
.floating-pane.is-leaving::before, .floating-pane:is(.is-arriving, .is-leaving) > * { opacity: 0; }
|
|
22731
22739
|
/* Opened again at once where it just was (a Filter menu drawn again with the list it filters), it shows without arriving. */
|
|
22732
22740
|
.floating-pane.opens-at-once, .floating-pane.opens-at-once::before, .floating-pane.opens-at-once > * { transition: none; }
|
|
22733
|
-
/* Closed, it
|
|
22734
|
-
|
|
22735
|
-
:is(.floating-pane, .floating-cast)
|
|
22736
|
-
:is(.floating-pane, .floating-cast).
|
|
22741
|
+
/* Closed, it's folded toward the button it opens from, and its shadow with it: it grows out of that edge, whole glass all the way, since a
|
|
22742
|
+
pane scaled still blurs what's behind it where one clipped or faded doesn't. Under its button it grows down, above it up, over it out. */
|
|
22743
|
+
:is(.floating-pane, .floating-cast) { --away-move: scale(1, 0.82); transform-origin: top center; }
|
|
22744
|
+
:is(.floating-pane, .floating-cast).is-above { transform-origin: bottom center; }
|
|
22745
|
+
:is(.floating-pane, .floating-cast).placed-over { --away-move: scale(0.97, 0.75); transform-origin: center; }
|
|
22737
22746
|
/* Open, it takes its own presses: it's moved to the body, and a page may turn presses off there (the sign-in's world goes through to its scene). */
|
|
22738
22747
|
.floating-pane:popover-open { pointer-events: auto; }
|
|
22739
22748
|
.floating-pane:is(.is-arriving, .is-leaving) { transform: var(--away-move); pointer-events: none; }
|
|
@@ -23005,10 +23014,13 @@ var SHEET_STYLES = `
|
|
|
23005
23014
|
.sheet { width: fit-content; max-width: min(var(--size-sheet), calc(100% - 2 * var(--pad-pane))); margin: auto; padding: 0; border: 0; overflow: visible; color: var(--ink);
|
|
23006
23015
|
--glass-tint: var(--glass-dropdown);
|
|
23007
23016
|
transition: var(--glass-transition), transform var(--motion-arrive) var(--ease-glide), overlay var(--motion-arrive) allow-discrete, display var(--motion-arrive) allow-discrete; }
|
|
23008
|
-
/* It fades
|
|
23009
|
-
|
|
23010
|
-
|
|
23011
|
-
|
|
23017
|
+
/* It fades what's on it, never itself, as a floating pane does: its glass arrives whole, blurred from the first frame, as it rises and grows
|
|
23018
|
+
into place (glass half faded in would let the sharp page through until the fade ended); leaving, the glass fades with the rest. A list
|
|
23019
|
+
opened in it (a Floating pane, placed in the sheet) keeps its own motion. */
|
|
23020
|
+
.sheet::before, .sheet > :not([popover], .floating-cast) { transition: opacity var(--motion-state); }
|
|
23021
|
+
.sheet[open]:not(.is-leaving)::before { transition: none; }
|
|
23022
|
+
.sheet:is(:not([open]), .is-leaving)::before, .sheet:is(:not([open]), .is-leaving, .is-arriving) > :not([popover], .floating-cast) { opacity: 0; }
|
|
23023
|
+
@starting-style { .sheet[open] > :not([popover], .floating-cast) { opacity: 0; } }
|
|
23012
23024
|
/* A picture's sheet: as wide as the screen allows, up to its own size, so a screenshot or a screen shows large. */
|
|
23013
23025
|
.sheet.is-picture { max-width: min(var(--size-sheet-picture), calc(100% - 2 * var(--pad-pane))); }
|
|
23014
23026
|
/* Over the page, fixed to the window whether it's opening, open or closing (it stops being :modal the moment it starts to close). */
|
|
@@ -31945,8 +31957,9 @@ var CHECKED_PAGE_LIST = [
|
|
|
31945
31957
|
{ name: "A game's players", area: "Developers", path: "/dashboard/tiny-farm/players", account: "Preview_Studio", mainActionShows: "nowhere" },
|
|
31946
31958
|
{ name: "A game's database", area: "Developers", path: "/dashboard/tiny-farm/database", account: "Preview_Studio", mainActionShows: "nowhere" },
|
|
31947
31959
|
{ name: "A game's items", area: "Developers", path: "/dashboard/tiny-farm/items", account: "Preview_Studio", mainActionShows: "nowhere" },
|
|
31948
|
-
{ name: "A game's worlds", area: "Developers", path: "/dashboard/
|
|
31949
|
-
{ name: "A game's
|
|
31960
|
+
{ name: "A game's worlds", area: "Developers", path: "/dashboard/arena/worlds", account: "Preview_Studio", mainActionShows: "nowhere" },
|
|
31961
|
+
{ name: "A game's world", area: "Developers", path: "/dashboard/arena/worlds/NRTHWC", account: "Preview_Studio", mainActionShows: "nowhere" },
|
|
31962
|
+
{ name: "A game's tester links", area: "Developers", path: "/dashboard/rocket-lab/testers", account: "Preview_Studio", mainActionShows: "nowhere" },
|
|
31950
31963
|
{ name: "A game's how it plays", area: "Developers", path: "/dashboard/tiny-farm/how-it-plays", account: "Preview_Studio", mainActionShows: "nowhere" },
|
|
31951
31964
|
{ name: "A game's multiplayer", area: "Developers", path: "/dashboard/tiny-farm/multiplayer", account: "Preview_Studio", mainActionShows: "nowhere" },
|
|
31952
31965
|
{ name: "A game's accounts and ages", area: "Developers", path: "/dashboard/tiny-farm/accounts", account: "Preview_Studio", mainActionShows: "nowhere" },
|
|
@@ -60427,8 +60440,8 @@ var SKILL_FILES = {
|
|
|
60427
60440
|
"sdk": '<!-- Made by scripts/build-skill.mjs: never edit it by hand. -->\n\n# The Zaisma SDK\n\nThe game\'s side of Zaisma: `<script src="_zaisma/v1.js"></script>` in its index.html, and the global `Zaisma`. This is `packages/sdk/zaisma.d.ts`, served beside the SDK as `_zaisma/v1.d.ts`, with a heading per declaration.\n\n```ts\n/**\n * The Zaisma SDK, typed: this file is its reference. One script tag, from the game\'s top folder,\n * gives a browser game its players (Zaisma accounts and guests) and multiplayer rooms:\n *\n * <script src="_zaisma/v1.js"></script>\n *\n * Plain JavaScript, no dependencies, MIT licensed, and every part is optional.\n *\n * v1 only gains things: calls, options, fields and values are added, never renamed or removed. Page\n * messages, storage keys and members whose names start with `_` are not part of v1.\n *\n * `Zaisma` is locked once the SDK loads: it, every namespace and every call under it can\'t be replaced,\n * redefined, deleted or added to, so a call by Zaisma\'s name is always Zaisma\'s own. Include the SDK once,\n * and never declare a `Zaisma` of your own at the top of a script (`const Zaisma = \u2026`, `function Zaisma`):\n * the browser refuses that script. Use the global `Zaisma` as it is.\n *\n * For editor and compiler checks, save this file beside your game\'s folder, not in it, since uploads\n * take no .ts files. On Zaisma it\'s served beside the SDK as _zaisma/v1.d.ts; in Zaisma\'s repository\n * it\'s packages/sdk/zaisma.d.ts. Then put `/// <reference path="../zaisma.d.ts" />` (and in JavaScript,\n * `// @ts-check`) at the top of your script, or list it in jsconfig.json or tsconfig.json. The\n * global `Zaisma` is then typed, and its types are `Zaisma.Room`, `Zaisma.JoinOptions` and so on (in\n * JavaScript, give `let room = null` a JSDoc `@type {Zaisma.Room | null}`, as the example games do).\n *\n * Names follow Zaisma\'s naming guide: whole words, the unit in the name (`idleTimeoutSec`), and is, has\n * or can for yes or no. An option or event the SDK doesn\'t take is refused with the list of the ones it\n * does (`error.code` "unknown_option" or "unknown_event"), so a misspelled or old one never goes\n * quietly unused. Errors carry `error.code` ({@link Zaisma.ErrorCode}).\n *\n * Within v1, codes and events only grow: handle unknown ones (a `default` branch), and a new code or event\n * never breaks your game.\n *\n * The Zaisma button shares your game\'s screen: while it plays on Zaisma, the button sits in the top right\n * corner of the game\'s frame, over the game, about 64 by 60 CSS px past the phone\'s safe area. On phones and\n * touch screens it\'s always there; with a mouse it slides in when the pointer reaches that corner. Keep your\n * own buttons, score and words out of that corner. The developer API\'s preview_game_page pictures the game\n * playing with the button in place, on a laptop and a phone.\n *\n * Player passes, for rooms and your own servers, need the game played on its zaisma.com page, which\n * checks the browser on Play: joining fails with `error.code` "unchecked" when it couldn\'t, or when the\n * game was opened anywhere else. A game played off Zaisma (exported, on another site, wrapped for a store)\n * plays online against your own game server only: call {@link Zaisma.setUpOffZaisma} first, and give\n * joinRoom and server.request a serverUrl; without them they fail with "not_on_zaisma".\n *\n * @example\n * const room = await Zaisma.joinRoom(); // joins ?room=CODE if the link has one, else makes a room\n * room.me; room.players; room.roomCode; room.inviteUrl;\n * room.on("message", (message) => {}); // from the game server\n * room.on("players", (players) => {});\n * room.on("connectionStatus", (connectionStatus) => {});\n * room.on("ended", ({ message, endReason }) => {});\n * room.send({ move: "left" });\n * room.leave();\n * await Zaisma.invite(room); // share sheet on phones, copies the link elsewhere\n */\n```\n\n## Calls\n\n### Zaisma.sdkVersionNumber\n\n```ts\n/** The SDK\'s version: 1 for _zaisma/v1.js. */\nconst sdkVersionNumber: 1;\n```\n\n### Zaisma.gameSlug\n\n```ts\n/** The game\'s slug, as in zaisma.com/g/<slug>, or null outside Zaisma. */\nconst gameSlug: string | null;\n```\n\n### Zaisma.player\n\n```ts\n/** This tab\'s player: their pass, profiles, and asking a guest to sign in. */\nconst player: {\n /**\n * This tab\'s player, with their player pass: the signed-in Zaisma account, with the same player ID in\n * every game, or a guest. joinRoom gets one by itself; call this to let the player into a server of\n * your own. A guest\'s is kept for the tab, so a guest who reloads stays the same guest, and renewed when\n * it has under 10 minutes left or the player signs in; an account gets a new one each time the game\n * loads, for whoever is signed in then. Fails with error.code "unchecked" when the\n * game isn\'t played on its zaisma.com page, "not_on_zaisma" when it isn\'t hosted on Zaisma, and\n * "account_needed" for a guest when the game needs an account for multiplayer or the whole game\n * (its account_requirement setting): ask them to sign in with Zaisma.player.signIn().\n *\n * @example\n * const mine = await Zaisma.player.getPass(); // { id, name, kind, pass, expiresAt }\n * socket.send(JSON.stringify({ pass: mine.pass }));\n */\n getPass(): Promise<PlayerWithPass>;\n\n /**\n * An account\'s public profile by player ID, what anyone sees of it, like a name for a leaderboard\n * row. Fails with error.code "no_player" for a guest\'s ID or a deleted account\'s, and\n * "bad_player_id" for anything that isn\'t a player ID.\n *\n * @example\n * const profile = await Zaisma.player.getProfile("player_8f3k2m");\n * scoreRow.textContent = profile.name; // the username: nobody can pass as someone else\n */\n getProfile(playerId: string): Promise<PlayerProfile>;\n\n /**\n * Ask a guest to sign in with their Zaisma account, without leaving the game. Zaisma\'s page shows a\n * small card beside the game ("Sign in" or make a free account, and "Not now"); signing in opens a\n * new tab, so the game keeps running. Resolves with the account once the player has signed in, and\n * at once when they already are. From then on Zaisma.player.getPass() and joinRoom give the account\'s pass;\n * rooms the player is already in keep them as the guest they joined as, so join again to play as\n * the account. Call it when the player presses something that needs an account, like Play online\n * in a game whose multiplayer needs one (joinRoom failed with "account_needed"), or Save to\n * leaderboard. A second call while the card is up waits for the same answer. Fails with error.code\n * "sign_in_declined" when the player chose Not now, and "not_on_zaisma" when the game isn\'t played\n * on its zaisma.com page. There\'s no time limit: the player may take a few minutes.\n *\n * @example\n * try {\n * room = await Zaisma.joinRoom();\n * } catch (error) {\n * if (error.code !== "account_needed") throw error;\n * await Zaisma.player.signIn(); // { id, name, kind: "account" }\n * room = await Zaisma.joinRoom();\n * }\n */\n signIn(): Promise<Player>;\n\n /**\n * Show Zaisma\'s "Keep your progress" card at the moment the game picks, like right after the player\n * beat a level or found something rare. It\'s the same card a guest gets by itself after 5 minutes of\n * play (account_offer_enabled; turn that off to pick every moment yourself): it offers a free account\n * so their progress is kept, beside the game, and making one opens a new tab, so the game keeps\n * running. Because it\'s Zaisma\'s card, Zaisma\'s rule on how often holds, however the game asks: at\n * most once a visit, and not for 3 days after the player chose Not now. Resolves with the account\n * once the player has one, and at once when they\'re signed in already. A second call while the card\n * is up waits for the same answer. There\'s no time limit: the player may take a few minutes.\n *\n * Fails with error.code "account_offer_too_soon" when the card already showed this visit or the\n * player chose Not now in the last 3 days (the game can\'t see the card, so it hears it here; show your\n * own message if you like), "sign_in_declined" when the player chose Not now, "cloud_saves_off" when\n * the game has cloud saves off (no progress for the card to keep: ask with Zaisma.player.signIn()\n * instead), "cloud_saves_not_here" when cloud saves don\'t work where it\'s played (a tester link, or a\n * Zaisma without accounts), and "not_on_zaisma" when the game isn\'t played on its zaisma.com page.\n *\n * @example\n * async function levelBeaten() {\n * try {\n * const account = await Zaisma.player.offerAccount(); // { id, name, kind: "account" }\n * showNote("Your progress follows you now, " + account.name + ".");\n * } catch (error) {\n * if (error.code !== "account_offer_too_soon" && error.code !== "sign_in_declined") throw error;\n * }\n * }\n */\n offerAccount(): Promise<Player>;\n};\n```\n\n### Zaisma.joinRoom()\n\n```ts\n/**\n * Join a room: the one joinOptions.roomCode names, else the one the page\'s link points to\n * (?room=CODE, on the same server: {@link Rooms.linkedServerUrl}), else a new room. Resolves once the\n * room has let the player in, so room.me and room.players are set. On your own servers (serverUrl),\n * it also tells Zaisma which room a signed-in player is in, and that they left it, so their friends\'\n * Join works there too ({@link Friends.setRoom}).\n *\n * Fails with an error whose code says why and whose message says it in words. The room won\'t take\n * the player: full, closed (to new players), ended, kept_out (removed for the rest of the match),\n * refused (the game server\'s canJoin said no; the message is its refusalMessage), hosting_paused (the\n * game\'s hosting is paused this month: its free allowance or its developer\'s budget or credit is used). No player pass: unchecked, or account_needed for a\n * guest when the game needs accounts (see Zaisma.player.getPass()). The\n * call is set up wrong: unknown_option, bad_room_code, bad_server_url, bad_transport, not_on_zaisma (the game is played\n * off Zaisma without a serverUrl, or before {@link setUpOffZaisma}). Off Zaisma, bad_player_token: your server\n * didn\'t take the playerToken (get the player a new one and call setUpOffZaisma again). Or connection_closed (the connection closed first, say the game left or the player\n * joined from another tab) and request_failed (Zaisma didn\'t answer). {@link ErrorCode} has them all.\n *\n * @example\n * const room = await Zaisma.joinRoom();\n * Zaisma.joinRoom({ joinData: { character: "knight" } }); // for the game server\'s canJoin and onJoin\n * Zaisma.joinRoom({ isListed: true }); // others find it in room lists\n * Zaisma.joinRoom({ name: "Ana\'s castle", labels: { Mode: "Classic", Map: "Docks" } });\n * Zaisma.joinRoom({ idleTimeoutSec: 300 }); // ask "Still there?" after 5 minutes without input\n * Zaisma.joinRoom({ serverUrl: "wss://play.example.com" }); // your own game server\n */\nfunction joinRoom(joinOptions?: JoinOptions): Promise<Room>;\n```\n\n### Zaisma.setUpOffZaisma()\n\n```ts\n/**\n * Set up a game played off Zaisma (exported, on another site, wrapped for a store) to play online against\n * your own game server. Off Zaisma there\'s no Zaisma pass, so joinRoom and server.request with a serverUrl\n * send the playerToken in its place, and your server says who the player is (startServer\'s identifyPlayer):\n * a Sign in with Zaisma ID token (same player ID and name as on Zaisma), your game\'s own token, or null for\n * a guest when your server lets guests in (outsideGuestsEnabled). They join with kind "outside_zaisma",\n * in the same rooms as players from your Zaisma page.\n *\n * On a Zaisma page it changes nothing and resolves { isOffZaisma: false }, so the same code runs in both\n * places. Call it again to replace the token (a new sign-in, or signing out); rooms use the newest one when\n * they reconnect. Off Zaisma there\'s no Zaisma bar, saves, buy sheet, friends or room lists.\n *\n * Fails with error.code unknown_option, bad_game_slug (not a game slug) and bad_player_token (not text up to 8 KB, or null).\n *\n * @example\n * await Zaisma.setUpOffZaisma({ gameSlug: "star-raiders", playerToken: idToken });\n * const room = await Zaisma.joinRoom({ serverUrl: "wss://play.example.com" });\n */\nfunction setUpOffZaisma(setUpOptions: SetUpOffZaismaOptions): Promise<OffZaismaSetup>;\n```\n\n### Zaisma.rooms\n\n```ts\n/** Room browsing: the game\'s listed rooms, which show on its Zaisma page and to the game itself. */\nconst rooms: Rooms;\n```\n\n### Zaisma.server\n\n```ts\n/** The game\'s own game server outside any room: requests to its onRequest. */\nconst server: Server;\n```\n\n### Zaisma.invite()\n\n```ts\n/**\n * Invite friends. On Zaisma it opens Zaisma\'s invite sheet, the same as the Zaisma overlay\'s Share: the\n * room\'s QR code, link and code, Copy and the share sheet ("opened", or "failed" when the page couldn\'t\n * open it). On your own site it opens the share sheet on phones, otherwise copies the room\'s invite link\n * (the game\'s page without a room). Call it from a button in your game, like on a "waiting for players"\n * screen: it opens only right after the player taps or presses a key in the game, so call it from that\n * tap\'s handler, and it fails with error.code "needs_player_tap" otherwise. On a page that isn\'t\n * Zaisma\'s, around a game hosted on Zaisma, it fails with "not_on_zaisma".\n *\n * @example\n * if ((await Zaisma.invite(room)) === "copied") inviteButton.textContent = "Link copied";\n */\nfunction invite(room?: Room | null): Promise<InviteStatus>;\n```\n\n### Zaisma.checkChat()\n\n```ts\n/**\n * Zaisma\'s chat check: the same check Zaisma runs on its side on every chat message to or from an\n * under-18 account. It stops contact details in any disguise, moving to another app or meeting up,\n * personal details and sexual content, and answers with the words to show the sender. Swearing and\n * slurs are flagged (hasSwearing, hasSlur) but allowed: blocking them is your game\'s call. For chat\n * between players use {@link Room.chat}, which runs this check on its way; this one is for other text\n * players type. Checks the whole text, up to 2000 characters; a longer one is refused (too_long), never cut.\n *\n * @example\n * const check = await Zaisma.checkChat(typedMessage);\n * if (!check.isAllowed) showError(check.message);\n * else if (check.hasSwearing) showError("No swearing in this game."); // your call\n * else send(check.text);\n */\nfunction checkChat(text: string): Promise<ChatCheck>;\n```\n\n### Zaisma.friends\n\n```ts\n/**\n * The signed-in player\'s Zaisma friends who are playing this game right now, for your own list of\n * them: to join a friend\'s match, watch it or invite them ({@link Friends.list}). A game never sees\n * friends who aren\'t playing it, or who\'s online.\n */\nconst friends: Friends;\n```\n\n### Zaisma.links\n\n```ts\n/**\n * The game\'s registered links: the sites on its details that it opens, like its store, Patreon,\n * Steam page or Discord ({@link Links.open}). The game can open no other sites.\n */\nconst links: Links;\n```\n\n### Zaisma.items\n\n```ts\n/**\n * The game\'s items: what the player owns (from their player pass, so it matches what the game\'s server\n * sees) and what the game sells, priced in the player\'s currency. Developers set items with set_item;\n * buying comes with Zaisma\'s buy sheet.\n */\nconst items: Items;\n```\n\n### Zaisma.saves\n\n```ts\n/**\n * The player\'s cloud saves, for games that draw their own save screens. With cloud saves on, Zaisma\n * copies the game\'s own browser saves (localStorage and IndexedDB) to a signed-in player\'s account\n * with no code, and keeps 5 earlier versions. When two devices played on, the progress played most\n * recently wins and the other is kept as an earlier version: listen for "conflict" to offer the\n * player the other one. When you change a player\'s save through the API or MCP, the game reloads with\n * it, unless it listens for "developerChange" and rereads its storage instead. Guests\' progress stays\n * in their browser, so the calls fail with "account_needed" for them.\n *\n * Every call fails with error.code "account_needed" for a guest, "cloud_saves_off" when the game has\n * cloud saves off, "cloud_saves_not_here" when they don\'t work where it\'s played (a tester link, or a\n * Zaisma without accounts), "not_on_zaisma" when the game isn\'t played on its zaisma.com page,\n * "slow_down" and "request_failed".\n */\nconst saves: Saves;\n```\n\n### Zaisma.versions\n\n```ts\n/**\n * A version the developer published with match_update_mode "now", for a game that isn\'t in a match\n * (single-player, or in a menu): it\'s never forced on the player. Listen for "update" and call\n * update.apply() when it suits the game, like at a checkpoint or back at the main menu: the page\n * reloads the game at the new version, with its save. Without a listener, Zaisma offers Update beside\n * the game, and the player gets it then, or the next time they open the game. Matches hear theirs from\n * the room instead (the room\'s "versionUpdate" event).\n * @example\n * Zaisma.versions.on("update", (update) => {\n * if (isAtMainMenu()) update.apply();\n * else pendingUpdate = update; // apply it when the player is back at the menu\n * });\n */\nconst versions: Versions;\n```\n\n### Zaisma.page\n\n```ts\n/**\n * Whether Zaisma\'s page covers the game right now, so a game can pause or hold the player\'s input while it does.\n * coveredBy is "sheet" while one of Zaisma\'s sheets is open over the game (buying, the Zaisma overlay, Report: the player is\n * busy with it), "card" while one of its cards is over the game\'s corner (Still there?, Keep your progress; the\n * game stays in view and playable), and null otherwise. Always null outside Zaisma\'s page (your own site, a\n * local test). Listen for "coveredBy" to hear each change.\n * @example\n * Zaisma.page.on("coveredBy", (coveredBy) => {\n * if (coveredBy === "sheet") pauseGame();\n * else resumeGame();\n * });\n */\nconst page: Page;\n```\n\n## Types\n\n### SetUpOffZaismaOptions\n\n```ts\n/** Options for {@link setUpOffZaisma}. */\ninterface SetUpOffZaismaOptions {\n /** Your game\'s slug, as its Zaisma link names it, like "star-raiders": the address your server\'s rooms and requests take. */\n gameSlug: string;\n /** The player\'s token for your own server, text up to 8 KB: a Sign in with Zaisma ID token or your game\'s own. Null or left out for a guest. */\n playerToken?: string | null;\n}\n```\n\n### OffZaismaSetup\n\n```ts\n/** What {@link setUpOffZaisma} answers. */\ninterface OffZaismaSetup {\n /** False on a Zaisma page (nothing changed); true elsewhere, where joins and requests now carry the playerToken. */\n isOffZaisma: boolean;\n}\n```\n\n### Friends\n\n```ts\n/** The player\'s friends playing this game ({@link friends}). */\ninterface Friends {\n /**\n * The player\'s friends playing this game right now, in any of its rooms or none, as each friend\'s\n * settings let the player see them: someone who hides what they\'re playing or appears offline isn\'t\n * listed. Each comes with the room to join them in when the player could join it, and otherwise why\n * not, the same reasons Join gives on zaisma.com/friends. Kept for 10 seconds, so call it whenever\n * your list opens. Fails with error.code "account_needed" for a guest (ask them to sign in with\n * {@link player.signIn}), and "not_on_zaisma" when the game isn\'t hosted on Zaisma.\n *\n * @example\n * const { friends } = await Zaisma.friends.list();\n * for (const friend of friends) {\n * if (friend.roomCode) addRow(friend.name, () => Zaisma.joinRoom({ roomCode: friend.roomCode, serverUrl: friend.serverUrl ?? undefined }));\n * else addRow(friend.name, null, friend.joinRefusal); // like "room_full" or "friend_not_in_room": see FriendJoinRefusal\n * }\n */\n list(): Promise<FriendList>;\n /**\n * Say which room on your own servers the player is in, or null when they left it, so their friends\'\n * Join on Zaisma takes them there: a link to your game\'s page with ?room=CODE&server=\u2026 that\n * joinRoom({ serverUrl }) follows (see {@link Rooms.linkedServerUrl}). joinRoom({ serverUrl }) does this by\n * itself, so call it only when your game has its own netcode. The server must be one of the game\'s\n * own servers, own_server_urls (error.code "unlisted_server" otherwise), and Zaisma rooms need\n * none of this. The SDK says it again every 2 minutes while the page is open, and a room it stops\n * saying drops off after 5. For a guest it does nothing: guests have no friends. Your server keeps\n * its own door: a friend\'s Join is only a room link.\n *\n * @example\n * await Zaisma.friends.setRoom({ serverUrl: "wss://play.example.com", roomCode: "K7Q2MX" });\n * await Zaisma.friends.setRoom(null); // left the match\n */\n setRoom(room: OwnServerRoom | null): Promise<void>;\n /**\n * Offer the player to send another player a friend request, from your own scoreboard, lobby or menu.\n * Zaisma asks the player first on its page ("Send Mia a friend request?", with the name Zaisma knows\n * them by), so nothing is sent without them, and the other player gets it over their game\'s corner and\n * on zaisma.com/friends. Players can also send one from Players in Zaisma\'s bar, so a button of your\n * own is optional. Resolves with what happened: "sent"; "cancelled" when the player said no or another\n * question was up; "already_friends"; or "not_taking_requests" when the other player doesn\'t take them\n * from this one (their settings, their age group, a block, or a guest), which never says which. Your game\n * never hears of requests themselves, only that two players are friends (room.areFriends on your game server, and the\n * passes\' tags, from their next join). Fails with error.code "account_needed" for a guest (ask them to\n * sign in with {@link player.signIn}), "bad_player_id" for something that isn\'t a player\'s id, and\n * "not_on_zaisma" when the game isn\'t played on Zaisma.\n *\n * @example\n * // A button beside each player on your end-of-match screen.\n * const { status } = await Zaisma.friends.sendRequest(player.id);\n * if (status === "sent") button.textContent = "Request sent";\n */\n sendRequest(playerId: string): Promise<FriendRequestAnswer>;\n}\n```\n\n### FriendRequestAnswer\n\n```ts\n/** What became of a friend request the game offered ({@link Friends.sendRequest}). */\ninterface FriendRequestAnswer {\n status: FriendRequestStatus;\n}\n```\n\n### FriendRequestStatus\n\n```ts\n/** "sent", "cancelled" (the player said no), "already_friends", or "not_taking_requests" (never why). */\ntype FriendRequestStatus = "sent" | "cancelled" | "already_friends" | "not_taking_requests";\n```\n\n### FriendList\n\n```ts\n/** The player\'s friends playing this game ({@link Friends.list}). */\ninterface FriendList {\n /** By name. Empty when none of them are playing it. */\n friends: FriendInGame[];\n}\n```\n\n### FriendInGame\n\n```ts\n/** A friend playing this game. */\ninterface FriendInGame {\n /** Their player ID, the same in every game, as in room.players. */\n id: string;\n /** The name to show for them: their username. */\n name: string;\n username: string;\n /** The room to join them in, when the player could join it; null otherwise, with joinRefusal. */\n roomCode: string | null;\n /** Your own server that room is on, for joinRoom\'s serverUrl; null for a Zaisma room, or with no room. */\n serverUrl: string | null;\n /** Why the player can\'t join them, or null when they can. */\n joinRefusal: FriendJoinRefusal | null;\n}\n```\n\n### FriendJoinRefusal\n\n```ts\n/**\n * Why the player can\'t join a friend, the same reasons Join gives on zaisma.com/friends, in this order:\n * - game_not_taking_joins: your game turned Join off (friend_joins_enabled false in its settings).\n * - friend_not_taking_joins: the friend\'s own setting doesn\'t let this player join them.\n * - private_room: your game turned Join off for their room ({@link Room.setFriendJoinsEnabled}).\n * - room_closed: their room is closed to new players.\n * - room_full: their room has no space (players and held seats).\n * - spectators_full: their room takes no more spectators, for Watch.\n * - friend_not_in_room: they\'re playing, but not in a room your game told Zaisma of (a Zaisma room, or one on your own servers through {@link Friends.setRoom}).\n *\n * More reasons may come within v1: show a plain "can\'t join" for one you don\'t know.\n */\ntype FriendJoinRefusal = "game_not_taking_joins" | "friend_not_taking_joins" | "private_room" | "room_closed" | "room_full" | "spectators_full" | "friend_not_in_room";\n```\n\n### OwnServerRoom\n\n```ts\n/** A room on the game\'s own servers ({@link Friends.setRoom}). */\ninterface OwnServerRoom {\n /** The server, starting with wss:// or https://, like "wss://play.example.com": one of the game\'s own servers (own_server_urls). */\n serverUrl: string;\n /** Its room code: six characters like "K7Q2MX", from 2 to 9 and A to Z without I or O. */\n roomCode: string;\n /** false: friends\' Join shows grayed as "Private room" instead of taking them there. Default true. */\n friendJoinsEnabled?: boolean;\n}\n```\n\n### Links\n\n```ts\n/** The game\'s registered links ({@link links}). */\ninterface Links {\n /**\n * Open one of the links registered on the game\'s details, by its link_name, in a new tab. Call it\n * from the player\'s tap or key press, like a Support us button: links open only right after one, so\n * nothing ever opens by itself (error.code "needs_player_tap" otherwise). On Zaisma, the page shows a\n * card over the game\'s top corner: "You\'re leaving Zaisma", your game\'s name, the full address, Open\n * and Stay. The game keeps running behind it. Resolves with "opened" when a new tab opened, and\n * "stayed" when the player chose Stay or the link can\'t open for them: guests and under-18 accounts\n * open only links on trusted store, payment and video sites, never chat apps like Discord, and see\n * "This link can\'t be opened here." instead. The game hears the same "stayed" either way, so it never\n * learns why. Your dashboard and get_game say who each link opens for (who_can_open).\n *\n * Add a path and query under the link\'s address, so a store can tell what was bought and by whom:\n * the link https://kit.itch.io/sky-hopper with path "/buy" opens https://kit.itch.io/sky-hopper/buy.\n * Another site, or a path outside the link\'s, never opens.\n *\n * On your own site there\'s no Zaisma page to look the link up, so give its address there as\n * ownSiteUrl, and it opens straight away. On Zaisma, the registered address opens, whatever\n * ownSiteUrl says.\n *\n * Fails with error.code: unknown_link (no link by that name on the game), bad_link_path,\n * bad_link_query (also when the link\'s own address already sets that name), bad_own_site_url,\n * needs_player_tap, not_on_zaisma (outside Zaisma without ownSiteUrl), unknown_option, slow_down and\n * request_failed.\n *\n * @example\n * supportButton.onclick = () => Zaisma.links.open("patreon");\n * buyButton.onclick = async () => {\n * const linkStatus = await Zaisma.links.open("store", { path: "/buy", queryParameters: { item: "sword", player: playerId } });\n * if (linkStatus === "opened") showNote("Finish buying in the new tab.");\n * };\n * Zaisma.links.open("store", { ownSiteUrl: "https://kit.itch.io/sky-hopper" }); // also works on your own site\n */\n open(linkName: string, linkOptions?: LinkOptions): Promise<LinkStatus>;\n}\n```\n\n### Items\n\n```ts\n/** The game\'s items ({@link items}). */\ninterface Items {\n /**\n * Whether the player owns a permanent item (bought or granted, not refunded), by its item_name, as their\n * player pass says: a new pass (at most a day old) brings new items. false for guests, who own nothing.\n * Fails with error.code bad_item_name, not_on_zaisma, unchecked, account_needed and request_failed, as\n * Zaisma.player.getPass() does.\n *\n * @example\n * if (await Zaisma.items.owns("skin_red-dragon")) unlockSkin("red-dragon");\n */\n owns(itemName: string): Promise<boolean>;\n /** Every permanent item the player owns, by item_name; [] for guests. Fails as {@link Items.owns} does. */\n owned(): Promise<string[]>;\n /**\n * The items the game sells, at the price this player pays: in their currency when the game set a price\n * for it (picked by the player\'s country), else the main price. Show priceText beside anything sold for\n * coins or gems too: real prices are always shown. Fails with error.code not_on_zaisma, bad_origin,\n * game_unavailable and request_failed.\n *\n * @example\n * for (const item of await Zaisma.items.list()) addShopRow(item.title, item.priceText, item.isOwned);\n */\n list(): Promise<ItemForSale[]>;\n /**\n * Buy an item through Zaisma\'s buy sheet: on the game\'s zaisma.com page it slides up over the game, which\n * keeps running; on your own site a zaisma.com window opens. The player pays you through your own Stripe\n * account (get_stripe_account), with no cut. Call it from a tap or key press handler. Every player outcome\n * resolves: "bought" (the player\'s pass owns it at once; pass purchase.receipt to your server to check),\n * "cancelled" (nothing was charged: the player closed the sheet, or already owned the item) or "failed"\n * (declined, or still settling when the sheet closed: a "purchase" event follows if it completes later).\n * Fails with error.code needs_player_tap, bad_item_name, no_item, no_game, not_for_sale,\n * stripe_not_connected, stripe_cannot_take_payments, bad_item_count, bad_game_account_id, unknown_option,\n * not_on_zaisma and request_failed: your mistakes, never the player\'s; for the ones Zaisma finds,\n * error.message ends with the fix (finish setting up Stripe, connect_stripe_account, set_item).\n *\n * @example\n * buyButton.onclick = async () => {\n * const bought = await Zaisma.items.buy("revive");\n * if (bought.status === "bought") revivePlayer();\n * };\n */\n buy(itemName: string, buyOptions?: BuyOptions): Promise<BuyResult>;\n /**\n * Listen for the buy sheet opening and closing, and for a purchase on its way to the game (the\n * {@link ItemsEvents}). Purchases come when the game\'s purchase\n * settings say purchase_delivery "game": the game calls {@link Items.markHandled} first, then hands it\n * over, so a second tab, which gets "already_handled", skips it and it comes once. Each one waiting comes once the game listens, and each new one after the\n * buy sheet completes it. A wrong name fails with error.code "unknown_event". With "game_server",\n * the game server\'s onPurchase takes purchases instead, and "purchase" and "refund" never fire.\n *\n * @example\n * Zaisma.items.on("purchase", async (purchase) => {\n * await Zaisma.items.markHandled(purchase.id); // already_handled: another tab took it\n * if (purchase.itemName === "revive") addRevives(purchase.itemCount);\n * });\n */\n on<EventName extends keyof ItemsEvents>(event: EventName, listener: ItemsEvents[EventName]): this;\n /** Stop listening. */\n off<EventName extends keyof ItemsEvents>(event: EventName, listener: ItemsEvents[EventName]): this;\n /**\n * The player\'s purchases the game hasn\'t marked handled, oldest first: each\n * completed one, and each taken back (purchaseStatus "refunded" or "charged_back") after it was\n * handled; at most 50 purchases and 50 refunds at a time. [] for guests, who buy nothing. Fails as {@link Items.owns} does, and with "slow_down".\n */\n unhandled(): Promise<Purchase[]>;\n /**\n * Mark a purchase handed over, so it doesn\'t come again (or, for one taken back, its refund). Fails\n * with error.code "bad_purchase_id", "no_purchase" (not this player\'s, or not paid), "already_handled"\n * (another tab or device took it first: don\'t hand it over twice), "handled_by_server" (purchase_delivery\n * isn\'t "game": the game server or the developer\'s own server marks it), "slow_down", and as\n * {@link Items.owns} does.\n *\n * @example\n * await Zaisma.items.markHandled(purchase.id);\n */\n markHandled(purchaseId: string): Promise<void>;\n}\n```\n\n### ItemsEvents\n\n```ts\n/** The events of {@link items}, each with what its listener gets. */\ninterface ItemsEvents {\n /** A completed purchase the game hasn\'t handled yet: mark it handled, then add what it bought. */\n purchase: (purchase: Purchase) => void;\n /**\n * A purchase taken back (refunded or charged back) after the game handled it: the game decides what to\n * take back, after marking it handled. A permanent item leaves {@link Items.owned} by itself.\n */\n refund: (purchase: Purchase) => void;\n /** The buy sheet opened over the game, which keeps running: pause it here if it shouldn\'t. */\n sheetOpen: (sheet: SheetEvent) => void;\n /** The buy sheet closed, bought or not; {@link Items.buy} says how it ended. */\n sheetClose: (sheet: SheetEvent) => void;\n}\n```\n\n### SheetEvent\n\n```ts\n/** Which item the buy sheet is for ({@link ItemsEvents}). */\ninterface SheetEvent {\n itemName: string;\n}\n```\n\n### BuyOptions\n\n```ts\n/** How {@link Items.buy} buys. */\ninterface BuyOptions {\n /** How many of a consumable item, from 1 (1 unless you say). A permanent item is always 1. */\n itemCount?: number;\n /** Your game\'s own account ID for the player, kept on the purchase and its receipt; null unless you say. */\n gameAccountId?: string | null;\n}\n```\n\n### BuyResult\n\n```ts\n/** How a buy ended ({@link Items.buy}). */\ninterface BuyResult {\n /**\n * bought: the player paid. cancelled: nothing was charged (the player closed the sheet before paying, or\n * already owned the item). failed: the payment was declined, or was still settling when the sheet closed;\n * if it completes later, the "purchase" event fires for it.\n */\n status: "bought" | "cancelled" | "failed";\n /**\n * The same {@link Purchase} the "purchase" event hands over, with its receipt when bought. On failed it\'s\n * the purchase when there is one (purchaseStatus "pending" or "failed", receipt ""); null on cancelled.\n */\n purchase: Purchase | null;\n}\n```\n\n### Purchase\n\n```ts\n/** A purchase on its way to the game ({@link ItemsEvents}), and the one a {@link BuyResult} carries, as the API\'s purchase in camelCase. */\ninterface Purchase {\n /** Like "purchase_8f2k1x". */\n id: string;\n itemName: string;\n itemKind: "permanent" | "consumable";\n /** How many of the item: 1 for permanent items. */\n itemCount: number;\n /** sale: bought on the buy sheet. grant: given by the developer (grant_item). */\n purchaseSource: "sale" | "grant";\n /** "pending" and "failed" appear only on a failed {@link BuyResult}\'s purchase; the events carry the rest. */\n purchaseStatus: "completed" | "refunded" | "charged_back" | "pending" | "failed";\n /** The game\'s own account ID for the player, when the game gave one to buy or grant_item; else null. */\n gameAccountId: string | null;\n /** What it paid, in the currency\'s minor units (cents); null for a grant. */\n paidMinorUnits: number | null;\n /** Like "EUR"; null for a grant. */\n currencyCode: string | null;\n /** When it was bought or granted, an ISO time. */\n purchasedAt: string | null;\n /**\n * When the item was taken back, an ISO time: a full refund or a chargeback (purchaseStatus "refunded" or\n * "charged_back"); null otherwise. A partial refund leaves the player owning the item and shows only in\n * the API\'s refunded_minor_units, so test purchaseStatus, not just refundedAt, for what the player owns.\n */\n refundedAt: string | null;\n /** The signed receipt, for a server of the game\'s own to check (verifyReceipt in @zaisma/game-server). "" on a failed {@link BuyResult}\'s purchase, which never completed. */\n receipt: string;\n}\n```\n\n### ItemForSale\n\n```ts\n/** One item the game sells, for this player ({@link Items.list}). */\ninterface ItemForSale {\n itemName: string;\n title: string;\n /** "" for none. */\n description: string;\n /** permanent: owned for good, on every device. consumable: delivered once, then the game keeps count. */\n itemKind: "permanent" | "consumable";\n itemCategory: "cosmetic" | "gameplay" | "content" | "currency";\n /** The price this player pays, in the currency\'s smallest unit (cents; yen are whole), tax included. */\n priceMinorUnits: number;\n /** Lowercase ISO 4217, like "usd" or "brl". */\n currencyCode: string;\n /** The price as the player reads it, like "$1.99" or "R$ 59,90". */\n priceText: string;\n /** The player owns it (a permanent item), by their pass. */\n isOwned: boolean;\n}\n```\n\n### Page\n\n```ts\n/** Whether Zaisma\'s page covers the game ({@link page}). */\ninterface Page {\n /** "sheet", "card" or null: what of Zaisma\'s is over the game now. Read-only. */\n readonly coveredBy: CoveredBy;\n /** Listen for "coveredBy": called with the new value each time it changes. A wrong name fails with error.code "unknown_event". */\n on(event: "coveredBy", listener: (coveredBy: CoveredBy) => void): Page;\n off(event: "coveredBy", listener: (coveredBy: CoveredBy) => void): Page;\n}\n```\n\n### CoveredBy\n\n```ts\n/** What of Zaisma\'s covers the game ({@link page}): one of its sheets, one of its cards, or nothing. */\ntype CoveredBy = "sheet" | "card" | null;\n```\n\n### Versions\n\n```ts\n/** A version published "now" ({@link versions}). */\ninterface Versions {\n /** Listen for "update". A wrong name fails with error.code "unknown_event". */\n on(event: "update", listener: (update: PendingUpdate) => void): Versions;\n off(event: "update", listener: (update: PendingUpdate) => void): Versions;\n}\n```\n\n### PendingUpdate\n\n```ts\n/** A newer version is out ({@link versions}): apply() reloads the game at it, keeping the save. */\ninterface PendingUpdate {\n /** The new version, like "version_k2v9q4x7m1p3w8r5t6y0". */\n versionId: string;\n apply(): void;\n}\n```\n\n### Saves\n\n```ts\n/** The player\'s cloud saves ({@link saves}). */\ninterface Saves {\n /**\n * Listen for an event (the {@link SavesEvents}). A wrong name fails with error.code "unknown_event".\n * Listen as the game starts: a conflict settled while the game was opening waits for the game to\n * listen, then arrives at once.\n *\n * @example\n * Zaisma.saves.on("conflict", (conflict) => {});\n * Zaisma.saves.on("developerChange", (change) => {});\n */\n on<EventName extends keyof SavesEvents>(event: EventName, listener: SavesEvents[EventName]): this;\n /** Stop listening. */\n off<EventName extends keyof SavesEvents>(event: EventName, listener: SavesEvents[EventName]): this;\n /**\n * The player\'s earlier versions in this game, newest first: up to 5, with the one the save is now\n * marked isCurrentSave. Each says why it was kept ({@link SaveCopyReason}).\n *\n * @example\n * const { saveCopies } = await Zaisma.saves.listCopies();\n * for (const copy of saveCopies) addRow(new Date(copy.savedAt).toLocaleString(), copy.copyReason);\n */\n listCopies(): Promise<SaveCopyList>;\n /**\n * One earlier version with what it holds: its localStorage items and IndexedDB databases, so the game\n * can show what\'s in it ("Level 7, 1,200 coins"). Writing its localStorageItems into localStorage\n * puts that progress in place without a reload, and the next save copies it to the account, but\n * keeps no earlier version of the progress it replaced: {@link Saves.restoreCopy} does. Fails with\n * error.code "bad_save_copy_id" for anything that isn\'t a save copy ID, and "no_save_copy" when the\n * player has no such copy (copies past the newest 5 are gone).\n *\n * @example\n * const copy = await Zaisma.saves.getCopy(copyId);\n * levelText.textContent = "Level " + (copy.localStorageItems.level ?? "1");\n */\n getCopy(saveCopyId: string): Promise<SaveCopyContents>;\n /**\n * Make an earlier version the player\'s save again, as the player\'s own change. The save it replaces\n * is kept first as an earlier version (copyReason "restore"), so going back can be undone. It\n * reloads the game with the restored progress, the way a game that keeps its state in memory needs:\n * resolves just before the reload. Fails with error.code "bad_save_copy_id", "no_save_copy" and the\n * errors every saves call has.\n *\n * @example\n * useOtherButton.onclick = () => Zaisma.saves.restoreCopy(conflict.keptSaveCopy.id);\n */\n restoreCopy(saveCopyId: string): Promise<void>;\n}\n```\n\n### SavesEvents\n\n```ts\n/** The events of {@link saves}, each with what its listener gets. */\ninterface SavesEvents {\n /**\n * Two progresses differed (two devices, or a guest who signed in to an account with progress of its\n * own), and Zaisma settled it: the progress played most recently won and is what the game opened\n * with, and the other was kept as an earlier version. Offer the player the other one if you like.\n * It fires on the device whose save was kept or refused, where the choice happened, never on a\n * device that only takes up newer progress (like coming back to a tab after another device played\n * on): that device\'s earlier save is still in {@link Saves.listCopies}.\n *\n * @example\n * Zaisma.saves.on("conflict", async (conflict) => {\n * const other = await Zaisma.saves.getCopy(conflict.keptSaveCopy.id);\n * const where = conflict.winnerKind === "this_device" ? "another device" : "this device";\n * if (confirm("Use your progress from " + where + " instead (level " + other.localStorageItems.level + ")?")) {\n * await Zaisma.saves.restoreCopy(conflict.keptSaveCopy.id); // the game reloads with it\n * }\n * });\n */\n conflict: (conflict: SaveConflict) => void;\n /**\n * You changed the player\'s save through the API or MCP while they played. Listening means the game\n * takes it in place: Zaisma has already written it into the game\'s localStorage and IndexedDB, so\n * reread your state from there (without listening, the game reloads instead). The player\'s progress\n * since their last save is kept as an earlier version.\n *\n * @example\n * Zaisma.saves.on("developerChange", () => {\n * state.coins = Number(localStorage.getItem("coins") ?? 0);\n * state.level = Number(localStorage.getItem("level") ?? 1);\n * redraw();\n * });\n */\n developerChange: (change: DeveloperChange) => void;\n}\n```\n\n### SaveCopyList\n\n```ts\n/** The player\'s earlier versions ({@link Saves.listCopies}). */\ninterface SaveCopyList {\n /** Newest first: up to 5. */\n saveCopies: SaveCopy[];\n}\n```\n\n### SaveCopy\n\n```ts\n/** One of the player\'s earlier versions ({@link Saves.listCopies}). */\ninterface SaveCopy {\n /** Its ID, like "save_copy_k2v9q4x7m1p3w8r5t6y0": what getCopy and restoreCopy take. */\n id: string;\n /** When this progress was saved, as an ISO time in UTC. */\n savedAt: string;\n /** Why it was kept. */\n copyReason: SaveCopyReason;\n /** How big it is, in bytes. */\n sizeBytes: number;\n /** It\'s the same progress as the save now. */\n isCurrentSave: boolean;\n /**\n * The game version that saved it, like "version_k2v9q4x7m1p3w8r5t6y0", as the game\'s page reported it;\n * null for a save you changed, replaced or reset through the API or MCP, and for one from before Zaisma kept it;\n * a restored save has the restored copy\'s.\n */\n versionId: string | null;\n}\n```\n\n### SaveCopyContents\n\n```ts\n/** An earlier version with what it holds ({@link Saves.getCopy}). */\ninterface SaveCopyContents extends SaveCopy {\n /** The game\'s localStorage as it was: every key with its text. */\n localStorageItems: Record<string, string>;\n /**\n * The game\'s IndexedDB databases as it was ([] when it keeps none), in Zaisma\'s save format, with\n * records whose binary data and dates are tagged values. restoreCopy puts them back.\n */\n indexeddbDatabases: IndexeddbDatabase[];\n}\n```\n\n### IndexeddbDatabase\n\n```ts\n/**\n * One IndexedDB database in a save, in Zaisma\'s save format, the same as the developer API\'s\n * get_save_copy answers. Its names (keyPath, autoIncrement, unique, multiEntry, version) are IndexedDB\'s own.\n */\ninterface IndexeddbDatabase {\n name: string;\n /** The database\'s IndexedDB version: a whole number from 1. */\n version: number;\n stores: IndexeddbStore[];\n}\n```\n\n### IndexeddbStore\n\n```ts\n/** One object store in an {@link IndexeddbDatabase}. */\ninterface IndexeddbStore {\n name: string;\n /** Where each record\'s key is in its value, or null when keys are kept beside the values. */\n keyPath: string | string[] | null;\n autoIncrement: boolean;\n indexes: IndexeddbIndex[];\n /** Each record as [key, value], in Zaisma\'s save format: binary data, dates and the like are tagged values. */\n records: [unknown, unknown][];\n}\n```\n\n### IndexeddbIndex\n\n```ts\n/** One index on an {@link IndexeddbStore}. */\ninterface IndexeddbIndex {\n name: string;\n keyPath: string | string[];\n unique: boolean;\n multiEntry: boolean;\n}\n```\n\n### SaveCopyReason\n\n```ts\n/**\n * Why an earlier version was kept: hourly (a routine copy while playing, at most one an hour),\n * account_lost (the account\'s progress, replaced by a device\'s played more recently), smaller (the\n * save shrank to under half, usually a reset), restore (the player went back to an earlier version:\n * restoreCopy), device_lost (a device\'s progress lost to the account\'s, played more recently) or\n * developer (you changed, reset or restored the save through the API or MCP).\n * More values may come; treat an unknown one as no reason shown.\n */\ntype SaveCopyReason = "hourly" | "account_lost" | "smaller" | "restore" | "device_lost" | "developer";\n```\n\n### SaveConflict\n\n```ts\n/** A conflict Zaisma settled ({@link SavesEvents.conflict}). */\ninterface SaveConflict {\n /**\n * Whose progress won: "this_device", played more recently, or "account", the account\'s, which the game\n * opened with. More values may come; treat an unknown one as "account".\n */\n winnerKind: "this_device" | "account";\n /** Where the other progress is kept. */\n keptSaveCopy: SaveCopy;\n}\n```\n\n### DeveloperChange\n\n```ts\n/** A change you made to the player\'s save ({@link SavesEvents.developerChange}). */\ninterface DeveloperChange {\n /** When you changed it, as an ISO time in UTC. */\n savedAt: string;\n /** Where the player\'s progress since their last save is kept, or null when there was none to keep. */\n keptSaveCopy: SaveCopy | null;\n}\n```\n\n### LinkOptions\n\n```ts\n/** What {@link Links.open} takes. Every option is optional. */\ninterface LinkOptions {\n /** A path added under the link\'s address: starts with /, like "/buy", with no ?, #, . or .. parts. Up to 500 characters. */\n path?: string;\n /**\n * Query parameters added to the link\'s address, like { item: "sword", player: "player_8f3k2m" }:\n * up to 20, each text of up to 500 characters (numbers as String(3)). Never one the link\'s own address sets.\n * The whole opened address is at most 2,000 characters and each parameter name at most 100.\n */\n queryParameters?: Record<string, string>;\n /**\n * The link\'s whole address when the game runs on your own site, like "https://kit.itch.io/sky-hopper",\n * where it opens straight away. On Zaisma the address registered for the link opens instead, so keep the two the same.\n */\n ownSiteUrl?: string;\n}\n```\n\n### LinkStatus\n\n```ts\n/**\n * What happened when the game opened a link: opened (in a new tab), or stayed (the player chose Stay, or\n * the link can\'t open for them). More values may come; treat an unknown one as "stayed".\n */\ntype LinkStatus = "opened" | "stayed";\n```\n\n### JoinOptions\n\n```ts\n/** What {@link joinRoom} takes. Every option is optional. */\ninterface JoinOptions {\n /**\n * A room\'s code, like "K7Q2MX": six characters today; they may grow up to 12, so don\'t depend on the\n * length. By default, the code in the page\'s link (?room=), else a new room.\n */\n roomCode?: string;\n /**\n * Your own game server\'s full address, like "wss://play.example.com" (wss://, ws://, https:// or\n * http://), instead of Zaisma rooms. Add it to the game\'s own servers on Zaisma first, so the game\n * is allowed to connect to it.\n */\n serverUrl?: string;\n /**\n * How to reach a room on your own server (serverUrl, wss:// or https://): "websocket" (the default), or\n * "webtransport", the fast lane: WebTransport, where sends with delivery "latest_only" go as datagrams, so a\n * late one is dropped instead of holding up what comes after it, as PC shooters play. Your server has to\n * serve it (the Node runner\'s --webtransport-port). Where WebTransport isn\'t there or doesn\'t connect in\n * 3 seconds (a network that blocks UDP), the room uses the WebSocket by itself; {@link Room.transport} says\n * which. Zaisma rooms use the WebSocket either way. Anything else is refused with error.code "bad_transport".\n *\n * @example\n * const room = await Zaisma.joinRoom({ serverUrl: "wss://play.example.com", transport: "webtransport" });\n */\n transport?: "websocket" | "webtransport";\n /**\n * true: a new room that shows in room lists, for others to find. By default false: a room only its\n * code and link reach, like a private match ({@link Rooms.quickJoin} lists its new rooms unless given\n * false). Counts only when this player makes the room.\n */\n isListed?: boolean;\n /**\n * false: a new room friends can\'t Join from Zaisma, shown grayed as "Private room" (codes and links\n * still work). Counts only when this player makes the room.\n */\n friendJoinsEnabled?: boolean;\n /** A new room\'s name, like "Ana\'s castle": up to 40 characters. Counts only when this player makes the room. */\n name?: string;\n /**\n * A new room\'s labels, which players can filter rooms by, like { Mode: "Classic", Map: "Docks" }: up\n * to 4, names up to 16 characters and values up to 24. Counts only when this player makes the room.\n */\n labels?: Record<string, string>;\n /**\n * What the player brings into the room, for the game server\'s canJoin and onJoin, like the character\n * they picked: plain JSON, up to 4 KB. It comes from the player\'s browser, so check it like any message.\n */\n joinData?: unknown;\n /**\n * Seconds without input before the player is asked "Still there?", from 30 to 86400 (anything else is\n * refused with error.code "bad_idle_timeout"). By default, the game server\'s idleTimeoutSec (600, 10 minutes).\n */\n idleTimeoutSec?: number;\n /**\n * false: never ask "Still there?" in this game. The room\'s own check still applies, except where the\n * game server\'s idleCheck is "client", as with the relay.\n */\n idleCheckEnabled?: boolean;\n /**\n * true: watch the room instead of playing, where the game server takes spectators (its\n * maximumSpectatorCount). A spectator gets what the room sends everyone, sends nothing ({@link Room.send}\n * throws error.code "spectator_cannot_send"), doesn\'t count as playing and is never asked "Still there?".\n * A closed or full room can still be watched; a room with nobody playing can\'t (error.code "room_not_running"),\n * and nor can one whose spectators are all there (error.code "spectators_full"), and a player already\n * playing in it can\'t watch it too (error.code "already_playing"). Zaisma\'s Watch opens\n * the game with {@link Rooms.isLinkedAsSpectator} true.\n *\n * @example\n * const room = await Zaisma.joinRoom({ isSpectator: Zaisma.rooms.isLinkedAsSpectator });\n */\n isSpectator?: boolean;\n}\n```\n\n### Region\n\n```ts\n/**\n * A continent code: Africa, Antarctica, Asia, Europe, North America, Oceania, South America. A region\n * the SDK doesn\'t take is refused with error.code "bad_region".\n */\ntype Region = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";\n```\n\n### QuickJoinOptions\n\n```ts\n/**\n * What {@link Rooms.quickJoin} takes: joinRoom\'s options but roomCode, isSpectator, serverUrl and transport\n * (it finds Zaisma rooms), and region.\n */\ninterface QuickJoinOptions extends Omit<JoinOptions, "roomCode" | "isSpectator" | "serverUrl" | "transport"> {\n /** Look for a room in this region only, like "EU", as in {@link RoomList.regions}. */\n region?: Region;\n /** Look for a room with these labels, like { Mode: "Classic" }; a new room gets them. */\n labels?: Record<string, string>;\n}\n```\n\n### ListOptions\n\n```ts\n/** What {@link Rooms.list} takes. */\ninterface ListOptions {\n /** Rooms in this region only, like "EU", as in {@link RoomList.regions}. */\n region?: Region;\n /** Rooms with these labels only, like { Mode: "Classic" }. */\n labels?: Record<string, string>;\n}\n```\n\n### MoveJoinOptions\n\n```ts\n/** What {@link Move.join} takes: joinRoom\'s options but roomCode, serverUrl and transport, which are the move\'s own, and isSpectator (moves are for players). */\ninterface MoveJoinOptions extends Omit<JoinOptions, "roomCode" | "serverUrl" | "transport" | "isSpectator"> {}\n```\n\n### KickOptions\n\n```ts\n/** What {@link Room.kick} takes. */\ninterface KickOptions {\n /** Keep them out for the rest of the match. */\n keepOut?: boolean;\n}\n```\n\n### RoomInfo\n\n```ts\n/** What {@link Room.setInfo} takes. Leave a field out to keep it; null clears it. */\ninterface RoomInfo {\n /** The room\'s name, like "Ana\'s castle": up to 40 characters. */\n name?: string | null;\n /** The room\'s labels, like { Mode: "Classic", Map: "Docks" }: up to 4, names up to 16 characters and values up to 24. */\n labels?: Record<string, string> | null;\n}\n```\n\n### Rooms\n\n```ts\n/** Room browsing: the game\'s listed rooms, which show on its Zaisma page and to the game itself. */\ninterface Rooms {\n /**\n * The room code the player\'s link points to (?room=CODE), or null. Check it to show a menu or a\n * character picker first, then join with what the player picked: joinRoom and quickJoin both follow a link to a Zaisma room.\n */\n readonly linkedRoomCode: string | null;\n /**\n * The game\'s own server the player\'s link points to (?server=, beside ?room=), or null: a friend\'s\n * Join into a room on your own servers ({@link Friends.setRoom}). Only joinRoom({ serverUrl }) follows a\n * link that names a server (the same one); quickJoin follows only links to Zaisma rooms, which name none. A game on\n * its own servers joins with joinRoom({ serverUrl, roomCode: Zaisma.rooms.linkedRoomCode }), using this\n * as serverUrl. Zaisma passes it on only when it\'s one of the game\'s own servers (own_server_urls).\n */\n readonly linkedServerUrl: string | null;\n /**\n * true when the player\'s link is a Watch (?watch=1 beside ?room=), from Zaisma\'s Watch beside Join: they\n * came to watch the linked room, not to play. Join it with joinRoom({ isSpectator: true }).\n */\n readonly isLinkedAsSpectator: boolean;\n /**\n * The game\'s listed rooms on Zaisma, for a game\'s own lobby or server browser: rooms with space\n * first (the player\'s country, then region, then the busiest), up to 50. Never who\'s in them.\n * Fails with error.code "not_on_zaisma" in a game that isn\'t hosted on Zaisma.\n *\n * @example\n * const { rooms, playingPlayerCount, regions } = await Zaisma.rooms.list();\n * Zaisma.rooms.list({ region: "EU", labels: { Mode: "Classic" } }); // one region, or rooms with these labels\n */\n list(listOptions?: ListOptions): Promise<RoomList>;\n /**\n * Drop the player into a match: the room their link points to if it has space, otherwise a listed\n * room with space (nearby and busy first), otherwise a new room. Rooms with someone the player\n * blocked come after the others, and before a new room; the linked room is the player\'s own choice.\n *\n * @example\n * const room = await Zaisma.rooms.quickJoin();\n * Zaisma.rooms.quickJoin({ region: "EU", labels: { Mode: "Classic" } }); // a room like that with space, else a new one with those labels\n */\n quickJoin(quickJoinOptions?: QuickJoinOptions): Promise<Room>;\n}\n```\n\n### Server\n\n```ts\n/** The game\'s own game server outside any room ({@link server}). */\ninterface Server {\n /**\n * Send a request to the game\'s own game server, its onRequest(player, request, server), outside\n * any room, and get back what it answers: for a leaderboard, a shop or a daily reward, in\n * single-player games too. The player\'s pass goes with it, so the server knows who\'s asking and\n * the player can\'t pretend to be someone else. The request is plain JSON, up to 16 KB; say what\n * it\'s for in its type, like a room message. On Zaisma, the game server is the one in your\n * upload\'s zaisma-server/ folder (or zaisma-server.js); give serverUrl for your own.\n *\n * Fails with error.code: no_request_handler (the game server has no onRequest), game_server_error\n * (onRequest threw, answered something that isn\'t plain JSON or over 1 MB, or took over 10\n * seconds; you see why with the game server\'s errors), hosting_paused (the game\'s hosting\n * on Zaisma is paused this month: its free allowance or its developer\'s budget or credit is used), too_big, bad_request (not plain JSON), slow_down\n * (over about 120 a minute from one address), bad_pass, account_needed, unchecked,\n * game_unavailable, bad_origin, busy, bad_server_url, not_on_zaisma (the game is played off\n * Zaisma without a serverUrl, or before {@link Zaisma.setUpOffZaisma}), bad_player_token (off Zaisma,\n * your server didn\'t take the playerToken), unknown_option and request_failed.\n *\n * @example\n * const top = await Zaisma.server.request({ type: "leaderboard" });\n * const { coinCount } = await Zaisma.server.request({ type: "claimDailyReward" });\n * Zaisma.server.request({ type: "buy", itemId: "sword" }, { serverUrl: "https://play.example.com" }); // your own server\n */\n request(request: unknown, requestOptions?: RequestOptions): Promise<unknown>;\n}\n```\n\n### SendOptions\n\n```ts\n/** How {@link Room.send} and {@link Room.sendBytes} send. */\ninterface SendOptions {\n /**\n * "reliable" (the default) reaches the game server in order. "latest_only" may be dropped: while\n * this player\'s connection is backed up, a newer send with the same latestKey replaces it, and the\n * newest goes once it catches up. For input sent every frame, like where the player aims. On the fast\n * lane to your own server ({@link JoinOptions.transport}), it goes as a datagram when it fits one. Anything\n * else throws error.code "bad_send_option".\n */\n delivery?: "reliable" | "latest_only";\n /**\n * For "latest_only", and needed there: which sends replace each other, up to 40 characters, like\n * "position". latest_only without one throws error.code "bad_send_option".\n */\n latestKey?: string;\n}\n```\n\n### StateChange\n\n```ts\n/**\n * One change in a state update: [path, value] sets what\'s at path to value, [path] removes it, and an\n * empty path replaces the whole state. path is keys of objects and indexes of arrays, from the top.\n */\ntype StateChange = [path: (string | number)[]] | [path: (string | number)[], value: unknown];\n```\n\n### RequestOptions\n\n```ts\n/** Options for {@link Server.request}. */\ninterface RequestOptions {\n /** Your own game server\'s address, like "https://play.example.com", instead of Zaisma\'s. The Node runner answers requests on the same port as its rooms. */\n serverUrl?: string;\n}\n```\n\n### Room\n\n```ts\n/** A room the player is in: one live match, running one copy of the game server. */\ninterface Room {\n /**\n * The room\'s code, like "K7Q2MX": six characters today; they may grow up to 12, so don\'t depend on the\n * length. It changes when the game server moves the player (the "moved" event).\n */\n readonly roomCode: string;\n /** This player. */\n readonly me: Player;\n /**\n * Players in the room right now, in join order, this player included, each with why they aren\'t\n * playing (awayReason), like a player whose connection dropped and who has a few seconds to come back.\n */\n readonly players: readonly ListedPlayer[];\n /** The host\'s player ID, when the game server gives the host controls (the relay does), else null. */\n readonly hostPlayerId: string | null;\n /** This player is watching, not playing ({@link JoinOptions.isSpectator}): they\'re never in players. */\n readonly isSpectator: boolean;\n /** How many are watching the room; the "settings" event says when it changes. */\n readonly spectatorCount: number;\n /** Where the socket stands; the "connectionStatus" event says when it changes. Away is awayReason, not this. */\n readonly connectionStatus: ConnectionStatus;\n /**\n * What this connection uses now: "webtransport" on the fast lane to your own server\n * ({@link JoinOptions.transport}), else "websocket", including when the fast lane didn\'t connect.\n */\n readonly transport: "websocket" | "webtransport";\n /**\n * Why this player is out of the match: "idle" (no input until the "Still there?" ran out) or "hidden"\n * (the game hidden too long), from the "away" event until "back"; null while they play.\n */\n readonly awayReason: "idle" | "hidden" | null;\n /**\n * The room\'s link on Zaisma, like "https://zaisma.com/g/sky-hopper?room=K7Q2MX", with &server= for a\n * room on your own server, or null outside Zaisma.\n */\n readonly inviteUrl: string | null;\n /** Shown in room lists. A room that isn\'t still works by code and link. */\n readonly isListed: boolean;\n /** Taking new players. A closed room lets back only players who were in it. */\n readonly isOpen: boolean;\n /** Zaisma\'s Join (friends on zaisma.com, Zaisma.friends) offers this room; when false it\'s grayed as "Private room". */\n readonly friendJoinsEnabled: boolean;\n /** The room\'s name, like "Ana\'s castle", or null. */\n readonly name: string | null;\n /** The room\'s labels, like { Mode: "Classic", Map: "Docks" }. */\n readonly labels: Readonly<Record<string, string>>;\n /**\n * Whether this player can chat at all ({@link Room.chat}): a Zaisma account whose chat setting isn\'t\n * nobody, playing (not watching). False for guests: hide your chat box, and offer preset phrases or emotes.\n */\n readonly canChat: boolean;\n /**\n * When Zaisma will end this match, an ISO time, or null: set once the game\'s hosting pauses for the\n * month, an hour after the pause (the "ending" event); null again if Zaisma calls the end off (the\n * "endingCancelled" event). Never set in a room on your own server.\n */\n readonly endsAt: string | null;\n /**\n * This player\'s round trip to the room in milliseconds, smoothed and measured by the room; null until\n * the first measurement, right after joining. The game server reads the same number with\n * room.pingDurationMs(playerId).\n *\n * @example\n * // A ping readout in the corner\n * pingText.textContent = room.pingDurationMs === null ? "" : room.pingDurationMs + " ms";\n */\n readonly pingDurationMs: number | null;\n /**\n * This player\'s view of the game server\'s state, when it has stateSyncEnabled: the game server\'s\n * state, or what its stateView answers for this player. null until the first update, which comes as\n * the player joins; after that it changes with each update (the "state" event). Read it, don\'t change it.\n *\n * @example\n * function draw() {\n * const world = room.state;\n * if (world) for (const [id, body] of Object.entries(world.bodies)) drawBody(id, body);\n * requestAnimationFrame(draw);\n * }\n */\n readonly state: unknown | null;\n /**\n * The state as it was smoothingOptions.delayMs behind the room\'s clock (100 unless you say, up to 1000),\n * between the two updates around then: numbers blended in a straight line (integers in between come back\n * as fractions), anything else as the older update had it, and what\'s in only one of them as it is. So\n * positions move evenly however the updates arrive, a moment behind; an angle that wraps around blends\n * the long way, so blend those yourself. A copy, yours to keep; null until the first update. Anything else\n * for delayMs throws error.code "bad_delay", and other options "unknown_option". Predicting this player\'s\n * own moves stays your game\'s.\n *\n * @example\n * function draw() {\n * const world = room.smoothedState(); // or room.smoothedState({ delayMs: 150 })\n * if (world) for (const body of Object.values(world.bodies)) drawBody(body.x, body.y);\n * requestAnimationFrame(draw);\n * }\n */\n smoothedState(smoothingOptions?: SmoothingOptions): unknown | null;\n\n /**\n * The room\'s clock now, in epoch milliseconds, estimated from the room\'s probes (Date.now() until the\n * first one): the same clock as the game server\'s room.serverTimeMs(), so a time it sends means the\n * same moment for every player.\n *\n * @example\n * // The game server sent { type: "countdown", startsAtMs: room.serverTimeMs() + 3000 }\n * room.on("message", (message) => {\n * if (message.type === "countdown") startsInMs = message.startsAtMs - room.serverTimeMs();\n * });\n */\n serverTimeMs(): number;\n /**\n * Send a message to the game server: plain JSON, up to 16 KB (more throws error.code "too_big"), about\n * 30 a second at most. Send input when it changes, not every frame. While connectionStatus isn\'t "open"\n * or the player is away, reliable sends wait and go in order once the room is back, up to 60: past that\n * the oldest is dropped, and an "error" event says "send_queue_full" once. With\n * { delivery: "latest_only", latestKey }, a message may be dropped for a newer one (SendOptions). A\n * spectator can\'t send: it throws error.code "spectator_cannot_send". Returns false only when the room\n * is gone (ended, kicked or left), so nothing will ever send.\n *\n * @example\n * room.send({ type: "fire" });\n * // Where the player aims, as it changes: only the newest matters.\n * room.send({ type: "aim", angle }, { delivery: "latest_only", latestKey: "aim" });\n */\n send(message: unknown, sendOptions?: SendOptions): boolean;\n /**\n * Send bytes to the game server (its onBytes), like a compact input: an ArrayBuffer or any typed\n * array, up to 16 KB (more throws error.code "too_big"), counted with messages (about 30 a second at\n * most). Anything else throws error.code "bad_bytes", and a spectator\'s throws "spectator_cannot_send".\n * Waits like room.send while the room isn\'t reachable, takes the same sendOptions, and returns false\n * only when the room is gone.\n */\n sendBytes(bytes: ArrayBuffer | ArrayBufferView, sendOptions?: SendOptions): boolean;\n /** Leave the room for good. */\n leave(): void;\n /**\n * Show or hide the room in room lists. From the room\'s host when the game uses the relay; with a\n * game server of your own, the server decides (its room.setListed). The "settings" event says when it changed.\n */\n setListed(isListed: boolean): void;\n /**\n * Open or close the room to new players; players who were in it can still come back. From the\n * room\'s host when the game uses the relay; with a game server of your own, the server decides (its\n * room.setOpen). The "settings" event says when it changed.\n */\n setOpen(isOpen: boolean): void;\n /**\n * Turn Zaisma\'s Join on or off for this room: off, a player\'s friends see Join grayed as "Private\n * room" on zaisma.com and in {@link Friends.list}. It isn\'t a lock: a code or link still reaches the\n * room, so close it (setOpen) or answer false from canJoin to keep players out. From the room\'s host\n * when the game uses the relay; with a game server of your own, the server decides (its\n * room.setFriendJoinsEnabled). The "settings" event says when it changed.\n */\n setFriendJoinsEnabled(isEnabled: boolean): void;\n /**\n * Name and label the room. From the room\'s host when the game uses the relay; with a game server of\n * your own, the server decides (its room.setInfo). Names and labels players type show on Zaisma\'s\n * pages only if they pass Zaisma\'s filter for its pages, which blocks swearing too.\n */\n setInfo(nameAndLabels: RoomInfo): void;\n /**\n * The host removes a player, when the game server gives the host controls (the relay does). They\'re\n * told the host removed them; keepOut keeps them out for the rest of the match.\n */\n kick(playerId: string, kickOptions?: KickOptions): void;\n /**\n * Whether to hide a player\'s emotes and phrases: this player muted or blocked them, or there\'s a\n * block between them either way (never which one made it, so a blocked player is never told).\n */\n isMuted(playerId: string): boolean;\n /** Mute a player for this room. The "muted" event says the list changed. */\n mute(playerId: string): void;\n /** Unmute a player muted for this room. A block stays: {@link Room.unblock} lifts one. */\n unmute(playerId: string): void;\n /**\n * Lift a block this session made of a player. A block between two accounts is undone only on\n * zaisma.com/friends, never from a game.\n */\n unblock(playerId: string): void;\n /**\n * Block a player in the room: a wall both ways, so neither one\'s emotes and phrases reach the other,\n * and the game server\'s room.hasBlockBetween says so. When both are Zaisma accounts, Zaisma asks the\n * player beside the game first, and the block then lasts in every game until they undo it on\n * zaisma.com/friends; it ends a friendship, and the blocked player isn\'t told. Any other block (a\n * guest\'s, or of a guest) lasts for the session. Resolves true once they\'re blocked, or false if the\n * player changed their mind. A block never removes anyone from the room.\n */\n block(playerId: string): Promise<boolean>;\n /**\n * Report a player to Zaisma, with what happened in the player\'s own words if they gave any (details).\n * The last chat lines (up to 20) they sent this player, or this player sent them, go with it from this\n * screen; nothing else about the reporting player is sent.\n */\n report(playerId: string, reason: ReportReason, details?: string): Promise<ReportAnswer>;\n /**\n * Send a chat message: through the room to the players in it (or chatOptions.toPlayerIds of them) who\n * may chat with this player, on Zaisma\'s rooms or your own server\'s runner. It reaches only players in\n * this player\'s chat group whose settings let them chat with this player, never anyone with a block\n * between them, and never spectators. Your game server\'s onChat may stop it or send it to fewer\n * players first; then Zaisma\'s chat filter checks it on its way (messages to and from under-18s\n * always, between adults when your game server turns it on), and Zaisma keeps none of it. Draw the\n * chat yourself: the "chat" event brings the others\' messages; show this player\'s own when it resolves.\n *\n * Resolves { sentAt } once it went, even when nobody could read it (the sender is never told who\n * can\'t). Rejects with error.code chat_stopped (error.reason says why, like contact_details or\n * stopped_by_game, and error.message is what to show the player), chat_not_allowed (a guest, or chat\n * set to nobody: check {@link Room.canChat} first), chat_empty, chat_too_long (over 2000 characters),\n * chat_too_fast (over 20 in 10 seconds) or connection_closed.\n *\n * @example\n * room.chat(input.value).then(({ sentAt }) => addLine(room.me.name, input.value), (error) => showError(error.message));\n */\n chat(text: string, chatOptions?: ChatOptions): Promise<ChatSent>;\n\n /**\n * Listen for an event. Listening is optional: without "move" and "back" listeners, the SDK follows\n * a move and rejoins by itself; with one, your game decides when.\n *\n * @example\n * room.on("message", (message) => {});\n * room.on("players", (players) => {});\n * room.on("move", (move) => { showLoading(); move.follow(); });\n */\n on<EventName extends keyof RoomEvents>(event: EventName, listener: RoomEvents[EventName]): this;\n /** Stop listening. */\n off<EventName extends keyof RoomEvents>(event: EventName, listener: RoomEvents[EventName]): this;\n}\n```\n\n### RoomEvents\n\n```ts\n/** A room\'s events, each with what its listener gets. */\ninterface RoomEvents {\n /**\n * A message from the game server: the game\'s own, as it sent it, and the player it came from when the\n * game server passed one player\'s message on (its fromPlayerId; the relay always does), or null.\n */\n message: (message: any, fromPlayerId: string | null) => void;\n /**\n * Bytes from the game server (its room.broadcastBytes or room.sendBytes): fromPlayerId is the player\n * they came from when the game server passed one player\'s bytes on (the relay always does), or null.\n */\n bytes: (bytes: Uint8Array, fromPlayerId: string | null) => void;\n /**\n * A state update, when the game server has stateSyncEnabled: state is room.state now, and changes\n * what changed since the last update, or null after a full copy (as the player joins, and after their\n * connection was backed up). Most games read room.state or room.smoothedState() as they draw instead.\n * @example\n * room.on("state", (state, changes) => { scoreText.textContent = String(state.scores[room.me.id]); });\n */\n state: (state: any, changes: StateChange[] | null) => void;\n /**\n * Players joined, left, walked away or came back, or their connection dropped or came back; the same\n * list as room.players.\n * @example\n * // Freeze a player whose connection dropped, and show them reconnecting, until they\'re back.\n * room.on("players", (players) => {\n * for (const player of players) {\n * const body = bodies.get(player.id);\n * if (body) body.isFrozen = player.awayReason === "lost";\n * }\n * });\n */\n players: (players: readonly ListedPlayer[]) => void;\n /** Where the socket stands, as room.connectionStatus. */\n connectionStatus: (connectionStatus: ConnectionStatus) => void;\n /** The match ended, with its message and why (endReason). The connection closes. */\n ended: (ended: Ended) => void;\n /**\n * Zaisma will end this match at endsAt (an ISO time, also room.endsAt), because the game\'s hosting on\n * Zaisma rooms paused for the month: tell your players and save what should last.\n * "ended" follows then.\n */\n ending: (ending: Ending) => void;\n /**\n * Zaisma called off the end the "ending" event announced, because the game\'s hosting started again:\n * room.endsAt is null, and the match goes on. Optional, as events added after v1 are, so v1\'s types still fit.\n */\n endingCancelled?: () => void;\n /** The game server or the host removed the player from the room. The connection closes. */\n kicked: (kicked: Kicked) => void;\n /** The room\'s listing, Join switch, name or labels changed, or how many watch: room.isListed, room.isOpen, room.friendJoinsEnabled, room.name, room.labels and room.spectatorCount have the new ones. */\n settings: (settings: RoomSettingsChange) => void;\n /**\n * The game server is sending the player to another room (its room.reserve or room.moveTo). Without\n * a listener the room follows by itself; with one, call move.follow() when your game is ready, or\n * leave and move.join() it as a new room object.\n */\n move: (move: Move) => void;\n /** This room object moved to another room: same object, new code. A "players" event with the new list follows. */\n moved: (moved: Moved) => void;\n /**\n * "Still there?": idleStatus "asking" when it\'s time to ask, after idleTimeoutSec without input, with\n * answerTimeoutSec to answer. Listening replaces Zaisma\'s own "Still there?": a card beside the game\n * on its zaisma.com page, and elsewhere a small plate in the game (restyle the plate with CSS on\n * #zaisma-still-there instead, if you like). Then "answered" (any input), or "timed_out" as the room\n * is told they walked away.\n */\n idle: (idle: Idle) => void;\n /**\n * The player walked away: out of the match, with their seat held for seatHoldDurationSec, unless the\n * game server decides (its onAway). Any input brings them back.\n */\n away: (away: Away) => void;\n /**\n * The player came back after walking away. isSeatHeld true: they\'re in their held seat again, after\n * the room let them back in. false: the seat ran out, and listening turns off rejoining by itself, so\n * call back.rejoin() to rejoin their old room (it fails if the room is full or over).\n */\n back: (back: Back) => void;\n /** Whose emotes and phrases to hide changed: every player ID room.isMuted is true for. */\n muted: (playerIds: string[]) => void;\n /**\n * The room sent an error, like too_fast, or the SDK has one for the room, like send_queue_full. Joining\n * fails with the same code when the room won\'t take the player.\n */\n error: (error: RoomError) => void;\n /**\n * The developer published a version with match_update_mode "now", and this match moves to it at\n * versionUpdate.appliesAt at the latest (sooner if the game server switches at a good moment). Show a\n * countdown or save; when it switches, this room object reconnects by itself, or, when the game\'s\n * files changed (isReloading), the page reloads the game at the new version and joinRoom() with no\n * code brings the player back into this room.\n * @example\n * room.on("versionUpdate", ({ appliesAt }) => showBanner(`Updating at ${new Date(appliesAt).toLocaleTimeString()}`));\n */\n versionUpdate: (versionUpdate: VersionUpdate) => void;\n /**\n * A room message reached this room and its game server has no onRoomMessage, so every player\'s game hears\n * it: from another room of the game (senderKind "room", fromRoomCode), its game server outside rooms\n * ("server") or the developer (the API and MCP, "developer"), like an announcement or a live event starting.\n * Zaisma shows nothing: your game decides. A game server with onRoomMessage takes it instead.\n * @example\n * room.on("roomMessage", ({ message }) => { if (message.kind === "blood_moon") startBloodMoon(); });\n */\n roomMessage?: (roomMessage: RoomMessage) => void;\n /**\n * Another player\'s chat message reached this player ({@link Room.chat}). Messages from players this\n * player muted or blocked never come. hasSwearing and hasSlur flag what Zaisma allows: hide or blur\n * them if your game doesn\'t. (Optional here only so games written for v1\'s events still fit.)\n */\n chat?: (chatMessage: ChatMessage) => void;\n}\n```\n\n### ChatOptions\n\n```ts\n/** What {@link Room.chat} takes. */\ninterface ChatOptions {\n /** Send it to only these players in the room (like a team), from room.players. All players when left out. */\n toPlayerIds?: string[];\n}\n```\n\n### ChatSent\n\n```ts\n/** {@link Room.chat}\'s answer once the message went. */\ninterface ChatSent {\n /** When the room sent it, as an ISO time. */\n sentAt: string;\n}\n```\n\n### ChatMessage\n\n```ts\n/** A chat message another player sent ({@link Room.chat}), as the "chat" event brings it. */\ninterface ChatMessage {\n fromPlayerId: string;\n text: string;\n /** It swears: Zaisma allows it; hide it if your game doesn\'t. */\n hasSwearing: boolean;\n /** It has a slur: Zaisma allows it too; your game and its moderators decide. */\n hasSlur: boolean;\n /** When the room sent it, as an ISO time. */\n sentAt: string;\n}\n```\n\n### ChatErrorCode\n\n```ts\n/**\n * The codes {@link Room.chat} rejects with: chat_stopped (the game server\'s onChat or Zaisma\'s filter\n * stopped it: error.reason and error.message say why), chat_not_allowed, chat_empty, chat_too_long,\n * chat_too_fast, bad_player_id, busy (try again in a moment), ended, spectator_cannot_send and\n * connection_closed. More codes may come within v1: show the error\'s message.\n */\ntype ChatErrorCode = "chat_stopped" | "chat_not_allowed" | "chat_empty" | "chat_too_long" | "chat_too_fast" | "chat_not_here" | "bad_player_id" | "busy" | "ended" | "spectator_cannot_send" | "connection_closed";\n```\n\n### ChatStoppedReason\n\n```ts\n/**\n * Why {@link Room.chat} was stopped (error.reason with chat_stopped): "stopped_by_game" (your game\n * server\'s onChat), the filter\'s {@link ChatCheckReason}s, "chat_paused" (the sender\'s chat is paused\n * for now) or "not_allowed_to_chat". More values may come.\n */\ntype ChatStoppedReason = "stopped_by_game" | ChatCheckReason | "chat_paused" | "not_allowed_to_chat";\n```\n\n### SmoothingOptions\n\n```ts\n/** What {@link Room.smoothedState} takes. */\ninterface SmoothingOptions {\n /** How far behind the room\'s clock to draw, in milliseconds, from 0 to 1000. By default 100. */\n delayMs?: number;\n}\n```\n\n### EndReason\n\n```ts\n/** Why a match ended (the "ended" event). More may come within v1: treat one you don\'t know like "game". */\ntype EndReason = "game" | "no_players" | "hosting_paused" | "kept_room_deleted" | "game_unavailable" | "game_server_stopped";\n```\n\n### Ended\n\n```ts\n/** The match ended (the room\'s "ended" event). */\ninterface Ended {\n /** What the game server said with room.end, or Zaisma\'s words when it ended the match; "" when none. */\n message: string;\n /**\n * Why: "game" (the game server\'s room.end), "no_players" (a spectator\'s room emptied of players),\n * "hosting_paused" (the game\'s hosting paused for the month), "kept_room_deleted" (the developer deleted\n * the kept room), "game_unavailable" (the game was taken down or made private) or "game_server_stopped"\n * (the game server failed and couldn\'t go on).\n */\n endReason: EndReason;\n}\n```\n\n### Ending\n\n```ts\n/** Zaisma will end the match (the room\'s "ending" event). */\ninterface Ending {\n /** When, an ISO time, also room.endsAt. */\n endsAt: string;\n}\n```\n\n### Moved\n\n```ts\n/** This room object moved (the room\'s "moved" event). */\ninterface Moved {\n /** The room it\'s in now. */\n roomCode: string;\n /** The room it left. */\n fromRoomCode: string;\n}\n```\n\n### Idle\n\n```ts\n/** The "Still there?" question (the room\'s "idle" event). */\ninterface Idle {\n /** "asking": show the question. "answered": the player gave input. "timed_out": no answer, and the room hears they walked away. */\n idleStatus: "asking" | "answered" | "timed_out";\n /** How long the player has to answer, in seconds: 30. */\n answerTimeoutSec: number;\n}\n```\n\n### RoomMessage\n\n```ts\n/** A room message, as the room\'s "roomMessage" event hands it over. */\ninterface RoomMessage {\n /** The message as sent: plain JSON, up to 16 KB. */\n message: unknown;\n /** Who sent it: another room\'s game server, the game server outside rooms, or the developer. */\n senderKind: "room" | "server" | "developer";\n /** The code of the room that sent it, or null unless senderKind is "room". */\n fromRoomCode: string | null;\n /** When it was sent, an ISO time. */\n sentAt: string;\n}\n```\n\n### VersionUpdate\n\n```ts\n/** A match moving to a version published "now" (the room\'s "versionUpdate" event). */\ninterface VersionUpdate {\n /** The version it moves to, like "version_k2v9q4x7m1p3w8r5t6y0". */\n versionId: string;\n /** When it switches at the latest, an ISO time. */\n appliesAt: string;\n /** The game\'s own files changed, so the page reloads the game at the new version; false: it only reconnects. */\n isReloading: boolean;\n}\n```\n\n### Player\n\n```ts\n/** A player, as the room shows them to everyone. */\ninterface Player {\n /** Their player ID, like "player_8f3k2m". An account\'s is the same in every game; a guest\'s is temporary. */\n id: string;\n /** The name shown for them: the account\'s name, or a guest\'s like "Swift Otter 42". */\n name: string;\n /** A signed-in Zaisma account, or a guest. */\n kind: PlayerKind;\n}\n```\n\n### ListedPlayer\n\n```ts\n/** A player in the room\'s list (room.players): who they are, and why they aren\'t playing. */\ninterface ListedPlayer extends Player {\n /**\n * Why this player isn\'t playing: "idle" or "hidden" (the game server kept them, onAway), or "lost"\n * (their connection dropped and they have reconnectTimeoutSec to come back); null while they play.\n */\n awayReason: "idle" | "hidden" | "lost" | null;\n}\n```\n\n### PlayerKind\n\n```ts\n/**\n * A signed-in Zaisma account, a guest, or a player your own server let in from outside Zaisma\n * (outside_zaisma: a game played off Zaisma, {@link setUpOffZaisma}). More values may come; treat an unknown one as "guest".\n */\ntype PlayerKind = "guest" | "account" | "outside_zaisma";\n```\n\n### PlayerProfile\n\n```ts\n/** What anyone sees of an account on its profile, zaisma.com/@username ({@link player.getProfile}). */\ninterface PlayerProfile {\n /** The account\'s player ID, the same in every game. */\n id: string;\n /** The name to show for them in games: their username, so nobody can pass as someone else. */\n name: string;\n /** Their username: unique ignoring case, 3 to 20 letters, numbers and underscores. It can change; the ID never does. */\n username: string;\n /** The name they chose to show beside @username on their profile, once checked; null when none. */\n displayName: string | null;\n /** What they wrote about themselves, once checked; null when none or when their profile is private. */\n bio: string | null;\n /** Links they chose to show (only adults can), up to 3; [] otherwise or when their profile is private. */\n linkUrls: string[];\n /** Their profile page. */\n profileUrl: string;\n /** True when they show their profile to friends only: strangers then see only the name, username and published games. */\n isProfilePrivate: boolean;\n /** Games they made that anyone can find, newest first. */\n publishedGames: ProfileGame[];\n /** Games they played lately, newest first, when they show those to anyone; [] otherwise. */\n playedGames: (ProfileGame & { playedPeriod: PlayedPeriod })[];\n /** The game they\'re playing right now, when they show that to anyone; null when they aren\'t, don\'t show it, appear offline, or the game isn\'t out yet. */\n playingNow: ProfileGame | null;\n}\n```\n\n### ProfileGame\n\n```ts\n/** A game on a profile. */\ninterface ProfileGame {\n slug: string;\n title: string;\n /** The game\'s page on Zaisma. */\n pageUrl: string;\n}\n```\n\n### PlayedPeriod\n\n```ts\n/** Roughly when a player last played a game: a profile never shows a time. More values may come; treat an unknown one as "earlier". */\ntype PlayedPeriod = "today" | "this_week" | "this_month" | "earlier";\n```\n\n### PlayerWithPass\n\n```ts\n/** This tab\'s player and their player pass (Zaisma.player.getPass()). */\ninterface PlayerWithPass extends Player {\n /**\n * The player pass: a standard EdDSA JWT (header typ "pass+jwt") any server can check against the\n * game\'s own keys at https://rooms.zaisma.com/v1/pass-keys/<gameSlug>. It proves only who the player is: its sub\n * is the player\'s ID, kind says guest or account, aud is the game, pass_version_number is 1. A\n * guest\'s pass also carries their name; an account\'s name comes from its profile\n * (https://rooms.zaisma.com/v1/players/<id>). An account\'s pass says who it can chat with:\n * who_can_chat (nobody, friends or anyone, the player\'s own setting) and, when anyone, an opaque\n * chat_group_id (chat_group_\u2026) that differs in every game. Zaisma never tells a game anyone\'s age; a\n * game could guess which chat group is the younger one from its size. It carries its friends and\n * blocks, never as a list of players anyone can read: player_tag_id, its own opaque tag in this game\n * (player_tag_\u2026), friend_player_tag_ids, its friends\' tags (up to 200), and block_player_tag_ids, the\n * tags of the accounts it has a block with, either way (up to 100). Your own server checks it with\n * verifyPass, then two players with passesAreFriends(first, second), canChat(first, second) before\n * passing chat between them, and passesHaveBlockBetween(first, second) before matching them\n * together, all from @zaisma/game-server; guests never chat and are never anyone\'s friend.\n */\n pass: string;\n /** When the pass runs out, as an ISO time in UTC. */\n expiresAt: string;\n}\n```\n\n### ConnectionStatus\n\n```ts\n/**\n * Where a room\'s socket stands: "connecting" (joining, or rejoining after back.rejoin()), "open",\n * "reconnecting" (it dropped and the SDK is connecting again) or "closed" (for good, or while the player\n * is away with their seat gone or their connection dropped, until they\'re back). Whether the player is\n * in the match is {@link Room.awayReason}, not this.\n */\ntype ConnectionStatus = "connecting" | "open" | "reconnecting" | "closed";\n```\n\n### RoomSettings\n\n```ts\n/** Whether a room shows in room lists, takes new players and is offered by Zaisma\'s Join, and its name and labels. */\ninterface RoomSettings {\n isListed: boolean;\n isOpen: boolean;\n friendJoinsEnabled: boolean;\n name: string | null;\n labels: Record<string, string>;\n}\n```\n\n### RoomSettingsChange\n\n```ts\n/** The room\'s settings changed, or how many watch (the room\'s "settings" event). */\ninterface RoomSettingsChange extends RoomSettings {\n spectatorCount: number;\n}\n```\n\n### Kicked\n\n```ts\n/** Why the player was removed from the room, and whether they\'re kept out for the rest of the match. */\ninterface Kicked {\n /** Why, in words to show the player. */\n message: string;\n isKeptOut: boolean;\n}\n```\n\n### Move\n\n```ts\n/** The game server is sending the player to another room ({@link RoomEvents.move}). */\ninterface Move {\n /** The room they\'re being sent to. */\n roomCode: string;\n /** Move this room object there: the old connection closes and the new one opens. */\n follow(): void;\n /** Join it as a new room object instead, on the same server as this one: leave this one first. */\n join(moveJoinOptions?: MoveJoinOptions): Promise<Room>;\n}\n```\n\n### Away\n\n```ts\n/** The player walked away ({@link RoomEvents.away}). */\ninterface Away {\n /** "idle": no input and no answer to "Still there?". "hidden": the game was hidden for 2 minutes in a real-time room. */\n awayReason: "idle" | "hidden";\n /** How long the room holds their seat, in seconds. */\n seatHoldDurationSec: number;\n}\n```\n\n### Back\n\n```ts\n/** The player is back after walking away ({@link RoomEvents.back}). */\ninterface Back {\n /** Their room. */\n roomCode: string;\n /** true: they\'re in their held seat again, and rejoin does nothing. false: the seat ran out, so call rejoin. */\n isSeatHeld: boolean;\n /** Rejoin their old room when the seat ran out. Fails if it\'s full or over. */\n rejoin(): void;\n}\n```\n\n### RoomError\n\n```ts\n/** An error the room sent. */\ninterface RoomError {\n code: RoomErrorCode;\n /** What happened, in words. */\n message: string;\n}\n```\n\n### RoomErrorCode\n\n```ts\n/**\n * The codes a room\'s errors have, in its "error" event and when joining fails:\n * - room_full: the room has no space.\n * - room_closed: the room is closed to new players.\n * - ended: the match is over.\n * - kept_out: the player was removed for the rest of the match.\n * - refused: the game server\'s canJoin turned them away.\n * - rented_share_used: this player is on a rented-server network, and the share of the game\'s hosting such traffic gets is used. Zaisma\'s page tells them to turn off their VPN or sign in. Everyone else plays on.\n * - hosting_paused: the game\'s hosting on Zaisma is paused this month (its free allowance, or its developer\'s budget or credit, is used); new rooms open again when the month resets (UTC) or its developer adds credit, and a running match takes no new players and ends within the hour.\n * - account_needed: the player is a guest, and the game needs a Zaisma account for multiplayer or the whole game.\n * - game_not_open_to_player: the account is younger than the game\'s minimum age (set on the dashboard); the game never learns its age.\n * - game_unavailable: the game can\'t be played right now.\n * - bad_pass: the player pass wasn\'t accepted (the SDK gets a new one and tries once more).\n * - bad_player_token: off Zaisma, your own server didn\'t take the playerToken ({@link setUpOffZaisma}); the game gets the player a new one.\n * - bad_origin: the connection didn\'t come from the game\'s own page.\n * - too_big: a message over 16 KB, or joinData over 4 KB.\n * - too_fast: more messages than the room takes (about 30 a second).\n * - bad_message, no_hello, not_allowed: a message the room couldn\'t read or use, didn\'t expect, or doesn\'t allow from this player.\n * - busy: the room couldn\'t take the player right now; try again soon.\n * - room_not_running: the room isn\'t running, like one with nobody playing to watch, or one a move named that isn\'t there.\n * - blocked_player_here: quickJoin\'s first try at a room with someone the player blocked; quickJoin tries the others first, and you won\'t see it.\n * - other_version: the room runs another version of the game. On its Zaisma page the game reloads at the room\'s version and joins it, and you won\'t see it; you see it outside Zaisma, through a tester link, or when that version is no longer kept.\n * - spectators_full: the room takes no more spectators (its game server\'s maximumSpectatorCount, 0 when it takes none).\n * - already_playing: a player in the room tried to watch it too.\n * - spectator_cannot_send: a spectator tried to send to the room ({@link Room.send}, {@link Room.sendBytes}).\n * - send_queue_full: the SDK\'s own: more than 60 reliable sends waited while the room wasn\'t reachable, so the oldest were dropped. Send less while connectionStatus isn\'t open, or use latest_only for updates that replace each other.\n * - chat_not_allowed, chat_empty, chat_too_long, chat_too_fast: {@link Room.chat} refused (they reject its promise, not the "error" event); chat_not_here: the room\'s server doesn\'t take chat.\n *\n * More codes may come within v1: handle one you don\'t know like an error you can show (its message).\n *\n * More values may come; treat an unknown one as "request_failed".\n */\ntype RoomErrorCode =\n```\n\n### RequestErrorCode\n\n```ts\n | "room_full"\n | "room_closed"\n | "ended"\n | "kept_out"\n | "refused"\n | "hosting_paused"\n | "rented_share_used"\n | "account_needed"\n | "game_not_open_to_player"\n | "game_unavailable"\n | "bad_pass"\n | "bad_player_token"\n | "bad_origin"\n | "too_big"\n | "too_fast"\n | "bad_message"\n | "no_hello"\n | "not_allowed"\n | "busy"\n | "room_not_running"\n | "blocked_player_here"\n | "other_version"\n | "spectators_full"\n | "already_playing"\n | "spectator_cannot_send"\n | "send_queue_full"\n | "chat_not_here"\n | "chat_not_allowed"\n | "chat_empty"\n | "chat_too_long"\n | "chat_too_fast";\n\n/**\n * The codes a request\'s errors have ({@link Server.request}), from Zaisma or the Node runner alike:\n * - bad_request: not plain JSON with the player\'s pass.\n * - too_big: a request over 16 KB.\n * - bad_pass: the player pass wasn\'t accepted (the SDK gets a new one and tries once more).\n * - bad_player_token: off Zaisma, your own server didn\'t take the playerToken ({@link setUpOffZaisma}); the game gets the player a new one.\n * - account_needed: the player is a guest, and the game needs a Zaisma account for multiplayer or the whole game.\n * - game_not_open_to_player: the account is younger than the game\'s minimum age (set on the dashboard); the game never learns its age.\n * - game_unavailable: the game can\'t be played right now.\n * - no_request_handler: the game\'s server has no onRequest.\n * - game_server_error: onRequest threw, answered something that isn\'t plain JSON or over 1 MB, or took over 10 seconds.\n * - rented_share_used: this player is on a rented-server network, and the share of the game\'s hosting such traffic gets is used. Zaisma\'s page tells them to turn off their VPN or sign in. Everyone else plays on.\n * - hosting_paused: the game\'s hosting on Zaisma is paused this month; requests work again when the month resets (UTC) or its developer adds credit.\n * - slow_down: too many requests from this address; try again in a minute.\n * - bad_origin: the request didn\'t come from the game\'s own page.\n * - busy: Zaisma couldn\'t answer right now; try again soon.\n *\n * More values may come; treat an unknown one as "request_failed".\n */\ntype RequestErrorCode =\n```\n\n### ErrorCode\n\n```ts\n | "bad_request"\n | "too_big"\n | "bad_pass"\n | "bad_player_token"\n | "account_needed"\n | "game_not_open_to_player"\n | "game_unavailable"\n | "no_request_handler"\n | "game_server_error"\n | "hosting_paused"\n | "rented_share_used"\n | "slow_down"\n | "bad_origin"\n | "busy";\n\n/**\n * The codes the SDK\'s errors have: a room\'s ({@link RoomErrorCode}), and:\n * - unchecked: no player pass, because the game isn\'t played on its zaisma.com page or Zaisma couldn\'t check the browser.\n * - unknown_option, unknown_event: a call the SDK doesn\'t take; the message lists what it does.\n * - slow_down: too many calls; try again in a minute.\n * - zaisma_rooms_not_used: the game doesn\'t use Zaisma rooms.\n * - bad_report: a report whose reason isn\'t a {@link ReportReason}, or whose player ID isn\'t one.\n * - bad_origin: the call didn\'t come from the game\'s own page.\n * - not_on_zaisma: the game is played off Zaisma, so it has no player passes, sign-in or room lists; joinRoom and server.request need {@link setUpOffZaisma} and a serverUrl.\n * - bad_game_slug: {@link setUpOffZaisma}\'s gameSlug isn\'t a game slug: 1 to 40 lowercase letters, digits or hyphens.\n * - sign_in_declined: the player chose Not now when the game asked them to sign in ({@link player.signIn}) or showed the "Keep your progress" card ({@link player.offerAccount}).\n * - account_offer_too_soon: the "Keep your progress" card already showed this visit, or the player chose Not now in the last 3 days ({@link player.offerAccount}).\n * - cloud_saves_off: the game has cloud saves off, so it has no saves on players\' accounts ({@link saves}).\n * - cloud_saves_not_here: cloud saves don\'t work where the game is played: a tester link, or a Zaisma without accounts. Save in the browser as usual.\n * - bad_save_copy_id: not a save copy ID; they come from {@link Saves.listCopies}, like "save_copy_k2v9q4x7m1p3w8r5t6y0".\n * - no_save_copy: the player has no earlier version with that ID in this game.\n * - bad_room_code: not a room code, which is six characters like "K7Q2MX", from 2 to 9 and A to Z without I or O.\n * - bad_server_url: a serverUrl that isn\'t a full wss://, ws://, https:// or http:// address ({@link Friends.setRoom} takes only wss:// and https://).\n * - unlisted_server: {@link Friends.setRoom} named a server that isn\'t one of the game\'s own servers (own_server_urls).\n * - connection_closed: the connection to the room closed before it let the player in; the message says why.\n * - bad_bytes: {@link Room.sendBytes} was given something other than an ArrayBuffer or a typed array.\n * - bad_send_option: a send\'s delivery or latestKey isn\'t one it takes; latest_only needs a latestKey.\n * - bad_delay: {@link Room.smoothedState}\'s delayMs isn\'t from 0 to 1000.\n * - bad_region: a region that isn\'t a continent code ({@link Region}).\n * - bad_idle_timeout: an idleTimeoutSec that isn\'t from 30 to 86400.\n * - bad_transport: a transport that isn\'t "websocket" or "webtransport".\n * - request_failed: Zaisma didn\'t answer (no connection, or a problem on Zaisma\'s side); try again.\n * - no_game: {@link Items.buy} named a game that isn\'t open to play here.\n * - chat_stopped, chat_not_allowed, chat_empty, chat_too_long, chat_too_fast, chat_not_here: {@link Room.chat} didn\'t send ({@link ChatErrorCode}).\n * - And a request\'s ({@link RequestErrorCode}).\n *\n * More values may come; treat an unknown one as "request_failed".\n */\ntype ErrorCode =\n```\n\n### SdkError\n\n```ts\n | RoomErrorCode\n | RequestErrorCode\n | "chat_stopped"\n | "chat_not_allowed"\n | "chat_empty"\n | "chat_too_long"\n | "chat_too_fast"\n | "chat_not_here"\n | "unchecked"\n | "unknown_option"\n | "unknown_event"\n | "slow_down"\n | "zaisma_rooms_not_used"\n | "bad_report"\n | "bad_origin"\n | "not_on_zaisma"\n | "bad_game_slug"\n | "sign_in_declined"\n | "account_offer_too_soon"\n | "cloud_saves_off"\n | "cloud_saves_not_here"\n | "bad_save_copy_id"\n | "no_save_copy"\n | "no_player"\n | "bad_player_id"\n | "bad_room_code"\n | "bad_bytes"\n | "bad_send_option"\n | "bad_delay"\n | "bad_region"\n | "bad_idle_timeout"\n | "bad_transport"\n | "bad_server_url"\n | "unlisted_server"\n | "unknown_link"\n | "bad_link_path"\n | "bad_item_name"\n | "bad_purchase_id"\n | "no_purchase"\n | "already_handled"\n | "handled_by_server"\n | "bad_link_query"\n | "bad_own_site_url"\n | "needs_player_tap"\n | "no_game"\n | "no_item"\n | "not_for_sale"\n | "stripe_not_connected"\n | "stripe_cannot_take_payments"\n | "bad_item_count"\n | "bad_game_account_id"\n | "connection_closed"\n | "request_failed";\n\n/**\n * An error from the SDK: its code says what went wrong, for the game to branch on, and its message\n * says it in one sentence, with what to fix.\n *\n * @example\n * try { room = await Zaisma.joinRoom(); }\n * catch (error) {\n * switch (error.code) {\n * case "room_full": showRoomFull(); break;\n * default: showError(error.message); // codes only grow within v1, so keep a default\n * }\n * }\n */\ninterface SdkError extends Error {\n code: ErrorCode;\n}\n```\n\n### InviteStatus\n\n```ts\n/**\n * What {@link invite} did: "opened" Zaisma\'s Share on a Zaisma page, or "failed" when the page couldn\'t\n * open it; elsewhere "shared" from the share sheet, "copied" the link, "cancelled" the share sheet, or\n * "failed" to do either. More values may come; treat an unknown one as "failed".\n */\ntype InviteStatus = "opened" | "shared" | "copied" | "cancelled" | "failed";\n```\n\n### ChatCheck\n\n```ts\n/** What {@link checkChat} found. */\ninterface ChatCheck {\n /** Whether it can be sent. */\n isAllowed: boolean;\n /** Why not, null when it\'s allowed ({@link ChatCheckReason}). */\n reason: ChatCheckReason | null;\n /** The words to show the sender when it\'s stopped (never about age or the other player); null when it\'s allowed. */\n message: string | null;\n /** Whether it swears. Zaisma allows swearing; block it yourself if your game doesn\'t. */\n hasSwearing: boolean;\n /** Whether it has a slur. Zaisma allows it too; your game and its moderators decide. */\n hasSlur: boolean;\n /** The text tidied up: hidden characters and extra spaces gone, line breaks kept (empty when it\'s too_long). */\n text: string;\n}\n```\n\n### ChatCheckReason\n\n```ts\n/**\n * Why {@link checkChat} stopped a message: "contact_details" (a link, handle, email, phone number or\n * contact app in any disguise, or moving to another app or meeting up), "personal_details" (where\n * someone lives, their school, their full name, photos), "sexual" or "too_long" (over 2000 characters).\n * "slur" and "unchecked" are v1\'s and no longer given: slurs are flagged (hasSlur), and what the AI can\'t\n * look at goes after the rules. The game server\'s ChatCheckReason has two more, "chat_paused" and\n * "not_allowed_to_chat", which only a room can give. More values may come; treat an unknown one as a\n * stop: show message.\n */\ntype ChatCheckReason = "contact_details" | "personal_details" | "slur" | "sexual" | "unchecked" | "too_long";\n```\n\n### ReportReason\n\n```ts\n/** What happened, in a player report. Zaisma looks at real_life_threat (a threat that reaches past the game: their real details, finding them, a plan), personal_details (sharing someone\'s), following_after_block and sexual (behavior); harassment, cheating and other go to the game\'s developer. */\ntype ReportReason = "real_life_threat" | "personal_details" | "following_after_block" | "sexual" | "harassment" | "cheating" | "other";\n```\n\n### ReportAnswer\n\n```ts\n/** Zaisma\'s answer to a report. */\ninterface ReportAnswer {\n isReported: true;\n}\n```\n\n### RoomList\n\n```ts\n/** The game\'s listed rooms ({@link Rooms.list}). */\ninterface RoomList {\n /** Rooms with space first (the player\'s country, then region, then the busiest), then full and closed ones. Up to 50, in the region asked for. */\n rooms: ListedRoom[];\n /** Everyone playing in the game\'s rooms everywhere, unlisted rooms too (for "playing now"). */\n playingPlayerCount: number;\n /** The game\'s rooms with someone playing, everywhere, unlisted ones too. */\n playingRoomCount: number;\n /** Listed rooms that are closed to new players, everywhere. */\n listedClosedRoomCount: number;\n /** Listed rooms a player could join right now, everywhere. */\n listedJoinableRoomCount: number;\n /** Listed rooms taking players, full ones too, in the region and with the labels asked for: the ones listed plus the ones past them (moreOpenRoomCount). */\n matchingOpenRoomCount: number;\n /** The regions with listed rooms, busiest first, for a region filter, like { region: "EU", regionName: "Europe", roomCount: 12, playerCount: 48 }. */\n regions: { region: Region; regionName: string; roomCount: number; playerCount: number }[];\n /** The region the rooms are filtered to, or null for everywhere. */\n region: Region | null;\n /** Open rooms in that region past the ones listed. */\n moreOpenRoomCount: number;\n /** Labels worth filtering by: ones several rooms have, with a handful of values. */\n filters: { label: string; values: string[] }[];\n}\n```\n\n### ListedRoom\n\n```ts\n/** A room in a room list. Never who\'s in it. */\ninterface ListedRoom {\n roomCode: string;\n /** Players in the match, not counting players who walked away. */\n playerCount: number;\n /** Seats held for players coming back or on their way: a room has space while playerCount + heldSeatCount < maximumPlayerCount. */\n heldSeatCount: number;\n maximumPlayerCount: number;\n /** Spectators watching the room. */\n spectatorCount: number;\n /** Spectators the room takes (its game server\'s maximumSpectatorCount): 0 when nobody can watch. Room to watch while spectatorCount < maximumSpectatorCount, full or closed rooms too. */\n maximumSpectatorCount: number;\n /** false: closed, so only players who were in it can come back. */\n isOpen: boolean;\n /**\n * Where the room runs: the country its first player connected from, and its region (a continent),\n * like { countryCode: "DE", countryName: "Germany", region: "EU" }; null when unknown.\n */\n location: { countryCode: string; countryName: string; region: Region | null } | null;\n /** In the same region as the player asking. */\n isNear: boolean;\n /** The room\'s name, or null. */\n name: string | null;\n /** The room\'s labels. */\n labels: Record<string, string>;\n /** Kept by the game server (room.setKept): a world that stays listed with nobody in it, like a server waiting for players. */\n isKept: boolean;\n /** The room\'s link on Zaisma, to join it or pass it on. */\n inviteUrl: string;\n}\n```\n',
|
|
60428
60441
|
"naming": "<!-- Made by scripts/build-skill.mjs: never edit it by hand. -->\n\n# Naming\n\nHow names, values, inputs, examples, errors and next steps work everywhere an AI or a developer reads or writes Zaisma: the developer API, the developer and admin MCPs, the SDK, the game server API, the docs and examples that show them, and Zaisma's own code (database columns, types, functions and variables). It's the working half of \"Nothing for an AI to guess\" in `docs/DECISIONS.md`. The inside uses the same names as the outside, so nothing needs translating between them.\n\nWhy: an AI reading `files: 12`, `dt` or `created_at: 1792012345678` has to stop and work out what it means, and sometimes gets it wrong. Every guess costs tokens and some cost a wrong call. A name that says what it holds, what kind of value and in what unit lets the AI predict the right value and the right next call straight away.\n\nThe API, MCPs, SDK, game server and Zaisma's own code all use these names, inside and out, and a test keeps it that way: everything new follows this guide. The messages between the SDK and rooms do too: `type` and `data`, not `t` and `d` (rooms are billed per message, never by its size). Examples in this guide show the pattern; the glossary at the end lists the names that exist.\n\n## The shape of a name\n\nA name has up to three parts: **what it's about**, **what kind of value**, **in what unit**. `play` + `duration` + `min` is `play_duration_min`; `file` + `count` is `file_count`. The middle part tells the AI the kind of value before it reads the value.\n\n| Kind of value | Name | Value | Example |\n| --- | --- | --- | --- |\n| Point in time | `<event>_at` | ISO 8601 string in UTC | `published_at: \"2026-10-14T17:00:00Z\"` |\n| Calendar day | `<what>_date`, or `date` | `\"YYYY-MM-DD\"`, UTC | `date: \"2026-10-14\"` |\n| Length of time | `<what>_duration_<unit>`, or a duration word below in place of `duration` | number | `play_duration_min`, `idle_timeout_sec` |\n| Count | `<thing>_count` | integer | `file_count`, `player_count` |\n| Place in a list | `<what>_index` | integer from 0 | `channel_index: 2` |\n| Step on a fixed scale | `<what>_level`, its values listed in the schema | integer | `quality_level: 2` |\n| Rate | `<things>_per_<unit>` | number | `ticks_per_sec`, `posts_per_day` |\n| Size | `size_bytes`, `<what>_size_bytes` | integer | `size_bytes: 52000` |\n| On-screen length | `width_px`, `height_px`, `<what>_px` | number | `width_px: 1920` |\n| Angle | `<what>_deg` | number | `rotation_deg: 35` |\n| Share | `<what>_pct` | number, 0 to 100 | `returned_pct: 42` |\n| Yes or no | `is_`, `has_` or `can_` first; `<setting>_enabled` for a setting someone switches; a verb for an input that asks for an action | boolean | `is_live`, `cloud_saves_enabled`, `reopen: true` |\n| Choice | `<what>_status`, `_kind` or `_mode`, or the setting's own name | one of a fixed list | `scan_status: \"held\"`, `visibility: \"listed\"` |\n| ID | `id` for the object's own; `<kind>_id` for one that points at another | `<kind>_<random>` | `id: \"version_8f3k2m\u2026\"`, `version_id: \"version_8f3k2m\u2026\"` |\n| List | plural noun; a list of IDs is `<kind>_ids` | array | `files`, `image_ids` |\n| Text in a format | `<what>_url`, `_base64`, `_markdown` | string | `preview_url`, `text_markdown`, `images_base64` |\n| Plain text | the thing's name, no suffix | string | `title`, `description` |\n\n### Units\n\nThe only unit suffixes:\n\n| Suffix | Unit |\n| --- | --- |\n| `_ms` | milliseconds, only where under a second matters |\n| `_sec` | seconds |\n| `_min` | minutes |\n| `_hours` | hours |\n| `_days` | days |\n| `_years` | years, for ages (`minimum_player_age_years`) |\n| `_bytes` | bytes |\n| `_px` | CSS pixels |\n| `_deg` | degrees |\n| `_pct` | percent, 0 to 100 (never 0 to 1) |\n| `_cents` | US cents, a number that may have a fraction (`review_cost_cents`); Stripe works in cents too |\n| `_minor_units` | the smallest unit of the currency in the `currency_code` beside it (cents, pence; yen are whole), as Stripe counts amounts (`price_minor_units`) |\n\nRates reuse them with `per` and the singular: `_per_sec`, `_per_min`, `_per_hour`, `_per_day`. Pick the unit people think in for that quantity (minutes played, player hours a month), then use that same unit for it everywhere.\n\nThe list stays short on purpose: each new suffix makes every suffix worth less. Add one only when a real field can't be said with these, and add it here in the same change.\n\n### Duration words\n\nA length of time says so in its name. `duration` is the default; four words say more when they fit:\n\n| Word | Means | Example |\n| --- | --- | --- |\n| `duration` | how long something lasts | `play_duration_min`, `seat_hold_duration_sec` |\n| `timeout` | how long before something gives up or steps in | `idle_timeout_sec` |\n| `interval` | time between repeats | `ping_interval_sec` |\n| `delay` | wait before something starts | `publish_delay_min` |\n| `cooldown` | wait before it can happen again | `vote_cooldown_sec` |\n\n## Rules\n\n1. **Whole words.** The only short forms are the units above, `id`/`ids`, `url` and `sha256`, plus `i` for a loop index in code. Not `dt`, `dx`, `msg`, `opts`, `pos`, `t`, `num`, `max`, `min`, `cfg`, `res`, `err`, `e`.\n2. **Minimum and maximum are spelled out**, as the first word: `minimum_player_count`, `maximum_player_count`. `_min` at the end always means minutes.\n3. **Vague nouns get a subject.** `data`, `info`, `value`, `result` and `context` never stand alone: `join_data`, `failure_context`.\n4. **One type and one unit per field.** No \"a number or false\", no \"a string or a number\". A setting with modes is a choice plus a separate number: `idle_check: \"server\" | \"client\" | \"off\"` and `idle_timeout_sec: 600`, not `idleAfter: 600 | false | \"client\"`.\n5. **A field reads right on its own.** If its short name means something else elsewhere in the glossary, use the full name. `code` is an error's code, so a room's is `room_code`; `players` is a list of players, so a number of them is `player_count`. On an object, `id` and `kind` are that object's own; anything else about it says what it is (`scan_status`, `review_status`, `page_url`, `image_url`).\n6. **One name per concept, everywhere.** The glossary below is the list. Check it before naming anything; a new concept goes into it in the same change.\n7. **Same words in each surface's style.** snake_case in the API and MCP (`play_duration_min`), camelCase in the SDK and game server (`playDurationMin`). The one exception: a webhook event reaches the game server as the API's own JSON, snake_case, so one event reads the same everywhere. Choice values and error codes are lowercase snake_case everywhere (`when_approved`, `keyboard_mouse`, `hosting_paused`); a word that's hyphenated in plain English keeps its hyphen (`co-op`).\n8. **Keys are always there.** An answer has the same keys every time. `null` means \"not set\" or \"none\" and nothing else. In an update, leaving a key out keeps it and `null` clears it.\n9. **A plural is always a list.** A number of things is never a bare plural, and a list names what's in it when that isn't obvious: `image_ids` holds IDs, `images` holds image objects, `images_base64` holds encoded images.\n10. **Times go in and out as ISO 8601.** Out: UTC with `Z`. In: ISO 8601 with `Z` or an offset, nothing else (no epoch numbers).\n11. **Lists that page** take `cursor` and answer `next_cursor`: an opaque string, `null` on the last page. Never a timestamp standing in for a cursor.\n\nGood and not:\n\n| Good | Not | Why |\n| --- | --- | --- |\n| `file_count: 12` | `files: 12` | `files` is a list elsewhere |\n| `created_at: \"2026-10-14T09:30:00Z\"` | `created_at: 1792012345678` | An AI can't read a date from a number without working it out |\n| `idle_timeout_sec: 300` | `idle: 300` | Seconds? Minutes? And what about idle? |\n| `tickDurationSec` | `dt` | Short forms hide both the meaning and the unit |\n| `maximum_player_count: 8` | `max: 8` | `max` of what, and `min` clashes with minutes |\n| `returned_pct: 42` | `percent: 42` | Percent of what |\n| `vote_count` and `affected_developer_count` | `count`, meaning one or the other by kind | One name, one meaning |\n\n## Zaisma's own code\n\nThe same rules hold inside, with these on top. `test/node/naming.test.ts` checks identifiers, type fields and the database columns the migrations make, in the TypeScript, the JavaScript the packages ship (the SDK, the CLI, the Node runner) and the SDK's types.\n\n- **Same words, two styles.** Database rows and API data are snake_case (`review_status`, `size_bytes`); variables, functions and types are camelCase or PascalCase (`reviewStatus`, `sizeBytes`). Never mix them in one shape: a stored JSON object is snake_case all the way down.\n- **Columns take the API's names**, so the API passes data through instead of renaming it: `games.review_status`, `versions.patch_notes`, `game_images.width_px`. When the API shows something differently (an ISO time, a list made from text), only the value's form changes, never its name.\n- **Stored times are `<event>_at_ms`**: epoch milliseconds, in columns and in variables (`createdAtMs`). `_at` always means an ISO string. `iso()` (`packages/core/src/time.ts`) is the only conversion between them.\n- **Yes/no columns are named like booleans** (`cloud_saves_enabled`, `is_listed`), even though D1 stores them as 0 or 1. Every other number column ends in `_count`, a unit, `_ms`, `_per_<unit>`, `_index` or `_level`.\n- **Whole words everywhere**, callback parameters included: `games.map((game) => \u2026)`, `catch (error)`, `(first, second) => \u2026` in a sort. `i` is the one short name, for a loop index.\n- **Names the platform sets keep its spelling**: Worker bindings and secrets in `Env` (`DB`, `GAMES`), `env` and `ctx` in Worker handlers, and Web and Cloudflare API fields (`httpMetadata`, `etag`). Our own variables holding them still get whole words (`response`, not `res`).\n- **No old names are left.** `test/naming-baseline.json` is empty, and the check fails on any name that breaks these rules. Should a name ever have to wait, it goes in that list (`npm run naming:baseline` writes it), and the check then fails on any new one and on any listed one that's gone, so the list only shrinks.\n- **A standard's shapes keep its names** (Exceptions below): declare the shape with a name, like `TurnstileAnswer` or `PassClaims`, and list its standard fields in `STANDARD_FIELDS_BY_SHAPE` in `test/naming-source.ts`. Only those fields of that shape are let through; anything of ours in it still follows the rules.\n\n## IDs\n\nEvery ID Zaisma makes says its kind in its value: `<kind>_<random>`, the kind in whole words (`play_ticket_\u2026` for a kind of two words; the random part never has an underscore). An object's own ID is `id`, because the value already says what it is; an ID that points at another object is `<kind>_id` (`{ \"id\": \"post_4k\u2026\", \"topic_id\": \"topic_9x\u2026\" }`). An AI always knows what it's holding, and passing one where another kind belongs gets a clear error: `wrong_id_kind`, \"That's an image ID; version_id takes a version ID.\", with a fix naming the call that lists the right ones. Schemas give every ID its kind as a pattern (`^version_[a-z0-9]+$`), and `test/site/naming.test.ts` checks that they do.\n\n| Kind | Example |\n| --- | --- |\n| `game` | `game_\u2026` |\n| `version` | `version_\u2026` |\n| `image` | `image_\u2026` |\n| `shader` | `shader_\u2026` |\n| `tester` | `tester_\u2026` |\n| `topic` (known issues too) | `topic_\u2026` |\n| `post` | `post_\u2026` |\n| `report` | `report_\u2026` |\n| `media` | `media_\u2026` |\n| `precedent` | `precedent_\u2026` |\n| `review_precedent` (a ruling the AI review follows) | `review_precedent_\u2026` |\n| `player` | `player_\u2026` |\n| `owner` | `owner_\u2026` |\n| `save_copy` | `save_copy_\u2026` |\n| `play_ticket` | `play_ticket_\u2026` |\n| `room_key` | `room_key_\u2026` |\n| `sign_in_app` | `sign_in_app_\u2026` |\n| `chat_group` | `chat_group_\u2026` |\n| `player_tag` | `player_tag_\u2026` |\n| `webhook` | `webhook_\u2026` |\n| `webhook_event` | `webhook_event_\u2026` |\n| `chat_review` | `chat_review_\u2026` |\n| `mcp_client` (an AI app that connects to the MCP by signing in; one that uses a metadata document is named by its URL instead) | `mcp_client_\u2026` |\n| `database_restore` (a restore of a game's database to a time, or the undo of one) | `database_restore_\u2026` |\n| `kept_room_restore` (a restore of a kept room's world to a time, or the undo of one) | `kept_room_restore_\u2026` |\n| `kept_room_restore_batch` (every kept room of a game going back to a time, or the undo of that) | `kept_room_restore_batch_\u2026` |\n| `whats_on_entry` (an event, news or a pick a person added to What's on at Zaisma) | `whats_on_entry_\u2026` |\n| `announcement` (short news Zaisma posts for players, shown on zaisma.com's home) | `announcement_\u2026` |\n| `top_up` (credit a developer bought on Stripe's page) | `top_up_\u2026` |\n| `credit_entry` (any other change to a developer's credit: a game's hosting charge for a day, a refund, what Zaisma wrote off) | `credit_entry_\u2026` |\n| `purchase` (a player's purchase or grant of an item in a game) | `purchase_\u2026` |\n| `spending_request` (a raise in spending an AI asked for, which only the developer approves on zaisma.com) | `spending_request_\u2026` |\n| `game_deletion_request` (a deletion of a game a key, an AI app or the dashboard asked for, which only the developer approves on zaisma.com) | `game_deletion_request_\u2026` |\n| `pending_refund` (a deleted account's refund Stripe hasn't taken yet; never shown outside Zaisma) | `pending_refund_\u2026` |\n| `scheduled_room_message` (a send to every room a game scheduled for later) | `scheduled_room_message_\u2026` |\n| `ban_match` (another account that paid with a card banned with an account, for a person at Zaisma to decide; only in the admin MCP) | `ban_match_\u2026` |\n| `review_batch` (a batch of a version's AI review requests sent to Anthropic; never shown outside Zaisma) | `review_batch_\u2026` |\n| `ncmec_report` (a report to NCMEC's CyberTipline; never shown outside Zaisma) | `ncmec_report_\u2026` |\n| `admin_change` (a change the admin's AI asked for, waiting for the admin's passkey tap; never shown outside Zaisma) | `admin_change_\u2026` |\n\n`ID_KINDS` (`packages/core/src/ids.ts`) is this list, and a test keeps the two in step; a new kind is added to both in the same change. Accounts' and guests' player IDs are both `player_\u2026`, in their passes and everywhere the SDK and game server show them; an account's never changes, and Zaisma's own account ID (the sign-in's) never leaves Zaisma. The developer API and MCP still name a game by its `slug`, the link name developers know. Not IDs, and kept as they are: a `slug`, a `room_code` (six letters players type), API keys (`zsk_\u2026`, a format secret scanners know), connected apps' access and refresh tokens (`zat_\u2026`, `zrt_\u2026`), webhook signing secrets (`whsec_\u2026`, Standard Webhooks' form) and file hashes (`sha256`).\n\n## Inputs\n\n- **Fixed lists, not free text.** A field with known values is an enum in the schema, and its description says what each value means.\n- **Templates, not free-form objects.** Every object has its properties, which are required and `additionalProperties: false`. No bare `{ \"type\": \"object\" }`.\n- **Every ID says where it comes from**: \"A version_id from get_game or upload_files\".\n- **Limits live in the schema** (`maxLength`, `minimum`, `maximum`, `maxItems`, `pattern`), not only in prose.\n\n### Examples\n\nThe bar: a model that has never seen Zaisma gets the call right the first time from the schema alone. Where we aren't confident it would, add examples until it would, as many as the call needs:\n\n- **None** for simple lookups like `get_game({ slug })`.\n- **One good example** for a typical write.\n- **Several good and bad** for big or flexible tools, like `update_game`'s players, `upload_files`, `post_topic` and `search_forum`.\n\nGood examples go in the input schema's `examples`, with realistic values (real-looking slugs, prefixed IDs, ISO times). Bad examples go at the end of the tool's description, one line each, with the reason:\n\n```\nNot: { \"at\": 1792012345678 } (scheduled_publish_at takes an ISO time like \"2026-11-01T17:00:00Z\")\n```\n\nA mistake that keeps showing up in MCP errors becomes a bad example.\n\n## Outputs\n\n- **Every MCP tool has an output schema** (`apps/site/src/schemas.ts`), with each field described once there where its name can't say it all. Not every AI app shows output schemas to the model, so the names carry the meaning, and the tool's description adds only what a reader of the answer must know that names can't carry (like what counts as a play).\n- **Compact JSON.** Answers aren't indented: indenting costs tokens and tells the AI nothing.\n- **The same shape every time** (rule 8).\n- **Brief by default** for anything that can be long, with a way to ask for more.\n\n## Errors\n\nEvery error, in the API and the MCP, has the same shape:\n\n```json\n{ \"error\": { \"code\": \"bad_time\", \"message\": \"scheduled_publish_at is in the past.\", \"field\": \"scheduled_publish_at\", \"fix\": \"Give an ISO time from 5 minutes to 90 days ahead, like \\\"2026-11-01T17:00:00Z\\\".\", \"message_for_people\": \"That time is outside the range this takes. Pick another.\", \"retry_after_sec\": null, \"help_url\": \"https://zaisma.com/developers/errors/bad_time\" } }\n```\n\n- `code`: stable, lowercase snake_case, one problem per code, never reused for another.\n- `message`: what happened, in one sentence.\n- `field`: the input at fault, or `null`.\n- `fix`: what to do about it, naming the call or value when there is one.\n- `message_for_people`: what happened and what to do, for a page to show; never names a call or field. Every code has one (`messageForPeople` in `ERROR_CODES`), and a throw gives its own only for specifics like a count or a name.\n- `retry_after_sec`: how long to wait when waiting helps (like `slow_down`), else `null`.\n- `help_url`: the code's page at `https://zaisma.com/developers/errors/<code>`, with what it means and the general fix (`fix` in `ERROR_CODES`); `null` for the admin MCP's own codes, which have no page.\n\nA page shows only `message_for_people`; `message` and `fix` are for the caller. Review reasons, findings and alerts carry `message_for_people` beside their `fix` the same way.\n\nIn the MCP the same object is the tool result's `structuredContent`, with `isError: true` and its message, fix and code as its text (`<message> <fix> (<code>)`), and each tool's listed output schema is its answer or the error (`anyOf`), because MCP clients check an error's `structuredContent` against it too. Every code is in `ERROR_CODES` (`packages/core/src/errors.ts`) and listed in `docs/DEVELOPER-API.md`, which a test keeps in step.\n\n## Next steps\n\nEvery call that changes something answers with `next_steps`: the calls that usually follow, ready to make.\n\n```json\n\"next_steps\": [\n { \"tool\": \"get_version\", \"arguments\": { \"slug\": \"sky-hopper\", \"version_id\": \"version_8f3k2m\" }, \"after_sec\": 30, \"reason\": \"The scan usually takes under a minute.\" }\n]\n```\n\n- `tool` is the MCP tool's name; `arguments` are what to send, filled in.\n- `after_sec`: how long to wait first, or `null` for straight away.\n- `reason`: why this is the next step, in one short sentence.\n- `next_steps` is `[]` when nothing usually follows.\n\n## Exceptions\n\nDeliberate, and only these:\n\n- **Standard formats keep their own names**: HTTP headers, JSON-RPC and MCP fields (`inputSchema`, `isError`, `structuredContent`) and JSON Schema keywords (`maxLength`). So do the shapes of standards and outside services Zaisma reads: JWT claims (`exp`, `nbf`, `iat`), OAuth and OpenID Connect at `/oauth/` and `/.well-known/` (`client_id`, `redirect_uri`, `id_token`, `expires_in`, `auth_time`, `invalid_grant`), WebAuthn's client and authenticator data (`crossOrigin`, `flags`), R2's ranges (`offset`, `length`, `suffix`), and what Cloudflare Turnstile (`success`) and VirusTotal answer.\n- **A save's IndexedDB databases** keep IndexedDB's own names (`keyPath`, `autoIncrement`, `unique`, `multiEntry`, `version`), and their records keep the `$z` tags (`{\"$z\": [kind, \u2026]}`) inside `indexeddb_databases`: they're the browser's and the game domain script's (`packages/sdk/saves.js`), not ours.\n- **API keys** keep `zsk_`, and webhook signing secrets Standard Webhooks' `whsec_`; the headers webhooks are sent with (`webhook-id`, `webhook-timestamp`, `webhook-signature`) are Standard Webhooks' own.\n\n## Glossary\n\nOne name per concept. The API and MCP column is snake_case; the SDK and game server column is camelCase. ID rows give the name for pointing at one; on the object itself it's `id`.\n\n| Concept | API and MCP | SDK and game server |\n| --- | --- | --- |\n| A game's link name, as in zaisma.com/g/<slug> | `slug` | `slug` |\n| A game's genres: up to 3 from one fixed list, which players filter Browse by | `genres` (a list of `action`, `adventure`, `role_playing`, `shooter`, `strategy`, `simulation`, `racing`, `sports`, `fighting`, `platformer`, `puzzle`, `horror`, `survival`, `sandbox`, `card_and_board`, `party`, `rhythm`, `visual_novel`); refused with `bad_genres`. Inside: `games.genres` (comma-separated), `GENRES`, `GENRE_LABELS`, `MAXIMUM_GENRE_COUNT` | |\n| A version of a game | `version_id` | |\n| An error code's page, with what it means and the general fix | `help_url` | |\n| The Zaisma skill: the workflow and its references, for any AI, installed by the upload command | `zaisma skill` (the command); MCP resources `zaisma://skill`, `zaisma://sdk`, `zaisma://naming`, `zaisma://errors`, `zaisma://game-server`, `zaisma://developer-api`, `zaisma://multiplayer`, `zaisma://loading`, `zaisma://phones`, `zaisma://saves`; MCP prompts `make_game`, `publish_game`, `fix_problem` | |\n| How many accounts have a game in their favorites (Your games) now, never who | `favorite_count` | |\n| A cover or gallery picture | `image_id` | |\n| A game's world behind Zaisma's glass, for one screen, and what it shows | `background`: `screen`, `source` (`zaisma`, `image`, `shader`, and on phone `wide`), `image_id`, `shader_id`, `still_url`; pictures are images of `kind` `background` and `phone_background` | |\n| Which screen a background is for | `screen`: `wide` (desktops and tablets), `phone` (composed for a tall screen); errors `bad_screen`, `bad_background_source`, `background_not_ready` | |\n| A small program that paints a background live | `shader_id`; a shader's `image` pass and `buffers`, `quality_checks`, `has_quality_levels`, `flash_count`, `still_url`, `frame_urls`, each pass's `source_url`, `buffer_count`, `texture_count`, `texture_image_ids`. Its source keeps Shadertoy's names on purpose (`mainImage`, `fragColor`, `fragCoord`, `iResolution`, `iTime`, `iTimeDelta`, `iFrame`, `iChannel0` to `iChannel3`, `iChannelResolution`), the form AI already writes, so nothing is left to guess; Zaisma's own inputs follow them (`iQuality`, `iGlassPanes`, `iGlassPaneCount`) | `SHADER_LIMITS`, `ShaderManifest` |\n| A buffer of a shader: a pass drawn to a picture kept between frames | `buffer_name` (`a` to `d`), `source`, `channels`; errors `bad_buffers`, `too_many_buffers` | |\n| What a shader pass's iChannel reads | `channels`, each `{ channel_index, input_kind, buffer_name, image_id, filter, wrap }`: `input_kind` `buffer` or `texture`, `filter` `linear` or `nearest`, `wrap` `clamp` or `repeat`; error `bad_shader_channel` | `ShaderChannel` |\n| A picture's tiny copy that pages show blurred until it arrives | `placeholder_data_url` on an image and a shader; `ShownPicture` (`imageUrl`, `widthPx`, `heightPx`, `placeholderDataUrl`) in Zaisma's pages; `PICTURE_PLACEHOLDER` | `ShownPicture`, `PICTURE_PLACEHOLDER` |\n| A picture a shader reads | an image of `kind` `shader_texture`; errors `shader_texture_too_big`, `too_many_shader_textures`, `shader_texture_in_use` | |\n| How much a shader draws on a device, and what the check measured at each | `quality_level` (`0` phones and slow devices, `1`, `2` desktops; `iQuality` in the shader), `quality_checks`, each `{ quality_level, check_frame_ms, maximum_check_frame_ms }` | `qualityLevel` |\n| A shader drawn before it's sent | `shader_check`: `compile_error`, `quality_checks`, `flash_count`, `is_glass_smoked`, `glass_tint_pct`, `notes` (each `{ code, message, fix }`, codes `shimmers_when_small`, `forces_thick_glass`), `sheet_url`, `sheet_expires_at`; `remaining_shader_check_count`; errors `daily_shader_checks_used`, `shader_check_unavailable`. The upload command's `check` on a shader's folder answers it with `renderer_kind` (`local_chrome`, `zaisma`), `sheet_file` and `texture_images` | `ShaderCheckAnswer` |\n| A shader as a folder, as the upload command reads and sends it | `image.glsl`, `buffer-a.glsl` to `buffer-d.glsl`, `channels.json` (passes `image`, `buffer-a` to `buffer-d`, each a list of channels with `texture_file`, a texture's file in the folder, in place of `image_id`); `shader --json` answers `texture_images` (each `{ texture_file, image_id, added_image }`) and `added_shader`; `help --json`'s `shader_folder`; errors `no_image_pass`, `unknown_shader_file`, `bad_channels_file`, `shader_texture_not_approved`, `no_chrome`, `local_chrome_failed` | `shaderCheckPageExpressions`, `shaderDraftAnswer` (`packages/cli/shader-check.mjs`) |\n| The color Zaisma tints its glass with over a game's background | `glass_tint_color` (`#RRGGBB`), error `bad_color` | |\n| A tester link | `tester_id` | |\n| A forum topic, a post in it | `topic_id`, `post_id` | |\n| A game named on something else, like a forum topic | `game_slug` | |\n| The known issue a message to Zaisma is about | `known_issue_topic_id` | |\n| Where a forum topic stands | `topic_status`: `new`, `investigating`, `known`, `planned`, `fixing`, `released`, `fixed`, `wont`, `answered` | |\n| Where a topic belongs | `category` (like `rooms`), in a `section` (like `multiplayer`) | |\n| Words to search for | `search_text` | |\n| A post's words, and the images sent with it | `text_markdown`, `images_base64`; a post's images are `media`, each with an `image_url` | |\n| Who wrote a post | `author`: `{ name, kind, is_you }`, `kind` one of `developer`, `ai`, `zaisma`; `author_kind` when sending | |\n| What an AI attaches for whoever fixes a problem | `debug_context`: `{ call, error_code, error_message, request_json, notes }` | |\n| The check a public post passes before others see it | `check_status`: `pending`, `passed`, `held` | |\n| Votes on a topic, and the developers a known issue affects | `vote_count`, `affected_developer_count` | |\n| What a developer thinks of a post, anonymously | `rating`: `like` or `dislike`; `like_count`, `dislike_count`, `your_rating` | |\n| A post saved to read again, private to the account | `bookmark`; `is_bookmarked`, `bookmarked_post_ids` | |\n| Taking back a vote, a rating, a bookmark or a follow | `undo: true` in the MCP; `DELETE` in the API | |\n| Posts an account can still make today | `remaining_post_count` | |\n| A room players join by typing it | `room_code` | `roomCode`; the game server's own room's, `room.roomCode` |\n| A player, and the players a call is for or leaves out | `player_id` | `playerId`; `playerIds`, `exceptPlayerId` |\n| Whether a player is signed in | a player's `kind`: `account`, `guest` (also the player pass's `kind` claim), and on a developer's own server `outside_zaisma` | `kind`; `playerKind` where it isn't on a player |\n| What anyone sees of an account | `player`: `{ id, name, username, display_name, bio, link_urls, profile_url, is_profile_private, published_games, played_games, playing_now }`, its public profile | `PlayerProfile`, `Zaisma.player.getProfile(playerId)` (`displayName`, `linkUrls`, `profileUrl`, `isProfilePrivate`, `publishedGames`, `playedGames`, `playingNow`) |\n| What a player writes on their profile, the check it passes, and who gets past its header | `display_name`, `bio`, `link_urls`; `profile_check_status`: `pending`, `passed`, `held` (in Zaisma's own code); the social setting `who_sees_profile`: `friends`, `anyone` | |\n| Roughly when a player last played a game (a profile never shows a time) | `played_period`: `today`, `this_week`, `this_month`, `earlier` | `playedPeriod` |\n| An account's unique name, as in @username (3 to 20 letters, numbers and underscores, unique ignoring case; it can change, the player ID can't), and the name games show for a player (an account's username; a guest's made-up one) | `username`; `name` | `username`; `name` |\n| An account Zaisma banned, and how far | `banned_at`, `ban_scope`: `developer`, `whole_account` (`GET /access`, the admin MCP's `ban_account`); error `account_banned`; Zaisma's own code: `accounts.banned_at_ms`, `accounts.ban_scope`, `accounts.ban_reason`, `accounts.ban_content_rule`, `BAN_SCOPES` | |\n| What a ban carries to new accounts | `banned_mark_count`; errors `stripe_account_banned`, `email_banned`; finding `matches_banned_account_files`; a ban match (`ban_match_id`, `decision`: `banned`, `not_the_same_person`); Zaisma's own code: `banned_marks` (`mark_kind`: `card`, `stripe_account`, `email`; `mark_sha256`, `banned_account_id`), `owner_cards` (`card_fingerprint_sha256`, `first_paid_at_ms`), `ban_matches`, `BAN_MARK_KINDS`, `BAN_MATCH_DECISIONS` | |\n| What an account has earned, and what each power needs | `standing` (`GET /access`): `is_established_developer`, `outside_links_enabled`, `search_engines_enabled`, `returning_player_count`, `minimum_returning_player_count`, `account_age_days`, `minimum_account_age_days`, `has_card_or_stripe_account`, `last_ruling_at`, `ruling_wait_ends_at`; the admin MCP's `set_zaisma_account` (`is_zaisma_account`); Zaisma's own code: `game_returning_players` (`first_counted_date`, `last_counted_date`, `counted_day_count`), `accounts.counted_play_day_count`, `accounts.last_counted_play_date`, `owners.last_ruling_at_ms`, `owners.returning_player_count`, `owners.is_established`, `owners.standing_checked_at_ms`, `owners.is_zaisma_account`, `STANDING_LIMITS`, `standingOf`, `recordReturningPlay`, `noteRuling`, `checkStanding`, `isStrangerChatWaiting`, `SEARCH_ENGINES_ENABLED_SQL` | |\n| A link that opens once the developer is established | `who_can_open` `waiting_for_standing` | |\n| Whether an account can make, upload and publish games before the beta (only accounts Zaisma adds can) | `can_publish` (`GET /access`, the admin MCP's `set_can_publish`); error `publishing_not_open` | |\n| Who an account can chat with, and the opaque group every account that chats at all chats in, friends included (never an age) | | player pass claims `who_can_chat`: `nobody`, `friends`, `anyone`; `chat_group_id` (a `chat_group_\u2026` ID, different in every game); checked with `canChat(first, second)`; `room.canChat` (whether this player can chat at all); `PlayerChatSettings` (`whoCanChat`, `chatGroupId`, the room's host's copy, never the game's) |\n| A chat message: a line a player typed, sent with room.chat through the room to the players who may read it, after the game server's onChat and Zaisma's chat filter | `chat_messages` on a player report (`from_player_id`, the reported player's or `null`, `text`, `sent_at`); Zaisma's own code: `reports.reported_chat_json`, `ReportedChatMessage`, `REPORTED_CHAT_LIMITS` | `room.chat(text, { toPlayerIds })` answers `{ sentAt }` (`ChatSent`); the `chat` event's `ChatMessage`: `fromPlayerId`, `text`, `hasSwearing`, `hasSlur`, `sentAt`; game server `onChat(state, player, room, chatInfo)` with `ChatInfo` `{ text, toPlayerIds }`, answering a `ChatAnswer` (`true`, `false`, `{ toPlayerIds }`); option `adultChatFilterEnabled`; `CHAT_ROOM_LIMITS` (`maximumChatMessageCount`, `chatWindowDurationMs`); wire messages `chat`, `chat_sent`, `chat_stopped` with a `chatNumber`; error codes `chat_stopped` (with `reason`, `stopped_by_game` for onChat), `chat_not_allowed`, `chat_empty`, `chat_too_long`, `chat_too_fast`, `chat_not_here` |\n| Chat between adults checked by Zaisma's filter, on the game's hosting meter | `adult_chat_check_count` (`room_usage` and `hosting_use_this_month`); share kind `adult_chat_checks`; `HOSTING_PRICES.adultChatCheckCentsPerCheck` | game server option `adultChatFilterEnabled`; `checkChat`'s `isAdultFilterEnabled` |\n| An account's Zaisma friends, and the invite that makes two accounts friends | | player pass claim `friend_player_tag_ids` (their `player_tag_id`s, never their player IDs), checked with `passesAreFriends(first, second)`; `room.areFriends(firstPlayerId, secondPlayerId)`; a friend invite's `invite_code` is 8 letters and digits, shown as `K7Q2-MX9P` |\n| A player's friends playing this game, the room to join each in, and why not | `server_url` (in Zaisma's own code: a room on the game's own servers) | `Zaisma.friends.list()` answers `{ friends }`, each `{ id, name, username, roomCode, serverUrl, joinRefusal }`; `joinRefusal`: `game_not_taking_joins`, `friend_not_taking_joins`, `private_room`, `room_closed`, `room_full`, `spectators_full`, `friend_not_in_room`; `Zaisma.friends.setRoom({ serverUrl, roomCode, friendJoinsEnabled })` (null when the player left), refused with `unlisted_server`; a friend's Join link's `?server=`, read as `Zaisma.rooms.linkedServerUrl` |\n| A block between two players, either way (never who made it, never anyone's list of blocks) | | `room.hasBlockBetween(firstPlayerId, secondPlayerId)`; player pass claims `player_tag_id` (the account's own `player_tag_\u2026` ID, different in every game) and `block_player_tag_ids` (the player tags of the accounts it has a block with), checked with `passesHaveBlockBetween(first, second)`; the room's `{ type: \"blocks\", playerIds }` to each player; a game's `{ type: \"block\", playerId }` and `{ type: \"unblock\", playerId }`; `room.block(playerId)`; quickJoin's hello `avoidBlockedPlayers: true`, turned away with `blocked_player_here` |\n| Whether Zaisma's Join (friends on zaisma.com, `Zaisma.friends`) takes players into a game's rooms, or into one room, and whether a game joins players by itself | `friend_joins_enabled`, error `bad_friend_joins_enabled`; `quick_joined_at_ms` (Zaisma's own code) | `friendJoinsEnabled` in `joinRoom`, `quickJoin`, `room.reserve` and the room's settings; `room.setFriendJoinsEnabled(isEnabled)`; every hello from quickJoin says `isQuickJoin: true` |\n| What Zaisma's chat filter stopped, and why (one set of reasons everywhere), and what it only flags | `reason`: `contact_details`, `personal_details`, `sexual`, `chat_paused`, `too_long`, `not_allowed_to_chat` (own servers' `checkChat` only), and `unchecked` from the game server's `checkChat` when Zaisma can't be reached; a message kept for review is a `chat_review_\u2026` ID, `chat_review_id` in the admin MCP | `Zaisma.checkChat` and the game server's `checkChat` answer `isAllowed`, `reason` (`ChatCheckReason`, the same values; the SDK's are the ones a game's own check can give), `message` (the words the sender sees), `hasSwearing` and `hasSlur` (allowed, flagged for the game), as a `ChatCheck` |\n| What a game needs a Zaisma account for | `account_requirement`: `none`, `multiplayer`, `whole_game`; a guest turned away gets `account_needed` | error `code` `account_needed` |\n| A game asking a guest to sign in while it runs, and the guest saying Not now | | `Zaisma.player.signIn()`; error `code` `sign_in_declined` |\n| A secret kept in the database under a key the database never holds (`packages/core/src/sealed-secrets.ts`), and what finds it | `sealed_signing_secret`, `sealed_token`, never in an answer; `token_sha256`. The key's two slots: `STORED_SECRETS_KEY`, `SECOND_STORED_SECRETS_KEY`, and `IS_SECOND_STORED_SECRETS_KEY_IN_USE`, the same shape for each replaceable key (`scripts/replace-key.mjs`) | |\n| A developer's own site or app that players sign in to with Zaisma, and OAuth's client type for it | `sign_in_app_id` (the OAuth `client_id`); `kind`: `confidential`, `public` | |\n| Where a sign-in can go back to, and asking for a new client secret | `redirect_urls`; `replace_client_secret: true`, answered once as `client_secret` | |\n| What an API key may do, and on which games | `access`: `api_key_name`, `access_level` (`read`, `upload`, `publish`, `full`, `custom`), `area_access` (each area's choice: `game_access`, `version_access`, `stats_access`, `database_access`, `save_access`, `purchase_access`, `forum_access`, `sign_in_app_access`, `webhook_access`, `credit_access`, `stripe_account_access`; choices `none`, `read`, `write`, and for versions `upload`, `publish`), `game_slugs` (`null` for every game); refused with `key_not_allowed` | |\n| An AI app that connects to the MCP by signing in (OAuth's client), and the connection it makes | `mcp_client_id` (the OAuth `client_id`: an `mcp_client_\u2026` ID, or its metadata document's URL); on `list_api_keys` items, `kind` (`api_key`, `connected_app`) and `connected_app_host` | |\n| An address a developer's server takes Zaisma's events at (or the game's own game server), the events it takes and the games they're about | `webhook_id`; `destination_kind` (`endpoint_url`, `game_server`), `endpoint_url` (`null` for a game server), `event_kinds`, `game_slugs` (`null` for every game; a game server's one game) | `onWebhook(event, server)` (`WebhookEvent`, the same JSON), `WEBHOOK_LIMITS`; on your own server, POSTs at `/v1/webhooks` checked with `ZAISMA_WEBHOOK_SIGNING_SECRET` |\n| What a webhook is sent, and what happened | `webhook_event`, its `id` a `webhook_event_\u2026` ID; its `kind`: `bug_reported`, `player_reported`, `scan_status_changed`, `ai_review_finished`, `live_version_changed`, `review_status_changed`, `country_blocks_changed`, `game_server_error_found`, `alert_raised`, `account_deleted` (with `account_deletion` `{ player_id, deleted_account_erase_enabled }`, and `game` or `sign_in_app`), `security_alert` (with `security_event`), `purchase_completed` and `purchase_refunded` (with `purchase`), `test`; when Zaisma made it: `created_at`; what it carries: `game`, `version`, `bug_report`, `player_report`, `game_server_error`, `alert`, `account_deletion`, `sign_in_app`, `security_event`, `purchase`. The game server gets it as the API's JSON, snake_case: the one exception to camelCase there | `WebhookEvent`, `WebhookEventKind`, `AccountDeletion`; `verifyWebhook` and `runWebhook` errors `{ error: { code, message, fix } }` |\n| Asking for a new signing secret for a webhook | `replace_signing_secret: true`, answered once as `signing_secret` (`whsec_\u2026`, Standard Webhooks' form) | |\n| An event on its way to one webhook, and how it went | `delivery_status`: `pending`, `delivered`, `failed`; `attempt_count`, `last_attempt_at`, `next_attempt_at`, `failure_message`; `pending_delivery_count`, `failed_delivery_count`, `is_last_delivery_failed` | |\n| The youngest age that can play a game, in years: 13, 16 or 18; never a band name. A younger account turned away gets `game_not_open_to_player` | `minimum_player_age_years`; errors `bad_minimum_player_age`, `accounts_needed_for_minimum_age` | error `code` `game_not_open_to_player` |\n| How many players, and the most and fewest allowed | `player_count`, `maximum_player_count`, `minimum_player_count` | `playerCount`, `maximumPlayerCount`, `minimumPlayerCount` |\n| Players who watch a room without playing: how many, the most a room takes, joining to watch, and their handlers | `spectator_count`, `maximum_spectator_count` | `maximumSpectatorCount`, `room.spectators`, `isSpectator` (joinRoom's option, `room.isSpectator`, `joinInfo.isSpectator`, a hello's), `spectatorCount`, `onSpectatorJoin(state, spectator, room)`, `onSpectatorLeave(state, spectator, room)`, `Zaisma.rooms.isLinkedAsSpectator` (a link's `watch=1`); errors `spectators_full` (no room for another spectator), `already_playing` (a player in the room asked to watch it) and `spectator_cannot_send` |\n| Who a broadcast reaches | | `audience`: `everyone` (the default), `players`, `spectators`, in `room.broadcast` and `room.broadcastBytes` |\n| How many files, and their total size | `file_count`, `size_bytes` | |\n| An image's size on screen | `width_px`, `height_px` | |\n| Counted plays, and time on screen in them | `play_count`, `play_duration_min` | |\n| Player time in rooms and data through the relay | `room_play_duration_min`, `room_play_duration_hours`; `relayed_size_bytes` | |\n| The time a game's own game server ran, in its rooms and outside them (requests, schedule runs, webhooks), its startup included, all of it priced | `game_server_cpu_duration_sec`; in Zaisma's own code `game_server_cpu_duration_ms`, `outside_room_cpu_duration_ms`, `game_server_startup_cpu_duration_ms` | `HOSTING_PRICES.gameServerCpuCentsPerSec` (Zaisma's own code) |\n| Where a game's hours went this month | `play_hours` on `hosting_use_this_month`: `total_duration_hours`, `new_player_duration_hours`, `returning_player_duration_hours`, `rented_network_duration_hours`, `other_network_duration_hours`, `rented_share_used_pct` |\n| A network Zaisma counts as rented servers, and the part of a game's meter its traffic gets | a rented network; the rented share: error `rented_share_used` |\n| A browser's signed first play of a game, kept only in the browser | `play_mark` |\n| A door's input refused by its stated shape | error `wrong_shape` |\n| A game's free hosting this month and what used it: one meter, a percentage, never dollars | `hosting_use_this_month`: `free_used_pct`, `second_free_allowance_month_start_date` (alert `second_free_allowance_started`), `free_rooms_stopped_at` (alert `free_rooms_stopped`), `shares` (each `{ kind, share_pct }`, `kind` one of `rooms`, `game_server`, `relayed_data`, `database`, `requests`), `is_paused`, `paused_reason` (`free_used`, `budget_used`, `credit_used`, `no_real_players`, `free_hosting_ended`, `null`), `paused_at`, `resets_on_date`, `monthly_budget_cents`, `spent_from_credit_cents`, and the counts `room_play_duration_hours`, `room_awake_duration_hours`, `room_connection_count`, `inbound_message_count`, `relayed_size_bytes`, `game_server_cpu_duration_sec`, `startup_cpu_duration_sec`, `game_server_session_count`, `loaded_version_count`, `outside_call_count`, `log_file_count`, `request_count`, `awake_duration_hours`, `database_call_count`, `written_row_count`, `read_row_count`, `bookkeeping_written_row_count`, `database_size_bytes`; refused with `hosting_paused`. Inside: `game_hosting_months` (`used_cents`, `charged_cents`, `written_off_cents`, `paused_at_ms`, `paused_reason`), `room_usage`'s counts (`room_awake_duration_sec`, `room_connection_count`, `object_request_count`, `game_server_session_count`, `game_server_startup_cpu_duration_ms`, `outside_call_count`, `object_awake_duration_sec`, `bookkeeping_written_row_count`, `log_file_count`, `database_call_count`, `database_awake_duration_sec`), `loaded_versions`, `HOSTING_PRICES`, `OUTSIDE_CALL_CPU_DURATION_MS`, `FREE_HOSTING_CENTS_PER_MONTH`, `hostingCostCents`, `hostingUseThisMonth`, `isHostingPaused`, `AwakeTime` | `hosting_paused` (a room's refusal, a request's error, a database error) |\n| What a game may draw from its developer's credit each month | `monthly_budget_cents` on a game (`null`: no paid hosting); error `bad_monthly_budget_cents`; alerts `hosting_budget_nearly_used`, `hosting_paused` with `budget_used` | |\n| A developer's credit | `credit`: `balance_cents`, `is_credit_low` (and the `credit_low` alert), `waiting_spending_requests` (on `get_credit`), `top_ups` (each `{ id, amount_cents, refundable_cents, refund_ends_at, created_at }`), `games` (each `{ slug, title, monthly_budget_cents, spent_from_credit_this_month_cents, last_month_beyond_free_cents }`), `entries` (each `{ id, entry_kind, amount_cents, game_slug, created_at }`, `entry_kind` one of `top_up`, `hosting_charge`, `refund`, `written_off`); a top-up's `amount_cents`, Stripe's `checkout_url`; `refunded_cents`; key area `credit_access`; `credit_balance_cents` in `get_access`; tools `get_credit`, `top_up_credit`, `refund_top_up`, `get_spending_request` (answers `spending_request`: `{ id, request_kind, game_slug, game_title, requested_change, current_setting, request_status, created_at, expires_at, answered_at }`; `confirmation_needed` adds `spending_request_id`); errors `no_spending_request` (`request_kind` is `game_budget` or `credit_plan_refill_level`; `request_status` is `waiting`, `approved`, `declined` or `expired`, which is never stored, only answered a day after the ask); errors `confirmation_needed` (with `confirm_url`), `account_not_protected`, `bad_top_up_amount`, `no_top_up`, `top_up_not_refundable`, `stripe_unavailable`. Inside: `credit_entries`, `owners.credit_balance_cents`, `owners.credit_low_line_cents`, `pending_refunds` (a deleted account's refund Stripe hasn't taken yet; `pending_refund_\u2026` IDs), `CREDIT_LIMITS`, `creditOf`, `isCreditLow`, `addCreditEntry`, `refundableTopUps` | |\n| The monthly credit plan | Always \"credit plan\", never \"plan\" alone (that's `free` or `pro`) or \"subscription\": `credit_plan` on `credit` (`null` with none): `{ refill_level_cents, plan_status, next_payment_at, next_payment_cents, started_at }`, `plan_status` `running` or `payment_failing`; input `refill_level_cents`; tools `start_credit_plan`, `change_credit_plan`, `stop_credit_plan`; errors `bad_refill_level_cents`, `already_credit_plan`, `no_credit_plan`; spending request kind `credit_plan_refill_level` (its change `{ refill_level_cents }`); emails `credit_plan_payment_failed`, `credit_plan_stopped`. Inside: `owners.credit_plan_subscription_id`, `credit_plan_refill_level_cents`, `credit_plan_status`, `credit_plan_started_at_ms`, `credit_plan_event_at_ms`, `spending_requests.refill_level_cents`, `CREDIT_LIMITS.minimumRefillLevelCents`, `maximumRefillLevelCents`, `minimumRefillCents`, `creditPlanCheckout`, `addRefillToInvoice`, `stopCreditPlan`, `STRIPE_CREDIT_PLAN_PRICE_ID`, Stripe metadata `subscription_kind` (`pro`, `credit_plan`) | |\n| What an account stores | `storage`: `{ stored_size_bytes, included_size_bytes, maximum_stored_size_bytes, allowance_kind, new_data_today_size_bytes, maximum_new_data_size_bytes, monthly_storage_budget_cents, unpaid_files_delete_at, spent_this_month_cents, price_per_gigabyte_month_cents, deletable_versions }`; \"stored\" is what the account keeps, \"included\" what it has with no budget, \"new data\" what it sends that it didn't already store (`owner_new_data_days`); `allowance_kind`: `new`, `established`, `paid_by_card`, `pro`; credit entry `storage_charge`; errors `storage_full`, `new_data_limit`, `bad_monthly_storage_budget_cents` | |\n| Deleting a version or a game | `delete_version`, `delete_game` with `confirm_slug`; `is_deleted`; errors `version_in_use`, `kept_for_review`, `bad_confirm_slug`; a file no version of the owner's uses is released (`released_at_ms`) and stops counting | |\n| A game waiting to be erased | `erases_at` on the game (`null` for any other), `is_erase_now_allowed`, `bring_back_game`, `erase_game_now`, and `game_deletion_request` with `request_kind` `delete_game` or `erase_game_now` |\n| A developer's plan and its limits | `plan`: `free` or `pro` (never \"subscription\" or \"tier\"); `pro`: `{ plan, pro_ends_at, is_pro_cancelled, monthly_price_cents, limits: { free, pro }, limits_for_everyone, used_today }`, each plan's limits `{ maximum_performance_check_count, included_size_bytes, maximum_new_data_size_bytes }`, `limits_for_everyone` `{ maximum_large_review_count, maximum_small_review_count, maximum_version_count }`, `used_today` `{ large_review_count, small_review_count, performance_check_count }`; Stripe's `checkout_url`; `plan` in `get_access`; key area `credit_access`; tools `get_pro`, `start_pro`, `cancel_pro`, `resume_pro`; errors `already_pro`, `not_pro`. Inside: `owners.pro_until_ms`, `is_pro_cancelled`, `stripe_subscription_id`, `PLAN_KINDS`, `PLAN_LIMITS`, `PRO_PRICE_CENTS_PER_MONTH`, `planOf`, `limitsFor`, `proCheckout`, `setProCancelled`, `STRIPE_PRO_PRICE_ID` | |\n| A developer's own Stripe account, where the buy sheet's sales go (Connect Standard: the developer is the seller, no fee) | `stripe_account`: `is_connected`, `stripe_account_id` (Stripe's `acct_\u2026`, not a Zaisma ID, so it says no kind), `can_take_payments`, `country_code`, `default_currency_code`, `business_name`, `support_email`, `is_stripe_tax_used`, `connected_at`, `balance` (Stripe's own figures, read live: `currency_code`, `available_minor_units`, `pending_minor_units`, `other_currency_balances` (each `{ currency_code, available_minor_units, pending_minor_units }`), `next_payout` (`{ amount_minor_units, currency_code, arrives_at }`); `null` when Stripe doesn't answer in 3 seconds); key area `stripe_account_access`; tools `get_stripe_account`, `connect_stripe_account`, `update_stripe_account`, `disconnect_stripe_account`; errors `stripe_not_connected`, `stripe_cannot_take_payments`, `bad_is_stripe_tax_used`. Inside: columns `stripe_account_id`, `can_take_stripe_payments`, `stripe_country_code`, `stripe_default_currency_code`, `stripe_business_name`, `stripe_support_email`, `is_stripe_tax_used`, `stripe_connected_at_ms` | |\n| The link a developer connects their Stripe account on | `connect_url`, `expires_at` (10 minutes), answered by `connect_stripe_account` (`POST /stripe-account/connection-links`); through a key, `confirmation_needed` with `confirm_url` | |\n| Whether Stripe Tax works out and records the tax inside each price (prices never change with it) | `is_stripe_tax_used`, `true` or `false`, in `update_stripe_account` and the `stripe_account`; error `bad_is_stripe_tax_used` | |\n| Zaisma's sheet a player buys an item on, over the game or in a window, and how a buy ends | the buy sheet; errors `not_for_sale`, `stripe_not_connected`, `stripe_cannot_take_payments` | `Zaisma.items.buy(itemName, { itemCount, gameAccountId })` answers `BuyResult` `{ status, purchase }`, `status` `bought`, `cancelled`, `failed`; `Zaisma.items.on(\"sheetOpen\" or \"sheetClose\", listener)` with `SheetEvent` `{ itemName }`; error `code` `needs_player_tap` |\n| A player's saved card and the purchase PIN that confirms it's them (the player side of the buy sheet; the sheet's own `/api/buy`, `/api/payment-methods` and `/api/account/purchase-pin` calls) | `saved_card` `{ card_brand, card_last_digits }` (`card_brand` Stripe's lowercase brand, like `visa`; `card_last_digits` the card's last four digits as text, never a number, so `0042` keeps its zeros), `purchase_pin` as the input (exactly 6 digits, as text, so `048213` keeps its zero) and only ever stored hashed as `purchase_pin_hash`, `has_purchase_pin`, `purchase_pin_failed_count`; how a buy confirms it's the player: `confirmation_method` one of `passkey`, `purchase_pin`, `password`, in the body as `passkey_tap`, `purchase_pin` or `password`, and a device's confirm kept in `purchase_confirmations` (15 minutes; a purchase PIN account's covers one buy, and so does one with no `buying_public_key_base64`); a browser's buying key, an ECDSA P-256 pair it keeps: `buying_public_key_base64` (the raw public half, sent to the sheet's start, confirm and pay calls, and kept by a confirm in `buying_keys`) and `buying_signature_base64` (its signature over the purchase, sent to the pay call), error `bad_buying_key`; on the sheet `is_confirmation_needed`, `confirmation_reason` (why: `purchase_pin`, `new_device` (no kept buying key signs this buy), `old_sign_in`, `big_spend`, or `null` when pressing Buy is enough; `is_confirmation_needed` is `confirmation_reason !== null`), `confirmation_methods` `{ has_passkey, has_purchase_pin, has_password, is_purchase_pin_locked }`, `is_eu_withdrawal_line_shown`, `refund_policy_words`, `has_account_email` (a saved card's receipts go to the account's email); player-side error codes `account_needed` (a guest), `account_protection_needed` (saving a card or setting a PIN needs a passkey or an email on the account), `already_owned` (a permanent item the player has), `purchase_confirmation_needed` (confirm it's you, then buy again), `purchase_pin_locked` (5 wrong PINs: a password confirm unlocks it), `wrong_purchase_pin`, `wrong_passkey`, `no_purchase_pin`, `bad_purchase_pin`, `card_not_saved`, `payment_declined` | `PURCHASE_PIN_LIMITS` `{ pinDigitCount, maximumFailedTryCount, confirmationDurationMin, signInMaximumAgeDays, dailySpendLimitUsdMinorUnits }`, `APPROXIMATE_USD_PER_CURRENCY_UNIT`, `approximateUsdMinorUnits`, `hashPurchasePin`, `isPurchasePin`, `purchasePinProblem`, `PURCHASE_LIMIT` (the 20-a-minute rate limit binding) (Zaisma's own code) |\n| How much of a sale to refund, and what is left | `amount_minor_units` in `refund_purchase` (left out: all that's left; a full refund takes the item back, a partial one leaves it), `refunded_minor_units` on the purchase; errors `bad_amount_minor_units`, `purchase_not_paid`, `already_refunded` | |\n| Bytes a game and its room send each other, and whose they are | | `room.sendBytes(bytes)` and the `\"bytes\"` event `(bytes, fromPlayerId)` in the SDK, error `code` `bad_bytes`; `onBytes(state, player, room, bytes)`, `room.broadcastBytes(bytes, { exceptPlayerId, fromPlayerId })`, `room.sendBytes(playerId, bytes)` on the game server |\n| A game's room traffic: messages and bytes each way per player a second, its message types, and what to change | `inbound_messages_per_player_sec`, `inbound_size_bytes_per_player_sec`, `outbound_messages_per_player_sec`, `outbound_size_bytes_per_player_sec`; `room_traffic` with `message_types` (`message_type`, `direction`: `inbound`, `outbound`, `average_size_bytes`, `largest_size_bytes`) and `traffic_hints` (`code`: `json_messages_large`, `outbound_heavy`, `message_near_limit`, `latest_only_available`); `message_type` `(state)` for state sync's updates. Inside: `room_message_types.backed_up_message_count` | `STATE_MESSAGE_TYPE`, `backedUpMessageCount` (Zaisma's own code) |\n| How many days a report or stats answer covers | `period_duration_days` | |\n| What the game check finds before an upload | `problems`, each `{ code, problem_kind, is_fixed_by_upload_command, message, path, quote, fix }`, `problem_kind` `refused` or `broken`; `omitted_problem_count` | |\n| A version's scan result, and what it found that holds or rejects it | `scan_status`: `scanning`, `held`, `approved`, `rejected`; `findings`, each `{ code, severity, message, content_rule, path, fix }` | |\n| Where a version stands with the AI review, and how long reviews usually take | `ai_review_status` (`not_started`, `waiting`, `reviewing`, `passed`, `stopped`, `skipped`), `ai_review_speed` (`at_once`, `batch`), `ai_review_requested_at`, `ai_review_finished_at`, `ai_review_waiting_reason`, `usual_ai_review_duration_min`, `ai_review_step` (`waiting_for_daily_review`, `in_line`, `reading_files`, `judging`), `ai_review_step_started_at`, `ai_review_waiting_ahead_count`, `daily_review_free_at`, `is_ai_review_needed_to_publish`, `is_open_before_ai_review`, `publish_after_ai_review_enabled`, `visibility_after_ai_review`, `publish_before_ai_review_enabled`. Inside: `ai_review_queued_at_ms`, `review_batches` (`anthropic_batch_id`, `request_count`, `review_step`: `reading`, `judging`, `ended_at_ms`, `collected_at_ms`), `read_files` (`file_sha256`, `reader_prompt_sha256`, `evidence_items`, `read_at_ms`) | `start_ai_review`, `AI_REVIEW_LIMITS`, `AiReviewStep`, `AiReviewProgress`, `aiReviewProgress`, `bad_publish_after_ai_review_enabled` |\n| How a version started in headless Chrome, and what would make it much smaller (notes, never holds) | `performance_check`: `{ check_status, checked_at, browser_description, loading_duration_sec, start_download_size_bytes, start_file_count, start_memory_size_bytes, longest_start_task_duration_ms, notes }`, `check_status` `waiting`, `checking`, `checked`, `over_daily_limit`, `could_not_run`; a performance note `{ code, message, path, saved_size_bytes, fix }`; the game check's `performance_notes`. Inside: `performance_checks.start_files`, each `{ path, destination, is_cors_request, downloaded_size_bytes }` | `PERFORMANCE_CHECK_LIMITS` |\n| How a game runs on players' devices, as totals (never per player), and the switch for it | `performance` in `get_stats`: `version_totals` and `device_totals`, each row `{ version_id, play_count, median_loading_duration_sec, slow_tenth_loading_duration_sec, median_frames_per_sec, low_tenth_frames_per_sec, long_frames_per_min, crashed_play_pct, error_stop_count, context_lost_count, stopped_responding_count, median_peak_memory_size_bytes, is_measured }`, a device row also `browser_name` (`chrome`, `edge`, `firefox`, `safari`, `samsung_internet`, `other`), `os_name` (`windows`, `macos`, `linux`, `chromeos`, `android`, `ios`, `other`), `device_kind` (`computer`, `phone`, `tablet`; `other` only in the folded row) and `graphics_family` (`nvidia`, `amd`, `intel`, `apple`, `qualcomm`, `arm`, `imagination`, `other`, `unknown`); the game's `performance_measuring_enabled`, error `bad_performance_measuring_enabled`. Inside: `performance_days` (`loading_counts`, `frame_rate_seconds`, `memory_counts`: JSON arrays of counts by bucket), `play_tickets.has_performance_loading`, `has_performance_crash`, `measured_duration_sec`; page messages `zaisma:performance`, `zaisma:alive` | `LOADING_BUCKETS_SEC`, `FRAME_RATE_BUCKETS`, `MEMORY_BUCKETS_BYTES`, `BROWSER_NAMES`, `OS_NAMES`, `DEVICE_KINDS`, `GRAPHICS_FAMILIES`, `CRASH_KINDS`, `PLAYER_PERFORMANCE_LIMITS`, `browserOf`, `osOf`, `percentileOf`, `frameRateAt` |\n| The AI review's two daily limits, and a version that steps aside for a newer one | a large review (read and judged: `daily_large_reviews_used`) and a small review (read alone: `daily_small_reviews_used`), never \"judged review\"; `replaced_by_version_id` (`version_replaced`). Inside: `read_at_ms` (when a version's small review ran), `is_small_review` in a scan report, and in the admin MCP `changes_since` with `added_paths`, `changed_paths`, `removed_paths` and their `*_path_count` | `PLAN_LIMITS.free.maximumLargeReviewsPerDay`, `maximumSmallReviewsPerDay` |\n| A sample game in the review test set, and what a run found | `is_honest`, `content_rule`, `protection`, `why` (in `case.json`); `outcome`: `held_bad`, `missed_bad`, `passed_honest`, `held_honest`, `inconsistent` (Zaisma's own code) | |\n| Zaisma's review of a game | `review_status`: `pending`, `live`, `held`, `removed` | |\n| Why Zaisma held, rejected or took down a game, version or image | `review_reason`: `{ code, message, content_rule, fix }`, its `code` from `REVIEW_CODES` | |\n| The countries a game is blocked in on a notice under their law | `country_blocks`, each `{ country_code, country_name, review_reason, blocked_at }`; the `game_blocked_in_country` alert, the `country_blocks_changed` webhook. Inside: `games.country_blocks`, each `blocked_at_ms` | |\n| Why a cover or a title keeps a game off Zaisma's lists, or held it for a fake reward (\"No slop\") | `listing_reason` on an image, `title_listing_reason` on a game, shaped like `review_reason`; the `game_off_lists` alert. Inside: `cleared_at_ms` on an image and `cleared_title` on a game (a person cleared it), `listing_check_requested_at_ms`, `listing_checked_at_ms` | |\n| What needs a developer's attention in a game | `alerts`, each `{ kind, message, fix, version_id }`, `kind` one of `game_removed`, `game_waiting_to_erase`, `game_held`, `game_blocked_in_country`, `version_rejected`, `version_held`, `link_flagged`, `game_off_lists`, `hosting_paused`, `free_rooms_stopped`, `second_free_allowance_started`, `database_full`, `hosting_nearly_paused`, `hosting_budget_nearly_used`, `credit_low`, `database_nearly_full`, `player_erase_failed`, `reports_open`; a heads-up is its paused or full kind with `nearly` (`nearly_used` for a budget) | |\n| A content rule, as a hold or takedown names it | `content_rule`: `child_safety`, `sexual`, `malware`, `illegal`, `real_people`, `copyright`, `defamation`, `trademark`, `personal_details`, `chat`, `crypto`, `purchases`, `faked_plays` (the same words as a report's `reason` where they mean the same) | |\n| Who can see a game | `visibility`: `draft`, `listed`, `unlisted`, `private` | |\n| Where to continue a list | `cursor` in, `next_cursor` out | |\n| A game server's logs, and where to read on from | `log_lines`, each `{ logged_at, level, text, source_kind, room_code, version_id }`; `level` a console method (`debug`, `log`, `info`, `warn`, `error`), `source_kind` `room`, `request`, `schedule` or `webhook`; filters `minimum_level`, `search_text`, `maximum_line_count`; `cursor` in and `next_cursor` out go back, `new_lines_cursor` in and out goes forward | `LOG_LIMITS`, `StoredLogLine`, `LogWriter` |\n| How a game is played | `play_modes`: a list of `{ mode, minimum_player_count, maximum_player_count, play_style }` | |\n| A version's notes for players, and when it goes live by itself | `patch_notes`, `scheduled_publish_at` | |\n| A publish that's news, and the dates only it moves | `is_big_update` (input and on a version), `big_update_at` (a game's last), `recently_updated_at` (a game's place on Recently updated); `first_published_at` (a game's or a version's first time live, which never moves) | error codes `bad_is_big_update`, `big_update_needs_patch_notes`, `big_update_already_live` |\n| Links, by what they open | `page_url` (a game's page), `preview_url` (a version), `image_url`, `link_url` (a tester link) | `inviteUrl` (a room's invite link), `serverUrl` (a game server of the developer's own) |\n| What a tester link opens and until when, and when a preview link stops working | `version_choice`: `live`, `newest_passed`, `picked`; `picked_version_id`, `ends_at`; `preview_url_expires_at` | |\n| Forum topics with something new from Zaisma | `unread_topic_count` | |\n| What a player wrote in a report | `player_text` | |\n| A report about one of a game's players, passed to its developer | `player_report`, in `player_reports`; who it's about: `reported_player_id`, `reported_player_name`; why: `reason`, one of `real_life_threat`, `personal_details`, `following_after_block`, `sexual`, `harassment`, `cheating`, `other` | |\n| Reports about the same problem, named by the first one (admin MCP) | `report_group_id` (a `report_\u2026` ID) | |\n| Where a report stands | `report_status`: `open`, `dismissed`, `actioned` | |\n| How serious a report or topic is (admin MCP) | `severity`: `child_safety` (reports only), `urgent`, `high`, `normal`, `low` | |\n| What a person decides about reports, a precedent or a post, and why (admin MCP) | `decision`, `why` | |\n| A ruling report triage follows, and where it stands (admin MCP) | `precedent_id`; `precedent_status`: `proposed`, `active`, `retired`; `can_ai_apply_alone`, `replaces_precedent_id`, `followed_count` | |\n| A ruling the AI review follows when it was wrong, and where it stands (admin MCP) | `review_precedent_id`; `decision`: `pass`, `hold`; `review_precedent_status`: `proposed`, `testing`, `active`, `failed`, `retired`; `replaces_review_precedent_id`, `followed_count` | |\n| What report triage and forum sorting found (admin MCP) | `triage`, `sorting`, `is_waiting_for_sorting`; what triage did by itself is `ai_actions` | |\n| Public forum posts waiting for a person (admin MCP) | `waiting_posts` | |\n| What happened to a game, and who did it | `events`, each with `happened_at` and `last_happened_at`, `occurrence_count`, `subject_name`; `done_by`: `you`, `api_key`, `ai`, `zaisma`; `actor` in the admin MCP | |\n| Where something came from | `device`, `network_name`, `city_name`, `region_name`, `country_code`, `connection_address`, `is_new_place` | |\n| An account's activity | `get_activity`'s `events`, each with `kind` (the account kinds), `sign_in_kind` (`password`, `passkey`, `email_code`, `google`, `discord`) and `security_alert_status`; `unseen_security_alerts`; `where_used_from_enabled` | |\n| A risky moment the owner hears about | a security alert, never just \"alert\" (a game's `alerts` are about its free use and reviews): `security_alert_status` `emailed`, `unseen` or `seen`; the `security_alert` webhook kind | |\n| The calls that usually follow a change | `next_steps` | |\n| Ticks a second, and the time since the last tick | | `ticksPerSec`, `tickDurationSec` |\n| Time without input before \"Still there?\", and who checks | | `idleTimeoutSec` (30 to 86400, else error `code` `bad_idle_timeout` in the SDK), `idleCheck`: `server`, `client`, `off`; a player's game turns its own off with `idleCheckEnabled: false` |\n| How long a seat is held for a player who walked away | | `seatHoldDurationSec` |\n| How many of the game's rooms one player sits in at once | | `maximumRoomCountPerPlayer` (1 to 10, 1 by default; a newer seat past it closes the oldest with close code 4001, \"Joined from somewhere else\") |\n| How long a player whose connection dropped stays in the match, and why a player in the room isn't playing | | `reconnectTimeoutSec`; `awayReason`: `idle`, `hidden`, `lost` or `null` (`room.awayReason(playerId)` on the game server, each `ListedPlayer` in `room.players` in the game) |\n| When Zaisma will end a match after its game's hosting paused, and hearing it | | `endsAt` (an ISO time); the game server's `onEnding`, the SDK's `ending` event, the room's `{ type: \"ending\", endsAt }` |\n| Zaisma calling that end off once the game's hosting starts again, and hearing it | | `endsAt` back to null; the game server's `onEndingCancelled`, the SDK's `endingCancelled` event, the room's `{ type: \"ending_cancelled\" }` |\n| When running matches get a newly published version | `match_update_mode`: `next_match`, `now` (on a publish, and on a version that goes live by itself) | the game server's `onVersionUpdate(state, versionUpdate, room)` with `VersionUpdate` `versionId`, `appliesAt` (an ISO time) and `isReloading`, `room.applyVersionUpdate()`; the room's `versionUpdate` event with `versionId`, `appliesAt` (an ISO time) and `isReloading`; `Zaisma.versions.on(\"update\")` and `update.apply()` for games not in a match; a hello's `versionId` (the version the player's game runs), turned away with `other_version` and the room's `versionId` when its game server runs another; `live_rooms.version_id` |\n| How often a real-time room saves its state, and a room coming back from a restart with it | | `stateSaveIntervalSec`; the game server's `onRestored(state, restoreInfo, room)`, with `RestoreInfo` `savedAt` (an ISO time), `lostDurationSec`, `savedVersionId` and `keptRoomRestore`; the Node runner's `--room-state-file` (`startServer({ roomStateFile })`, table `room_states`: `room_code`, `format_version`, `state_json`, `saved_room_json`, `saved_at_ms`, `is_saved_empty`, `is_kept`; the keys inside `saved_room_json` are snake_case, like `known_player_ids`, `kept_out`, `ends_at_ms` and `match_players`); a real-time room (`ticksPerSec`) hears `onRestored`, a turn-based room doesn't |\n| A message for a live room from another room, the game server outside rooms or the developer | `message`; tools `send_room_message`, `send_to_every_room`; `is_delivered`, `room_count`; errors `bad_room_message`, `room_busy`, `every_room_send_limit`; the bench's `POST /bench/api/room-messages`. Inside: `ROOM_MESSAGE_LIMITS`, `checkRoomMessage`, `GameRoomsService.sendRoomMessage` (`deliveryOutcome` `delivered`, `no_room`, `room_busy`) and `sendToEveryRoom` (`isLimited`), `RoomReachBinding`, the rooms' `/room-message` | `RoomMessage` (`message`, `senderKind` `room` \\| `server` \\| `developer`, `fromRoomCode`, `sentAt`), `ROOM_MESSAGE_SENDER_KINDS`; `room.sendToRoom(roomCode, message)` and `server.sendToRoom` answering `{ isDelivered }`, `room.sendToEveryRoom(message, roomSelection)` and `server.sendToEveryRoom` answering `{ roomCount }`; the handler `onRoomMessage(state, roomMessage, room)`; the room's `roomMessage` event; `ROOM_MESSAGE_LIMITS` (`maximumRoomMessageSizeBytes`, `maximumRoomSendsPerSec`, `maximumReceivedRoomMessagesPerSec`, `maximumEveryRoomSendsPerMin`, `maximumScheduledRoomMessageCount`, `maximumScheduleAheadDurationDays`, `maximumListedRoomCount`) |\n| A send to every room scheduled for later | `scheduled_room_message` (`id`, `send_at`, `labels`, `created_at`), `scheduled_room_messages` (each with `message`, `sent_at`, `delivered_room_count`), `send_at`, `is_cancelled`; tools `list_room_messages`, `cancel_room_message`; errors `too_many_scheduled_room_messages`, `no_scheduled_room_message`, `bad_time`. Inside: `scheduled_room_messages` (`room_message_json`, `labels_json`, `send_at_ms`, `created_at_ms`, `sent_at_ms`, `delivered_room_count`), `sendDueRoomMessages` | |\n| One of a game's rooms running now, as the game reaches it, and who's in one | `rooms` (each `room_code`, `name`, `labels`, `player_count`, `maximum_player_count`, `spectator_count`, `is_listed`, `is_open`, `is_kept`, `version_id`, `continent`, `created_at`), `room_count`, `room`, `players` (each `player_id`, `name`, `kind`, `is_away`, `away_reason`, `joined_at`, `is_spectator`), `labels` (a list of `label_name` and `label_value`; as an input, which rooms: those holding every label), `is_kicked`, `is_ended`, `is_kept_out`, `confirm`; tools `list_rooms`, `get_room`, `kick_player`, `end_room`; errors `no_room`, `no_player_in_room`, `bad_labels`, `bad_kick_message`, `bad_end_message`; `zaisma rooms`. Inside: `listLiveRooms`, `liveRoomOf`, `LiveRoomRecord`, `GameRoomsService.getRoom`, `kickPlayer` (`kickOutcome`), `endRoom` (`endOutcome`) | `LiveRoom` (`roomCode`, `name`, `labels`, `playerCount`, `maximumPlayerCount`, `spectatorCount`, `isListed`, `isOpen`, `isKept`, `versionId`, `continent`, `createdAt`), `RoomPlayer` (`playerId`, `name`, `kind`, `isAway`, `awayReason`, `joinedAt`, `isSpectator`), `RoomSelection` (`labels`); `room.listRooms(roomSelection)` and `server.listRooms` answering `{ rooms }`, `server.getRoom(roomCode)`, `server.kickFromRoom(roomCode, playerId, kickOptions)` and `server.endRoom(roomCode, message)` answering `{ isDone }`. Inside: `RoomReach`, `ServerRoomReach`, `Transport.roomReach`, `newServer`, `RoomCore.receiveRoomMessage`, `RoomCore.roomPlayers` |\n| A room that keeps its world when everyone leaves, sleeping until someone joins, and the game's storage it counts toward with the database | `kept_rooms` (each `room_code`, `name`, `saved_size_bytes`, `saved_at`, `last_played_at`, `created_at`, `erases_at`), `kept_rooms_size_bytes`, `waiting_kept_rooms_size_bytes`, `storage_size_bytes`, `maximum_storage_size_bytes`, `is_deleted`, `is_brought_back`, `is_erased`; `live_rooms.is_kept`; tools `list_kept_rooms`, `delete_kept_room`, `bring_back_kept_room`, `erase_kept_room_now`; errors `no_kept_room`, `kept_room_not_waiting`, `kept_room_erasing`; `zaisma kept-rooms` | `room.isKept`, `room.setKept(isKept)`; `isKept` in `room.reserve` and `ListedRoom`; Zaisma's own `Saved.isSavedEmpty` and the Node runner's `room_states.is_saved_empty` (saved as the room emptied: nothing lost) |\n| What happens to a player who walks away | | `awayMode`: `hold`, `lobby` |\n| A mistake in a game server's code, and how it fails | | a `GameServerError` with a `code` (`GameServerErrorCode`: `unknown_option`, `bad_option`, `bad_room_call`, `room_call_limit`, `room_call_unavailable`, `bad_handler_answer`), the `field` it is about (an option, a handler like `canJoin` or a room call like `room.kick`), and a `fix`; shown in the game's logs and `get_stats` errors |\n| Starting a game server on your own machine, and what it answers | | `import { startServer } from \"@zaisma/game-server/node\"`: `startServer({ gameServer, gameSlug, port, origins, issuerUrl, loadPassKeys, loadReceiptKeys, loadProfile, database, secrets, webhookSigningSecret, roomStateFile, webtransportPort, certificatePath, certificateKeyPath, identifyPlayer, outsideGuestsEnabled })` answers `{ close, httpServer, fastLaneReady }`; the command `npx @zaisma/game-server <server.ts> --game <slug>` with `--port`, `--origin`, `--issuer-url`, `--database-file`, `--room-state-file`, and the fast lane's `--webtransport-port`, `--certificate-path` and `--certificate-key-path` (bin `zaisma-game-server`) |\n| The fast lane to a game's own server (WebTransport), and what a room's connection uses | | `transport`: `websocket`, `webtransport` (`Zaisma.joinRoom`'s option, refused with `bad_transport`, and `room.transport`; `TRANSPORTS` in the SDK); `FAST_LANE_CONNECT_TIMEOUT_MS` (3000); `FastLane` (the SDK's adapter); `delivery` reaches the room's `send` and `sendBytes` (`Transport`) |\n| Sending each player the game server's state, then only what changed, and what each player sees of it | | `stateSyncEnabled`; `stateView(state, viewer, room)`; the room's `{ type: \"state\", serverTimeMs, full }` and `{ type: \"state\", serverTimeMs, changes }`; a `StateChange` `[path, value]` or `[path]`; `room.state`, the `\"state\"` event `(state, changes)` and `room.smoothedState({ delayMs })` (`SmoothingOptions`) in the SDK, error `code` `bad_delay`; `ROOM_LIMITS.maximumStateViewSizeBytes`; in Zaisma's own code `diffState`, `applyStateChanges`, `newStateTracker` |\n| A send that may be dropped for a newer one while a player's connection is backed up | | `delivery`: `reliable`, `latest_only`; `latestKey` (needed with `latest_only`); `SendOptions` in the SDK and on the game server, error `code` `bad_send_option`; a player's connection is backed up (`isBackedUp`, `ROOM_TUNING.backedUpSizeBytes`, `backedUpDelayMs`); `ROOM_LIMITS.maximumLatestOnlySlotCount`, `maximumLatestKeyCharacterCount` |\n| A message between a game and its room, the game's own message in it, and the player it came from | | `type`, `data`, `fromPlayerId` (a send option on the game server, `null` for the game server's own); the `\"message\"` event `(message, fromPlayerId)`; `ClientMessage`, `ServerMessage` |\n| Which room messages a game and its room speak | | `protocolVersionNumber` (a hello's and a welcome's), `PROTOCOL_VERSION_NUMBER` (1) |\n| A quick join's hello asking for a room without anyone the player blocked (an action, so a verb) | | `avoidBlockedPlayers` |\n| Why a match ended | | `endReason`: `game`, `no_players`, `hosting_paused`, `kept_room_deleted`, `game_unavailable`, `game_server_stopped` (`EndReason`); the `\"ended\"` event `{ message, endReason }` |\n| Where the \"Still there?\" question stands | | `idleStatus`: `asking`, `answered`, `timed_out`, with `answerTimeoutSec`; the `\"idle\"` event (`Idle`) |\n| A player back after walking away, and whether their seat was still held | | the `\"back\"` event `{ roomCode, isSeatHeld, rejoin() }` |\n| Reliable sends waiting while a room isn't reachable | | `MAXIMUM_QUEUED_SEND_COUNT` (60, the SDK's); error `code` `send_queue_full` |\n| How a room checks and paces its connections (not limits a game sets) | | `ROOM_TUNING`: `probeIntervalSec`, `probeAnswerTimeoutSec`, `probeSentSizeBytes`, `maximumUnansweredSentSizeBytes`, `maximumUnansweredProbeCount`, `backedUpSizeBytes`, `backedUpDelayMs` |\n| Why a room closed a connection | | `ENDED_CLOSE_CODE` (4000: the match ended), `REMOVED_CLOSE_CODE` (4001: refused, removed or replaced), `SEAT_GONE_CLOSE_CODE` (4002: the seat is no longer held), `NO_ANSWER_CLOSE_CODE` (4003: no answer or too far behind), `VERSION_UPDATE_CLOSE_CODE` (4004: the match switches to a version published now), `BUSY_CLOSE_CODE` (1013) |\n| What a player's game brings into a room, and what a room another room made starts with | | `joinData`, `setupData` |\n| How a player came into a room, and why they left or walked away | | `joinInfo: { fromRoomCode, isReturning, isSpectator }`; `leaveInfo: { reason }`, `reason` one of `left`, `lost`, `idle`, `hidden`, `kicked`; `onAway(state, player, room, awayInfo)` with `awayInfo: { reason }` (`AwayInfo`), `reason` one of `idle`, `hidden`, `lost` |\n| Words a person reads about what happened: an error's, a kick's, a refusal's, a match's end; on errors, findings and alerts, `message_for_people` is the page's text beside the caller's `message` and `fix` | `message`, `message_for_people` | `message`; `refusalMessage` in what `canJoin` answers (`true`, `false` or `{ refusalMessage }`; answering nothing or anything else turns the player away and is logged as `bad_handler_answer`) |\n| The room's host, who can run it from the game, and whether a game server has one | | `hostPlayerId`, `hostControlsEnabled` |\n| Whether a room shows in room lists, and takes new players | | `isListed`, `isOpen` |\n| Rooms in a room list: everyone playing and their rooms, listed ones closed and with space, ones taking players that match, the ones past the list, and seats held | | in the SDK's `RoomList` `playingPlayerCount`, `playingRoomCount`, `listedClosedRoomCount`, `listedJoinableRoomCount`, `matchingOpenRoomCount`, `moreOpenRoomCount`; `heldSeatCount`; a region's `regionName`. Zaisma's own code keeps `playing`, `joinableRoomCount`, `openRoomCount` |\n| The game page's room list, a page at a time (zaisma.com's own, not a developer call): where a page starts and how many rooms it holds, the order it's in, and how many rows a refresh keeps (full rooms always show, last) | `GET /g/<slug>/rooms?cursor=` (the page's `nextCursor`, as an opaque string; a Load more link carries it), `room_order` (`best_to_join`, `most_players`, `fewest_players`) and `shown_row_count`; an old link's `is_hiding_full_rooms` is let go | `listRoomPage(database, gameId, { cursor, pageRoomCount })` answers a `RoomPage` (a `RoomList` and `nextCursor`, `null` on the last page); `roomOrder` (`RoomOrder`, from `ROOM_ORDERS`) and `isHidingFullRooms` on the `RoomPage`; `MAXIMUM_PAGE_ROOM_COUNT` |\n| A part of the world rooms run in: a continent code, like `EU` | | `region` (`Region`: `AF`, `AN`, `AS`, `EU`, `NA`, `OC`, `SA`), error `code` `bad_region` |\n| What of Zaisma's covers the game on its page: one of its sheets, one of its cards, or nothing | | `Zaisma.page.coveredBy` (`CoveredBy`: `sheet`, `card`, `null`) and its `coveredBy` event; the page's message `zaisma:covered` with `coveredBy`. Inside: `zaismaLayers.coveredBy` |\n| How a notice or card waits its turn over a page or a game | | `noticeUrgency`: `information`, `ask`, `urgent` (component option and `data-notice-urgency`); `sheetsToClose` (sheet IDs an urgent card closes); `zaismaLayers` `say`, `show`, `leave`, `step`, `openSheets`; `STALE_INFORMATION_MS`, `MAXIMUM_PAGE_NOTICE_COUNT`, `NOTICE_STAY_MS`, `NOTICE_UNDO_STAY_MS`; a sheet's `SheetStep` (`stepName`) and `SheetTab` (`tabValue`) |\n| Where a room's socket stands | | `connectionStatus`: `connecting`, `open`, `reconnecting`, `closed`; whether the player is in the match is `room.awayReason` (`idle`, `hidden` or `null`) |\n| Errors a room's player gets, renamed for v1 | | `room_full`, `room_closed`, `room_not_running`, `spectators_full`, `bad_origin`, `already_playing`; for a call, `zaisma_rooms_not_used` (the game doesn't use Zaisma rooms) |\n| Keeping a kicked player out, as asked and as told | | `keepOut` (asked), `isKeptOut` (told) |\n| A player's cloud save, what it holds, and who made it as it is | `local_storage_items` (each localStorage key and its text), `indexeddb_databases`, `keys` (some localStorage keys asked for) and `missing_keys`; `changed_by_kind`: `player`, `developer` | |\n| An earlier version of a save, why it was kept, and the one a change kept | `save_copy_id`; `saved_at`, `copy_reason`: `hourly`, `account_lost`, `smaller`, `restore`, `device_lost`, `developer`; `is_current_save`; `save_copy_count`; `kept_save_copy_id` | `Zaisma.saves.listCopies()` answers `{ saveCopies }`, each `SaveCopy` with `copyReason` (`SaveCopyReason`, the same values) |\n| Which format a stored save is in | `save_format_version_number` (`1`), the first key of the save's stored text | |\n| When a save or an earlier version was last saved or changed (never `updated_at`) | `saved_at` | `savedAt` on a `SaveCopy` and on `developerChange`'s `DeveloperChange` |\n| The game version that saved a save or an earlier version (a label, `null` when the developer wrote it) | `version_id` on a save and a save copy | `versionId` on a `SaveCopy` |\n| Whose progress won when two devices' progress differed | | `winnerKind` on `conflict`'s `SaveConflict`: `this_device`, `account` |\n| A game's own SQLite database, a statement for it and the values for its `?`s | `sql`, `values` (a blob as `{ blob_base64 }`), `statements`; answered as `rows`, `statement_results` (one per statement) and `read_row_count`, `written_row_count`; its `tables` and `indexes` (`table_name`) | `room.database`: `query(sql, values)` answers rows, `batch(statements)` runs `{ sql, values }` statements in one transaction; a `DatabaseError` has a `code` and a `fix` |\n| Erasing a player from a game's database, and whether Zaisma does it when they delete their account | `erase_player`, `erased_tables` (`table_name`, `erased_row_count`); `deleted_account_erase_enabled` | `database.erasePlayer(playerId)` answers `[{ tableName, erasedRowCount }]` |\n| A game database's whole contents as SQLite's SQL dump, in parts | `dump_sql` (one part, in and out), `next_cursor` and `cursor` between parts; an import answers `statement_count` and `skipped_statement_count` | `dumpPart(read, cursor)` answers `{ dumpSql, nextCursor, readRowCount }`; `importStatements(dumpSql)` (`DUMP_LIMITS`: `exportPartSizeBytes`, `maximumImportPartSizeBytes`) |\n| Going back to an earlier moment of a kept room's world or of every one, and undoing that | `restore_kept_room`, `undo_kept_room_restore`, `list_kept_room_restores`, `restore_every_kept_room`, `undo_every_kept_room_restore`, `get_kept_room_restore_batch`; `restore_to_at`; a restore is `{ id, room_code, restore_to_at, restored_at, undoes_kept_room_restore_id, kept_room_restore_batch_id, undo_expires_at }` (`kept_room_restore_id`), listed as `restores` with `earliest_restore_to_at`; a batch is `kept_room_restore_batch` with `kept_room_count`, `restored_room_count`, `skipped_room_count`, `failed_room_count`, `failed_room_codes`; `live_version_published_since`; errors `no_kept_room_restore`, `no_kept_room_restore_batch`, `kept_room_restore_unavailable`, `kept_room_restore_batch_running` | `server.restoreKeptRoom(roomCode, { restoreToAt })`, `server.undoKeptRoomRestore(roomCode, keptRoomRestoreId)`, `server.listKeptRoomRestores(roomCode)` (`KeptRoomRestore`, `KeptRoomRestoreList`, `earliestRestoreToAt`); `restoreInfo.keptRoomRestore` (`KeptRoomRestoreInfo`, with `erasedPlayerIds`) |\n| A deleted kept room's world coming back from its last copy | `bring_back_kept_room`, `is_bringing_back`, `copy_saved_at`; `deleted_kept_rooms` (each `room_code`, `name`, `saved_size_bytes`, `deleted_at`, `bring_back_ends_at`, `bring_back_started_at`, `bring_back_failed_at`), `deleted_kept_room_count`; errors `kept_room_copies_unavailable`, `no_kept_room_copy`, `room_code_in_use`, `game_storage_full` | |\n| Going back to an earlier moment of a game's database, and undoing that | `restore_database`, `restore_to_at`; a restore is `{ id, restore_to_at, restored_at, undoes_database_restore_id, undo_expires_at }` (`database_restore_id`), listed as `restores`; `undo_database_restore`; `erased_again_player_count`; errors `no_database_restore`, `database_restore_unavailable` | |\n| A game database's use this month, and the most a game can keep | `database_use_this_month`: `read_row_count`, `written_row_count`, `storage_size_bytes`, `maximum_storage_size_bytes`; at it, `database_full` | `MAXIMUM_DATABASE_SIZE_BYTES`, `MAXIMUM_GAME_STORAGE_SIZE_BYTES` (Zaisma's own code); `database_full`, and `hosting_paused` an hour after the game's hosting paused |\n| A request from a game to its own game server outside any room, and what that answers | `request_count` (in a day's `game_server`) | `Zaisma.server.request(request, { serverUrl })` answers the `answer`; the game server's `onRequest(player, request, server)`, with `server.database`; sent to `POST /v1/requests/<slug>` as `{ pass, request }`, answered `{ answer }` |\n| A game server's schedules, and one run of one | `schedules` (in stats): `schedule_name`, `cron`, `version_id`, `next_run_at`, `last_run_at`; `scheduled_run_count` (in a day's `game_server`) | `schedules: [{ name, cron }]` (`Schedule`, up to `SCHEDULE_LIMITS.maximumScheduleCount`, cron in UTC); `onSchedule(run, server)` with `run.name`, `run.cron`, `run.scheduledAt` (`ScheduledRun`), and `server.database` |\n| A friend request a game offers, sent only once the player says yes on Zaisma's page, and who takes them | the social setting `who_can_send_friend_requests`: `nobody` (Invites only), `played_with` (People I play with: the same room now or within the last hour), `anyone`; in Zaisma's own code `friend_requests` (`sender_account_id`, `recipient_account_id`, `answer`: `accepted`, `turned_down`) and `room_visits` | `Zaisma.friends.sendRequest(playerId)` answers `{ status }`: `sent`, `cancelled`, `already_friends`, `not_taking_requests`; the room's `{ type: \"friend_request\", playerId }` from a game and `{ type: \"friend_request\" }` to the other player (look now, never who) |\n| A game played off its Zaisma page (exported, on another site, in a store), and its players on the developer's own server | | `Zaisma.setUpOffZaisma({ gameSlug, playerToken })` answers `{ isOffZaisma }` (refused with `bad_game_slug`, `bad_player_token`); `playerToken`, a player's proof from somewhere other than Zaisma (a Sign in with Zaisma ID token or the game's own token, up to 8 KB; `null` for a guest), sent in a hello or request in place of `pass` (`REQUEST_LIMITS.maximumPlayerTokenSizeBytes`); the player's `kind` `outside_zaisma`; `startServer`'s `identifyPlayer(playerToken, { origin })` answering `{ id, name }` or null (`IdentifyPlayer`, `OutsidePlayer`) and `outsideGuestsEnabled`; `signInWithZaismaPlayers({ signInAppIds, siteUrl, loadKeys, loadProfile })` and `guestPlayer()`; refused with `bad_player_token`; `checkChat`'s `null` passes. Inside: `OUTSIDE_PLAYER_LIMITS`, `OUTSIDE_ZAISMA_CHAT_SETTINGS`, `checkedOutsidePlayer`, `isPlayerToken`, `ChatMessage.hasOutsideReceiver` |\n| A game's own servers that players' browsers connect to, named in the game's menu | `own_server_urls` (each `wss://` or `https://` and a host, like `wss://play.example.com`) | `serverUrl` in `Zaisma.joinRoom` and `Zaisma.friends.setRoom` |\n| The hosts a game's own game server can call (game server reach), and how a call it can't make fails | `game_server_allowed_hosts` (host names, or `*.example.com` for the names under one) | plain `fetch()`; a refused call throws an `OutsideCallError` with a `code` (`OutsideCallErrorCode`: `not_https`, `unreachable_host`, `host_not_allowed`, `outside_call_limit`, `too_big`, `outside_call_timeout`, `outside_call_failed`) and a `fix` (`OUTSIDE_CALL_LIMITS`: `maximumBodySizeBytes`, `timeoutSec`, `maximumCallsPerMin`) |\n| A game's registered links: the name the game opens one by, its address, whether its game page shows it, and who it opens for | `links`, each `{ link_name, destination_url, is_on_game_page, who_can_open, review_reason }`; `who_can_open`: `everyone`, `signed_in_adults`, `waiting_for_standing`, `nobody` | `Zaisma.links.open(linkName, { path, queryParameters, ownSiteUrl })` answers a `LinkStatus`: `opened`, `stayed`; errors `unknown_link`, `bad_link_path`, `bad_link_query`, `bad_own_site_url`, `needs_player_tap` |\n| A game's secrets: a name like an environment variable's, its text, and when it was set | `secret_name`, `secret_value` in; a secret is `{ name, set_at }` out, never its value; `deleted_secret_name` | `server.secrets` and `room.secrets` (by name, read-only); on your own server, the environment variables |\n| A game server's data files: any file in `zaisma-server/` that isn't code, read whole, and what a game server can be and use | | `room.readDataFile(path)` and `server.readDataFile(path)` (the path from `zaisma-server/`, an `ArrayBuffer` back); `dataFolder` (`startServer`) and `--data-folder` on your own server; `GAME_SERVER_LIMITS` `{ maximumSizeBytes, maximumFileCount, maximumCallCpuDurationMs, maximumStartCpuDurationMs, maximumLoadCpuDurationMs, maximumMemorySizeBytes }`; `SERVER_CODE_FILE` (Zaisma's own code) |\n| Something a game sells or grants | `items`, each `{ item_name, title, description, item_kind, item_category, price_minor_units, currency_code, local_prices, card_fee_note, created_at, updated_at }`; `item_kind` `permanent`, `consumable`; `item_category` `cosmetic`, `gameplay`, `content`, `currency`; `price_minor_units` `null` for an item only granted or no longer sold (then `currency_code` `null` too); `local_prices`, each `{ currency_code, price_minor_units }`, never the main currency again; `currency_code` lowercase ISO 4217 as Stripe writes it (`usd`, `brl`); `removed_item_name`; `is_on_game_page` (the game page sells it under Add-ons too); errors `no_item`, `too_many_items`, `bad_item`, `unsupported_currency`, `price_too_low`, `item_has_owners` | `ITEM_LIMITS`, `ITEM_KINDS`, `ITEM_CATEGORIES`, `CURRENCY_MINIMUM_PRICES`, `COUNTRY_CURRENCIES`, `priceFor`, `priceText`, `cardFeeNote`, `checkItem`; `Zaisma.items.list()` answers `ItemForSale` `{ itemName, title, description, itemKind, itemCategory, priceMinorUnits, currencyCode, priceText, isOwned }` |\n| A player's purchase or grant of an item, and its proof | `purchase` `{ id, item_name, item_kind, item_count, purchase_source, purchase_status, player_id, game_account_id, paid_minor_units, currency_code, refunded_minor_units, purchased_at, refunded_at, receipt }`; `paid_minor_units` what the whole purchase paid, never the item's `price_minor_units`; `purchase_source` `sale`, `grant`; `purchase_status` `pending`, `completed`, `failed`, `refunded`, `charged_back`; `item_count` how many of the item (1 for a permanent one); `receipt` the signed token; `game_account_id` the game's own ID for the player's account in its own system, given back as sent (not a Zaisma ID, so it says no kind); `is_already_owned`; `owned_item_names`, in the pass too; key area `purchase_access`; errors `no_purchase`, `bad_item_count`, `bad_game_account_id`, `bad_purchase_source`, `bad_purchase_status`, `already_refunded`, `stripe_not_connected`, `receipts_unavailable` | `ReceiptClaims` with `receipt_version_number`, `purchase_id` (and `jti`, the same), `purchased_at`, `purchase_status`, `paid_minor_units`; header `typ` `receipt+jwt`; `ReceiptError`, `ReceiptErrorCode` (`wrong_version` beside the pass codes); `verifyReceipt`, `room.verifyReceipt(receipt)`, `server.verifyReceipt(receipt)`, `RECEIPT_TOKEN_TYPE`, `RECEIPT_VERSION_NUMBER`, `ReceiptCheckBinding`, `RECEIPT_SIGNING_KEY`, `RETIRED_RECEIPT_PUBLIC_KEYS`; columns `deleted_game_slug`, `deleted_game_title` on purchases; `ReceiptSigningService`, `receiptClaimsFor`, `ownedItemNames`, `owningPurchaseOf`, `newGrant`, `recordGrant`, `takeBack`; `player.ownedItemNames` on the game server; `Zaisma.items.owns(itemName)`, `Zaisma.items.owned()` |\n| A game that sells itself once, and its demo | `full_game_item_name` (the permanent content item a player owns to play; `null`: free to play), `demo_game_slug` (another of the developer's games, free to play; `demo_game_id` in the games table); Browse's `?price=` one of `free`, `under_5`, `5_to_15`, `15_to_30`, `30_and_up`; errors `bad_full_game_item`, `full_game_item_in_use`, `bad_demo_game`, `account_requirement_locked`, `full_game_not_owned` | `PRICE_RANGES`, `PriceRange`, `priceRangeOf`, `fullGameOwner`, `settlePaidGame` |\n| What a game page says the game sells | `purchase_label` `{ categories, has_own_payments }`; `own_payment_categories` (what the developer sells through their own payments, the same four categories); `refund_policy` `no_refunds`, `unused_within_14_days`, `within_14_days`, `own_words`, with `refund_policy_text`; errors `refund_policy_needed`, `bad_refund_policy`, `bad_refund_policy_text`, `bad_own_payment_categories`; content rule `purchases`, findings `ai_paid_random_rewards`, `ai_coin_price_without_real_price` | `REFUND_POLICIES`, `purchaseLabelOf`, `checkPurchaseSettings` |\n| Where a game's purchases are delivered, each exactly once | `purchase_delivery` (`game`, `game_server`, `own_server`; `game` by default), in the purchase settings beside `refund_policy`; errors `bad_purchase_delivery`, `no_game_server` | `config.purchaseDelivery` (`\"game\"`, `\"game_server\"`, `\"own_server\"`, given to the SDK by the page); `startServer({ zaismaKey })`, and `ZAISMA_KEY` on your own server for `onPurchase` and `onRefund` |\n| Whether a purchase, and its refund, reached the game, its game server or your own server | `handled_at` and `refund_handled_at` on a `purchase` (ISO time, `null` until then); `unhandled_purchases` (completed purchases not handled, and refunded or charged-back ones handled but not yet told, oldest first, at most 50 purchases and 50 refunds) in `get_player_items`; `mark_purchase_handled` (`POST \u2026/purchases/:purchase_id/handled`); webhook events `purchase_completed` and `purchase_refunded` with `purchase` (`null` in every other event); errors `already_handled`, `handled_by_server` | `Zaisma.items.unhandled()` answers `Purchase[]` `{ id, itemName, itemKind, itemCount, purchaseSource, purchaseStatus, gameAccountId, paidMinorUnits, currencyCode, purchasedAt, refundedAt, receipt }`; `Zaisma.items.markHandled(purchaseId)`, errors `bad_purchase_id`, `no_purchase`, `already_handled`, `handled_by_server`, `slow_down` |\n| A purchase, or its refund, arriving at the game or its game server | | `Zaisma.items.on(\"purchase\", listener)` and `Zaisma.items.on(\"refund\", listener)` (`ItemsEvents`, `off` to stop), each listener gets a `Purchase`; `onPurchase(state, player, room, purchase)` and `onRefund(state, player, room, purchase)` on the game server (`Purchase`, `PurchaseHandling`, `purchaseHandling` on a `Transport`); the room message `{ type: \"zaisma:purchase\", purchaseId, receipt? }` the SDK sends to a game server's rooms after a purchase |\n| What a request to a game server can fail with | | `RequestErrorCode`: `bad_request`, `too_big`, `bad_pass`, `bad_player_token`, `account_needed`, `game_not_open_to_player`, `game_unavailable`, `no_request_handler`, `game_server_error`, `hosting_paused`, `rented_share_used`, `slow_down`, `bad_origin`, `busy` |\n| What an error or a review reason is, and its other parts | `code`; `message`, `field`, `fix`, `retry_after_sec` (inside `error` only); `content_rule` (inside `review_reason` and `findings` only) | `code` (on the error only) |\n\n## Adding a field, option or tool\n\n1. Look in the glossary. If the concept is there, use its name.\n2. Name it by its shape: what it's about, the kind of value, the unit.\n3. One type, one unit, and the same keys every time.\n4. Describe it in the schema, with limits.\n5. Add examples if a call could go wrong, good and bad, as many as it needs.\n6. Errors get a code, a field and a fix; changes answer with `next_steps`.\n7. Update the glossary, `docs/DEVELOPER-API.md` and the SDK's types (`packages/sdk/zaisma.d.ts`, its reference) in the same change.\n8. After the beta, renaming or removing a field, option or tool follows \"What's live keeps working\" in `docs/DECISIONS.md`.\n",
|
|
60429
60442
|
"errors": "<!-- Made by scripts/build-skill.mjs: never edit it by hand. -->\n\n# Error codes\n\nEvery error the developer API and MCP answer with, as `{ \"error\": { code, message, field, fix, message_for_people, retry_after_sec, help_url } }`. A thrown error's own `fix` is more specific than the general one here: do what it says first. Each code's page is at `help_url`.\n\n## Signing in and requests\n\n- `no_key` (HTTP 401): The MCP was called without an API key or a connected app's token. Fix: Send an API key as Authorization: Bearer <key>, made on zaisma.com/account, or connect the MCP at https://zaisma.com/mcp and sign in. https://zaisma.com/developers/errors/no_key\n- `bad_key` (HTTP 401): The API key isn't valid: removed, mistyped or never made. Fix: Make a new API key on zaisma.com/account and send it as Authorization: Bearer <key>. https://zaisma.com/developers/errors/bad_key\n- `key_turned_off` (HTTP 401): The API key was found in public and turned off for good. Fix: Make a new API key on zaisma.com/account and keep it out of public files, like a game's code or a public repository. https://zaisma.com/developers/errors/key_turned_off\n- `key_ended` (HTTP 401): The API key reached the end date it was made with. Fix: Make a new API key on zaisma.com/account, with a later end date or none. https://zaisma.com/developers/errors/key_ended\n- `access_token_ended` (HTTP 401): A connected app's access token is past its hour; the app refreshes it by itself. Fix: Refresh the token with the refresh token from the sign-in, as the MCP app does by itself, or connect the app again. https://zaisma.com/developers/errors/access_token_ended\n- `token_not_for_api` (HTTP 401): A connected app's token works only at the MCP, not the REST API. Fix: Call the MCP at https://zaisma.com/mcp with this token, or make an API key on zaisma.com/account for the REST API. https://zaisma.com/developers/errors/token_not_for_api\n- `signed_out` (HTTP 401): No API key, and no signed-in session. Fix: Send an API key as Authorization: Bearer <key>, or sign in on zaisma.com first. https://zaisma.com/developers/errors/signed_out\n- `no_account` (HTTP 401): The account isn't finished yet. Fix: Finish making the account on zaisma.com/join, then call again. https://zaisma.com/developers/errors/no_account\n- `bad_origin` (HTTP 403): A call with a session came from another site. Fix: Call the API with an API key from your own server or tools, never with a zaisma.com session from another site. https://zaisma.com/developers/errors/bad_origin\n- `key_not_allowed` (HTTP 403): The API key is limited to other games, or its access doesn't cover the call. Fix: Call get_access to see what the key covers, then make a key on zaisma.com/account with the games and access this call needs. https://zaisma.com/developers/errors/key_not_allowed\n- `slow_down` (HTTP 429): Too many calls in a minute. Fix: Wait retry_after_sec seconds, then call again, and space calls out from then on. https://zaisma.com/developers/errors/slow_down\n- `not_found` (HTTP 404): There's no API call at that path. Fix: Check the path against docs/DEVELOPER-API.md: every path starts with /api/dev, like GET /api/dev/games. https://zaisma.com/developers/errors/not_found\n- `bad_method` (HTTP 405): The path doesn't take that method. Fix: Send the call with a method the path takes, as docs/DEVELOPER-API.md lists it. https://zaisma.com/developers/errors/bad_method\n- `gone` (HTTP 410): The call was removed, like the first feedback calls. Fix: Use the call the message names instead, as docs/DEVELOPER-API.md lists it. https://zaisma.com/developers/errors/gone\n- `bad_json` (HTTP 400): The body isn't a JSON object. Fix: Send the body as one JSON object with Content-Type: application/json. https://zaisma.com/developers/errors/bad_json\n- `json_too_big` (HTTP 413): The JSON body is over the call's size limit. Fix: Send less in one call, in parts, or use the upload command for files. https://zaisma.com/developers/errors/json_too_big\n- `wrong_shape` (HTTP 400): A field that isn't the type or size its call takes, refused before any of the call's own code runs. Fix: Change the field named in field to the type and size the call takes, as the MCP tool's input schema says. https://zaisma.com/developers/errors/wrong_shape\n- `unknown_field` (HTTP 400): A field, argument or query parameter the call doesn't take. Fix: Leave out the field named in field: the MCP tool's input schema lists every field the call takes. https://zaisma.com/developers/errors/unknown_field\n- `missing_field` (HTTP 400): A field the call needs wasn't sent. Fix: Send the field named in field, as the MCP tool's input schema says. https://zaisma.com/developers/errors/missing_field\n- `wrong_id_kind` (HTTP 400): An ID of another kind was sent, like an image ID as version_id. Fix: Send an ID of the kind the field names, like a version_\u2026 ID as version_id, from the call that answered it. https://zaisma.com/developers/errors/wrong_id_kind\n- `internal_error` (HTTP 500): Something broke on Zaisma's side. Fix: Call again in a minute, and if it keeps happening, tell Zaisma with message_zaisma, kind bug. https://zaisma.com/developers/errors/internal_error\n\n## Games\n\n- `no_game` (HTTP 404): You have no game with that slug. Fix: Call list_games for your games' slugs, then call again with one of them. https://zaisma.com/developers/errors/no_game\n- `bad_slug` (HTTP 400): The link name isn't lowercase letters, numbers and single hyphens, or is reserved. Fix: Give a slug of lowercase letters, numbers and single hyphens, like space-race, that isn't one Zaisma keeps. https://zaisma.com/developers/errors/bad_slug\n- `slug_taken` (HTTP 409): Another game has that link name, or a deleted game had it. Fix: Give create_game another slug, or leave slug out to have one made from the title. https://zaisma.com/developers/errors/slug_taken\n- `too_many_games` (HTTP 403): The account has as many games as it can have. Fix: Delete a game you don't need with delete_game, then make the new one. https://zaisma.com/developers/errors/too_many_games\n- `account_banned` (HTTP 403): Zaisma banned the account's developer side, or the whole account: only get_access, list_games and export_game work, and for a whole-account ban nothing does. Fix: Export your games with export_game to keep them, and read the ban's reason in get_access. https://zaisma.com/developers/errors/account_banned\n- `account_paused` (HTTP 403): A person at Zaisma needs to look at the account: until then it can't make, upload or publish games, or post on the forum. Fix: Wait for a person at Zaisma to look at the account; get_access says why it's paused, and message_zaisma reaches them. https://zaisma.com/developers/errors/account_paused\n- `publishing_not_open` (HTTP 403): Until the beta, only accounts Zaisma adds can make, upload and publish games. Fix: Call get_access to see can_publish, and ask Zaisma for access with message_zaisma until the beta opens. https://zaisma.com/developers/errors/publishing_not_open\n- `bad_title` (HTTP 400): A game's, topic's or precedent's title is empty or too long. Fix: Give a title that isn't empty and fits the field's length, as the input schema says. https://zaisma.com/developers/errors/bad_title\n- `title_names_zaisma` (HTTP 400): A game's title holds the whole word Zaisma, which only Zaisma's own games can use. Fix: Give the game a title without the word Zaisma. https://zaisma.com/developers/errors/title_names_zaisma\n- `bad_description` (HTTP 400): The description isn't text of up to 500 characters. Fix: Give a description of up to 500 characters of plain text. https://zaisma.com/developers/errors/bad_description\n- `bad_visibility` (HTTP 400): visibility isn't draft, listed, unlisted or private. Fix: Give visibility as listed, unlisted, private or draft. https://zaisma.com/developers/errors/bad_visibility\n- `bad_devices` (HTTP 400): devices isn't a list of phone, tablet and computer. Fix: Give devices as a list from phone, tablet and computer. https://zaisma.com/developers/errors/bad_devices\n- `bad_genres` (HTTP 400): genres isn't a list of up to 3 of Zaisma's genres. Fix: Give genres as a list of up to 3 of the genres update_game's input schema lists. https://zaisma.com/developers/errors/bad_genres\n- `bad_controls` (HTTP 400): controls isn't a list of touch, keyboard_mouse and gamepad. Fix: Give controls as a list from touch, keyboard_mouse and gamepad. https://zaisma.com/developers/errors/bad_controls\n- `bad_screen_orientation` (HTTP 400): screen_orientation isn't portrait, landscape, either or null. Fix: Give screen_orientation as portrait, landscape, either or null. https://zaisma.com/developers/errors/bad_screen_orientation\n- `bad_play_modes` (HTTP 400): play_modes isn't a list of play modes, or one of them is wrong. Fix: Fix the play mode named in field, as update_game's input schema shows, like { \"mode\": \"online\", \"minimum_player_count\": 2, \"maximum_player_count\": 4, \"play_style\": \"co-op\" }. https://zaisma.com/developers/errors/bad_play_modes\n- `bad_cloud_saves_enabled` (HTTP 400): cloud_saves_enabled isn't true or false. Fix: Give cloud_saves_enabled as true or false. https://zaisma.com/developers/errors/bad_cloud_saves_enabled\n- `bad_account_offer_enabled` (HTTP 400): account_offer_enabled isn't true or false. Fix: Give account_offer_enabled as true or false. https://zaisma.com/developers/errors/bad_account_offer_enabled\n- `bad_deleted_account_erase_enabled` (HTTP 400): deleted_account_erase_enabled isn't true or false. Fix: Give deleted_account_erase_enabled as true or false. https://zaisma.com/developers/errors/bad_deleted_account_erase_enabled\n- `bad_friend_joins_enabled` (HTTP 400): friend_joins_enabled isn't true or false. Fix: Give friend_joins_enabled as true or false. https://zaisma.com/developers/errors/bad_friend_joins_enabled\n- `bad_performance_measuring_enabled` (HTTP 400): performance_measuring_enabled isn't true or false. Fix: Give performance_measuring_enabled as true or false. https://zaisma.com/developers/errors/bad_performance_measuring_enabled\n- `bad_room_browsing` (HTTP 400): room_browsing isn't page, game or off. Fix: Give room_browsing as page, game or off. https://zaisma.com/developers/errors/bad_room_browsing\n- `bad_multiplayer_mode` (HTTP 400): multiplayer_mode isn't none, relay or own. Fix: Give multiplayer_mode as none, relay or own. https://zaisma.com/developers/errors/bad_multiplayer_mode\n- `bad_account_requirement` (HTTP 400): account_requirement isn't none, multiplayer or whole_game. Fix: Give account_requirement as none, multiplayer or whole_game. https://zaisma.com/developers/errors/bad_account_requirement\n- `bad_minimum_player_age` (HTTP 400): minimum_player_age_years isn't 13, 16 or 18. Fix: Give minimum_player_age_years as 13, 16 or 18. https://zaisma.com/developers/errors/bad_minimum_player_age\n- `accounts_needed_for_minimum_age` (HTTP 400): A game for 16 or 18 and up needs account_requirement whole_game, since only accounts have an age. Fix: Call update_game with account_requirement whole_game in the same call as a minimum age of 16 or 18. https://zaisma.com/developers/errors/accounts_needed_for_minimum_age\n- `content_needs_minimum_age` (HTTP 409): A version shows lifelike gore, which plays only in games for 16 and up. Fix: Call update_game with minimum_player_age_years 16 or 18 and account_requirement whole_game, or upload a version without lifelike gore. https://zaisma.com/developers/errors/content_needs_minimum_age\n- `gallery_picture_needed` (HTTP 409): A listed game needs at least one gallery picture. Fix: Add a gallery picture with add_image, kind screenshot, then list the game again. https://zaisma.com/developers/errors/gallery_picture_needed\n- `bad_links` (HTTP 400): links isn't a list of up to 20 { link_name, destination_url, is_on_game_page } with names of their own and https addresses that aren't link shorteners, IP addresses, addresses with a user name, or on Zaisma's own domains. Fix: Give links as a list of up to 20 { link_name, destination_url, is_on_game_page }, each with its own name and an https address on a name of its own. https://zaisma.com/developers/errors/bad_links\n- `bad_own_server_urls` (HTTP 400): own_server_urls isn't a list of up to 5 server addresses like wss://play.example.com, or one is an IP address, this computer or on Zaisma's own domains. Fix: Give own_server_urls as up to 5 addresses like wss://play.example.com, on a name of your own. https://zaisma.com/developers/errors/bad_own_server_urls\n- `bad_game_server_allowed_hosts` (HTTP 400): game_server_allowed_hosts isn't a list of up to 20 host names (like discord.com or *.example.com), or one is an IP address or on Zaisma's own domains. Fix: Give game_server_allowed_hosts as up to 20 host names like discord.com or *.example.com, with no IP addresses or Zaisma domains. https://zaisma.com/developers/errors/bad_game_server_allowed_hosts\n- `built_in_server` (HTTP 403): The game runs a game server built into Zaisma, which only Zaisma changes. Fix: Leave the game's server settings as they are, and ask Zaisma with message_zaisma if one needs to change. https://zaisma.com/developers/errors/built_in_server\n- `game_removed` (HTTP 403): Zaisma took the game down, so this can't change. Fix: Read the takedown's review_reason with get_game, and ask Zaisma with message_zaisma if it's unclear. https://zaisma.com/developers/errors/game_removed\n- `needs_confirm` (HTTP 409): Hiding a game players can play, or ending a live room, needs the developer's OK. Fix: Ask the developer, then call again with \"confirm\": true. https://zaisma.com/developers/errors/needs_confirm\n- `bad_period_duration_days` (HTTP 400): period_duration_days isn't a whole number from 1 to 90. Fix: Give period_duration_days as a whole number from 1 to 90. https://zaisma.com/developers/errors/bad_period_duration_days\n- `bad_cursor` (HTTP 400): cursor isn't a next_cursor from an earlier answer. Fix: Give cursor as the next_cursor of the last answer, or leave it out to start from the top. https://zaisma.com/developers/errors/bad_cursor\n\n## Players\n\n- `no_player` (HTTP 404): No account has that player ID: a guest's, or a deleted account's. Fix: Use a player ID from an account, like one from list_purchases or the game server's player pass, not a guest's. https://zaisma.com/developers/errors/no_player\n\n## Covers, gallery pictures, backgrounds and other images\n\n- `bad_kind` (HTTP 400): kind isn't one of the choices the call takes. Fix: Give kind as one of the choices the call's input schema lists. https://zaisma.com/developers/errors/bad_kind\n- `not_an_image` (HTTP 415): The file isn't an image of a type the call takes. Fix: Send a PNG, WebP or JPEG, as base64 or a file. https://zaisma.com/developers/errors/not_an_image\n- `image_too_big` (HTTP 413): The image is over 10 MB. Fix: Send the image at up to 10 MB, as WebP or a smaller JPEG. https://zaisma.com/developers/errors/image_too_big\n- `bad_image_dimensions` (HTTP 400): The image is smaller than its kind's least size (a cover or gallery picture 1280 by 720, a square cover 512, a share picture 600 by 315), or over 8,192 px on a side. Fix: Send the image at its kind's size: at least 1280 by 720 for a cover or gallery picture, 512 for a square cover, 600 by 315 for a share picture, and at most 8,192 px a side. https://zaisma.com/developers/errors/bad_image_dimensions\n- `not_square` (HTTP 400): A square cover isn't as wide as it is tall. Fix: Crop the square cover to as wide as it is tall, at least 512 px a side. https://zaisma.com/developers/errors/not_square\n- `too_many_gallery_pictures` (HTTP 400): The game has 8 gallery pictures already. Fix: Remove a gallery picture with remove_image before adding another. https://zaisma.com/developers/errors/too_many_gallery_pictures\n- `image_refused` (HTTP 422): The image can't be used. Fix: Read the image's review_reason with get_game and send another image that keeps to the cover guide at zaisma.com/developers/covers. https://zaisma.com/developers/errors/image_refused\n- `no_image` (HTTP 404): The game has no image with that ID. Fix: Call get_game for the game's image IDs, then call again with one of them. https://zaisma.com/developers/errors/no_image\n- `no_file` (HTTP 400): A form on Zaisma's pages was sent without its image. Fix: Pick an image in the form and send it again. https://zaisma.com/developers/errors/no_file\n- `bad_background_shape` (HTTP 400): A wide background is landscape (1.3 to 2.4 times as wide as tall), a phone background portrait (1.6 to 2.4 times as tall as wide), and its long side at least 1600 px. Fix: Send a wide background 1.3 to 2.4 times as wide as tall, or a phone background 1.6 to 2.4 times as tall as wide, with its long side at least 1600 px. https://zaisma.com/developers/errors/bad_background_shape\n- `not_a_shader` (HTTP 400): A shader's pass isn't GLSL text with a mainImage function, or has its own main(), a #version or #extension line, texture2D, iMouse or sound. Fix: Write each pass as GLSL with a mainImage function, without main(), #version, #extension, texture2D, iMouse or sound, and test it with check_shader. https://zaisma.com/developers/errors/not_a_shader\n- `shader_too_big` (HTTP 413): A shader's pass is over 64 KB. Fix: Keep each pass under 64 KB, moving work into buffers if needed. https://zaisma.com/developers/errors/shader_too_big\n- `bad_buffers` (HTTP 400): buffers isn't a list of { buffer_name, source, channels } with buffer_name a, b, c or d, each once. Fix: Give buffers as a list of { buffer_name, source, channels } with buffer_name a, b, c or d, each once. https://zaisma.com/developers/errors/bad_buffers\n- `too_many_buffers` (HTTP 400): A shader has more than 4 buffers. Fix: Give a shader at most 4 buffers, a to d. https://zaisma.com/developers/errors/too_many_buffers\n- `bad_shader_channel` (HTTP 400): A channel isn't { channel_index 0 to 3, input_kind, buffer_name or image_id, filter, wrap }, names a buffer the shader doesn't have, or a texture that isn't an approved shader_texture of the game. Fix: Give each channel as { channel_index, input_kind, buffer_name or image_id, filter, wrap }, naming a buffer the shader has or an approved shader_texture image. https://zaisma.com/developers/errors/bad_shader_channel\n- `shader_texture_too_big` (HTTP 413): A shader texture is over 8 MB, or over 4,096 px on a side. Fix: Send the texture at up to 8 MB and 4,096 px a side. https://zaisma.com/developers/errors/shader_texture_too_big\n- `too_many_shader_textures` (HTTP 400): The game has 16 shader textures already, or a shader's channels name more than 4. Fix: Remove a shader texture with remove_image, or give a shader's channels at most 4 textures. https://zaisma.com/developers/errors/too_many_shader_textures\n- `shader_texture_in_use` (HTTP 409): A shader the game keeps reads this texture. Fix: Remove the shaders that read the texture with remove_shader first. https://zaisma.com/developers/errors/shader_texture_in_use\n- `daily_shader_checks_used` (HTTP 429): The account has run 100 shader checks in the last day. Fix: Wait for the oldest check to pass a day, after retry_after_sec, or check the shader on your own computer with npx @zaisma/cli check. https://zaisma.com/developers/errors/daily_shader_checks_used\n- `daily_page_previews_used` (HTTP 429): The account has run every page preview its plan has in the last day (20, or 60 with Pro). Fix: Wait retry_after_sec seconds for the oldest preview to pass a day, or start Zaisma Pro with start_pro for 60 a day. https://zaisma.com/developers/errors/daily_page_previews_used\n- `page_preview_unavailable` (HTTP 503): Zaisma can't open pages in Chrome right now, so it can't picture them. Fix: Call preview_game_page again in a few minutes. https://zaisma.com/developers/errors/page_preview_unavailable\n- `bad_page_preview_images` (HTTP 400): images isn't a list of up to 8 { kind, image_base64 } or { kind, image_id }, with kind cover, share, screenshot, background or phone_background. Fix: Give images as up to 8 { kind, image_base64 } or { kind, image_id }, with kind cover, share, screenshot, background or phone_background. https://zaisma.com/developers/errors/bad_page_preview_images\n- `bad_page_preview_shaders` (HTTP 400): shaders isn't a list of { screen, image, buffers } with each screen at most once. Fix: Give shaders as a list of { screen, image, buffers }, each screen at most once. https://zaisma.com/developers/errors/bad_page_preview_shaders\n- `shader_check_unavailable` (HTTP 503): Zaisma can't draw shaders here right now, so it can't check one. Fix: Call check_shader again in a few minutes, or check it on your own computer with npx @zaisma/cli check. https://zaisma.com/developers/errors/shader_check_unavailable\n- `no_shader` (HTTP 404): The game has no shader with that ID. Fix: Call get_game for the game's shader IDs, then call again with one of them. https://zaisma.com/developers/errors/no_shader\n- `bad_screen` (HTTP 400): screen isn't wide or phone. Fix: Give screen as wide or phone. https://zaisma.com/developers/errors/bad_screen\n- `bad_background_source` (HTTP 400): source isn't zaisma, image or shader, or wide (which only phone takes). Fix: Give source as zaisma, image or shader, or wide for the phone screen only. https://zaisma.com/developers/errors/bad_background_source\n- `background_not_ready` (HTTP 409): The image or shader isn't this game's, isn't approved yet, or is for the other screen. Fix: Wait until get_game shows the image or shader approved for this screen, then call set_background again. https://zaisma.com/developers/errors/background_not_ready\n- `bad_color` (HTTP 400): The color isn't #RRGGBB. Fix: Give the color as #RRGGBB, like #1A2B3C. https://zaisma.com/developers/errors/bad_color\n\n## Uploading versions\n\n- `bad_files` (HTTP 400): files isn't a list of files in the shape the call takes. Fix: Give files as a list of { path, content_base64 } or { path, size_bytes, sha256 }, as the call's input schema shows. https://zaisma.com/developers/errors/bad_files\n- `bad_path` (HTTP 400): A file's path is absolute, has . or .. in it, has control characters or is over 200 characters. Fix: Give each file a relative path like assets/hero.png, without . or .. parts, control characters or more than 200 characters. https://zaisma.com/developers/errors/bad_path\n- `hidden_file` (HTTP 400): A file or folder's name starts with a dot. Fix: Leave out files and folders whose names start with a dot, or rename the ones the game needs. https://zaisma.com/developers/errors/hidden_file\n- `precompressed_file` (HTTP 400): A file is pre-compressed (.gz or .br). Fix: Upload with npx @zaisma/cli upload, which unpacks .gz and .br files, or send them unpacked. https://zaisma.com/developers/errors/precompressed_file\n- `file_type_not_allowed` (HTTP 400): A file is of a type games can't have. Fix: Leave the file out, or change it to a type games can have, as check_game lists them. https://zaisma.com/developers/errors/file_type_not_allowed\n- `file_too_big` (HTTP 413): A file is over 500 MB. Fix: Split the file into pieces of up to 500 MB that the game loads one by one. https://zaisma.com/developers/errors/file_too_big\n- `duplicate_path` (HTTP 400): Two files share a path. Fix: Send each path once. https://zaisma.com/developers/errors/duplicate_path\n- `no_index_html` (HTTP 400): There's no index.html at the top of the game. Fix: Put an index.html at the top of the game's folder, the page Zaisma opens first. https://zaisma.com/developers/errors/no_index_html\n- `too_many_files` (HTTP 400): The game has more than 20,000 files. Fix: Pack small files together, like sprites into atlases, to keep the game under 20,000 files. https://zaisma.com/developers/errors/too_many_files\n- `storage_full` (HTTP 413): The upload doesn't fit in what the account can store. Fix: Delete old versions with delete_version, raise the storage budget with set_storage_budget, or start Zaisma Pro for more storage. https://zaisma.com/developers/errors/storage_full\n- `new_data_limit` (HTTP 429): The account has sent all the new data it can today, counted from UTC midnight. Fix: Wait until UTC midnight, after retry_after_sec, and send only changed files, as npx @zaisma/cli upload does. https://zaisma.com/developers/errors/new_data_limit\n- `too_big_for_mcp` (HTTP 413): upload_files and check_game take up to 5 MB; bigger builds go through the upload command. Fix: Run npx @zaisma/cli upload <folder> --game <slug> in a terminal with ZAISMA_KEY set instead. https://zaisma.com/developers/errors/too_big_for_mcp\n- `bad_base64` (HTTP 400): Something sent as base64 isn't valid base64. Fix: Encode the content as standard base64 and send it again. https://zaisma.com/developers/errors/bad_base64\n- `files_missing` (HTTP 409): Some of the version's files haven't been sent yet. Fix: Send the files the answer lists, then finish the version again. https://zaisma.com/developers/errors/files_missing\n- `bad_patch_notes` (HTTP 400): patch_notes isn't text of up to 2,000 characters, or a publish changed them on a version that has been live. Fix: Give patch_notes as up to 2,000 characters, and only with a version going live for the first time. https://zaisma.com/developers/errors/bad_patch_notes\n- `bad_is_big_update` (HTTP 400): is_big_update isn't true or false, or an upload sent it without publish_when_approved. Fix: Give is_big_update as true or false, and with an upload only beside publish_when_approved true. https://zaisma.com/developers/errors/bad_is_big_update\n- `big_update_needs_patch_notes` (HTTP 400): A big update has no patch_notes, and a big update must say what's new. Fix: Send patch_notes saying what's new beside is_big_update true. https://zaisma.com/developers/errors/big_update_needs_patch_notes\n- `big_update_already_live` (HTTP 400): The version has been live already, and only a version going live for the first time can be a big update. Fix: Publish it as a quiet patch without is_big_update, or upload a new version for the big update. https://zaisma.com/developers/errors/big_update_already_live\n- `bad_publish_when_approved` (HTTP 400): publish_when_approved isn't true or false. Fix: Give publish_when_approved as true or false. https://zaisma.com/developers/errors/bad_publish_when_approved\n- `bad_publish_after_ai_review_enabled` (HTTP 400): publish_after_ai_review_enabled isn't true or false, or it came with nothing to publish. Fix: Give publish_after_ai_review_enabled as true or false, beside a version to publish. https://zaisma.com/developers/errors/bad_publish_after_ai_review_enabled\n- `bad_match_update_mode` (HTTP 400): match_update_mode isn't next_match or now, or it came without publish_when_approved. Fix: Give match_update_mode as next_match or now, and with an upload only beside publish_when_approved true. https://zaisma.com/developers/errors/bad_match_update_mode\n- `version_limit` (HTTP 429): The game has had 100 versions in the last day. Fix: Wait retry_after_sec seconds for the oldest version to pass a day, and test locally with npx @zaisma/cli play-locally in between. https://zaisma.com/developers/errors/version_limit\n- `version_in_use` (HTTP 409): The version can't be deleted: it's live, set to publish, or a tester link picked it. Fix: Publish another version, cancel the scheduled publish or change the tester link first, then delete it. https://zaisma.com/developers/errors/version_in_use\n- `kept_for_review` (HTTP 403): The version or game is kept for a person at Zaisma, so it can't be deleted. Fix: Wait for the person at Zaisma to finish, as get_version or get_game says. https://zaisma.com/developers/errors/kept_for_review\n- `bad_confirm_slug` (HTTP 400): confirm_slug isn't the game's link name. Fix: Give confirm_slug as the game's own slug, exactly. https://zaisma.com/developers/errors/bad_confirm_slug\n- `not_waiting_to_erase` (HTTP 409): The game isn't deleted and waiting to be erased, so there's nothing to bring back or erase now. Fix: Call get_game to see the game's state: only a deleted game waiting its week can be brought back or erased now. https://zaisma.com/developers/errors/not_waiting_to_erase\n- `already_erasing` (HTTP 409): The game's week is over and its erasing has started, so it can't be brought back. Fix: Make the game again with create_game and upload a version from your own copy. https://zaisma.com/developers/errors/already_erasing\n- `played_by_others` (HTTP 409): Other people played this game, so it waits out its week before it's erased; only a game nobody but its developer played can be erased at once. Fix: Let the game wait out its week, or ask the developer to confirm erasing it now on zaisma.com. https://zaisma.com/developers/errors/played_by_others\n- `no_game_deletion_request` (HTTP 404): This game has no deletion request with that ID. Fix: Use the game_deletion_request_id from the confirmation_needed answer, or call delete_game again. https://zaisma.com/developers/errors/no_game_deletion_request\n- `bad_monthly_storage_budget_cents` (HTTP 400): monthly_storage_budget_cents isn't null or a whole number from 100 to 1,000,000. Fix: Give monthly_storage_budget_cents as null or a whole number from 100 to 1,000,000. https://zaisma.com/developers/errors/bad_monthly_storage_budget_cents\n- `no_content_length` (HTTP 411): A file was sent without a Content-Length header. Fix: Send the file with a Content-Length header, as npx @zaisma/cli upload does. https://zaisma.com/developers/errors/no_content_length\n- `file_needs_parts` (HTTP 413): A file over 95 MB was sent in one go. Fix: Send files over 95 MB in parts, as the upload answer's part size says, or use npx @zaisma/cli upload. https://zaisma.com/developers/errors/file_needs_parts\n- `no_body` (HTTP 400): A file was sent without a body. Fix: Send the file's bytes as the request's body. https://zaisma.com/developers/errors/no_body\n- `hash_mismatch` (HTTP 400): A file doesn't match the SHA-256 it was sent as. Fix: Hash the exact bytes you send with SHA-256 and send the file again. https://zaisma.com/developers/errors/hash_mismatch\n- `forbidden_file` (HTTP 400): A file is a program or an archive, whatever its name says. Fix: Leave programs and archives out of the game, or unpack the archive into the folder. https://zaisma.com/developers/errors/forbidden_file\n- `bad_size_bytes` (HTTP 400): size_bytes isn't a whole number above 0. Fix: Give size_bytes as the file's size in bytes, a whole number above 0. https://zaisma.com/developers/errors/bad_size_bytes\n- `bad_part_number` (HTTP 400): A part's number isn't from 1 to 10,000. Fix: Number parts from 1 to 10,000, in order. https://zaisma.com/developers/errors/bad_part_number\n- `no_upload_id` (HTTP 400): A part was sent without its upload_id. Fix: Send the upload_id the start of the upload answered with each part. https://zaisma.com/developers/errors/no_upload_id\n- `bad_part_size` (HTTP 400): A part is empty, over 50 MB or has no Content-Length header. Fix: Send each part with a Content-Length header, from 1 byte to 50 MB. https://zaisma.com/developers/errors/bad_part_size\n- `upload_closed` (HTTP 400): The upload_id isn't an open upload any more. Fix: Start the file's upload again for a new upload_id. https://zaisma.com/developers/errors/upload_closed\n- `bad_parts` (HTTP 400): The finishing call isn't { upload_id, parts: [{ part_number, etag }] }. Fix: Finish with { upload_id, parts: [{ part_number, etag }] }, each part's etag as its upload answered. https://zaisma.com/developers/errors/bad_parts\n- `parts_incomplete` (HTTP 400): The parts sent don't make a whole file. Fix: Send the missing parts, then finish the file again. https://zaisma.com/developers/errors/parts_incomplete\n\n## Versions and publishing\n\n- `no_version` (HTTP 404): The game has no version with that ID. Fix: Call get_game for the game's version IDs, then call again with one of them. https://zaisma.com/developers/errors/no_version\n- `bad_time` (HTTP 400): A time isn't an ISO time in the range it takes: scheduled_publish_at from a few minutes to 90 days ahead, a tester link's ends_at from now to a year ahead, a database restore's restore_to_at within the last 30 days and not before the game was made, a room message's send_at from 10 seconds to 90 days ahead, and a What's on entry's starts_at from an hour ago to 90 days ahead and its ends_at after now and starts_at and at most 60 days after it. Fix: Give an ISO time in UTC within the range the field takes, like \"2026-11-01T17:00:00Z\". https://zaisma.com/developers/errors/bad_time\n- `still_scanning` (HTTP 409): The version is still being scanned. Fix: Wait retry_after_sec seconds, then call get_version until the scan has finished. https://zaisma.com/developers/errors/still_scanning\n- `not_approved` (HTTP 409): The version didn't pass review, so it can't be published. Fix: Read the version's review_reason and findings with get_version, fix what they say and upload a new version. https://zaisma.com/developers/errors/not_approved\n\n## Tester links\n\n- `bad_name` (HTTP 400): A tester link's or sign-in app's name isn't 1 to 60 characters, or a sign-in app's says Zaisma. Fix: Give a name of 1 to 60 characters, and for a sign-in app one without the word Zaisma. https://zaisma.com/developers/errors/bad_name\n- `too_many_tester_links` (HTTP 403): The game has 50 tester links on already. Fix: Remove a tester link you don't need with remove_tester_link first. https://zaisma.com/developers/errors/too_many_tester_links\n- `no_tester_link` (HTTP 404): The game has no tester link on with that ID. Fix: Call get_game for the game's tester link IDs, then call again with one of them. https://zaisma.com/developers/errors/no_tester_link\n- `bad_version_choice` (HTTP 400): version_choice isn't live, newest_passed or picked, or picked_version_id doesn't go with it. Fix: Give version_choice as live, newest_passed or picked, and picked_version_id only with picked. https://zaisma.com/developers/errors/bad_version_choice\n\n## Sign in with Zaisma\n\n- `bad_redirect_urls` (HTTP 400): redirect_urls isn't a list of 1 to 10 https URLs (http only for localhost) without #fragments. Fix: Give redirect_urls as 1 to 10 https addresses without #fragments, or http only for localhost. https://zaisma.com/developers/errors/bad_redirect_urls\n- `bad_replace_client_secret` (HTTP 400): replace_client_secret isn't true or false, or the app is public and has no client secret. Fix: Give replace_client_secret as true or false, and only for an app that has a client secret. https://zaisma.com/developers/errors/bad_replace_client_secret\n- `too_many_sign_in_apps` (HTTP 403): The account has 20 sign-in apps already. Fix: Delete a sign-in app you don't need with delete_sign_in_app first. https://zaisma.com/developers/errors/too_many_sign_in_apps\n- `no_sign_in_app` (HTTP 404): You have no sign-in app with that ID. Fix: Call list_sign_in_apps for your apps' IDs, then call again with one of them. https://zaisma.com/developers/errors/no_sign_in_app\n\n## Webhooks\n\n- `bad_destination_kind` (HTTP 400): destination_kind isn't endpoint_url or game_server. Fix: Give destination_kind as endpoint_url or game_server. https://zaisma.com/developers/errors/bad_destination_kind\n- `bad_endpoint_url` (HTTP 400): endpoint_url isn't an https URL on a name (no IP address, user name or #fragment), or it's on Zaisma's own domains, or it's given for a webhook to a game server, which has none. Fix: Give endpoint_url as an https address on a name of your own, without a user name or #fragment, and none for a webhook to a game server. https://zaisma.com/developers/errors/bad_endpoint_url\n- `bad_event_kinds` (HTTP 400): event_kinds isn't a list of 1 or more of the webhook event kinds. Fix: Give event_kinds as a list of 1 or more of the event kinds create_webhook's input schema lists. https://zaisma.com/developers/errors/bad_event_kinds\n- `bad_game_slugs` (HTTP 400): game_slugs isn't null or a list of 1 to 50 of your games' slugs, or, for a webhook to a game server, a list of the one game whose server it is. Fix: Give game_slugs as null for every game, or 1 to 50 of your games' slugs, and for a webhook to a game server the one game whose server it is. https://zaisma.com/developers/errors/bad_game_slugs\n- `bad_replace_signing_secret` (HTTP 400): replace_signing_secret isn't true or false. Fix: Give replace_signing_secret as true or false. https://zaisma.com/developers/errors/bad_replace_signing_secret\n- `too_many_webhooks` (HTTP 403): The account has 10 webhooks already. Fix: Delete a webhook you don't need with delete_webhook first. https://zaisma.com/developers/errors/too_many_webhooks\n- `no_webhook` (HTTP 404): You have no webhook with that ID. Fix: Call list_webhooks for your webhooks' IDs, then call again with one of them. https://zaisma.com/developers/errors/no_webhook\n\n## The game database\n\n- `bad_sql` (HTTP 400): The SQL isn't one statement SQLite takes, or statements isn't a list of { sql, values }. Fix: Send one statement SQLite takes, with ? for each value, or statements as a list of { sql, values }. https://zaisma.com/developers/errors/bad_sql\n- `bad_values` (HTTP 400): values isn't a list of text, numbers, null and { blob_base64 } for the SQL's ?s. Fix: Give values as a list of text, numbers, null and { blob_base64 }, one for each ? in the SQL. https://zaisma.com/developers/errors/bad_values\n- `bad_player_id` (HTTP 400): player_id isn't a player ID (player_\u2026). Fix: Give player_id as a player ID like player_\u2026, from a player pass or a purchase. https://zaisma.com/developers/errors/bad_player_id\n- `too_many_rows` (HTTP 400): A statement answered more than 10,000 rows. Fix: Add LIMIT and page through the rows, 10,000 at a time at most. https://zaisma.com/developers/errors/too_many_rows\n- `integer_too_large` (HTTP 400): A statement answered a whole number past 2^53, which JavaScript can't hold exactly. Fix: Select the number as text with CAST(column AS TEXT). https://zaisma.com/developers/errors/integer_too_large\n- `answer_too_big` (HTTP 400): The rows answered come to more than 8 MB. Fix: Select fewer columns or rows at once, with LIMIT and paging. https://zaisma.com/developers/errors/answer_too_big\n- `database_full` (HTTP 403): The statement would grow the game's storage (its database and kept rooms) past the 10 GB a game can keep. Fix: Delete rows the game doesn't need, or delete kept rooms, to stay under 10 GB. https://zaisma.com/developers/errors/database_full\n- `database_unavailable` (HTTP 503): The game's database didn't answer. Fix: Call again in a minute. https://zaisma.com/developers/errors/database_unavailable\n- `database_restore_unavailable` (HTTP 501): This Zaisma's game databases can't go back in time: its storage keeps no history, like a local preview. Fix: Restore databases on zaisma.com, not on a local preview. https://zaisma.com/developers/errors/database_restore_unavailable\n- `no_database_restore` (HTTP 404): The game has no database restore with that ID in the last 30 days. Fix: Call get_database for the restores of the last 30 days, then call again with one of their IDs. https://zaisma.com/developers/errors/no_database_restore\n- `bad_secret_name` (HTTP 400): A secret's name isn't capitals, digits and underscores starting with a capital, up to 64 characters. Fix: Give the secret's name as capitals, digits and underscores starting with a capital, like DISCORD_TOKEN, up to 64 characters. https://zaisma.com/developers/errors/bad_secret_name\n- `bad_secret_value` (HTTP 400): secret_value isn't text of up to 8 KB. Fix: Give secret_value as text of up to 8 KB. https://zaisma.com/developers/errors/bad_secret_value\n- `no_secret` (HTTP 404): The game has no secret by that name. Fix: Call list_secrets for the game's secret names, then call again with one of them. https://zaisma.com/developers/errors/no_secret\n- `too_many_secrets` (HTTP 403): The game has 50 secrets, the most it can have. Fix: Delete a secret the game doesn't need with delete_secret first. https://zaisma.com/developers/errors/too_many_secrets\n- `secrets_unavailable` (HTTP 503): The game's secrets didn't answer. Fix: Call again in a minute. https://zaisma.com/developers/errors/secrets_unavailable\n- `no_kept_room` (HTTP 404): The game has no kept room with that code. Fix: Call list_kept_rooms for the game's kept rooms' codes, then call again with one of them. https://zaisma.com/developers/errors/no_kept_room\n- `no_kept_room_restore` (HTTP 404): The kept room has no restore with that ID in the last 30 days. Fix: Call list_kept_room_restores for the room's restores, then call again with one of their IDs. https://zaisma.com/developers/errors/no_kept_room_restore\n- `no_kept_room_restore_batch` (HTTP 404): The game has no restore of every kept room with that ID in the last 30 days. Fix: Use the batch ID restore_every_kept_room answered, from the last 30 days. https://zaisma.com/developers/errors/no_kept_room_restore_batch\n- `kept_room_restore_unavailable` (HTTP 501): This Zaisma's rooms can't go back in time: their storage keeps no history, like a local preview. Fix: Restore kept rooms on zaisma.com, not on a local preview. https://zaisma.com/developers/errors/kept_room_restore_unavailable\n- `kept_room_restore_batch_running` (HTTP 409): The game's kept rooms are going back to a moment already, and one batch runs at a time. Fix: Wait for the running batch to finish, as get_kept_room_restore_batch says, then call again. https://zaisma.com/developers/errors/kept_room_restore_batch_running\n- `kept_room_copies_unavailable` (HTTP 501): This Zaisma can't read its kept rooms' copies, so an erased kept room can't come back. Fix: Bring the world back on zaisma.com, not on a local preview. https://zaisma.com/developers/errors/kept_room_copies_unavailable\n- `no_kept_room_copy` (HTTP 404): No copy of the deleted world is left: a copy lasts about 28 days after a world is deleted. Fix: Start the world again in a new room; no copy of it is left. https://zaisma.com/developers/errors/no_kept_room_copy\n- `room_code_in_use` (HTTP 409): Another room of the game has that code now, so the deleted world can't come back under it. Fix: Wait until the room with that code ends, or end it with end_room, then call again. https://zaisma.com/developers/errors/room_code_in_use\n- `game_storage_full` (HTTP 403): The deleted world doesn't fit in the 10 GB a game can keep. Fix: Delete rows or kept rooms the game doesn't need to make room under 10 GB, then call again. https://zaisma.com/developers/errors/game_storage_full\n- `kept_room_not_waiting` (HTTP 409): The kept room isn't deleted and waiting to be erased, so there's nothing to bring back or erase now. Fix: Call list_kept_rooms to see the room's state: only a deleted room waiting its week can be brought back or erased now. https://zaisma.com/developers/errors/kept_room_not_waiting\n- `kept_room_erasing` (HTTP 409): The kept room's week is over and its erasing has started: in a minute it comes back only from its last copy. Fix: Restore the world from its last copy with bring_back_kept_room in a minute. https://zaisma.com/developers/errors/kept_room_erasing\n\n## Reaching live rooms\n\n- `no_room` (HTTP 404): The game has no live room with that code on Zaisma. Fix: Call list_rooms for the game's live rooms' codes, then call again with one of them. https://zaisma.com/developers/errors/no_room\n- `no_player_in_room` (HTTP 404): That player isn't in the room now. Fix: Call get_room for the players in the room now, then call again with one of them. https://zaisma.com/developers/errors/no_player_in_room\n- `bad_room_message` (HTTP 400): message isn't plain JSON of up to 16 KB. Fix: Give message as plain JSON of up to 16 KB. https://zaisma.com/developers/errors/bad_room_message\n- `bad_labels` (HTTP 400): labels isn't a list of up to 4 labels, each { label_name, label_value } of text. Fix: Give labels as up to 4 { label_name, label_value }, each of text. https://zaisma.com/developers/errors/bad_labels\n- `bad_kick_message` (HTTP 400): A kick's message isn't text of up to 200 characters. Fix: Give the kick's message as text of up to 200 characters. https://zaisma.com/developers/errors/bad_kick_message\n- `bad_end_message` (HTTP 400): An end's message isn't text of up to 200 characters. Fix: Give the end's message as text of up to 200 characters. https://zaisma.com/developers/errors/bad_end_message\n- `room_busy` (HTTP 429): The room took 100 room messages in the last second. Fix: Wait retry_after_sec seconds, and send the room fewer messages at once. https://zaisma.com/developers/errors/room_busy\n- `every_room_send_limit` (HTTP 429): The game sent to every room 10 times in the last minute, from its game server, the API and the MCP together. Fix: Wait retry_after_sec seconds, and send to every room less often. https://zaisma.com/developers/errors/every_room_send_limit\n- `too_many_scheduled_room_messages` (HTTP 409): The game has 100 scheduled room messages waiting, the most it can have. Fix: Cancel a scheduled message with cancel_room_message, or wait for some to be sent. https://zaisma.com/developers/errors/too_many_scheduled_room_messages\n- `no_scheduled_room_message` (HTTP 404): The game has no scheduled room message with that ID waiting. Fix: Call list_room_messages for the waiting messages' IDs, then call again with one of them. https://zaisma.com/developers/errors/no_scheduled_room_message\n- `dump_too_big` (HTTP 413): dump_sql is over 5 MB: import a dump in parts, each ending on a whole statement. Fix: Import the dump in parts of up to 5 MB, each ending on a whole statement, as npx @zaisma/cli database import does. https://zaisma.com/developers/errors/dump_too_big\n\n## Hosting and credit\n\n- `hosting_paused` (HTTP 429): The game's hosting is paused this month: its free allowance, its budget or its developer's credit is used, or Zaisma's free hosting ran out and it has no budget with credit, or it has no real players and games with none used their share. It starts again when the month resets, the budget is raised or credit is added. Fix: Call get_credit to see why, then top up with top_up_credit, raise the game's budget with update_game, or wait for the next month. https://zaisma.com/developers/errors/hosting_paused\n- `confirmation_needed` (HTTP 403): This needs the developer's passkey on zaisma.com (turning spending on or up, connecting a Stripe account, deleting a game other people played, or erasing a waiting game or kept room's world at once): confirm_url is where they do it. Fix: Show the developer confirm_url, where they confirm with their passkey, then check their answer with the request ID the error gives. https://zaisma.com/developers/errors/confirmation_needed\n- `bad_monthly_budget_cents` (HTTP 400): monthly_budget_cents isn't a whole number of cents of at least 100 ($1), or null for no paid hosting. Fix: Give monthly_budget_cents as a whole number of cents of at least 100, or null for no paid hosting. https://zaisma.com/developers/errors/bad_monthly_budget_cents\n- `bad_top_up_amount` (HTTP 400): amount_cents isn't a whole number of cents from 1,000 ($10) to 100,000 ($1,000). Fix: Give amount_cents as a whole number of cents from 1,000 to 100,000. https://zaisma.com/developers/errors/bad_top_up_amount\n- `account_not_protected` (HTTP 403): The account has no passkey and no email yet, and a top-up keeps a card, so it needs one of them first: add a passkey or an email on zaisma.com/account. Fix: Ask the developer to add a passkey or an email on zaisma.com/account, then top up again. https://zaisma.com/developers/errors/account_not_protected\n- `money_paused` (HTTP 423): Top-ups and credit refunds on this account passed USD 2,000.00 in a day, so both are paused until a person at Zaisma looks. Credit already there keeps working. The developer gets an email when they're on again. Fix: Wait for the email saying top-ups are on again; credit already there keeps working. https://zaisma.com/developers/errors/money_paused\n- `new_payer_limit` (HTTP 403): A new account, or an account with a newly saved card, pays up to USD 100.00 in all, buys and credit together, in its first 7 days; this payment would go past it. The message says the day it lifts. Fix: Wait until the day the message names, or pay less now. https://zaisma.com/developers/errors/new_payer_limit\n- `no_top_up` (HTTP 404): You have no top-up with that ID. Fix: Call get_credit for the account's top-ups, then call again with one of their IDs. https://zaisma.com/developers/errors/no_top_up\n- `no_spending_request` (HTTP 404): You have no spending request with that ID. Fix: Use the spending_request_id from the confirmation_needed answer. https://zaisma.com/developers/errors/no_spending_request\n- `top_up_not_refundable` (HTTP 409): The top-up has nothing left to refund: it's spent, refunded, or over 30 days old. Fix: Call get_credit to see which top-ups still have credit to refund within their 30 days. https://zaisma.com/developers/errors/top_up_not_refundable\n- `bad_refill_level_cents` (HTTP 400): refill_level_cents isn't a whole number of cents from 1,000 ($10) to 1,000,000 ($10,000). Fix: Give refill_level_cents as a whole number of cents from 1,000 to 1,000,000. https://zaisma.com/developers/errors/bad_refill_level_cents\n- `already_credit_plan` (HTTP 409): The developer already has a monthly credit plan, so there's nothing to start: change its level or stop it. Fix: Change the plan's level with change_credit_plan, or stop it with stop_credit_plan. https://zaisma.com/developers/errors/already_credit_plan\n- `no_credit_plan` (HTTP 409): The developer has no monthly credit plan to change or stop. Fix: Start one with start_credit_plan first. https://zaisma.com/developers/errors/no_credit_plan\n- `already_pro` (HTTP 409): The developer already has a Zaisma Pro subscription (running, cancelled until the month ends, or a renewal Stripe is retrying), so there's nothing to start. Fix: Call get_pro to see the subscription, and resume_pro if it's cancelled. https://zaisma.com/developers/errors/already_pro\n- `pro_not_refundable` (HTTP 409): Zaisma Pro's payment can't be refunded: only the first payment, within 14 days of it, and only while it's the only one. Fix: Cancel Zaisma Pro with cancel_pro so it ends with the month instead. https://zaisma.com/developers/errors/pro_not_refundable\n- `not_pro` (HTTP 409): There's nothing to cancel or resume: the developer has no Zaisma Pro, or it's already cancelled (or isn't cancelled). Fix: Call get_pro to see the subscription's state, then start_pro, cancel_pro or resume_pro as it fits. https://zaisma.com/developers/errors/not_pro\n- `stripe_unavailable` (HTTP 503): Stripe didn't answer, or this Zaisma has no Stripe account set up. Fix: Call again in a few minutes. https://zaisma.com/developers/errors/stripe_unavailable\n\n## A game server's logs\n\n- `bad_room_code` (HTTP 400): room_code isn't a room's code: six characters like K7Q2MX. Fix: Give room_code as a room's six-character code, like K7Q2MX. https://zaisma.com/developers/errors/bad_room_code\n- `bad_minimum_level` (HTTP 400): minimum_level isn't debug, info, warn or error. Fix: Give minimum_level as debug, info, warn or error. https://zaisma.com/developers/errors/bad_minimum_level\n- `bad_source_kind` (HTTP 400): source_kind isn't room, request, schedule or webhook. Fix: Give source_kind as room, request, schedule or webhook. https://zaisma.com/developers/errors/bad_source_kind\n- `bad_search_text` (HTTP 400): search_text is empty or over 200 characters. Fix: Give search_text of 1 to 200 characters. https://zaisma.com/developers/errors/bad_search_text\n- `bad_maximum_line_count` (HTTP 400): maximum_line_count isn't a whole number from 1 to 500. Fix: Give maximum_line_count as a whole number from 1 to 500. https://zaisma.com/developers/errors/bad_maximum_line_count\n- `two_log_cursors` (HTTP 400): get_logs got both cursor and new_lines_cursor. Fix: Send cursor to page back, or new_lines_cursor to follow, not both. https://zaisma.com/developers/errors/two_log_cursors\n\n## Items and purchases\n\n- `no_item` (HTTP 404): The game has no item by that name. Fix: Call list_items for the game's item names, then call again with one of them. https://zaisma.com/developers/errors/no_item\n- `too_many_items` (HTTP 400): The game has 1,000 items, the most it can have. Fix: Remove items the game no longer uses with remove_item first. https://zaisma.com/developers/errors/too_many_items\n- `bad_item` (HTTP 400): An item's name, title, description, kind, category, price or local prices isn't one set_item takes; field says which. Fix: Fix the item's field named in field, as set_item's input schema says. https://zaisma.com/developers/errors/bad_item\n- `unsupported_currency` (HTTP 400): Zaisma doesn't price in that currency. Fix: Price the item in one of the currencies set_item's input schema lists. https://zaisma.com/developers/errors/unsupported_currency\n- `price_too_low` (HTTP 400): The price is under the least Stripe charges in its currency. Fix: Raise the price to at least the least Stripe charges in that currency. https://zaisma.com/developers/errors/price_too_low\n- `refund_policy_needed` (HTTP 409): A game that sells anything states its refund policy first. Fix: Set the game's refund policy with set_purchase_settings first. https://zaisma.com/developers/errors/refund_policy_needed\n- `bad_refund_policy` (HTTP 400): refund_policy isn't no_refunds, unused_within_14_days, within_14_days, own_words or null. Fix: Give refund_policy as no_refunds, unused_within_14_days, within_14_days, own_words or null. https://zaisma.com/developers/errors/bad_refund_policy\n- `bad_refund_policy_text` (HTTP 400): refund_policy_text isn't up to 600 characters of plain words, or doesn't go with refund_policy own_words. Fix: Give refund_policy_text as up to 600 characters of plain words, only with refund_policy own_words. https://zaisma.com/developers/errors/bad_refund_policy_text\n- `bad_own_payment_categories` (HTTP 400): own_payment_categories isn't a list of cosmetic, gameplay, content and currency. Fix: Give own_payment_categories as a list from cosmetic, gameplay, content and currency. https://zaisma.com/developers/errors/bad_own_payment_categories\n- `item_has_owners` (HTTP 409): Players bought or were granted the item, so it can't be removed; take its price off to stop selling it. Fix: Take the item's price off with set_item to stop selling it, and keep it for those who own it. https://zaisma.com/developers/errors/item_has_owners\n- `bad_item_count` (HTTP 400): item_count isn't a whole number from 1 to 1,000, isn't 1 for a permanent item, or makes a buy's total more than 99,999,999 minor units. Fix: Give item_count as a whole number from 1 to 1,000, and 1 for a permanent item. https://zaisma.com/developers/errors/bad_item_count\n- `bad_game_account_id` (HTTP 400): game_account_id isn't text of up to 200 characters, or null. Fix: Give game_account_id as text of up to 200 characters, or null. https://zaisma.com/developers/errors/bad_game_account_id\n- `bad_purchase_source` (HTTP 400): purchase_source isn't sale or grant. Fix: Give purchase_source as sale or grant. https://zaisma.com/developers/errors/bad_purchase_source\n- `bad_purchase_status` (HTTP 400): purchase_status isn't pending, completed, failed, refunded or charged_back. Fix: Give purchase_status as pending, completed, failed, refunded or charged_back. https://zaisma.com/developers/errors/bad_purchase_status\n- `no_purchase` (HTTP 404): The game has no purchase with that ID. Fix: Call list_purchases for the game's purchase IDs, then call again with one of them. https://zaisma.com/developers/errors/no_purchase\n- `already_refunded` (HTTP 409): The purchase was refunded or charged back already. Fix: Call get_purchase to see the refund that's there; nothing more is needed. https://zaisma.com/developers/errors/already_refunded\n- `stripe_not_connected` (HTTP 409): Selling with the buy sheet, and refunding a sale, go through the developer's own Stripe account, which isn't connected: connect_stripe_account. Fix: Connect the developer's Stripe account with connect_stripe_account first. https://zaisma.com/developers/errors/stripe_not_connected\n- `stripe_cannot_take_payments` (HTTP 409): The developer's Stripe account is connected, but Stripe hasn't turned on payments for it yet: finish setting it up on Stripe's dashboard. Fix: Finish setting the account up on Stripe's dashboard, then check with get_stripe_account. https://zaisma.com/developers/errors/stripe_cannot_take_payments\n- `stripe_account_banned` (HTTP 403): The Stripe account was banned from Zaisma with the account that connected it, so it can't be connected again. Fix: Connect another Stripe account, of an account Zaisma hasn't banned. https://zaisma.com/developers/errors/stripe_account_banned\n- `email_banned` (HTTP 403): The email was banned from Zaisma with the account it was on, so it can't be added to an account. Fix: Use another email. https://zaisma.com/developers/errors/email_banned\n- `bad_is_stripe_tax_used` (HTTP 400): is_stripe_tax_used isn't true or false. Fix: Give is_stripe_tax_used as true or false. https://zaisma.com/developers/errors/bad_is_stripe_tax_used\n- `bad_amount_minor_units` (HTTP 400): amount_minor_units isn't a whole number from 1 to what's left of the sale to refund. Fix: Give amount_minor_units as a whole number from 1 to what's left of the sale to refund, as get_purchase shows. https://zaisma.com/developers/errors/bad_amount_minor_units\n- `purchase_not_paid` (HTTP 409): The sale wasn't paid (pending or failed), so there's nothing to refund. Fix: Leave the sale as it is: nothing was paid, so nothing is owed. https://zaisma.com/developers/errors/purchase_not_paid\n- `not_for_sale` (HTTP 409): The item has no price, so players can't buy it; it's only granted. Fix: Give the item a price with set_item to sell it, or grant it with grant_item. https://zaisma.com/developers/errors/not_for_sale\n- `receipts_unavailable` (HTTP 503): Zaisma couldn't sign the purchase's receipt at that moment. A grant answered with it wasn't made, so trying again grants it once. Fix: Call again in a minute: the grant wasn't made, so it's made once. https://zaisma.com/developers/errors/receipts_unavailable\n- `bad_purchase_delivery` (HTTP 400): purchase_delivery isn't game, game_server or own_server. Fix: Give purchase_delivery as game, game_server or own_server. https://zaisma.com/developers/errors/bad_purchase_delivery\n- `no_game_server` (HTTP 409): purchase_delivery game_server needs a game server, on Zaisma or the developer's own, and the game has none. Fix: Give the game a game server, or set purchase_delivery to game. https://zaisma.com/developers/errors/no_game_server\n- `already_handled` (HTTP 409): The purchase was handed over already, or its refund was told already. Fix: Leave it: the purchase was handed over already. https://zaisma.com/developers/errors/already_handled\n- `handled_by_server` (HTTP 409): The game's purchases go to its game server or the developer's own server (purchase_delivery), so the game can't mark them handled. Fix: Mark the purchase handled from the game server or your own server, which purchase_delivery names. https://zaisma.com/developers/errors/handled_by_server\n- `bad_full_game_item` (HTTP 400): full_game_item_name doesn't name one of the game's items that's permanent and content, or the game is another game's demo. Fix: Name one of the game's items that's permanent and content, set with set_item. https://zaisma.com/developers/errors/bad_full_game_item\n- `full_game_item_in_use` (HTTP 409): The item is the game's full game (full_game_item_name), so it can't be removed or stop being permanent and content. Fix: Set full_game_item_name to another item, or null, with update_game first. https://zaisma.com/developers/errors/full_game_item_in_use\n- `bad_demo_game` (HTTP 400): demo_game_slug isn't another of the developer's games that's free to play, or the game itself is free to play. Fix: Give demo_game_slug as another of your games that's free to play, from a game that sells itself. https://zaisma.com/developers/errors/bad_demo_game\n- `account_requirement_locked` (HTTP 400): A game that sells itself (full_game_item_name) needs account_requirement whole_game, since only accounts own it. Fix: Keep account_requirement whole_game, or stop selling the game with full_game_item_name null first. https://zaisma.com/developers/errors/account_requirement_locked\n- `full_game_not_owned` (HTTP 403): The game sells itself, and the player's account doesn't own it: buy it on its game page. Fix: Let the player buy the game on its game page, or grant it with grant_item. https://zaisma.com/developers/errors/full_game_not_owned\n\n## Cloud saves\n\n- `no_save` (HTTP 404): The player has no save in the game. Fix: Check the player ID, and that the player has played the game signed in with cloud saves on. https://zaisma.com/developers/errors/no_save\n- `no_save_copy` (HTTP 404): The player's save has no earlier version with that ID. Fix: Call list_save_copies for the save's earlier versions, then call again with one of their IDs. https://zaisma.com/developers/errors/no_save_copy\n- `bad_keys` (HTTP 400): keys isn't a list of 1 to 100 localStorage keys of up to 1,000 characters. Fix: Give keys as a list of 1 to 100 localStorage keys, each up to 1,000 characters. https://zaisma.com/developers/errors/bad_keys\n- `bad_local_storage_items` (HTTP 400): local_storage_items isn't an object of localStorage keys and their text (null removes a key in a change). Fix: Give local_storage_items as an object of keys and their text, with null to remove a key in a change. https://zaisma.com/developers/errors/bad_local_storage_items\n- `bad_indexeddb_databases` (HTTP 400): indexeddb_databases isn't a list of databases, each { name, version, stores } as get_save answers them. Fix: Give indexeddb_databases as get_save answered them, each { name, version, stores }. https://zaisma.com/developers/errors/bad_indexeddb_databases\n- `save_too_big` (HTTP 413): The save would be over 5 MB. Fix: Keep the save under 5 MB, saving less or smaller values. https://zaisma.com/developers/errors/save_too_big\n- `cloud_saves_off` (HTTP 409): The game has cloud saves off, so it doesn't read saves from players' accounts. Fix: Turn cloud saves on with update_game, cloud_saves_enabled true. https://zaisma.com/developers/errors/cloud_saves_off\n- `cloud_saves_not_here` (HTTP 409): Cloud saves don't work here: this is a tester link, or this Zaisma has no accounts. The game page answers it to `Zaisma.saves` and `Zaisma.player.offerAccount()`; no API or MCP call returns it. Fix: Test cloud saves on the game's zaisma.com page, signed in, not through a tester link. https://zaisma.com/developers/errors/cloud_saves_not_here\n- `save_busy` (HTTP 409): The player's game kept saving at the same moment, so the change didn't go through. Fix: Call again in a moment. https://zaisma.com/developers/errors/save_busy\n\n## The developer forum\n\n- `no_topic` (HTTP 404): There's no topic with that ID you can see. Fix: Call search_forum for the topic's ID, then call again with it. https://zaisma.com/developers/errors/no_topic\n- `no_post` (HTTP 404): There's no post with that ID you can see in the topic. Fix: Call get_topic for the topic's post IDs, then call again with one of them. https://zaisma.com/developers/errors/no_post\n- `no_known_issue` (HTTP 404): There's no known issue with that ID. Fix: Call search_forum with tab known for the known issues' IDs. https://zaisma.com/developers/errors/no_known_issue\n- `no_media` (HTTP 404): There's no image there you can see. Fix: Use an image address from a post you can see. https://zaisma.com/developers/errors/no_media\n- `bad_tab` (HTTP 400): tab isn't latest, top, unanswered, known, yours, messages or bookmarks. Fix: Give tab as latest, top, unanswered, known, yours, messages or bookmarks. https://zaisma.com/developers/errors/bad_tab\n- `bad_section` (HTTP 400): section isn't one of the forum's sections. Fix: Give section as one of the sections search_forum's input schema lists. https://zaisma.com/developers/errors/bad_section\n- `bad_category` (HTTP 400): category isn't one of the forum's categories. Fix: Give category as one of the categories post_topic's input schema lists. https://zaisma.com/developers/errors/bad_category\n- `no_category` (HTTP 400): A public topic was sent without its category. Fix: Give a public topic a category, as post_topic's input schema lists. https://zaisma.com/developers/errors/no_category\n- `bad_tag` (HTTP 400): tag isn't one of the forum's tags. Fix: Give tag as one of the tags search_forum's input schema lists. https://zaisma.com/developers/errors/bad_tag\n- `bad_tags` (HTTP 400): tags isn't a list of up to 3 of the forum's tags. Fix: Give tags as up to 3 of the tags post_topic's input schema lists. https://zaisma.com/developers/errors/bad_tags\n- `bad_topic_status` (HTTP 400): topic_status isn't one of the statuses. Fix: Give topic_status as one of the statuses the input schema lists. https://zaisma.com/developers/errors/bad_topic_status\n- `bad_is_answered` (HTTP 400): is_answered isn't true or false. Fix: Give is_answered as true or false. https://zaisma.com/developers/errors/bad_is_answered\n- `bad_maximum_topic_count` (HTTP 400): maximum_topic_count isn't a whole number from 1 to 30. Fix: Give maximum_topic_count as a whole number from 1 to 30. https://zaisma.com/developers/errors/bad_maximum_topic_count\n- `bad_detail` (HTTP 400): detail isn't brief. Fix: Give detail as brief, or leave it out. https://zaisma.com/developers/errors/bad_detail\n- `bad_post_selection` (HTTP 400): post_selection isn't all, answer, latest or none. Fix: Give post_selection as all, answer, latest or none. https://zaisma.com/developers/errors/bad_post_selection\n- `bad_is_public` (HTTP 400): is_public isn't true or false. Fix: Give is_public as true or false. https://zaisma.com/developers/errors/bad_is_public\n- `bad_text_markdown` (HTTP 400): text_markdown is empty or over 8,000 characters. Fix: Give text_markdown of 1 to 8,000 characters. https://zaisma.com/developers/errors/bad_text_markdown\n- `bad_author_kind` (HTTP 400): author_kind isn't developer or ai. Fix: Give author_kind as developer or ai. https://zaisma.com/developers/errors/bad_author_kind\n- `bad_debug_context` (HTTP 400): debug_context isn't an object of its five text fields, up to 8,000 characters in all. Fix: Give debug_context as an object of its five text fields, up to 8,000 characters in all. https://zaisma.com/developers/errors/bad_debug_context\n- `bad_images_base64` (HTTP 400): images_base64 isn't a list of base64 images. Fix: Give images_base64 as a list of PNG, WebP or JPEG images in base64. https://zaisma.com/developers/errors/bad_images_base64\n- `too_many_images` (HTTP 400): A post carries more than 10 images. Fix: Send at most 10 images with a post. https://zaisma.com/developers/errors/too_many_images\n- `bad_reopen` (HTTP 400): reopen isn't true or false. Fix: Give reopen as true or false. https://zaisma.com/developers/errors/bad_reopen\n- `bad_answer_post_id` (HTTP 400): answer_post_id isn't a post ID or null. Fix: Give answer_post_id as a post ID from get_topic, or null. https://zaisma.com/developers/errors/bad_answer_post_id\n- `bad_reason` (HTTP 400): reason isn't one of the report reasons. Fix: Give reason as one of the reasons report_post's input schema lists. https://zaisma.com/developers/errors/bad_reason\n- `post_limit` (HTTP 429): The account has posted 100 times in the last day. Fix: Wait retry_after_sec seconds before posting again. https://zaisma.com/developers/errors/post_limit\n- `image_limit` (HTTP 429): The account has uploaded 200 forum images in the last day. Fix: Wait retry_after_sec seconds before sending more images. https://zaisma.com/developers/errors/image_limit\n- `not_yours` (HTTP 403): Only the developer who started the topic can do that. Fix: Ask the developer who started the topic, or reply to it with reply_to_topic. https://zaisma.com/developers/errors/not_yours\n- `not_a_question` (HTTP 400): Only a question has an answer to mark. Fix: Mark answers only in topics of kind question. https://zaisma.com/developers/errors/not_a_question\n- `not_closed` (HTTP 400): The topic isn't closed, so there's nothing to reopen. Fix: Leave it: the topic is open already. https://zaisma.com/developers/errors/not_closed\n- `not_released` (HTTP 400): The topic isn't a known issue whose fix is out. Fix: Wait until the known issue's fix is out, as get_topic shows. https://zaisma.com/developers/errors/not_released\n- `cant_vote` (HTTP 400): The topic doesn't take your vote: it's yours, private, or a discussion. Fix: Vote only on others' public topics that aren't discussions. https://zaisma.com/developers/errors/cant_vote\n- `cant_flag` (HTTP 400): Only public topics others can see can be flagged as misplaced. Fix: Flag only public topics others can see. https://zaisma.com/developers/errors/cant_flag\n- `retired_tool` (HTTP 410): The tool is retired; the error names the one that replaces it. Fix: Call the tool the message names instead. https://zaisma.com/developers/errors/retired_tool\n- `bad_rating` (HTTP 400): rating isn't like or dislike. Fix: Give rating as like or dislike. https://zaisma.com/developers/errors/bad_rating\n- `cant_rate_post` (HTTP 400): Only posts in public topics take likes and dislikes. Fix: Rate only posts in public topics. https://zaisma.com/developers/errors/cant_rate_post\n- `cant_rate_own_post` (HTTP 400): Your own posts take no likes or dislikes from you. Fix: Rate only other people's posts. https://zaisma.com/developers/errors/cant_rate_own_post\n- `cant_report` (HTTP 400): The post can't be reported: it's yours, or Zaisma's. Fix: Report only others' posts, never your own or Zaisma's. https://zaisma.com/developers/errors/cant_report\n",
|
|
60430
|
-
"game-server": '<!-- Made by scripts/build-skill.mjs: never edit it by hand. -->\n\n# @zaisma/game-server\n\nWrite a game server once; run it in Zaisma\'s rooms or on your own Node server. Rooms, players, state sync, chat, the game\'s database and its requests behave the same in both.\n\nTo play your multiplayer game on your own computer before you upload it, run `npx @zaisma/game-server@1 play-locally` in the game\'s folder (or `npx @zaisma/cli play-locally`, which runs it). It serves the game, runs its game server, and opens a test bench: each player on Zaisma\'s own game page, guests until they sign in with a name, and a dev bar whose Add a player opens another tab as a new player, with passes signed by a key of its own, so two tabs play together with no account, key or internet. Flags: `[folder]`, `--port 4800`, `--game <slug>`, `--on-network`, `--no-open`, `--json`; Zaisma\'s README has the whole of it under "Play it on your own computer".\n\n```ts\n// server.ts\nimport { defineGameServer } from "@zaisma/game-server";\n\nexport default defineGameServer({\n ticksPerSec: 20,\n setup: () => ({ scores: {} }),\n onJoin: (state, who, room) => ({ ...state, scores: { ...state.scores, [who.id]: 0 } }),\n});\n```\n\nOn your own server (Node 22.18 or later):\n\n```\nnpx @zaisma/game-server@1 ./server.ts --game <your-game-slug> --port 8080\n```\n\nor from code:\n\n```ts\nimport { startServer } from "@zaisma/game-server/node";\nimport gameServer from "./server.ts";\n\nconst running = startServer({ gameServer, gameSlug: "your-game-slug", port: 8080 });\n// Later: await running.close(); every room saves first.\n```\n\nFor the fast lane (WebTransport, where `latest_only` sends go as datagrams), install its two optional packages beside the runner and give it all three of `--webtransport-port`, `--certificate-path` and `--certificate-key-path` (`startServer({ webtransportPort, certificatePath, certificateKeyPath })`):\n\n```\nnpm install @fails-components/webtransport@1.6.11 @fails-components/webtransport-transport-http3-quiche@1.6.11\nnpx @zaisma/game-server@1 ./server.ts --game <your-game-slug> --port 8080 --webtransport-port 443 --certificate-path fullchain.pem --certificate-key-path privkey.pem\n```\n\nGames join it with `Zaisma.joinRoom({ serverUrl, transport: "webtransport" })`, and fall back to the WebSocket by themselves where it doesn\'t connect.\n\nA mistake in your game server\'s code becomes a coded error in the game\'s logs, never a silent success, and the Node runner behaves the same as Zaisma\'s rooms. Versions follow semver: within 1.x the package only gains things.\n\n- The game server, handler by handler: the "Game servers" section of the [README](https://github.com/zaisma/zaisma#readme) and [`docs/DEVELOPER-API.md`](https://github.com/zaisma/zaisma/blob/main/docs/DEVELOPER-API.md).\n- Every name and option follows [`docs/NAMING.md`](https://github.com/zaisma/zaisma/blob/main/docs/NAMING.md).\n\nMIT licensed.\n\n### Multiplayer\n\nGames include the SDK with `<script src="_zaisma/v1.js"></script>` and call `await Zaisma.joinRoom()`. Its reference is its types, [`packages/sdk/zaisma.d.ts`](packages/sdk/zaisma.d.ts) (served beside it as `_zaisma/v1.d.ts`): every call, option, event and error code, explained. Save it beside your game\'s folder (uploads take no `.ts` files) and put `/// <reference path="../zaisma.d.ts" />` (and in JavaScript, `// @ts-check`) at the top of your script, and your editor and AI get errors instead of guesses. A room link (`zaisma.com/g/<game>?room=CODE`) drops friends into the same match, as guests or signed in. A game that needs a Zaisma account for multiplayer or the whole game (its `account_requirement` setting) gives guests no passes (`error.code === "account_needed"`), and its page asks them to sign in. Any game can ask a guest to sign in while it runs with `await Zaisma.player.signIn()`: the page offers an account beside the game, signing in happens in a new tab so the game keeps running, and the next `Zaisma.player.getPass()` or `joinRoom()` is the account\'s. Player passes come from the game\'s zaisma.com page, which checks that a real browser opened it (Cloudflare\'s invisible check, started as the page opens so Play doesn\'t wait), so bots can\'t fill rooms: a game opened anywhere else, or a browser the check can\'t confirm, can\'t join (`error.code === "unchecked"`).\n\nMultiplayer is server-client: the *client* is the game in the browser, the *game server* holds the official state and checks every move, and a *room* is one live match running one copy of the game server. A game server is a plain object:\n\n```ts\nexport default {\n maximumPlayerCount: 8, // up to 100\n ticksPerSec: 20, // up to 60; leave out for turn-based games so the room sleeps between moves\n setup: (setupData) => ({ players: {} }), // setupData: what room.reserve() passed, for a room another room made, else null\n onJoin(state, player, room, joinData, joinInfo) {}, // joinData: what the player\'s game passed to joinRoom({ joinData }), else null;\n // joinInfo: { fromRoomCode, isReturning, isSpectator } (isReturning: back to a held seat)\n canJoin(state, player, room, joinData, joinInfo) {}, // true lets them in; false or { refusalMessage } turns them away\n onChat(state, player, room, chatInfo) {}, // a player\'s room.chat, before Zaisma\'s filter: true, false or { toPlayerIds }\n adultChatFilterEnabled: false, // true: Zaisma\'s chat filter checks chat between adults too (on your meter)\n onLeave(state, player, room, leaveInfo) {}, // leaveInfo.reason: left, lost, idle, hidden or kicked\n onMessage(state, player, room, message) {},\n onBytes(state, player, room, bytes) {}, // bytes a player\'s game sent (room.sendBytes), a Uint8Array\n onTick(state, tickDurationSec, room) {}, // tickDurationSec: seconds since the last tick\n onRequest(player, request, server) {}, // a request outside any room (Zaisma.server.request): answer it (below)\n schedules: [{ name: "daily-reset", cron: "0 0 * * *" }], // runs by itself, in UTC (below)\n onSchedule(run, server) {}, // run.name: which schedule is due\n};\n// room.broadcast(message, { exceptPlayerId, delivery }), room.send(playerId, message, { delivery }), room.players, room.end(message),\n// room.broadcastBytes(bytes, { exceptPlayerId, fromPlayerId, delivery }), room.sendBytes(playerId, bytes, { delivery }),\n// room.setListed(false), room.setOpen(false), room.reserve({ playerIds, setupData }),\n// await room.database.query(sql, values), await room.database.batch([{ sql, values }]) (the game database, below)\n// await room.verifyReceipt(receipt) (a purchase\'s signed receipt, checked; server.verifyReceipt the same)\n// room.readDataFile("maps/docks.bin") (a data file beside the code, an ArrayBuffer; server.readDataFile the same; below)\n```\n\nNames follow [`docs/NAMING.md`](docs/NAMING.md): whole words, with the unit in the name. A game server with an option it doesn\'t take doesn\'t start, and says which ones it does take (`unknown_option`); the SDK refuses options and events it doesn\'t take the same way. Every message between a game and its room says its `type`, and a game\'s own messages travel in `data`; rooms count messages, not their size, so whole words cost nothing.\n\n`canJoin` decides who comes in, before they join: answer `true` to let them in, `false` to turn them away, or `{ refusalMessage: "Wrong room password." }` to turn them away with a message they see (up to 200 characters). Any other answer, nothing included, like a string, turns them away too, and shows in your game server\'s errors with what to answer instead. Only decide there; change the state in `onJoin`.\n\n```ts\ncanJoin(state, player, room, joinData) {\n return joinData?.password === state.password || { refusalMessage: "Wrong room password." };\n},\n```\n\nEach player\'s ping, measured by the room, is `room.pingDurationMs(playerId)` on the game server and `room.pingDurationMs` in their game, and both read the room\'s clock with `room.serverTimeMs()` (see "Room connections" in [`docs/DEVELOPER-API.md`](docs/DEVELOPER-API.md)).\n\nA room takes up to 100 players at up to 60 ticks a second. Each player\'s game sends up to 30 messages a second (a burst of 60), so a game at 60 ticks sends two inputs in one message; the game server can still send every tick. Past 100 players, split a world into rooms and move players between them (`room.moveTo`).\n\n**Bytes:** for snapshots and inputs where JSON is too big, a game sends bytes with `room.sendBytes(bytes)` (an `ArrayBuffer` or any typed array) and gets them with `room.on("bytes", (bytes, fromPlayerId) => {})`; the game server takes them in `onBytes` and sends them with `room.broadcastBytes(bytes)` and `room.sendBytes(playerId, bytes)`. `fromPlayerId` is the player they came from when the game server passes one player\'s bytes on (`room.broadcastBytes(bytes, { fromPlayerId: player.id })`, as the relay does), else `null`. Bytes have the same limits as messages: up to 16 KB each, counted together with them. The MCP\'s `get_stats` shows each game\'s room traffic per player and its biggest message types, with hints on what to send as bytes or send less.\n\n**Sending only what changed:** turn on `stateSyncEnabled` and keep the world in the game server\'s state; each player then gets a full copy as they join and after that only what changed, after every tick (or every move, in a turn-based game), with no code to send it. `stateView(state, viewer, room)` cuts what each player sees: only what\'s near them in a big world, or without the other team\'s cards. In the game, `room.state` is the player\'s view and `room.smoothedState()` the same a moment (100 ms) behind, with positions moving evenly between updates. A player whose connection is backed up gets nothing until they\'ve caught up, then a full copy. See `examples/arena`, and "State sync" in [`docs/DEVELOPER-API.md`](docs/DEVELOPER-API.md).\n\n```ts\n// A 100-player world where each player gets only the players within 800 units of them.\nexport default {\n maximumPlayerCount: 100,\n ticksPerSec: 30,\n stateSyncEnabled: true,\n setup: () => ({ players: {} }),\n onJoin(state, player) { state.players[player.id] = { name: player.name, x: 0, y: 0, health: 100 }; },\n onLeave(state, player) { delete state.players[player.id]; },\n stateView(state, viewer) {\n const me = state.players[viewer.id];\n const nearby = {};\n for (const [id, other] of Object.entries(state.players)) {\n if (me && Math.hypot(other.x - me.x, other.y - me.y) <= 800) nearby[id] = { name: other.name, x: Math.round(other.x), y: Math.round(other.y), health: other.health };\n }\n return { players: nearby };\n },\n};\n// In the game: requestAnimationFrame(function draw() { drawPlayers(room.smoothedState()?.players ?? {}); requestAnimationFrame(draw); });\n```\n\n**Messages that can be dropped:** `{ delivery: "latest_only" }` on any send, from the game server or the game, marks a message only the newest of matters, like positions every tick or where a player aims: while a player\'s connection is backed up, a newer one with the same `latestKey` (which it needs, like `"position"`) replaces it, and the newest goes once they catch up. Zaisma\'s rooms carry them over the WebSocket today, and the same call moves to real datagrams once Cloudflare carries them; on your own server, the fast lane already sends them as datagrams (see [Run your game server yourself](#run-your-game-server-yourself)). `get_stats` says which of your message types would gain from it (`latest_only_available`).\n\nGames without server code can use the built-in `relay` (up to 16 players), which passes each message on to everyone else as it was sent (your game\'s `message` event gets the message, then `fromPlayerId` as its second argument), and bytes the same way. See `examples/arena` (real-time) and `examples/four-in-a-row` (turn-based).\n\n#### Your game server on Zaisma\n\nPut your game server in a `zaisma-server/` folder at the top of your upload and set multiplayer to "Your game server" (dashboard), or `multiplayer: "own"` (MCP or API). Zaisma\'s rooms run it for you:\n\n```\nindex.html\nzaisma-server/\n index.js export default { setup, onJoin, onMessage, ... }\n physics.js import { step } from "./physics.js" works in index.js\n levels/docks.js\n maps/docks.bin a data file: room.readDataFile("maps/docks.bin")\n```\n\n- **Plain JavaScript ES modules:** `zaisma-server/index.js` default-exports the game server above, and can import the folder\'s other files by relative path: `.js` code, `.json` data (`import levels from "./levels.json"`) and `.wasm` WebAssembly, like a physics engine (`import mod from "./physics.wasm"` gives a `WebAssembly.Module`; `new WebAssembly.Instance(mod, imports)` starts it). Packages from npm (`import "lodash"`) and TypeScript need a build step: bundle into one `zaisma-server.js` at the top of the upload instead (`npx esbuild server.ts --format=esm --bundle --outfile=zaisma-server.js`), or into `zaisma-server/index.js` when it has data files. Up to 500 files and 32 MB in all, data files included (`GAME_SERVER_LIMITS`).\n- **Data files:** every other file in `zaisma-server/` (`.bin`, `.gz`, `.txt`, anything but `.js`, `.json` and `.wasm`) ships beside the code as a data file, like prebuilt navigation meshes, level geometry or a dictionary. `room.readDataFile("maps/docks.bin")` (or `server.readDataFile` in `onRequest`, `onSchedule` and `onWebhook`) answers it as an `ArrayBuffer`, by its path from `zaisma-server/`: no base64, no download, and nothing on the meter, since it comes with the code. It\'s the same `ArrayBuffer` every time, shared by every room of the version running in the same place, so read it and never change it; keep what you build from it in a variable outside the handlers (`const meshes = new Map()`) and every room there shares it too. A path with no data file throws a `GameServerError` `bad_room_call`. On your own server, data files are read from the game server\'s folder (`--data-folder`, or `startServer({ dataFolder })`; `zaisma-server` by default).\n- **Time to start:** each call into the game server, a tick with the messages since the last one, a join, a request, has 50 ms of CPU (`GAME_SERVER_LIMITS.maximumCallCpuDurationMs`). A start has 5 seconds (`maximumStartCpuDurationMs`): loading the game server, `setup`, `onRestored`, and a real-time room\'s first tick after either, so build what the match needs once (a map\'s navigation, its collision) in that first tick, not spread over many. The game server\'s top-level code, outside its handlers, has Cloudflare\'s 1 second as it loads (`maximumLoadCpuDurationMs`), so heavy work goes in that first tick. One copy of the game server, shared by the version\'s rooms in one place, has 128 MB of memory (`maximumMemorySizeBytes`), its data files included. Every second of CPU is on the game\'s hosting meter, starts included.\n- **Sealed off:** nothing of Zaisma\'s but its own game\'s database and secrets, and other servers only on the hosts you list (below), so it talks to its players through `room` and its answers to their requests. State is plain JSON.\n- **Private:** players never get its files; the game domain refuses `zaisma-server/` and `zaisma-server.js`.\n- **Real-time rooms batch input:** in a room with `ticksPerSec`, the state stays inside the sandbox, and players\' messages and bytes reach `onMessage` and `onBytes` just before the next `onTick`, in the order they came, with what they send going out then (at most a tick later). A handler that throws leaves the rest of the batch to run, and what it changed in the state before throwing stays, as on your own server, where they run as they come. Either way a room\'s handlers run one at a time: one that awaits (the database, say) finishes before the room\'s next message, bytes or tick reaches the game server.\n- **Kept in check:** an error in a handler loses that one message or tick and the match carries on. A call that runs past its CPU (above; a loop that never ends) is stopped, freezing the match meanwhile, and a match stopped twice ends. Your dashboard and the MCP\'s `get_stats` show these errors with the file and line they came from.\n- **Memory outside the handlers:** a room\'s state is plain JSON, and it\'s all Zaisma keeps of a room. What the game server keeps in its own variables, outside the handlers (`const worlds = new Map()`), lives in the copy of the version that runs the room: the version\'s rooms running in the same place share it, as they share data files, and rooms elsewhere have copies of their own. It\'s lost whenever that copy starts again, which can happen at any time (a while unused, Zaisma\'s own updates, a call stopped for running too long), and then the room carries on from its last state, with no `onRestored` (that runs only when the room itself restarts): a turn-based room\'s state as of its last call, a real-time room\'s as of its last copy, taken every 5 seconds. So a world that isn\'t JSON (typed arrays, a collision tree, a physics engine\'s bodies) goes there, keyed by `room.roomCode`; each handler that finds its room\'s entry missing rebuilds it from the state, and the room deletes its entry once its match is over, since every room in that copy shares its 128 MB. On your own server and in play-locally, one process runs every room, so they all share it; it\'s lost when the process starts again (play-locally starts it again on each change to the game server), and every room then comes back through `onRestored`.\n- **Updates:** rooms keep the version they started with until they end; new rooms get the live version.\n\nThe same file runs on your own machine too (below), so you can test it there or move off Zaisma any time.\n\n#### The game database\n\nEvery game has its own SQLite database, part of its hosting: shared by all its rooms, kept between matches, for what the game server owns or must trust (inventories, leaderboards, bans, worlds). Players\' own progress belongs in cloud saves, which need no code. The game server uses it as `room.database` with plain SQL, in any handler that awaits it:\n\n```js\nasync onJoin(state, player, room) {\n await room.database.query("CREATE TABLE IF NOT EXISTS scores (player_id TEXT PRIMARY KEY, best_score INTEGER NOT NULL)");\n const [mine] = await room.database.query("SELECT best_score FROM scores WHERE player_id = ?", [player.id]);\n room.send(player.id, { bestScore: mine?.best_score ?? 0 });\n},\nasync onMessage(state, player, room, message) {\n if (message.type === "finished") {\n await room.database.query(\n "INSERT INTO scores VALUES (?, ?) ON CONFLICT (player_id) DO UPDATE SET best_score = max(best_score, excluded.best_score)",\n [player.id, state.scores[player.id]],\n );\n }\n},\n```\n\n- **`query(sql, values)`** runs one statement and answers its rows as objects (`[]` when it returns none). `values` fill its `?`s in order: text, numbers, `null` or a `Uint8Array` (whole numbers past 2^53 are refused with `bad_values` and can\'t be read back as numbers (`integer_too_large`): store them as text and read them with `CAST(col AS TEXT)`; use 1 and 0 for true and false; store objects as `JSON.stringify` and read them with `JSON.parse` or SQLite\'s JSON functions). To see what an `INSERT`, `UPDATE` or `DELETE` changed, add `RETURNING`.\n- **`batch([{ sql, values }, ...])`** runs up to 100 statements in one transaction, so they all happen or none do (moving an item between two inventories, say), and answers each one\'s rows. `BEGIN` and `COMMIT` aren\'t taken; batch is the transaction.\n- **Errors** are a `DatabaseError` with a `code` and a `fix`: `bad_sql` (SQLite\'s own message, or more than one statement in a query), `bad_values`, `integer_too_large` (a result holds a whole number past 2^53), `too_many_rows` (over 10,000 rows; page with `LIMIT`), `hosting_paused` (the game\'s hosting is paused this month, below), `database_full` (its storage, the database and kept rooms together, is at the 10 GB a game can have: it can change and delete rows but not grow) and `database_unavailable`.\n- **Part of the game\'s hosting on Zaisma.** Rows written and read, and what it stores, count on the game\'s one hosting meter with its rooms and requests (see "Hosting" below). Every statement counts the rows SQLite touched, like Cloudflare\'s billing: an index makes lookups read fewer rows. When the game\'s hosting pauses, the database keeps answering for the hour running matches get, so their last saves land, then answers `hosting_paused` until it starts again.\n- **You and your AI reach it too:** look at its tables and use, query it, fix data, change tables and roll it back to any minute in the last 30 days through the developer API, the MCP (`get_database`, `query_database`, `batch_database`, `restore_database`) or `zaisma database` in a terminal, with the same checks and limits (see "The game database" in [`docs/DEVELOPER-API.md`](docs/DEVELOPER-API.md)).\n- **Take it out, bring it in:** the whole database goes out and in as SQLite\'s own SQL dump (`export_database`, `import_database`), or as a ready SQLite file from a terminal: `zaisma database export <game> game.sqlite` and `zaisma database import <game> game.sqlite`.\n- **The same code on your own server:** the Node runner keeps the database in a local SQLite file (below), checked the same way, with no limits. Moving between Zaisma and your own server is one command each way: export to the file the runner uses, or import the runner\'s file.\n\n#### Room browsing\n\nOpen rooms are listed on the game\'s page (how full each is and where it runs, never who\'s in it), with "playing now" under the title (every room counts, hidden ones too), and the game gets the same list to show its own way:\n\n```js\nconst { rooms, playingPlayerCount, regions } = await Zaisma.rooms.list(); // how full each room is and where it runs, never who\'s in it\nZaisma.rooms.list({ region: "EU", labels: { Mode: "Classic" } }); // one region, or rooms with these labels\nconst room = await Zaisma.rooms.quickJoin(); // the linked room, else a busy room with space nearby, else a new one\nZaisma.joinRoom({ isListed: true }); // a new room others find in room lists (by default only its code and link reach it)\nZaisma.joinRoom({ name: "Ana\'s castle", labels: { Mode: "Classic", Map: "Docks" } }); // name and label a new room\nawait Zaisma.checkChat(typed); // { isAllowed, reason, message, hasSwearing, text }: Zaisma\'s chat check\n```\n\nRooms can have a name and up to 4 labels (like Mode and Map), set by your game server with `room.setInfo({ name, labels })`, by the room\'s first player with the relay, or when the room is made. Names and labels players type are fine; on zaisma.com they show only if they pass Zaisma\'s text filter (no links, handles, emails, phone numbers or contact apps; no slurs or sexual words), and players can report them. Inside your game they\'re yours to look after, under the content rules.\n\nOn the game server, `room.setListed(false)` hides a room (its code and links still work) and `room.setOpen(false)` closes it to new players once a match starts; players who were in it can still come back. With the relay, the room\'s first player can do the same from the game (`room.setListed`, `room.setOpen`, `room.setInfo`). In the dashboard, a game lists its rooms on the page and in the game, only in the game, or nowhere.\n\nJoin on the game page is an ordinary room link, so the game decides what comes first:\n\n- **Straight in:** call `joinRoom()` or `quickJoin()` when the game starts; both follow a link to a Zaisma room; on your own servers, join with `joinRoom({ serverUrl: Zaisma.rooms.linkedServerUrl, roomCode: Zaisma.rooms.linkedRoomCode })`, since only `joinRoom({ serverUrl })` follows a link that names a server.\n- **A menu or character customizer first:** check `Zaisma.rooms.linkedRoomCode`, show your screen, then join with what the player picked: `joinRoom({ joinData: { character: "knight" } })` hands it to your game server\'s `canJoin` and `onJoin` (plain JSON, up to 4 KB; it comes from the player\'s browser, so check it like any message). If the room filled up meanwhile, `joinRoom` fails with `error.code === "room_full"` and `quickJoin` finds another.\n- **Your own lobby:** list rooms only in the game and draw them yourself from `Zaisma.rooms.list()`.\n\n#### Lobbies and matches\n\nA room can make a room for some of its players and send them there, like a lobby starting a match:\n\n```ts\nconst roomCode = room.reserve({ playerIds: [a.id, b.id], setupData: { map: "Docks", teams } }); // in your game server\n```\n\n```js\nroom.on("move", (move) => { room.leave(); move.join(); }); // in the game: go to the new room\n```\n\nThe new room runs the same game server, and its `setup(setupData)` gets your setup data, so it can start the match already set up (players can read it but can\'t change it; up to 4 KB). It\'s ready before anyone hears its code, only the players named can join it (it\'s a closed room, until your server opens it), and it\'s hidden from room lists unless you pass `isListed: true` (with a `name` and `labels` if you like). To send players to a room that\'s already running instead, like the next area of an open world, use `room.moveTo(roomCode, { playerIds, joinData })`: the other room\'s `canJoin` decides, and `onMoved(state, moveResult, room)` hears `{ roomCode, movedPlayers, refusals }`. A room can reserve up to 20 rooms a minute. See `examples/four-in-a-row`: its "Find an opponent" waits in a lobby room until there\'s someone to play.\n\nA griefed world or a bad update can be undone: `server.restoreKeptRoom(roomCode, { restoreToAt })` puts a kept room\'s world back as it was at any minute in the last 30 days, by your game\'s own rule of who may, and `server.undoKeptRoomRestore` undoes it for 30 days; `server.listKeptRoomRestores(roomCode)` gives a restore screen what it draws from. Players drop for a second or two and reconnect, and `onRestored` hears `restoreInfo.keptRoomRestore`, so your game tells them its own way. Your AI does the same through the API and MCP (`restore_kept_room`, `restore_every_kept_room`), and a deleted world comes back with `bring_back_kept_room` for about 28 days. See `docs/DEVELOPER-API.md`, Kept rooms.\n\n**One room at a time.** A player sits in one of your game\'s rooms at a time, as on Steam: when they join another room, their seat in the first closes with "Joined from somewhere else" and your game server\'s `onLeave` runs there with reason `"left"`. Moving a player (`room.moveTo`, `room.reserve`) and watching (`isSpectator`) never close a seat. A game that keeps players in more than one room, like a hangout hub beside its matches, raises `maximumRoomCountPerPlayer` (up to 10): a join past it closes the oldest seat. "Playing now" counts each player once.\n\n**Kept rooms** are for worlds that last, like a survival server: a kept room doesn\'t end when everyone leaves, but sleeps with its state saved, costs nothing while it sleeps, and wakes as it was when someone joins, a day or a month later.\n\n```ts\nroom.setKept(true); // in your game server, like in setup or when players build their first base\n```\n\nA listed kept room stays on the game page\'s Rooms tab with nobody in it, like a server waiting for players (`Zaisma.rooms.list` says `isKept`). A world waking from its sleep runs `onRestored` with `restoreInfo.lostDurationSec` 0 and `restoreInfo.savedAt`, so you can grow crops for the time that passed, and it wakes on the game\'s live version, with `restoreInfo.savedVersionId` saying which one saved it. `room.end()` ends it for good, and `room.setKept(false)` makes it an ordinary room again. Saved worlds count toward the game\'s storage with its database, on its hosting meter: at the 10 GB a game can have, new rooms can\'t be kept until you make room, but kept rooms keep saving. List and delete them with `list_kept_rooms` and `delete_kept_room`, or `zaisma kept-rooms`. A room made with `room.reserve({ ..., isKept: true })` starts kept. On your own server the Node runner keeps them in `--room-state-file`.\n\n`room.roomCode` tells the game server which room it\'s in, so a game with one shared world can keep only that room and turn players away from any other code, even from a changed page:\n\n```ts\ncanJoin(state, player, room) { return room.roomCode === "WRLD22" || { refusalMessage: "Join the main world." }; },\nonJoin(state, player, room) { room.setKept(true); },\n```\n\nPlaying alone needs no room, so don\'t make one until others can join: time in a room counts toward hosting even with one player.\n\n**Hosting.** Everything a game runs on Zaisma\'s servers (its rooms\' awake time, connections and messages, its game server\'s CPU and starts, data Zaisma\'s relay sends its players, its database, and requests and schedule runs to its game server) counts on one meter, and every game gets a free allowance each month (UTC): 8 friends playing a real-time game every night use about a third of it, and it covers about 1,300 player-hours of an 8-player real-time game. Your dashboard and `get_stats` show it as a percentage, with what used it. Past it, a game keeps going only when its developer has added hosting credit and given it a monthly budget (`monthly_budget_cents`; see "Hosting and credit" in [docs/DEVELOPER-API.md](docs/DEVELOPER-API.md)). Otherwise its hosting pauses until the month resets: no new rooms open (joining fails with `error.code === "hosting_paused"`), no new relayed connections or requests start, and matches already running get an hour to finish (`room.endsAt`, the game server\'s `onEnding`, the SDK\'s `ending` event). Game files, saves, sign-in, publishing and spectators are never on the meter, and your own servers never are.\n\n#### Spectators\n\nA game server that turns watching on lets people watch a match without playing, like a tournament\'s crowd or friends waiting for the next round:\n\n```ts\nexport default {\n maximumSpectatorCount: 20, // up to 100; leave it out, or 0, and nobody can watch\n onSpectatorJoin(state, spectator, room) { room.send(spectator.id, { type: "snapshot", state }); }, // catch them up\n onSpectatorLeave(state, spectator, room) {},\n onTick(state, tickDurationSec, room) {\n room.broadcast({ type: "positions", positions: state.positions }); // players and spectators\n room.broadcast({ type: "hands", hands: state.hands }, { audience: "players" }); // never the spectators\n room.broadcast({ type: "commentary", text: state.commentary }, { audience: "spectators" });\n },\n};\n```\n\n```js\nconst room = await Zaisma.joinRoom({ isSpectator: Zaisma.rooms.isLinkedAsSpectator }); // in the game\nroom.isSpectator; // watching: room.send and room.sendBytes throw error.code "spectator_cannot_send"\nroom.spectatorCount; // how many watch; the "settings" event says when it changes\n```\n\nA spectator gets everything the room sends everyone (`audience` picks who: `"everyone"`, the default, `"players"` or `"spectators"`, for `room.broadcast` and `room.broadcastBytes`), and `room.send(spectator.id, ...)` reaches one. They send nothing, so they can\'t bother players or dodge the room\'s limits; they\'re never in `room.players`, don\'t count toward `maximumPlayerCount` or "playing now", are never idle or away, and are free: watching isn\'t player time. `room.spectators` lists them, `joinInfo.isSpectator` tells `canJoin` a watcher is asking, and `room.kick` works on them too. A closed or full room can still be watched (watching a match under way is the point); a room with nobody playing can\'t (`room_not_running`), one whose audience is full answers `spectators_full`, and a player already playing in the room answers `already_playing`. When the last player leaves, the spectators are told the match ended.\n\nOn zaisma.com, Watch shows beside Join (friends playing, the Players plate, the Rooms tab) for games that take spectators, with the same rules as Join, and opens the game with `Zaisma.rooms.isLinkedAsSpectator` true. The Rooms tab and the Players plate say how many are watching, never who.\n\n#### Players who walk away\n\nPlayers who walk away stop holding seats and running matches, in every game, with no code:\n\n- **Lost connections** (a closed laptop, lost signal): the SDK pings the room every 25 seconds without waking it, and a connection that stops answering is dropped about a minute later (within seconds in a real-time room). The SDK says goodbye as the page closes, so most players leave at once.\n- **Idle:** after 10 minutes without input the SDK asks "Still there?" with a small plate at the top of the game for 30 seconds; no answer, and the player walks away. Rooms check for themselves too: a game that sends nothing at all for a minute past that counts as idle.\n- **Hidden:** in a real-time room (one with `ticksPerSec`), a game hidden for 2 minutes counts as away.\n\nA player whose connection drops stays in the match first, as away with reason `lost`, for 30 seconds while the SDK reconnects: `onAway` runs if your game server has one, every player\'s game sees `awayReason: "lost"` for them in `room.players`, and if they\'re back in time, `onBack` runs and they carry on where they were. Freeze their character meanwhile (in `onTick`, skip players whose `room.awayReason(playerId)` is `"lost"`), or do nothing and they stand still.\n\nA player who walks away, or whose connection stays lost, leaves the match (`onLeave` with `leaveInfo.reason`) and the room holds their seat for 5 minutes: they come straight back to it with any input, or by reconnecting, and `onJoin` gets `joinInfo.isReturning`. Held seats count toward `maximumPlayerCount`, but players who walked away don\'t count as playing now or toward how full a room looks, and a room where everyone\'s away stops ticking. Once the seat runs out, the SDK offers their old room again if it has space. Zaisma never covers your game or sends anyone away from it for being idle.\n\nWhen Zaisma restarts its rooms (every update to Zaisma does), a real-time match comes back where it was a few seconds before, and its players reconnect into it: the room saves its state every `stateSaveIntervalSec` (5 by default, 1 to 60), and `onRestored(state, restoreInfo, room)` runs once with `restoreInfo.lostDurationSec`, the seconds of play lost, so you can resync clocks or tell your players. Turn-based rooms save after every move, so they lose nothing. Publishing with `match_update_mode: "now"` moves every live match to the new version the same way, within seconds; your game server can hold it until the end of a round with `onVersionUpdate` ([Updates](docs/DEVELOPER-API.md#updates)).\n\nYour game server picks what happens:\n\n```ts\nexport default {\n idleCheck: "server", // who checks: "server" (the default), "client" (each player\'s game decides), or "off"\n idleTimeoutSec: 300, // seconds without input before "Still there?" (default 600)\n seatHoldDurationSec: 120, // seconds a seat stays held (default 300, up to 1800; 0 for none)\n reconnectTimeoutSec: 30, // seconds a player whose connection dropped stays in the match (default 30, up to 300; 0 to take them out at once)\n maximumRoomCountPerPlayer: 1, // rooms of your game one player sits in at once (default 1, up to 10; see "Lobbies and matches")\n awayMode: "lobby", // send players who walk away back to the room that made this one (room.reserve); "hold" is the default\n onAway(state, player, room, awayInfo) {}, // awayInfo.reason "idle", "hidden" or "lost"; for idle and hidden, the player stays and you kick, move or keep them\n onBack(state, player, room) {}, // a player onAway kept, or whose connection dropped, came back: send them the full state\n stateSaveIntervalSec: 5, // how often a real-time room saves its state, for a restart to come back with (default 5, 1 to 60)\n onRestored(state, restoreInfo, room) {}, // the room restarted with its saved state: restoreInfo.savedAt, lostDurationSec and savedVersionId\n onVersionUpdate(state, versionUpdate, room) {}, // a version published "now" is coming: call room.applyVersionUpdate() at a good moment, or it switches at versionUpdate.appliesAt\n onPurchase(state, player, room, purchase) {}, // with purchase_delivery "game_server": a purchase to hand over, once; a throw tries again at the player\'s next join\n onRefund(state, player, room, purchase) {}, // a purchase handed over before was refunded or charged back: take back what you decide\n};\n```\n\nIn the game, all of it is optional:\n\n```js\nroom.on("connectionStatus", (connectionStatus) => {}); // the socket: "connecting", "open", "reconnecting" or "closed"\nroom.on("away", ({ awayReason, seatHoldDurationSec }) => {}); // awayReason: "idle" or "hidden" (also room.awayReason); the seat is held that long\nroom.on("idle", ({ idleStatus }) => {}); // ask "Still there?" your way: "asking", then "answered" or "timed_out"\nroom.on("back", (back) => back.rejoin()); // back: isSeatHeld true, already in; false, the seat ran out and listening turns off rejoining by itself\nroom.on("players", (players) => {}); // each player\'s awayReason: "lost" while their connection dropped, "idle" or "hidden" if onAway kept them, else null\nZaisma.joinRoom({ idleCheckEnabled: false }); // no "Still there?" in this game (where idleCheck is "client", as with the relay, the room follows this)\n```\n\nEvery number behind this (pings, timeouts, reconnecting, held seats, message limits, close codes) is in [Room connections](docs/DEVELOPER-API.md#room-connections).\n\nYour own clients follow the same protocol: send the text `ping` every 30 seconds or so (the room answers `pong`), `{"type":"idle"}`, `{"type":"hidden"}` and `{"type":"shown"}` as they happen, and `{"type":"back"}` when the player returns. Their hello carries `"protocolVersionNumber":1`. Errors from the room are `{"type":"error","code":"room_full","message":"This room is full."}`, with codes in lowercase snake_case, one of: `rented_share_used`, `room_full`, `room_closed`, `ended`, `too_big`, `too_fast`, `bad_message`, `bad_pass`, `bad_player_token`, `no_hello`, `not_allowed`, `game_unavailable`, `busy`, `kept_out`, `refused`, `room_not_running`, `hosting_paused`, `account_needed`, `game_not_open_to_player`, `blocked_player_here`, `other_version`, `spectators_full`, `spectator_cannot_send`, `already_playing`, `bad_origin`, `send_queue_full`, `chat_not_here`, `chat_not_allowed`, `chat_empty`, `chat_too_long` or `chat_too_fast`. The SDK\'s types explain each one (`RoomErrorCode`); codes only grow within v1.\n\n#### Requests to your game server\n\nNot everything needs a room. A game\'s own game server can also answer plain requests from the game, for a leaderboard, a shop or a daily reward, in single-player games too. Give it `onRequest`, and the game calls it with `Zaisma.server.request`:\n\n```js\n// zaisma-server/index.js (or zaisma-server.js)\nexport default {\n async onRequest(player, request, server) {\n await server.database.query("CREATE TABLE IF NOT EXISTS rewards (player_id TEXT PRIMARY KEY, claimed_date TEXT NOT NULL)");\n if (request.type === "claimDailyReward") {\n const today = new Date().toISOString().slice(0, 10);\n const [claimed] = await server.database.query("INSERT INTO rewards VALUES (?, ?) ON CONFLICT (player_id) DO UPDATE SET claimed_date = excluded.claimed_date WHERE claimed_date < excluded.claimed_date RETURNING player_id", [player.id, today]);\n return { isClaimed: Boolean(claimed) };\n }\n return { error: "unknown request" };\n },\n};\n\n// In the game:\nconst { isClaimed } = await Zaisma.server.request({ type: "claimDailyReward" });\n```\n\n- **`onRequest(player, request, server)`** answers what the game gets back: plain JSON, up to 1 MB, within 10 seconds. `player` is who sent it, from their player pass, so a player can\'t claim someone else\'s reward. `request` is the game\'s plain JSON, up to 16 KB, from the player\'s browser, so check it like any message and say what it\'s for in its `type`. There\'s no room and no state: what lasts goes in `server.database`, the same game database the game\'s rooms use.\n- **Rooms or not:** a game server with only `onRequest` needs no `setup()` and runs no rooms; one with both does both. Requests work whatever the game\'s multiplayer setting, as long as its live version has the game server in its `zaisma-server/` folder or `zaisma-server.js`, run in the same sealed sandbox as its rooms.\n- **Errors:** the game gets an `error.code`, one of: `rented_share_used`, `bad_request`, `too_big`, `bad_pass`, `bad_player_token`, `account_needed`, `game_not_open_to_player`, `game_unavailable`, `no_request_handler`, `game_server_error`, `hosting_paused`, `slow_down`, `bad_origin` or `busy`. `no_request_handler` means no `onRequest`; `game_server_error` means it threw, answered something that isn\'t plain JSON or over 1 MB, or took over 10 seconds (you see why with your game server\'s errors in the dashboard and `get_stats`, with the file and line); `slow_down` means over about 120 a minute from one address; `hosting_paused` answers HTTP 403. The pass\'s own are `account_needed` and `bad_pass`; `bad_player_token` is your own server\'s, for a game played off Zaisma (below). A game server that keeps running on too long (a loop that never ends) is paused for a few minutes.\n- **Part of the game\'s hosting on Zaisma.** Each request, webhook event and schedule run counts on the game\'s hosting meter, and so does its CPU past the first 10 ms (see "Hosting" above). While the game\'s hosting is paused, requests answer `hosting_paused`. Your dashboard and `get_stats` show the month\'s count.\n- **On your own server** the Node runner answers the same requests at `POST /v1/requests/<game>` on its port, with `server.database` its local SQLite file: `Zaisma.server.request(request, { serverUrl: "https://play.example.com" })`. Any server can answer them the same way: the body is `{ pass, request }` as JSON (sent as `text/plain`, so browsers need no preflight), and the answer `{ answer }` or `{ error: { code, message } }`.\n\n#### Schedules\n\nA game\'s own game server can also run by itself, for a daily reset, a weekly leaderboard or a persistent world\'s turns. List its `schedules`, each a name and a cron, and `onSchedule` runs at each:\n\n```js\n// zaisma-server/index.js (or zaisma-server.js)\nexport default {\n schedules: [\n { name: "daily-reset", cron: "0 0 * * *" }, // every midnight, UTC\n { name: "world-turn", cron: "*/15 * * * *" }, // every 15 minutes\n ],\n async onSchedule(run, server) {\n if (run.name === "daily-reset") {\n // Safe to run twice: it only resets what\'s older than this run.\n await server.database.query("DELETE FROM daily_scores WHERE scored_at < ?", [run.scheduledAt]);\n }\n if (run.name === "world-turn") await server.database.query("UPDATE crops SET growth = min(growth + 1, 10)");\n },\n};\n```\n\n- **`cron`** is the usual five fields, minute hour day-of-month month day-of-week, always in UTC: numbers, `*`, ranges (`1-5`), steps (`*/15`) and lists (`1,15`). `"0 4 * * 1"` is Mondays at 04:00. So a schedule runs at most once a minute; anything faster belongs in a room\'s `onTick`. A cron that doesn\'t read stops the game server starting, and says why.\n- **`onSchedule(run, server)`** gets `run.name`, `run.cron` (the cron with spaces tidied: trimmed, one space between fields) and `run.scheduledAt`, the minute it was due (an ISO time). There\'s no room, no player and no state: what lasts goes in `server.database`, the same game database the game\'s rooms and requests use. It has 30 seconds. A run can rarely come late or twice (after a restart), so make it safe to repeat, like a reset that checks `run.scheduledAt`.\n- **Up to 10 schedules on Zaisma.** Each run counts as a request on the game\'s hosting meter, and a paused game\'s schedules don\'t run. They run with the live version\'s game server, whatever the multiplayer setting, within a minute of it going live; a version without them stops them, and so does a game taken down. A game server with only schedules needs no `setup()` and runs no rooms. Your dashboard and `get_stats` show each schedule with its next and last run, the runs per day, and any errors with the schedule\'s name, file and line.\n- **On your own server** the Node runner runs the same schedules at the same minutes while it\'s up, with `server.database` its local SQLite file, and prints a run\'s errors. A run due while it\'s down is missed.\n\n#### Messages between rooms\n\nA game server reaches the game\'s other live rooms with a room message: `room.sendToRoom(roomCode, message)` tells one room (answering `{ isDelivered }`), `room.sendToEveryRoom(message, { labels })` tells every other room with someone in it, or only those holding every label given (answering `{ roomCount }`), and `room.listRooms({ labels })` lists them, newest first. Outside rooms, `onRequest`, `onSchedule` and `onWebhook` get the same on `server`, plus `server.getRoom(roomCode)` (the room and who\'s in it), `server.kickFromRoom(roomCode, playerId, { message, keepOut })` and `server.endRoom(roomCode, message)`. The receiving room\'s `onRoomMessage(state, roomMessage, room)` decides what its players see; without it, every player\'s game hears the room\'s `roomMessage` event. `roomMessage.senderKind` says who sent it (`room`, `server` or `developer`), with `fromRoomCode` for a room. A message is plain JSON up to 16 KB; a room sends up to 20 a second and takes up to 100, and the whole game sends to every room up to 10 times a minute.\n\nA party leaving one world for another, the same code in Zaisma\'s rooms and on your own server with the Node runner:\n\n```js\nexport default {\n setup: () => ({ partiesComing: [] }),\n async onMessage(state, player, room, message) {\n if (message.kind !== "travel") return;\n const { isDelivered } = await room.sendToRoom(message.toRoomCode, { kind: "party_coming", leaderName: player.name });\n if (isDelivered) room.moveTo(message.toRoomCode, { playerIds: [player.id] });\n },\n onRoomMessage(state, roomMessage, room) {\n if (roomMessage.message.kind !== "party_coming") return;\n room.broadcast({ kind: "notice", text: `${roomMessage.message.leaderName}\'s party is on its way from ${roomMessage.fromRoomCode}.` });\n return { ...state, partiesComing: [...state.partiesComing, roomMessage.fromRoomCode] };\n },\n};\n```\n\nOn Zaisma, the developer API and MCP reach the same rooms (`send_room_message`, `send_to_every_room` now or at a set time, `list_rooms`, `get_room`, `kick_player`, `end_room`), for the game\'s own moderation page or a live event: see "Reaching live rooms" in [`docs/DEVELOPER-API.md`](docs/DEVELOPER-API.md). On your own server the Node runner gives these calls among its own rooms, and Zaisma\'s API doesn\'t reach them.\n\n#### Calling other servers, with secrets\n\nA game\'s server can call your own server, a payment provider, Discord, GitHub or any other https API with plain `fetch()`, on the hosts you list for the game, and keep the tokens it needs as secrets:\n\n```js\n// zaisma-server/index.js: post each new top score to the game\'s Discord channel\nexport default {\n async onRequest(player, request, server) {\n if (request.type !== "score") return null;\n await fetch(server.secrets.DISCORD_WEBHOOK_URL, {\n method: "POST",\n headers: { "Content-Type": "application/json" },\n body: JSON.stringify({ content: `${player.name} scored ${request.score}!` }),\n });\n return { isPosted: true };\n },\n};\n```\n\n```sh\n\n## Room connections\n\nHow a room and each player\'s game stay in touch, the same in Zaisma rooms and on your own server (the Node runner): how a dead connection is noticed, what happens to a player whose connection drops or who walks away, the limits on what players send, and why a connection closes.\n\n### Staying connected\n\n- **The SDK pings** the room every 25 seconds (the room answers without waking up), and reconnects by itself when a ping goes unanswered for 15 seconds, or in a real-time room (one with `ticksPerSec`) after 8 seconds without a word from the room, which probes every 2 seconds (not while the player is away or the game is hidden).\n- **Reconnecting** waits half a second, then doubles each try up to 8 seconds, with no limit, and `room.connectionStatus` is `"reconnecting"` meanwhile. Your game keeps the same room object: the `players` event and your game server\'s messages carry on once it\'s back.\n- **The room drops** a connection with no ping or message for 75 seconds (a closed laptop, lost signal): Zaisma rooms check every 30 seconds, the Node runner every 5. The SDK says goodbye as the page closes, so most players who leave do so at once.\n- **`room.connectionStatus` is the socket only:** `"connecting"`, `"open"`, `"reconnecting"` or `"closed"`. Whether the player is in the match is `room.awayReason` (below), so a player who walked away with the socket still open stays `"open"`.\n- **Sends wait while it\'s down:** reliable `room.send` and `room.sendBytes` calls made while `connectionStatus` isn\'t `"open"`, or while the player is away, are kept in order and go once the room lets them back in, before any latest-only sends that waited. Up to 60 wait (the room\'s burst, so the flush never trips `too_fast`); past that the oldest is dropped and the `error` event says `send_queue_full` once per outage. Both calls return `false` only once the room is gone (ended, kicked or left).\n\n### Dropped players\n\nA blip is the most common thing that goes wrong online, so a player whose connection drops stays in the match for a while instead of leaving it:\n\n- **Away, reason `lost`:** the player stays in `room.players` for `reconnectTimeoutSec` (30 by default, 0 to 300). The game server\'s `onAway(state, player, room, { reason: "lost" })` runs if it has one, `room.awayReason(playerId)` answers `"lost"`, and every player\'s game sees `awayReason: "lost"` for them in `room.players` and the `players` event. They don\'t count as playing, nothing is sent to them, and their seat counts toward `maximumPlayerCount`. If they were the host, the next player is host until they\'re back.\n- **Freeze them:** a game that does nothing shows them standing still. A real-time game can freeze their character, skip their turn or pause the match: in `onTick`, skip players whose `room.awayReason(playerId)` is `"lost"`, and in the game, draw them dimmed or "reconnecting" from `awayReason`.\n- **Back in time:** the SDK reconnects by itself, `onBack(state, player, room)` runs (not `onJoin`, and `canJoin` isn\'t asked), and `awayReason` goes back to `null` for everyone. Send them the full state in `onBack`, since they missed what was sent meanwhile.\n- **Not back in time:** they leave the match as before: `onLeave` with reason `lost`, and the room holds their seat for `seatHoldDurationSec`, so a later return gets `onJoin` with `joinInfo.isReturning`.\n- **`reconnectTimeoutSec: 0`** takes a dropped player out of the match at once (`onLeave`, reason `lost`), as before this option.\n- **`onAway` takes over idle and hidden too:** with `onAway`, a player who goes idle or hidden stays in the room until your game decides (below). To freeze dropped players while leaving idle and hidden ones to the room, read `room.awayReason` in `onTick` instead of adding `onAway`; `onBack` alone changes nothing else.\n\nReal-time rooms notice a silent drop within seconds (their probes); turn-based rooms keep the slower 75-second check, so they can sleep between moves.\n\n### Updates\n\nA version you publish (or roll back to) reaches running matches at their next match, or now: `match_update_mode` `"next_match"` (the default) or `"now"` on `publish_version`, on `upload_files` and `POST /games/:slug/versions` with `publish_when_approved`, `zaisma publish --match-update-mode now`, `zaisma upload \u2026 --publish-when-approved --match-update-mode now`, or Update running games now on the dashboard.\n\n- **Now, in a match:** every live room of the game hears it within seconds (a room that slept through it finds it within a minute of waking). Players\' games get the room\'s `versionUpdate` event, `{ versionId, appliesAt, isReloading }`, to show a countdown or save. Without `onVersionUpdate`, the match switches 10 seconds later. With `onVersionUpdate(state, versionUpdate, room)`, the room waits for your game server: call `room.applyVersionUpdate()` at a good moment, like the end of a round, or it switches at `versionUpdate.appliesAt`, 5 minutes on.\n- **The switch:** the room saves, its connections close with code `4004`, and the new version\'s game server starts from the saved state: `onRestored(state, restoreInfo, room)` runs with `restoreInfo.savedVersionId`, the version that saved it, so you can bring an older state up to date (or `room.end()` the match if you can\'t). When only the game server changed, players\' games reconnect by themselves in a second or two. When the game\'s own files changed (`isReloading`), the game page reloads the game in place at the new version, with its save, and `Zaisma.joinRoom()` with no code brings the player back into the same room. Players come back as dropped players do (away, reason `lost`, for `reconnectTimeoutSec`, then a held seat), so a slow reload still finds its place. The game page\'s bar says Updating meanwhile; nothing covers the game.\n- **Now, not in a match** (a single-player game, or a menu): never forced. The game page notices within 2 minutes. A game listening to `Zaisma.versions.on("update", (update) => \u2026)` switches when it says, with `update.apply()` (at a checkpoint, back at its menu), and the page reloads it with its save; otherwise the bar beside the game shows Update, and the player taps it when they\'re ready, or gets the new version the next time they open the game.\n- **Next match:** nothing changes for running matches: a room keeps the version it started on until its match ends.\n- **A room on another version:** a player always plays the version their room runs. A Zaisma room whose game server runs another version than the player\'s game (an open tab from before a publish, or a friend\'s match still finishing on the version before) turns a newcomer away with `other_version`, and on the game\'s Zaisma page the game reloads at the room\'s version, with its save, and joins it; your game never sees it. While the room runs it, the game\'s address serves that version\'s files to the room\'s players, as long as it\'s one you could roll back to (the live version and the last 5 that passed), and not held or taken down. Players already in the room are never turned away this way, and rooms with a built-in game server have no version of their own. Outside Zaisma, through a tester link, or when that version is no longer kept, the join fails with `other_version`.\n- **On your own server** `onVersionUpdate` never runs and `room.applyVersionUpdate()` does nothing: the game page still reloads players\' games after a `now` publish when they\'re not in a match, and you restart your server to switch it (the Node runner brings its matches back, below).\n\n### Restarts\n\nZaisma restarts its rooms whenever Zaisma itself is updated, and a match carries on:\n\n- **Saved every few seconds:** a real-time room saves its game server\'s state every `stateSaveIntervalSec` (5 by default, 1 to 60), only when it changed, and once more when everyone walks away or leaves; a turn-based room saves after every change, as always. A state over 32 MB as JSON isn\'t saved: the game\'s logs say so once, and a restart starts that room fresh.\n- **Back a few seconds behind:** the restarted room starts from the last save instead of `setup`; a real-time room (one with `ticksPerSec`) also runs `onRestored(state, restoreInfo, room)` once, and so does a turn-based room that had players in its match (it loses no moves, only the connections): `restoreInfo.savedAt` (an ISO time) and `restoreInfo.lostDurationSec`, the seconds of play since then that are lost. Use it to resync clocks or tell players.\n- **Players come back as dropped players:** everyone who was in the match is away with reason `lost` (`room.awayReason` answers it in `onRestored`), `onAway` runs for each, and they have the whole `reconnectTimeoutSec` from the restart. Their connections drop (the Node runner closes them with code `1012` as it stops), the SDK reconnects to the same room by itself, and `onBack` runs for each one back; anyone who isn\'t leaves as `lost` (above).\n- **A room that empties** keeps its saved state for a day, so players rejoining it find the match as it was (a real-time room\'s `onRestored` runs then too, with `lostDurationSec` 0: it saved as the last player left). A kept room keeps it until it ends (see Kept rooms below). A match that ends keeps nothing.\n- **On your own server** the Node runner saves to its `--room-state-file` (`zaisma-room-states.sqlite`) the same way, and saves every room when it\'s stopped, so a clean restart loses nothing.\n\n### Walking away\n\nPlayers who walk away stop holding seats and running matches, with no code:\n\n- **Idle:** after `idleTimeoutSec` without input (600 by default, 30 to 86400), the SDK asks "Still there?" for 30 seconds; no answer, and they walk away (`idleCheck`: `"server"`, the default, `"client"` or `"off"`).\n- **Hidden:** in a real-time room, a game hidden for 2 minutes counts as away.\n- **What happens:** with `awayMode: "hold"` (the default), they leave the match (`onLeave`, reason `idle` or `hidden`) and the room holds their seat for `seatHoldDurationSec` (300 by default, up to 1800, 0 for none); any input brings them back, and `onJoin` gets `joinInfo.isReturning`. `awayMode: "lobby"` sends them to the room that made this one (`room.reserve`). With `onAway`, they stay in the room and your game decides: kick them, move them or keep them.\n- **In the game:** the `idle` event hands `{ idleStatus, answerTimeoutSec }`: `"asking"` when it\'s time to ask (listening replaces Zaisma\'s "Still there?" plate), then `"answered"` on input or `"timed_out"` as the room hears they walked away. The `away` event hands `{ awayReason, seatHoldDurationSec }` and `room.awayReason` says `"idle"` or `"hidden"` until they\'re back. The `back` event hands `{ roomCode, isSeatHeld, rejoin() }`: `isSeatHeld: true` once the room let them back into their held seat; `false` on their first input after the seat ran out, when listening for `back` leaves rejoining to your game (`back.rejoin()`), and without a listener the SDK rejoins by itself.\n\n### Message limits\n\n- **From each player:** up to 16 KB a message (or bytes), and 30 a second with a burst of 60. The SDK throws `too_big` before sending one over 16 KB; past the rate, that message is refused with an `error` event (`too_fast`) and the connection stays open.\n- **Who sent it:** a message or bytes the game server passes on from one player carries `fromPlayerId` (its send options\' `fromPlayerId`; the relay always sets it), and the game\'s `message` event hands `(message, fromPlayerId)`, `bytes` hands `(bytes, fromPlayerId)`, with `null` for the game server\'s own.\n- **Join and setup data:** up to 4 KB of JSON (`joinData`, `setupData`).\n- **From the room:** what your game server sends isn\'t capped, but a player who can\'t keep up is dropped (below).\n\n### Ping and the room\'s clock\n\n- **Ping:** the game server reads a player\'s round trip with `room.pingDurationMs(playerId)`, and the player\'s game reads its own with `room.pingDurationMs`: the same number, in milliseconds, smoothed so one slow packet doesn\'t make it jump. It\'s `null` until the first measurement, right after the player joins.\n- **Measured by the room:** the room sends each player a small probe right after they join, every 2 seconds while a real-time room ticks (turn-based rooms keep sleeping between moves), and whenever 256 KB has gone out to them; the SDK answers it at once. Answers aren\'t game messages: they don\'t count toward a player\'s 30 a second, your message stats or the idle check. Since the room measures it, a player can only make their ping look worse by answering late, never better, so cap any lag compensation that uses it.\n- **One clock:** `room.serverTimeMs()` is the room\'s clock now, in epoch milliseconds, on the game server (like `Date.now()`) and in every player\'s game, where the SDK estimates it from the probes. A time the game server sends means the same moment for everyone, like `{ startsAtMs: room.serverTimeMs() + 3000 }` for a countdown.\n\n### Slow connections\n\nA player whose connection can\'t keep up is dropped before the room has to hold a growing backlog for them: when a probe has gone unanswered for 8 seconds, or 2 MB has gone out to them since the last probe they answered. Their connection closes with code `4003` and they become a dropped player (above): away with reason `lost` for `reconnectTimeoutSec`, while the SDK reconnects by itself, so they come back caught up. Send a returning player the full state in `onBack`, and in `onJoin` when `joinInfo.isReturning`, not just what changed (state sync does it by itself). A room\'s memory for its players stays bounded, and one bad connection can\'t stall a match for everyone else.\n\nBefore that, a connection can be **backed up**: 64 KB or more sent to it and not through yet. On your own server, that\'s the socket\'s `bufferedAmount`; in Zaisma rooms, 64 KB or more sent since the last probe the player answered, while a probe of theirs is 250 ms later than their ping. State sync skips a backed-up player and latest-only messages wait for them (below), so a slow player never builds a queue of stale updates.\n\n### State sync\n\nAn optional building block for real-time worlds, the same in Zaisma rooms and on your own server: your game server keeps its state as a plain object, and with `stateSyncEnabled: true` each player\'s game gets it without your code sending anything.\n\n- **A full copy, then what changed:** a player gets their whole view as they join (and after reconnecting), then, after each tick (or each handler, in a turn-based game), only what changed since their last: `{ type: "state", serverTimeMs, full }`, then `{ type: "state", serverTimeMs, changes }`. Each change is `[path, value]` (set) or `[path]` (remove), with `path` the keys and indexes from the top: objects by key, arrays by index while their length stays the same and whole when it changes. `serverTimeMs` is the room\'s clock as it was sent. Nothing goes out when nothing a player sees changed.\n- **Each player\'s view:** `stateView(state, viewer, room)` answers what `viewer` sees, like only what\'s near them in a big world or without the other team\'s hand; without it, everyone sees the whole state. It runs for every player on every tick, so keep it cheap, and it only answers: a call in it that changes the room or sends (`room.broadcast`, `room.kick`, `room.end`, ...) throws `room_call_unavailable`, which the game\'s logs show; reading (`room.players`, `room.roomCode`) works. A view over 1 MB as JSON isn\'t sent, and the game\'s logs say so once.\n- **In the game:** `room.state` is this player\'s view (null until the first update), the `"state"` event hands `(state, changes)` (`changes` null after a full copy), and `room.smoothedState({ delayMs })` answers the state `delayMs` (100 by default, up to 1000) behind the room\'s clock, between the two updates around then: numbers blended in a straight line (integers in between come back as fractions, and an angle that wraps blends the long way), anything else as the older one had it. Predicting the player\'s own moves stays your game\'s.\n- **Backed up:** a player whose connection is backed up gets nothing until they\'ve caught up, then a full copy, so a slow spell costs one copy instead of a growing queue. There are no acknowledgements: over the room\'s connection a change can\'t be lost.\n- **Where it runs:** where the state is, in your game server\'s sandbox on Zaisma (its time counts as the game server\'s CPU) and in the room on your own server. The state goes as JSON, so keep it plain; its updates count as `(state)` in `get_stats`.\n\n### Latest-only messages\n\n`room.broadcast`, `room.send`, `room.broadcastBytes` and `room.sendBytes` on the game server, and `room.send` and `room.sendBytes` in the game, take `{ delivery, latestKey }`:\n\n- **`delivery: "reliable"`** (the default) reaches every player, in order.\n- **`delivery: "latest_only"`** may be dropped: while a player\'s connection is backed up, a newer latest-only message with the same `latestKey` replaces the one waiting, and the newest goes once they catch up (oldest key first, before anything newer). For positions sent every tick, or where a player aims. A player keeps up to 64 waiting, one per key; past it, the least recently replaced is dropped.\n- **`latestKey`**, up to 40 characters, says which messages replace each other, like `"position"`, and `latest_only` needs one: without it the send throws: in the game (the SDK) the error\'s code is `bad_send_option`, and on the game server it is a `GameServerError` with the code `bad_room_call` and the room call (like `room.broadcast`) as its field. Bytes have their own keys.\n- **Zaisma rooms carry them over the WebSocket today**, since Cloudflare doesn\'t yet let Workers take WebTransport or WebRTC data channels; the same `delivery: "latest_only"` moves to real datagrams once it does, with no change to your game. **On your own server, the fast lane carries them as datagrams already** (below). Anything else for `delivery` or `latestKey` throws in your code, naming what to give: the SDK\'s error has the code `bad_send_option`; the game server\'s is a `GameServerError` (`bad_room_call`) saying the same.\n\n### The fast lane to your own server\n\n`Zaisma.joinRoom({ serverUrl: "wss://play.example.com", transport: "webtransport" })` joins a room on your own server over WebTransport (HTTP/3 over UDP) instead of the WebSocket. The Node runner serves it with `--webtransport-port`, `--certificate-path` and `--certificate-key-path` (`startServer({ webtransportPort, certificatePath, certificateKeyPath })`, all three or none); any other server can speak it too. `transport` is `"websocket"` (the default) or `"webtransport"`, else the SDK refuses it with `bad_transport`; a `serverUrl` that isn\'t `wss://` or `https://`, and Zaisma\'s own rooms, use the WebSocket either way. If WebTransport isn\'t there, its session is refused, or it isn\'t up within 3 seconds (`FAST_LANE_CONNECT_TIMEOUT_MS`), the room uses the WebSocket for the rest of its life and logs one console warning; a fast lane that worked and then dropped is tried again first. `room.transport` says what the connection uses now.\n\nThe wire:\n\n- **The session** is at `https://<server>/v1/rooms/<game>/<code>`: the `serverUrl`\'s host and port, with `wss:` read as `https:`. The browser sends the page\'s `Origin`; check it as you do for the WebSocket. The certificate must be a real one for that name (browsers check it as for any HTTPS site).\n- **One bidirectional stream**, opened by the client first, carries every frame the WebSocket carries, in order: each is `[4-byte big-endian payload length][1-byte kind: 0 text, 1 bytes][payload]`. Text is the same UTF-8: the JSON messages (`hello`, `welcome`, `probe`, `probe_answer`, ...) and `ping`/`pong`. Bytes are the same binary frames: from the room, `[1-byte sender ID length][sender ID][bytes]`; from the client, the bytes alone.\n- **A datagram** is `[1-byte kind][payload]`, with the same payloads, and carries only `latest_only` sends, both ways, when it fits the session\'s `maxDatagramSize`; a bigger one goes on the stream. Take datagrams only from a player you let in.\n- **Closing:** the session\'s close info carries the WebSocket\'s close codes and reasons (`closeCode` 4000 to 4004, as in [Close codes](#close-codes)).\n\nA server of your own that isn\'t the Node runner (Rust, C++, a studio\'s engine) needs to: accept WebTransport sessions at that path and check `Origin`; read the hello from the stream and verify its pass against your game\'s keys at `https://rooms.zaisma.com/v1/pass-keys/<gameSlug>`; answer each `probe` the room protocol says to send, and every `ping` with `pong`; send the same frames on the stream, and `latest_only` ones as datagrams when they fit.\n\n### Room error codes\n\nA room answers a refusal with `{ type: "error", code, message }`, then closes the connection (`4001`, or `1013` for `busy`); a message it can\'t take gets the same `error` and the connection stays open. In the SDK they are `error.code` and the `error` event.\n\n| Code | Meaning |\n| --- | --- |\n| `room_full` | The room has no space for another player. |\n| `room_closed` | The room isn\'t taking new players (`room.setOpen(false)`). |\n| `ended` | The match is over. |\n| `too_big` | A message over 16 KB, or `joinData` over 4 KB. |\n| `too_fast` | More messages than the room takes (30 a second, burst of 60). |\n| `bad_message` | A message the room couldn\'t read or use. |\n| `bad_pass` | The player pass wasn\'t accepted; the SDK gets a new one and tries once more. |\n| `bad_player_token` | A game played off Zaisma sent a `playerToken` your own server didn\'t take (its `identifyPlayer` said no, or it takes no guests); the game gets the player a new one. |\n| `no_hello` | The first message wasn\'t a hello with a player pass (or, to your own server, a `playerToken`). |\n| `not_allowed` | Only the game server or the room\'s host can do that. |\n| `game_unavailable` | The game can\'t be played right now. |\n| `busy` | The room couldn\'t take the player right now; the SDK tries again soon. |\n| `kept_out` | The player was removed for the rest of the match. |\n| `refused` | The game server\'s `canJoin` turned the player away. |\n| `room_not_running` | The room isn\'t running, like one with nobody playing to watch. |\n| `rented_share_used` | This player is on a rented-server network, and the share of the game\'s hosting such traffic gets is used; everyone else plays on. Zaisma\'s page tells them to turn off their VPN or sign in. |\n| `hosting_paused` | The game\'s hosting is paused this month, or Zaisma\'s free room time ran out; new rooms open again when it resets or its developer adds credit and a budget. |\n| `account_needed` | The game needs a Zaisma account for multiplayer, and the player is a guest. |\n| `game_not_open_to_player` | The account is younger than the game\'s minimum age. |\n| `blocked_player_here` | Someone the player blocked is in the room; `quickJoin` tries other rooms first. |\n| `other_version` | The room runs another version of the game (see Updates above). |\n| `spectators_full` | The room takes no more spectators. |\n| `spectator_cannot_send` | A spectator tried to send to the room. |\n| `already_playing` | A player in the room tried to watch it too. |\n| `bad_origin` | The connection didn\'t come from the game\'s own page. |\n| `send_queue_full` | The SDK\'s own: more than 60 sends waited while it reconnected, so the oldest were dropped. |\n| `chat_not_here` | A chat message reached a room whose server doesn\'t take chat (an older runner). |\n| `chat_not_allowed` | `room.chat` from a guest, or a player whose chat is set to nobody or paused (`room.canChat` is `false`). |\n| `chat_empty` | `room.chat` with nothing but spaces. |\n| `chat_too_long` | `room.chat` over 2000 characters. |\n| `chat_too_fast` | More than 20 chat messages in 10 seconds from one player. |\n| `bad_region` | The SDK\'s own: a `region` that isn\'t a continent code (`"AF"`, `"AN"`, `"AS"`, `"EU"`, `"NA"`, `"OC"` or `"SA"`). |\n| `bad_idle_timeout` | The SDK\'s own: an `idleTimeoutSec` that isn\'t from 30 to 86400. |\n| `bad_transport` | The SDK\'s own: a `transport` that isn\'t `"websocket"` or `"webtransport"`. |\n| `zaisma_rooms_not_used` | The SDK\'s own: the game doesn\'t use Zaisma rooms, so there are none to join or list. |\n\n### Close codes\n\n| Code | Why | What the SDK does |\n| --- | --- | --- |\n| `4000` | The match ended (`room.end`, or Zaisma ending it) | Stops: `connectionStatus` `"closed"`, after the `ended` event with its `endReason` |\n| `4001` | The room refused the player (an `error` with the code comes first, like `room_full`, `bad_origin` or `game_unavailable`), removed them (`room.kick`), or they joined from another tab | Stops: `connectionStatus` `"closed"` |\n| `4002` | The seat held for a player who walked away ran out | `connectionStatus` `"closed"`; waits for the player to come back, then the `back` event with `isSeatHeld: false` |\n| `4003` | The connection stopped answering probes or fell too far behind | Reconnects by itself, as a dropped player |\n| `4004` | The match switched to a version published `"now"` | Reconnects by itself, or the page reloads the game at the new version (`isReloading`) |\n| `1012` | The Node runner is restarting | Reconnects by itself, as a dropped player |\n| `1013` | Zaisma rooms are busy (an `error` with `busy` comes first) | Reconnects by itself, waiting longer each try |\n\nAny other close (a network drop) reconnects by itself too.\n\n### Room events\n\nEvery event the game\'s room object has, and what its listener gets. Within v1, events and error codes only grow, so keep a `default` for ones you don\'t know.\n\n| Event | Listener gets |\n| --- | --- |\n| `message` | `(message, fromPlayerId)` |\n| `bytes` | `(bytes, fromPlayerId)` |\n| `state` | `(state, changes)` |\n| `players` | `(players)`, each `{ id, name, kind, awayReason }` |\n| `connectionStatus` | `(connectionStatus)` |\n| `settings` | `{ isListed, isOpen, friendJoinsEnabled, name, labels, spectatorCount }` |\n| `ended` | `{ message, endReason }`: `game`, `no_players`, `hosting_paused`, `kept_room_deleted`, `game_unavailable` or `game_server_stopped` |\n| `ending` | `{ endsAt }` |\n| `endingCancelled` | `()`: the end `ending` announced is off, since the game\'s hosting started again; `room.endsAt` is `null` |\n| `kicked` | `{ message, isKeptOut }` |\n| `chat` | `{ fromPlayerId, text, hasSwearing, hasSlur, sentAt }`: another player\'s chat line (see Chat) |\n| `move` | `{ roomCode, follow(), join(joinOptions) }` |\n| `moved` | `{ roomCode, fromRoomCode }` |\n| `idle` | `{ idleStatus, answerTimeoutSec }` |\n| `away` | `{ awayReason, seatHoldDurationSec }` |\n| `back` | `{ roomCode, isSeatHeld, rejoin() }` |\n| `muted` | `(playerIds)` |\n| `error` | `{ code, message }` |\n| `versionUpdate` | `{ versionId, appliesAt, isReloading }` |\n| `roomMessage` | `{ message, senderKind, fromRoomCode, sentAt }`: a room message for a room whose game server has no `onRoomMessage` (see Reaching live rooms) |\n\nThe SDK and rooms say which messages they speak with `protocolVersionNumber` (1 today): the SDK sends it in its hello, and the welcome answers the room\'s. A room skips a message type it doesn\'t know, so a newer SDK still plays in an older room.\n',
|
|
60431
|
-
"developer-api": '<!-- Made by scripts/build-skill.mjs: never edit it by hand. -->\n\n# Developer API\n\nOne API behind the developer MCP, the upload command (`packages/cli`) and the dashboard (zaisma.com/dashboard, `apps/site/src/dashboard.ts`), so they always agree. Base: `https://zaisma.com/api/dev`. Every answer is JSON. Errors say what happened, which input, and what to do (see Errors below), and every call that changes something answers with `next_steps` (see Next steps).\n\nNames follow [`docs/NAMING.md`](NAMING.md): each one says what it holds, what kind of value and in what unit (`file_count`, `size_bytes`, `play_duration_min`, `width_px`), times are ISO 8601 in UTC (`created_at: "2026-10-14T09:30:00.000Z"`) and come in the same way, every ID says its kind (`version_8f3k\u2026`, `topic_9x2m\u2026`, `post_4kq7\u2026`; an ID of another kind is refused with `wrong_id_kind`, saying what it is and where the right one comes from), a plural is always a list, and every answer has the same keys every time (`null` when not set). Inputs are closed: a field or query parameter a call doesn\'t take is refused (`unknown_field`), never quietly ignored, and so is a value that isn\'t one of its choices; a call that takes no body refuses one (`unknown_field` for its first key, `bad_json` for anything that isn\'t a JSON object), though an empty body or `{}` passes. The JSON Schema of each answer is in `apps/site/src/schemas.ts`.\n\n## The MCP\n\nAny AI tool that supports remote MCP servers can manage your games at `https://zaisma.com/mcp`, signed in with the same API key. In Claude Code:\n\n```bash\nclaude mcp add --transport http zaisma https://zaisma.com/mcp --header "Authorization: Bearer $ZAISMA_KEY"\n```\n\nApps that can\'t send a key connect by signing in instead. In claude.ai: Settings \u2192 Connectors \u2192 Add custom connector, with `https://zaisma.com/mcp`; ChatGPT and other apps the same way, wherever they add a remote MCP server. The app opens a Zaisma page where you choose what it may do and tap your passkey, then you\'re back in the app with every tool working. The key command above stays the way for Claude Code and the upload command.\n\nEvery tool is a call to this API (`apps/site/src/mcp.ts`): `list_games`, `create_game`, `get_game`, `get_playing_now`, `get_whats_on`, `update_game`, `check_game` (what Zaisma would refuse in a game and what won\'t work on Zaisma, before uploading; see Checking a game below), `upload_files` (small games up to 5 MB, sent as file contents), `get_version`, `update_version` (a version\'s notes before it\'s live), `publish_version` (also rolls back and publishes later), `cancel_scheduled_publish`, `end_preview_links`, `add_image`, `remove_image`, `add_shader`, `check_shader` (a shader drawn as the check would, before it\'s sent; see Backgrounds below), `remove_shader`, `set_background`, `preview_game_page` (pictures of every place players meet the game, from what you\'re still designing; see Seeing it as players do below), `add_tester_link`, `update_tester_link`, `remove_tester_link`, `get_reports`, `get_stats`, `get_history`, `get_qr_code` (the game\'s link, or a room\'s, as a QR code), `export_game` (everything about a game as one .zip; see Export everything below), `get_logs` (what the game server printed, see A game server\'s logs below), `get_player`, `get_access` (what the key can do), `get_activity` (your account\'s activity, needs a full key), `list_api_keys` (your keys and connected apps with their end dates, last use and whether Zaisma turned one off; needs a full key), the sign-in apps\' `list_sign_in_apps`, `create_sign_in_app`, `update_sign_in_app` and `delete_sign_in_app`, hosting credit\'s `get_credit`, `top_up_credit`, `refund_top_up`, `start_ai_review`, `start_credit_plan`, `change_credit_plan`, `stop_credit_plan` and `get_spending_request` (see Hosting and credit below), Zaisma Pro\'s `get_pro`, `start_pro`, `cancel_pro`, `resume_pro` and `refund_pro` (see Zaisma Pro below), `get_storage`, `set_storage_budget`, `delete_version` and `delete_game`, `bring_back_game`, `erase_game_now`, `get_game_deletion_request` (see Storage below), the Stripe account\'s `get_stripe_account`, `connect_stripe_account`, `update_stripe_account` and `disconnect_stripe_account` (see Selling with the buy sheet below), the webhooks\' `list_webhooks`, `create_webhook`, `update_webhook`, `delete_webhook`, `test_webhook` and `list_webhook_deliveries` (see Webhooks below), a game\'s secrets\' `list_secrets`, `set_secret` and `delete_secret` (see Secrets below), the items\' `list_items`, `set_item`, `remove_item`, `set_purchase_settings`, `grant_item`, `list_purchases`, `get_purchase`, `refund_purchase`, `mark_purchase_handled` and `get_player_items` (see Items and purchases below), a game\'s kept rooms\' `list_kept_rooms`, `delete_kept_room`, `bring_back_kept_room` and `erase_kept_room_now`, `restore_kept_room`, `undo_kept_room_restore`, `list_kept_room_restores`, `restore_every_kept_room`, `get_kept_room_restore_batch`, `undo_every_kept_room_restore` (see Kept rooms below), a game\'s live rooms\' `list_rooms`, `get_room`, `send_room_message`, `send_to_every_room`, `list_room_messages`, `cancel_room_message`, `kick_player` and `end_room` (see Reaching live rooms below), the game database\'s `get_database`, `query_database`, `batch_database`, `export_database`, `import_database`, `erase_player`, `restore_database` and `undo_database_restore` (see The game database below), cloud saves\' `list_saves`, `get_save`, `change_save`, `replace_save`, `reset_save`, `list_save_copies`, `get_save_copy` and `restore_save_copy` (see Cloud saves below), and the developer forum\'s `search_forum`, `get_topic`, `post_topic`, `message_zaisma`, `reply_to_topic`, `vote`, `rate_post`, `bookmark_post`, `report_post`, `forum_people`, `still_happening`, `flag_misplaced`, `follow_topic` and `mark_answer` (see The developer forum below). Bigger builds go through the upload command. Making a game players can play private or a draft again, and ending a live room (`end_room`), need `"confirm": true`, so the AI asks you first.\n\nEvery tool has an output schema, and answers are compact JSON. Arguments are closed: one a tool doesn\'t take is refused (`unknown_field`, with the arguments it does take), never quietly dropped, and a missing required one is `missing_field`. A refused call is a tool result with `isError: true`, the error object below as its `structuredContent` and its message, fix and code as its text; each tool\'s listed output schema is its answer or that error, because MCP clients check both against it. The tools that are easy to get wrong (`update_game`, `check_game`, `upload_files`, `publish_version`, `search_forum`, `post_topic`, `change_save`, `replace_save`, `set_secret`) carry good examples in their input schema and bad ones at the end of their description.\n\n## Teaching your AI\n\nZaisma teaches any AI its own workflow, the same way everywhere, from one source in the repository (`skills/zaisma/`, the open SKILL.md format):\n\n- **The skill.** `npx @zaisma/cli skill` installs the Zaisma skill into every AI tool it finds on the computer: Claude Code (`~/.claude/skills/zaisma`), Codex (`~/.codex/skills/zaisma`), Cursor (`~/.cursor/skills/zaisma`), Gemini CLI (`~/.gemini/skills/zaisma`), and the shared `~/.agents/skills/zaisma` that several tools read. It writes only where a tool\'s own folder is already there (and always the shared one), lists each folder and asks once first; `--yes` skips the question, `--project` installs into the current project\'s folders instead, and `--folder <folder>` into one folder only. With `--json` it needs `--yes` (`install_not_confirmed` otherwise) and answers `{ installed_copies: [{ tool, folder }], skipped_tools }`. It never writes over a `zaisma` skill it didn\'t install (`skill_not_ours`). Every later run of any `zaisma` command updates the copies it installed to its own version, saying so in one line (with `--json`, a `skill_updates` list of `{ tool, folder, from_version, to_version }` in the answer).\n- **The Claude Code plugin,** the MCP and the skill together, from this repository: `/plugin marketplace add zaisma/zaisma`, then `/plugin install zaisma@zaisma`.\n- **The MCP\'s resources and prompts.** With nothing installed, any AI connected to the MCP reads the same skill: resources `zaisma://skill` (read first), `zaisma://sdk`, `zaisma://naming`, `zaisma://errors`, `zaisma://game-server` and `zaisma://developer-api` (this page), and the guides `zaisma://multiplayer`, `zaisma://loading`, `zaisma://phones` and `zaisma://saves`, each opened only when the game needs it (`resources/list`, `resources/read`, all `text/markdown`). Three prompts start from the moments an AI starts from (`prompts/list`, `prompts/get`): `make_game` (`idea`), `publish_game` (`slug`) and `fix_problem` (`slug`, and `error_code` or `version_id`, one of them).\n- **llms.txt.** `https://zaisma.com/llms.txt` answers "tell me about Zaisma" in the llms.txt format; `https://zaisma.com/llms-full.txt` is the skill, this page and the SDK reference in one file.\n- **Error pages.** Every error code has its own page, `https://zaisma.com/developers/errors/<code>` (all of them at `/developers/errors`), with what it means and the general fix, and every error answer links it as `help_url`.\n\n## Errors\n\nEvery error, in the API and the MCP, has the same shape:\n\n```json\n{"error": {"code": "bad_play_modes", "message": "The online mode\'s play_style is missing or isn\'t co-op, versus or both.", "field": "play_modes[1].play_style", "fix": "Give play_style: co-op (together), versus (against each other) or both, like { \\"mode\\": \\"online\\", \\"minimum_player_count\\": 2, \\"maximum_player_count\\": 4, \\"play_style\\": \\"co-op\\" }.", "message_for_people": "One of the ways to play isn\'t one Zaisma knows. Check Players and save again.", "retry_after_sec": null, "help_url": "https://zaisma.com/developers/errors/bad_play_modes"}}\n```\n\n- `code`: stable, one problem per code, from the list below; search the forum with it (`search_forum`) to find others who hit it. Codes named `bad_<field>` mean that input\'s value isn\'t one the call takes.\n- `message`: what happened, in one sentence.\n- `field`: the input at fault, with its place in a list when it\'s in one (`files[3].path`, `debug_context.call`), or `null`.\n- `fix`: what to do about it, naming the call or the value when there is one.\n- `message_for_people`: what happened and what to do, in a page\'s words, naming no call or field: the only text Zaisma\'s pages show. Show it to your human as it is when they should read what the dashboard would say.\n- `retry_after_sec`: how long to wait when waiting helps (`slow_down`, `post_limit`, `still_scanning`), also sent as the `Retry-After` header; otherwise `null`.\n- `help_url`: the code\'s page, `https://zaisma.com/developers/errors/<code>`: what it means and the general fix. The fix in the answer is for this case, and comes first.\n- `confirm_url`: only with `confirmation_needed`, where the developer does it themselves on zaisma.com with their passkey (see Hosting and credit).\n- `spending_request_id`: only with `confirmation_needed` for a raise in spending; `GET /spending-requests/:spending_request_id` checks the developer\'s answer (IDs `spending_request_\u2026`).\n- `game_deletion_request_id`: only with `confirmation_needed` for deleting a game or erasing a kept room\'s world; `GET /games/:slug/deletion-requests/:game_deletion_request_id` checks the developer\'s answer (IDs `game_deletion_request_\u2026`).\n\nThe HTTP status goes with the code, as listed. The list lives in `ERROR_CODES` (`packages/core/src/errors.ts`), and a test keeps this page in step with it.\n\n**Signing in and requests**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_key` | 401 | The MCP was called without an API key or a connected app\'s token. |\n| `bad_key` | 401 | The API key isn\'t valid: removed, mistyped or never made. |\n| `key_turned_off` | 401 | The API key was found in public and turned off for good. |\n| `key_ended` | 401 | The API key reached the end date it was made with. |\n| `access_token_ended` | 401 | A connected app\'s access token is past its hour; the app refreshes it by itself. |\n| `token_not_for_api` | 401 | A connected app\'s token works only at the MCP, not the REST API. |\n| `signed_out` | 401 | No API key, and no signed-in session. |\n| `no_account` | 401 | The account isn\'t finished yet. |\n| `bad_origin` | 403 | A call with a session came from another site. |\n| `key_not_allowed` | 403 | The API key is limited to other games, or its access doesn\'t cover the call. |\n| `slow_down` | 429 | Too many calls in a minute. |\n| `not_found` | 404 | There\'s no API call at that path. |\n| `bad_method` | 405 | The path doesn\'t take that method. |\n| `gone` | 410 | The call was removed, like the first feedback calls. |\n| `bad_json` | 400 | The body isn\'t a JSON object. |\n| `json_too_big` | 413 | The JSON body is over the call\'s size limit. |\n| `wrong_shape` | 400 | A field that isn\'t the type or size its call takes, refused before any of the call\'s own code runs. |\n| `unknown_field` | 400 | A field, argument or query parameter the call doesn\'t take. |\n| `missing_field` | 400 | A field the call needs wasn\'t sent. |\n| `wrong_id_kind` | 400 | An ID of another kind was sent, like an image ID as version_id. |\n| `internal_error` | 500 | Something broke on Zaisma\'s side. |\n\n**Games**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_game` | 404 | You have no game with that slug. |\n| `bad_slug` | 400 | The link name isn\'t lowercase letters, numbers and single hyphens, or is reserved. |\n| `slug_taken` | 409 | Another game has that link name, or a deleted game had it. |\n| `too_many_games` | 403 | The account has as many games as it can have. |\n| `account_banned` | 403 | Zaisma banned the account\'s developer side, or the whole account: only get_access, list_games and export_game work, and for a whole-account ban nothing does. |\n| `account_paused` | 403 | A person at Zaisma needs to look at the account: until then it can\'t make, upload or publish games, or post on the forum. |\n| `publishing_not_open` | 403 | Until the beta, only accounts Zaisma adds can make, upload and publish games. |\n| `bad_title` | 400 | A game\'s, topic\'s or precedent\'s title is empty or too long. |\n| `title_names_zaisma` | 400 | A game\'s title holds the whole word Zaisma, which only Zaisma\'s own games can use. |\n| `bad_description` | 400 | The description isn\'t text of up to 500 characters. |\n| `bad_visibility` | 400 | visibility isn\'t draft, listed, unlisted or private. |\n| `bad_devices` | 400 | devices isn\'t a list of phone, tablet and computer. |\n| `bad_genres` | 400 | genres isn\'t a list of up to 3 of Zaisma\'s genres. |\n| `bad_controls` | 400 | controls isn\'t a list of touch, keyboard_mouse and gamepad. |\n| `bad_screen_orientation` | 400 | screen_orientation isn\'t portrait, landscape, either or null. |\n| `bad_play_modes` | 400 | play_modes isn\'t a list of play modes, or one of them is wrong. |\n| `bad_cloud_saves_enabled` | 400 | cloud_saves_enabled isn\'t true or false. |\n| `bad_account_offer_enabled` | 400 | account_offer_enabled isn\'t true or false. |\n| `bad_deleted_account_erase_enabled` | 400 | deleted_account_erase_enabled isn\'t true or false. |\n| `bad_friend_joins_enabled` | 400 | friend_joins_enabled isn\'t true or false. |\n| `bad_performance_measuring_enabled` | 400 | performance_measuring_enabled isn\'t true or false. |\n| `bad_room_browsing` | 400 | room_browsing isn\'t page, game or off. |\n| `bad_multiplayer_mode` | 400 | multiplayer_mode isn\'t none, relay or own. |\n| `bad_account_requirement` | 400 | account_requirement isn\'t none, multiplayer or whole_game. |\n| `bad_minimum_player_age` | 400 | minimum_player_age_years isn\'t 13, 16 or 18. |\n| `accounts_needed_for_minimum_age` | 400 | A game for 16 or 18 and up needs account_requirement whole_game, since only accounts have an age. |\n| `content_needs_minimum_age` | 409 | A version shows lifelike gore, which plays only in games for 16 and up. |\n| `gallery_picture_needed` | 409 | A listed game needs at least one gallery picture. |\n| `bad_links` | 400 | links isn\'t a list of up to 20 { link_name, destination_url, is_on_game_page } with names of their own and https addresses that aren\'t link shorteners, IP addresses, addresses with a user name, or on Zaisma\'s own domains. |\n| `bad_own_server_urls` | 400 | own_server_urls isn\'t a list of up to 5 server addresses like wss://play.example.com, or one is an IP address, this computer or on Zaisma\'s own domains. |\n| `bad_game_server_allowed_hosts` | 400 | game_server_allowed_hosts isn\'t a list of up to 20 host names (like discord.com or *.example.com), or one is an IP address or on Zaisma\'s own domains. |\n| `built_in_server` | 403 | The game runs a game server built into Zaisma, which only Zaisma changes. |\n| `game_removed` | 403 | Zaisma took the game down, so this can\'t change. |\n| `needs_confirm` | 409 | Hiding a game players can play, or ending a live room, needs the developer\'s OK. |\n| `bad_period_duration_days` | 400 | period_duration_days isn\'t a whole number from 1 to 90. |\n| `bad_cursor` | 400 | cursor isn\'t a next_cursor from an earlier answer. |\n\n**Players**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_player` | 404 | No account has that player ID: a guest\'s, or a deleted account\'s. |\n\n**Covers, gallery pictures, backgrounds and other images**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_kind` | 400 | kind isn\'t one of the choices the call takes. |\n| `not_an_image` | 415 | The file isn\'t an image of a type the call takes. |\n| `image_too_big` | 413 | The image is over 10 MB. |\n| `bad_image_dimensions` | 400 | The image is smaller than its kind\'s least size (a cover or gallery picture 1280 by 720, a square cover 512, a share picture 600 by 315), or over 8,192 px on a side. |\n| `not_square` | 400 | A square cover isn\'t as wide as it is tall. |\n| `too_many_gallery_pictures` | 400 | The game has 8 gallery pictures already. |\n| `image_refused` | 422 | The image can\'t be used. |\n| `no_image` | 404 | The game has no image with that ID. |\n| `no_file` | 400 | A form on Zaisma\'s pages was sent without its image. |\n| `bad_background_shape` | 400 | A wide background is landscape (1.3 to 2.4 times as wide as tall), a phone background portrait (1.6 to 2.4 times as tall as wide), and its long side at least 1600 px. |\n| `not_a_shader` | 400 | A shader\'s pass isn\'t GLSL text with a mainImage function, or has its own main(), a #version or #extension line, texture2D, iMouse or sound. |\n| `shader_too_big` | 413 | A shader\'s pass is over 64 KB. |\n| `bad_buffers` | 400 | buffers isn\'t a list of { buffer_name, source, channels } with buffer_name a, b, c or d, each once. |\n| `too_many_buffers` | 400 | A shader has more than 4 buffers. |\n| `bad_shader_channel` | 400 | A channel isn\'t { channel_index 0 to 3, input_kind, buffer_name or image_id, filter, wrap }, names a buffer the shader doesn\'t have, or a texture that isn\'t an approved shader_texture of the game. |\n| `shader_texture_too_big` | 413 | A shader texture is over 8 MB, or over 4,096 px on a side. |\n| `too_many_shader_textures` | 400 | The game has 16 shader textures already, or a shader\'s channels name more than 4. |\n| `shader_texture_in_use` | 409 | A shader the game keeps reads this texture. |\n| `daily_shader_checks_used` | 429 | The account has run 100 shader checks in the last day. |\n| `daily_page_previews_used` | 429 | The account has run every page preview its plan has in the last day (20, or 60 with Pro). |\n| `page_preview_unavailable` | 503 | Zaisma can\'t open pages in Chrome right now, so it can\'t picture them. |\n| `bad_page_preview_images` | 400 | images isn\'t a list of up to 8 { kind, image_base64 } or { kind, image_id }, with kind cover, share, screenshot, background or phone_background. |\n| `bad_page_preview_shaders` | 400 | shaders isn\'t a list of { screen, image, buffers } with each screen at most once. |\n| `shader_check_unavailable` | 503 | Zaisma can\'t draw shaders here right now, so it can\'t check one. |\n| `no_shader` | 404 | The game has no shader with that ID. |\n| `bad_screen` | 400 | screen isn\'t wide or phone. |\n| `bad_background_source` | 400 | source isn\'t zaisma, image or shader, or wide (which only phone takes). |\n| `background_not_ready` | 409 | The image or shader isn\'t this game\'s, isn\'t approved yet, or is for the other screen. |\n| `bad_color` | 400 | The color isn\'t #RRGGBB. |\n\n**Uploading versions**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_files` | 400 | files isn\'t a list of files in the shape the call takes. |\n| `bad_path` | 400 | A file\'s path is absolute, has . or .. in it, has control characters or is over 200 characters. |\n| `hidden_file` | 400 | A file or folder\'s name starts with a dot. |\n| `precompressed_file` | 400 | A file is pre-compressed (.gz or .br). |\n| `file_type_not_allowed` | 400 | A file is of a type games can\'t have. |\n| `file_too_big` | 413 | A file is over 500 MB. |\n| `duplicate_path` | 400 | Two files share a path. |\n| `no_index_html` | 400 | There\'s no index.html at the top of the game. |\n| `too_many_files` | 400 | The game has more than 20,000 files. |\n| `storage_full` | 413 | The upload doesn\'t fit in what the account can store. |\n| `new_data_limit` | 429 | The account has sent all the new data it can today, counted from UTC midnight. |\n| `too_big_for_mcp` | 413 | upload_files and check_game take up to 5 MB; bigger builds go through the upload command. |\n| `bad_base64` | 400 | Something sent as base64 isn\'t valid base64. |\n| `files_missing` | 409 | Some of the version\'s files haven\'t been sent yet. |\n| `bad_patch_notes` | 400 | patch_notes isn\'t text of up to 2,000 characters, or a publish changed them on a version that has been live. |\n| `bad_is_big_update` | 400 | is_big_update isn\'t true or false, or an upload sent it without publish_when_approved. |\n| `big_update_needs_patch_notes` | 400 | A big update has no patch_notes, and a big update must say what\'s new. |\n| `big_update_already_live` | 400 | The version has been live already, and only a version going live for the first time can be a big update. |\n| `bad_publish_when_approved` | 400 | publish_when_approved isn\'t true or false. |\n| `bad_publish_after_ai_review_enabled` | 400 | publish_after_ai_review_enabled isn\'t true or false, or it came with nothing to publish. |\n| `bad_match_update_mode` | 400 | match_update_mode isn\'t next_match or now, or it came without publish_when_approved. |\n| `version_limit` | 429 | The game has had 100 versions in the last day. |\n| `version_in_use` | 409 | The version can\'t be deleted: it\'s live, set to publish, or a tester link picked it. |\n| `kept_for_review` | 403 | The version or game is kept for a person at Zaisma, so it can\'t be deleted. |\n| `bad_confirm_slug` | 400 | confirm_slug isn\'t the game\'s link name. |\n| `not_waiting_to_erase` | 409 | The game isn\'t deleted and waiting to be erased, so there\'s nothing to bring back or erase now. |\n| `already_erasing` | 409 | The game\'s week is over and its erasing has started, so it can\'t be brought back. |\n| `played_by_others` | 409 | Other people played this game, so it waits out its week before it\'s erased; only a game nobody but its developer played can be erased at once. |\n| `no_game_deletion_request` | 404 | This game has no deletion request with that ID. |\n| `bad_monthly_storage_budget_cents` | 400 | monthly_storage_budget_cents isn\'t null or a whole number from 100 to 1,000,000. |\n| `no_content_length` | 411 | A file was sent without a Content-Length header. |\n| `file_needs_parts` | 413 | A file over 95 MB was sent in one go. |\n| `no_body` | 400 | A file was sent without a body. |\n| `hash_mismatch` | 400 | A file doesn\'t match the SHA-256 it was sent as. |\n| `forbidden_file` | 400 | A file is a program or an archive, whatever its name says. |\n| `bad_size_bytes` | 400 | size_bytes isn\'t a whole number above 0. |\n| `bad_part_number` | 400 | A part\'s number isn\'t from 1 to 10,000. |\n| `no_upload_id` | 400 | A part was sent without its upload_id. |\n| `bad_part_size` | 400 | A part is empty, over 50 MB or has no Content-Length header. |\n| `upload_closed` | 400 | The upload_id isn\'t an open upload any more. |\n| `bad_parts` | 400 | The finishing call isn\'t { upload_id, parts: [{ part_number, etag }] }. |\n| `parts_incomplete` | 400 | The parts sent don\'t make a whole file. |\n\n**Versions and publishing**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_version` | 404 | The game has no version with that ID. |\n| `bad_time` | 400 | A time isn\'t an ISO time in the range it takes: scheduled_publish_at from a few minutes to 90 days ahead, a tester link\'s ends_at from now to a year ahead, a database restore\'s restore_to_at within the last 30 days and not before the game was made, a room message\'s send_at from 10 seconds to 90 days ahead, and a What\'s on entry\'s starts_at from an hour ago to 90 days ahead and its ends_at after now and starts_at and at most 60 days after it. |\n| `still_scanning` | 409 | The version is still being scanned. |\n| `not_approved` | 409 | The version didn\'t pass review, so it can\'t be published. |\n\n**Tester links**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_name` | 400 | A tester link\'s or sign-in app\'s name isn\'t 1 to 60 characters, or a sign-in app\'s says Zaisma. |\n| `too_many_tester_links` | 403 | The game has 50 tester links on already. |\n| `no_tester_link` | 404 | The game has no tester link on with that ID. |\n| `bad_version_choice` | 400 | version_choice isn\'t live, newest_passed or picked, or picked_version_id doesn\'t go with it. |\n\n**Sign in with Zaisma**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_redirect_urls` | 400 | redirect_urls isn\'t a list of 1 to 10 https URLs (http only for localhost) without #fragments. |\n| `bad_replace_client_secret` | 400 | replace_client_secret isn\'t true or false, or the app is public and has no client secret. |\n| `too_many_sign_in_apps` | 403 | The account has 20 sign-in apps already. |\n| `no_sign_in_app` | 404 | You have no sign-in app with that ID. |\n| `bad_destination_kind` | 400 | destination_kind isn\'t endpoint_url or game_server. |\n| `bad_endpoint_url` | 400 | endpoint_url isn\'t an https URL on a name (no IP address, user name or #fragment), or it\'s on Zaisma\'s own domains, or it\'s given for a webhook to a game server, which has none. |\n| `bad_event_kinds` | 400 | event_kinds isn\'t a list of 1 or more of the webhook event kinds. |\n| `bad_game_slugs` | 400 | game_slugs isn\'t null or a list of 1 to 50 of your games\' slugs, or, for a webhook to a game server, a list of the one game whose server it is. |\n| `bad_replace_signing_secret` | 400 | replace_signing_secret isn\'t true or false. |\n| `too_many_webhooks` | 403 | The account has 10 webhooks already. |\n| `no_webhook` | 404 | You have no webhook with that ID. |\n\n**The game database**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_sql` | 400 | The SQL isn\'t one statement SQLite takes, or statements isn\'t a list of { sql, values }. |\n| `bad_values` | 400 | values isn\'t a list of text, numbers, null and { blob_base64 } for the SQL\'s ?s. |\n| `bad_player_id` | 400 | player_id isn\'t a player ID (player_\u2026). |\n| `too_many_rows` | 400 | A statement answered more than 10,000 rows. |\n| `integer_too_large` | 400 | A statement answered a whole number past 2^53, which JavaScript can\'t hold exactly. |\n| `answer_too_big` | 400 | The rows answered come to more than 8 MB. |\n| `database_full` | 403 | The statement would grow the game\'s storage (its database and kept rooms) past the 10 GB a game can keep. |\n| `database_unavailable` | 503 | The game\'s database didn\'t answer. |\n| `database_restore_unavailable` | 501 | This Zaisma\'s game databases can\'t go back in time: its storage keeps no history, like a local preview. |\n| `no_database_restore` | 404 | The game has no database restore with that ID in the last 30 days. |\n| `bad_secret_name` | 400 | A secret\'s name isn\'t capitals, digits and underscores starting with a capital, up to 64 characters. |\n| `bad_secret_value` | 400 | secret_value isn\'t text of up to 8 KB. |\n| `no_secret` | 404 | The game has no secret by that name. |\n| `too_many_secrets` | 403 | The game has 50 secrets, the most it can have. |\n| `secrets_unavailable` | 503 | The game\'s secrets didn\'t answer. |\n| `no_kept_room` | 404 | The game has no kept room with that code. |\n| `no_kept_room_restore` | 404 | The kept room has no restore with that ID in the last 30 days. |\n| `no_kept_room_restore_batch` | 404 | The game has no restore of every kept room with that ID in the last 30 days. |\n| `kept_room_restore_unavailable` | 501 | This Zaisma\'s rooms can\'t go back in time: their storage keeps no history, like a local preview. |\n| `kept_room_restore_batch_running` | 409 | The game\'s kept rooms are going back to a moment already, and one batch runs at a time. |\n| `kept_room_copies_unavailable` | 501 | This Zaisma can\'t read its kept rooms\' copies, so an erased kept room can\'t come back. |\n| `no_kept_room_copy` | 404 | No copy of the deleted world is left: a copy lasts about 28 days after a world is deleted. |\n| `room_code_in_use` | 409 | Another room of the game has that code now, so the deleted world can\'t come back under it. |\n| `game_storage_full` | 403 | The deleted world doesn\'t fit in the 10 GB a game can keep. |\n| `kept_room_not_waiting` | 409 | The kept room isn\'t deleted and waiting to be erased, so there\'s nothing to bring back or erase now. |\n| `kept_room_erasing` | 409 | The kept room\'s week is over and its erasing has started: in a minute it comes back only from its last copy. |\n| `no_room` | 404 | The game has no live room with that code on Zaisma. |\n| `no_player_in_room` | 404 | That player isn\'t in the room now. |\n| `bad_room_message` | 400 | message isn\'t plain JSON of up to 16 KB. |\n| `bad_labels` | 400 | labels isn\'t a list of up to 4 labels, each { label_name, label_value } of text. |\n| `bad_kick_message` | 400 | A kick\'s message isn\'t text of up to 200 characters. |\n| `bad_end_message` | 400 | An end\'s message isn\'t text of up to 200 characters. |\n| `room_busy` | 429 | The room took 100 room messages in the last second. |\n| `every_room_send_limit` | 429 | The game sent to every room 10 times in the last minute, from its game server, the API and the MCP together. |\n| `too_many_scheduled_room_messages` | 409 | The game has 100 scheduled room messages waiting, the most it can have. |\n| `no_scheduled_room_message` | 404 | The game has no scheduled room message with that ID waiting. |\n| `dump_too_big` | 413 | dump_sql is over 5 MB: import a dump in parts, each ending on a whole statement. |\n\n**Hosting and credit**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `hosting_paused` | 429 | The game\'s hosting is paused this month: its free allowance, its budget or its developer\'s credit is used, or Zaisma\'s free hosting ran out and it has no budget with credit, or it has no real players and games with none used their share. It starts again when the month resets, the budget is raised or credit is added. |\n| `confirmation_needed` | 403 | This needs the developer\'s passkey on zaisma.com (turning spending on or up, connecting a Stripe account, deleting a game other people played, or erasing a waiting game or kept room\'s world at once): confirm_url is where they do it. |\n| `bad_monthly_budget_cents` | 400 | monthly_budget_cents isn\'t a whole number of cents of at least 100 ($1), or null for no paid hosting. |\n| `bad_top_up_amount` | 400 | amount_cents isn\'t a whole number of cents from 1,000 ($10) to 100,000 ($1,000). |\n| `account_not_protected` | 403 | The account has no passkey and no email yet, and a top-up keeps a card, so it needs one of them first: add a passkey or an email on zaisma.com/account. |\n| `money_paused` | 423 | Top-ups and credit refunds on this account passed USD 2,000.00 in a day, so both are paused until a person at Zaisma looks. Credit already there keeps working. The developer gets an email when they\'re on again. |\n| `new_payer_limit` | 403 | A new account, or an account with a newly saved card, pays up to USD 100.00 in all, buys and credit together, in its first 7 days; this payment would go past it. The message says the day it lifts. |\n| `no_top_up` | 404 | You have no top-up with that ID. |\n| `no_spending_request` | 404 | You have no spending request with that ID. |\n| `top_up_not_refundable` | 409 | The top-up has nothing left to refund: it\'s spent, refunded, or over 30 days old. |\n| `bad_refill_level_cents` | 400 | refill_level_cents isn\'t a whole number of cents from 1,000 ($10) to 1,000,000 ($10,000). |\n| `already_credit_plan` | 409 | The developer already has a monthly credit plan, so there\'s nothing to start: change its level or stop it. |\n| `no_credit_plan` | 409 | The developer has no monthly credit plan to change or stop. |\n| `already_pro` | 409 | The developer already has a Zaisma Pro subscription (running, cancelled until the month ends, or a renewal Stripe is retrying), so there\'s nothing to start. |\n| `pro_not_refundable` | 409 | Zaisma Pro\'s payment can\'t be refunded: only the first payment, within 14 days of it, and only while it\'s the only one. |\n| `not_pro` | 409 | There\'s nothing to cancel or resume: the developer has no Zaisma Pro, or it\'s already cancelled (or isn\'t cancelled). |\n| `stripe_unavailable` | 503 | Stripe didn\'t answer, or this Zaisma has no Stripe account set up. |\n\n**A game server\'s logs**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_room_code` | 400 | room_code isn\'t a room\'s code: six characters like K7Q2MX. |\n| `bad_minimum_level` | 400 | minimum_level isn\'t debug, info, warn or error. |\n| `bad_source_kind` | 400 | source_kind isn\'t room, request, schedule or webhook. |\n| `bad_search_text` | 400 | search_text is empty or over 200 characters. |\n| `bad_maximum_line_count` | 400 | maximum_line_count isn\'t a whole number from 1 to 500. |\n| `two_log_cursors` | 400 | get_logs got both cursor and new_lines_cursor. |\n\n**Items and purchases**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_item` | 404 | The game has no item by that name. |\n| `too_many_items` | 400 | The game has 1,000 items, the most it can have. |\n| `bad_item` | 400 | An item\'s name, title, description, kind, category, price or local prices isn\'t one set_item takes; field says which. |\n| `unsupported_currency` | 400 | Zaisma doesn\'t price in that currency. |\n| `price_too_low` | 400 | The price is under the least Stripe charges in its currency. |\n| `refund_policy_needed` | 409 | A game that sells anything states its refund policy first. |\n| `bad_refund_policy` | 400 | refund_policy isn\'t no_refunds, unused_within_14_days, within_14_days, own_words or null. |\n| `bad_refund_policy_text` | 400 | refund_policy_text isn\'t up to 600 characters of plain words, or doesn\'t go with refund_policy own_words. |\n| `bad_own_payment_categories` | 400 | own_payment_categories isn\'t a list of cosmetic, gameplay, content and currency. |\n| `item_has_owners` | 409 | Players bought or were granted the item, so it can\'t be removed; take its price off to stop selling it. |\n| `bad_item_count` | 400 | item_count isn\'t a whole number from 1 to 1,000, isn\'t 1 for a permanent item, or makes a buy\'s total more than 99,999,999 minor units. |\n| `bad_game_account_id` | 400 | game_account_id isn\'t text of up to 200 characters, or null. |\n| `bad_purchase_source` | 400 | purchase_source isn\'t sale or grant. |\n| `bad_purchase_status` | 400 | purchase_status isn\'t pending, completed, failed, refunded or charged_back. |\n| `no_purchase` | 404 | The game has no purchase with that ID. |\n| `already_refunded` | 409 | The purchase was refunded or charged back already. |\n| `stripe_not_connected` | 409 | Selling with the buy sheet, and refunding a sale, go through the developer\'s own Stripe account, which isn\'t connected: connect_stripe_account. |\n| `stripe_cannot_take_payments` | 409 | The developer\'s Stripe account is connected, but Stripe hasn\'t turned on payments for it yet: finish setting it up on Stripe\'s dashboard. |\n| `stripe_account_banned` | 403 | The Stripe account was banned from Zaisma with the account that connected it, so it can\'t be connected again. |\n| `email_banned` | 403 | The email was banned from Zaisma with the account it was on, so it can\'t be added to an account. |\n| `bad_is_stripe_tax_used` | 400 | is_stripe_tax_used isn\'t true or false. |\n| `bad_amount_minor_units` | 400 | amount_minor_units isn\'t a whole number from 1 to what\'s left of the sale to refund. |\n| `purchase_not_paid` | 409 | The sale wasn\'t paid (pending or failed), so there\'s nothing to refund. |\n| `not_for_sale` | 409 | The item has no price, so players can\'t buy it; it\'s only granted. |\n| `receipts_unavailable` | 503 | Zaisma couldn\'t sign the purchase\'s receipt at that moment. A grant answered with it wasn\'t made, so trying again grants it once. |\n| `bad_purchase_delivery` | 400 | purchase_delivery isn\'t game, game_server or own_server. |\n| `no_game_server` | 409 | purchase_delivery game_server needs a game server, on Zaisma or the developer\'s own, and the game has none. |\n| `already_handled` | 409 | The purchase was handed over already, or its refund was told already. |\n| `handled_by_server` | 409 | The game\'s purchases go to its game server or the developer\'s own server (purchase_delivery), so the game can\'t mark them handled. |\n| `bad_full_game_item` | 400 | full_game_item_name doesn\'t name one of the game\'s items that\'s permanent and content, or the game is another game\'s demo. |\n| `full_game_item_in_use` | 409 | The item is the game\'s full game (full_game_item_name), so it can\'t be removed or stop being permanent and content. |\n| `bad_demo_game` | 400 | demo_game_slug isn\'t another of the developer\'s games that\'s free to play, or the game itself is free to play. |\n| `account_requirement_locked` | 400 | A game that sells itself (full_game_item_name) needs account_requirement whole_game, since only accounts own it. |\n| `full_game_not_owned` | 403 | The game sells itself, and the player\'s account doesn\'t own it: buy it on its game page. |\n\n**Cloud saves**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_save` | 404 | The player has no save in the game. |\n| `no_save_copy` | 404 | The player\'s save has no earlier version with that ID. |\n| `bad_keys` | 400 | keys isn\'t a list of 1 to 100 localStorage keys of up to 1,000 characters. |\n| `bad_local_storage_items` | 400 | local_storage_items isn\'t an object of localStorage keys and their text (null removes a key in a change). |\n| `bad_indexeddb_databases` | 400 | indexeddb_databases isn\'t a list of databases, each { name, version, stores } as get_save answers them. |\n| `save_too_big` | 413 | The save would be over 5 MB. |\n| `cloud_saves_off` | 409 | The game has cloud saves off, so it doesn\'t read saves from players\' accounts. |\n| `cloud_saves_not_here` | 409 | Cloud saves don\'t work here: this is a tester link, or this Zaisma has no accounts. The game page answers it to `Zaisma.saves` and `Zaisma.player.offerAccount()`; no API or MCP call returns it. |\n| `save_busy` | 409 | The player\'s game kept saving at the same moment, so the change didn\'t go through. |\n\n**The developer forum**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_topic` | 404 | There\'s no topic with that ID you can see. |\n| `no_post` | 404 | There\'s no post with that ID you can see in the topic. |\n| `no_known_issue` | 404 | There\'s no known issue with that ID. |\n| `no_media` | 404 | There\'s no image there you can see. |\n| `bad_tab` | 400 | tab isn\'t latest, top, unanswered, known, yours, messages or bookmarks. |\n| `bad_section` | 400 | section isn\'t one of the forum\'s sections. |\n| `bad_category` | 400 | category isn\'t one of the forum\'s categories. |\n| `no_category` | 400 | A public topic was sent without its category. |\n| `bad_tag` | 400 | tag isn\'t one of the forum\'s tags. |\n| `bad_tags` | 400 | tags isn\'t a list of up to 3 of the forum\'s tags. |\n| `bad_topic_status` | 400 | topic_status isn\'t one of the statuses. |\n| `bad_is_answered` | 400 | is_answered isn\'t true or false. |\n| `bad_maximum_topic_count` | 400 | maximum_topic_count isn\'t a whole number from 1 to 30. |\n| `bad_detail` | 400 | detail isn\'t brief. |\n| `bad_post_selection` | 400 | post_selection isn\'t all, answer, latest or none. |\n| `bad_is_public` | 400 | is_public isn\'t true or false. |\n| `bad_text_markdown` | 400 | text_markdown is empty or over 8,000 characters. |\n| `bad_author_kind` | 400 | author_kind isn\'t developer or ai. |\n| `bad_debug_context` | 400 | debug_context isn\'t an object of its five text fields, up to 8,000 characters in all. |\n| `bad_images_base64` | 400 | images_base64 isn\'t a list of base64 images. |\n| `too_many_images` | 400 | A post carries more than 10 images. |\n| `bad_reopen` | 400 | reopen isn\'t true or false. |\n| `bad_answer_post_id` | 400 | answer_post_id isn\'t a post ID or null. |\n| `bad_reason` | 400 | reason isn\'t one of the report reasons. |\n| `post_limit` | 429 | The account has posted 100 times in the last day. |\n| `image_limit` | 429 | The account has uploaded 200 forum images in the last day. |\n| `not_yours` | 403 | Only the developer who started the topic can do that. |\n| `not_a_question` | 400 | Only a question has an answer to mark. |\n| `not_closed` | 400 | The topic isn\'t closed, so there\'s nothing to reopen. |\n| `not_released` | 400 | The topic isn\'t a known issue whose fix is out. |\n| `cant_vote` | 400 | The topic doesn\'t take your vote: it\'s yours, private, or a discussion. |\n| `cant_flag` | 400 | Only public topics others can see can be flagged as misplaced. |\n| `retired_tool` | 410 | The tool is retired; the error names the one that replaces it. |\n| `bad_rating` | 400 | rating isn\'t like or dislike. |\n| `cant_rate_post` | 400 | Only posts in public topics take likes and dislikes. |\n| `cant_rate_own_post` | 400 | Your own posts take no likes or dislikes from you. |\n| `cant_report` | 400 | The post can\'t be reported: it\'s yours, or Zaisma\'s. |\n\n## Next steps\n\nEvery call that changes something answers with `next_steps`: the calls that usually follow, ready to make, or `[]` when nothing does. The steps of sending files (`PUT /files/:sha256`, the parts calls and `POST /forum/media`) are the exception: their next call is always the one that uses them.\n\n```json\n"next_steps": [{"tool": "get_version", "arguments": {"slug": "sky-hopper", "version_id": "version_8f3k2m9q1x7c4v6b0n5z"}, "after_sec": 30, "reason": "The scan usually takes under a minute; once it passes, show the developer its preview_url."}]\n```\n\n- `tool` is the MCP tool\'s name (each maps to a call on this page); `arguments` are filled in as far as Zaisma knows, and `reason` says what to add (like a new game\'s files).\n- `after_sec`: how long to wait first, or `null` for straight away.\n- What follows today: a restored kept room, its undo and restores (`undo_kept_room_restore`, `list_kept_room_restores`); a restore of every kept room, its progress and the database and version calls with the same time (`get_kept_room_restore_batch`, `restore_database`, `publish_version`); a new game, its upload (`upload_files`); a new version, checking its scan (`get_version`); publishing while the game is a draft or private, making it `listed` when the developer wants players in (`update_game`); making a game `listed` or `unlisted` with nothing live, publishing the version that passed (`publish_version`), checking the one being scanned, or uploading one; `multiplayer_mode: "own"` without a game server, uploading one; scheduling a version still being scanned, checking its scan; a new webhook, or a new `endpoint_url` or signing secret, sending it a test event (`test_webhook`); a database restore, seeing the tables it went back to (`get_database`) and undoing it (`undo_database_restore`); an undo, `get_database`; a new image or shader, checking it (`get_game`); a shader check that passed, sending the same shader (`add_shader`, with its `image` and `buffers` to add); a new credit checkout or refund, `get_credit`; a new Zaisma Pro checkout or a Pro refund, `get_pro`; a kept room deleted, `list_kept_rooms`; a send to every room, `list_rooms`; a scheduled one, `list_room_messages` once it\'s due and `cancel_room_message`; a kick, `get_room`; an ended room, `list_rooms`; a secret set while the game server has no allowed hosts, `update_game` with `game_server_allowed_hosts`; a database import, `get_database`; `minimum_player_age_years` set to 16 or 18, which passes the versions held only for lifelike gore, `get_version`; a priced item before the Stripe account is connected or can take payments, and a new Stripe account connection, `get_stripe_account`. Other calls answer `[]` today; read `next_steps` on every answer, since more calls fill it within v1.\n\n## The AI review\n\nThe fixed checks (malware scan, image matching and Zaisma\'s own file checks) run on every upload, and any can stop it. The AI review follows for what other people can reach, and only the newest live version is reviewed, the same for every developer.\n\n- **A version only its developer can reach gets none and never waits:** a draft, or a live version of a `draft` or `private` game with no tester link on and nothing sold. Until a review lets it through, its `preview_url` opens only for the game\'s signed-in developer. An AI tests with `npx @zaisma/cli play-locally`, or starts the review.\n- **Before publishing,** `is_ai_review_needed_to_publish` says whether publishing starts a review, and `usual_ai_review_duration_min` how long a review like it usually takes, from recent real ones, not a promise: a batch can take much longer.\n- **While it runs,** `ai_review_step` says where it is (`waiting_for_daily_review`, `in_line`, `reading_files`, `judging`) and `ai_review_step_started_at` since when; waiting for a daily review, `ai_review_waiting_ahead_count` says how many of the account\'s reviews of the same size go first and `daily_review_free_at` when one frees up for it. The dashboard shows the same, and moves with it.\n- **A developer who has earned it** (`GET /access`, `standing.publish_before_ai_review_enabled`: established, a card that paid or a Stripe account that can take payments, with no ruling in 30 days) publishes straight away, with the review pending. With `publish_after_ai_review_enabled` it goes live only once it passes.\n- **Until then, what other people can reach waits for the review:** a publish stays off and goes live once it passes; a hidden game set `listed` or `unlisted` stays hidden, with `visibility_after_ai_review` saying what it becomes; a tester link says the game is being reviewed. A game\'s first review runs at full price in about a minute, and updates in half-price batches, usually under an hour. A tweak (nothing new in the evidence) reuses the earlier verdict.\n- **A game with 1,000 counted plays in the last 7 days** is reviewed at once, at full price.\n- **Ahead of a launch,** `POST /games/:slug/versions/:version_id/ai-review` (`start_ai_review`) starts a review without publishing. A scheduled release\'s review starts by itself up to a day before its time when other people can reach the game. If it isn\'t done on time, a developer who has earned it goes live anyway, and anyone else goes live when it passes.\n- **A stop** rolls the game back to the last version that passed, in running matches too, or with none leaves the game with no live version and its `review_reason`, until a fix goes live. The version\'s `findings` give the reason and the fix. The `ai_review_finished` webhook says when any review ends.\n- **Past the review\'s monthly budget,** versions go on with the fixed checks alone (`ai_review_status` `skipped`, with the note `ai_review_budget_used`). Nobody waits for a person.\n- **Files are read once.** A file any version that passed already had read is never read again, whoever sends it.\n\n`ai_review_status` is `not_started`, `waiting`, `reviewing`, `passed`, `stopped` or `skipped`; `ai_review_speed` is `at_once` or `batch`.\n\n## Holds and takedowns\n\nWhen Zaisma holds, rejects or takes something down, it says why, the same way in the dashboard, these answers and the MCP: a `review_reason`, with the same parts as an error plus the content rule it\'s about.\n\n```json\n"review_reason": {"code": "taken_down", "message": "The game\'s login screen asks players for their Steam password.", "content_rule": "malware", "fix": "If it\'s a mistake, or to say what you\'ll change, message_zaisma with the game_slug. Until Zaisma restores it, the game can\'t get new versions or change who can play it.", "message_for_people": "A person at Zaisma took the game down for the reason given. Until Zaisma restores it, the game takes no new versions. If it\'s a mistake, message Zaisma."}\n```\n\n- `code`: stable, one problem per code, from the list below, never the same as an error code; search the forum with it (`search_forum`).\n- `message`: what happened and why, in plain words: the code\'s meaning, or for the AI review and a person at Zaisma, their own words.\n- `content_rule`: the content rule it\'s about ([zaisma.com/legal/content-rules](https://zaisma.com/legal/content-rules), each rule at `#<rule>`), or `null` when it breaks none, like a check that couldn\'t finish. A hold names the rule a person checks it against; a rejection or takedown, the rule it broke.\n- `fix`: what to do about it, naming the call when there is one.\n- `message_for_people`: what happened and what to do, in a page\'s words, naming no call or field: the only text Zaisma\'s pages show. Show it to your human as it is when they should read what the dashboard would say.\n\nWhere it shows:\n\n- **A game\'s `review_reason`**: why it\'s `held` or `removed`; `null` while it\'s `pending` or `live`.\n\nZaisma acts on `copyright`, `defamation` and `trademark` only when someone sends a notice ([zaisma.com/legal/dmca](https://zaisma.com/legal/dmca), [zaisma.com/legal/defamation](https://zaisma.com/legal/defamation), [zaisma.com/legal/trademark](https://zaisma.com/legal/trademark)), in a game\'s files and on its covers, backgrounds and title alike, and doesn\'t judge the notice itself: the game is `held` with `copyright_notice`, `defamation_notice` or `trademark_notice`, and the message says what the notice names. The game can still get new versions: publish one without it, and a person at Zaisma checks it and shows the game again, usually within a day (publishing tells Zaisma; there\'s nothing more to send). If the notice is wrong, the developer sends a counter-notice instead, which goes to the person who sent the notice; the game is back after 10 working days unless they say they\'ve gone to court. The scan and the AI review never look for either rule.\n\nWhen a country\'s law forbids what US law allows (the UK\'s hatred offences, say), a notice from a court, regulator or police there blocks the game for players in that country only, and everyone else still plays it: it\'s in the game\'s `country_blocks` with `country_law_notice`, whose message says which law and what it names, and the `game_blocked_in_country` alert. Players there get a page saying it isn\'t available in their country (HTTP 451), and Zaisma\'s lists, its files and Zaisma rooms leave it out there; its preview links still open, so you can check a fix from there. The game keeps its versions and can publish more: publish one without what the notice names, and a person at Zaisma checks it and lifts the block, usually within a day. If the notice is wrong, write to safety@zaisma.com with the game\'s slug and why. A `country_blocks_changed` webhook says when a block starts or ends.\n\n- **A version\'s `review_reason`**: a person rejected it, or a report paused the update; `null` otherwise. Its `findings` are what the scan found that holds or rejects it, each `{"code", "severity", "message", "content_rule", "path", "fix", "message_for_people"}`, where `severity` is `reject` (it can\'t go live) or `hold` (a person at Zaisma looks first, usually within a day). A finding with severity `info` is a note and holds nothing: `unregistered_link`, `unlisted_address` and `api_key_in_files`. A game that bumps into a protection the sandbox already enforces (a plain `window.open`, a call to an address that isn\'t Zaisma rooms or its own servers) passes with a note; a game that tries to get around one (a site opened with no tap, a link or address built from pieces, the page outside the frame, a peer connection from a frame of its own) is rejected as `ai_protection_dodged`. The version that only removes what held or rejected a game passes by itself, with no daily review used.\n\nThe AI review judges each content rule by one yes/no test, shown under the rule at [zaisma.com/legal/content-rules](https://zaisma.com/legal/content-rules) (`CONTENT_RULE_DETAILS` in `packages/core/src/review.ts`). A version whose files answer a test yes is rejected within minutes, with the rule, the line it found and the fix, and no person; so is obfuscated code, which the review can\'t read (a minified build is fine). The AI review holds a version for a person only for lifelike gore (`ai_lifelike_gore`, which the game\'s age setting decides) or when it can\'t finish.\n- **An image\'s `review_reason`**: why it wasn\'t approved.\n- **`get_history`**: each hold, rejection and takedown with its `review_reason`, kept after it\'s over.\n- **A hold or rejection released because the review was wrong:** if the review got it wrong, `message_zaisma` with the `version_id`. When a person at Zaisma approves a version the AI review held or rejected, `get_history` says "A person looked and released this hold. It didn\'t count against your daily reviews." with the version\'s ID, and that review is given back: it doesn\'t count toward your 5 judged reviews a day.\n- **Errors:** `game_removed` and `not_approved` put the reason\'s code and message in theirs, and its fix as theirs.\n\nThe list lives in `REVIEW_CODES` and the rules in `CONTENT_RULES` (`packages/core/src/review.ts`), and a test keeps this page in step with them. Rule says which content rule a code is about: one rule always, `none` when it breaks none, or `picked` when the person deciding picks it each time.\n\n**The scan\'s checks**\n\n| Code | Rule | Meaning |\n| --- | --- | --- |\n| `crypto_miner` | `malware` | The code mines cryptocurrency. |\n| `packed_code` | `malware` | Code is packed or decoded at runtime (eval of encoded text), which hides what it does. |\n| `top_navigation` | `malware` | The code tries to change the page outside the game (the top or parent window\'s location). |\n| `relay_bypass` | `malware` | The code makes a WebRTC connection from a frame of its own, which skips Zaisma\'s relay and would show players each other\'s internet address. |\n| `password_field` | `malware` | The game has a password field. Games don\'t need one, and phishing pages do. |\n| `external_form` | `personal_details` | The game has a form that sends what players type to another site. |\n| `antivirus_flag` | `malware` | Antivirus engines flag a file: three or more reject the version, fewer hold it for a person. |\n| `unregistered_link` | none | The game opens a site with window.open or a link that opens a new tab. The sandbox blocks that, so players tapping it get nothing. |\n| `unlisted_address` | none | The game connects to an address that isn\'t Zaisma rooms or one of its own servers. The game\'s security policy blocks it, so the call fails for players. |\n| `matches_another_developers_game` | `copyright` | Most of this version\'s files are already in another developer\'s game, so a person at Zaisma looks first. |\n| `matches_banned_account_files` | none | Most of its files match a game Zaisma took down. |\n| `api_key_in_files` | none | A Zaisma API key was in the game\'s files, so Zaisma turned it off: anyone who plays the game could have read it. |\n\n**Checks that couldn\'t finish (no rule broken)**\n\n| Code | Rule | Meaning |\n| --- | --- | --- |\n| `too_much_code` | none | The game has more code than the review reads (about 19 MB of text), so a person at Zaisma looks first. |\n| `too_many_pictures_inside_packs` | none | The game\'s packs hold more pictures than image matching checks inside them (10,000), so the first 10,000 were matched. |\n| `image_matching_off` | none | Image matching isn\'t connected, so a person at Zaisma approves each version. |\n| `image_matching_failed` | none | Image matching couldn\'t check every picture and video, so a person at Zaisma looks first. |\n| `ai_review_off` | none | AI review isn\'t set up, so a person at Zaisma approves each version. |\n| `ai_review_budget_used` | none | This month\'s AI reviews are used up, so this version went on with the fixed checks alone. |\n| `ai_review_declined` | none | The AI reviewer wouldn\'t review the game, so a person at Zaisma looks. |\n| `ai_review_failed` | none | The AI review didn\'t finish, so a person at Zaisma looks. |\n| `daily_large_reviews_used` | none | This developer\'s 5 large reviews for today (a new game or a real change, judged) are used, so this version waits for the next one to free up. |\n| `daily_small_reviews_used` | none | This developer\'s 30 small reviews for today (versions read by the AI) are used, so this version waits unread for the next one to free up. |\n| `version_replaced` | none | A newer version of this game came in while this one waited, so this one isn\'t reviewed. |\n| `scan_failed` | none | The scan didn\'t finish after three tries, so a person at Zaisma looks. |\n\n**The AI review**\n\nEvery version gets the same review, as a process rather than one look. Zaisma\'s own checks list what each file connects to, the links it opens and the code it can\'t follow. Reader models then read all of the code and pictures, in pieces, and pull out the exact lines and pictures that matter. Last, one stronger model judges from that list alone and picks its findings from the codes below, so the same game gets the same verdict every run. A finding\'s `path` and `quote` point at the exact line it\'s about.\n\nEach developer gets two kinds of review a day, across all their games. A large review is a new game or a real change: read by the reader models and judged, 5 a day. A small review is a version the reader models read, 30 a day: a tweak of a game that already passed (levels, sprites, balance: nothing new it connects to, opens, asks for or shows) keeps that version\'s verdict on a small review alone, and a real change uses one of each. Files a version shares unchanged with an earlier one aren\'t read again, so a version that changes nothing to read uses neither. Past 30, a new version is held unread with `daily_small_reviews_used`; past 5, a real change is held with `daily_large_reviews_used`, and tweaks still pass at once. Either way it\'s checked by itself as soon as one frees up, within a day. A version after a held one is checked for what the hold named and for anything new; what already passed stays passed. A version that\'s still waiting when a newer one of the same game comes in steps aside (`version_replaced`, with `replaced_by_version_id` on the version): only the newest is reviewed, and the older one never goes live by itself.\n\n| Code | Rule | Meaning |\n| --- | --- | --- |\n| `ai_malware` | `malware` | The AI review found malware: a crypto miner, or code that hides what it runs. |\n| `ai_phishing_or_scam` | `malware` | The AI review found phishing or a scam. |\n| `ai_data_collection` | `personal_details` | The AI review found the game asking players for personal details, like emails, real names, birthdays or location. |\n| `ai_sexual_content` | `sexual` | The AI review found sexual content or nudity. |\n| `ai_private_details_or_threats` | `real_people` | The AI review found private details about a real person, like a home address, phone number or school, or a real threat against one. |\n| `ai_protection_dodged` | `malware` | The AI review found code that tries to get around one of Zaisma\'s protections: the page outside the game\'s frame, the relay between players, registered links or the list of servers. |\n| `ai_lifelike_gore` | none | The AI review found lifelike gore (photo-real or lifelike injury shown up close), which plays only in games for 16 and up. |\n| `ai_real_money_gambling` | `illegal` | The AI review found real-money gambling. |\n| `ai_paid_random_rewards` | `purchases` | The AI review found paid random rewards (loot boxes): something bought with money, or with coins bought with money, that gives a random item. |\n| `ai_coin_price_without_real_price` | `purchases` | The AI review found prices in coins or gems with no real price beside them, for coins or gems bought with money. |\n| `ai_free_text_chat` | `chat` | The AI review found typed text another player reads as written that doesn\'t go through Zaisma\'s chat hosting (room.chat in Zaisma rooms, canChat and checkChat on your own server). |\n| `ai_disallowed_crypto` | `crypto` | The AI review found cryptocurrency the rules don\'t allow: coins other than Bitcoin, tokens, NFTs or airdrops, or Bitcoin used for investment advice, paying players or asking for wallet access. |\n| `ai_other` | none | The AI review found faked plays or players, or text that addresses the reviewer. |\n| `ai_concern` | none | The AI review held or rejected the version without naming one concern; the message is its summary. |\n\n**People and reports**\n\n| Code | Rule | Meaning |\n| --- | --- | --- |\n| `needs_review` | none | A person at Zaisma needs to look at it first. |\n| `report_paused_game` | none | A player report paused the game while Zaisma checks it. |\n| `report_paused_update` | none | A player report paused this update while Zaisma checks it; players get the version before it. |\n| `rejected_by_zaisma` | picked | A person at Zaisma rejected the version; the message says why. |\n| `taken_down` | picked | A person at Zaisma took the game down; the message says why. |\n| `copyright_notice` | `copyright` | The owner of a work sent a copyright (DMCA) notice, so players can\'t open the game; the message says what it names. |\n| `defamation_notice` | `defamation` | A private person sent a defamation notice saying the game falsely accuses them of a crime, so players can\'t open the game; the message says what it names. |\n| `trademark_notice` | `trademark` | The owner of a registered trademark sent a notice, so players can\'t open the game; the message says what it names. |\n| `country_law_notice` | none | A notice says the game breaks a law of one country that US law allows, so players in that country can\'t open it, and everyone else still can; the message says which law and what it names. |\n| `developer_account_deleted` | none | The game\'s developer deleted their Zaisma account, which takes their games down with it. |\n| `developer_deleted_game` | none | The game\'s developer deleted it. |\n| `image_rejected` | picked | A person at Zaisma didn\'t approve the image; the message says why. |\n| `link_flagged` | `malware` | Cloudflare lists the link\'s site for malware or phishing, so the link opens for nobody. |\n| `details_rejected` | picked | A person at Zaisma didn\'t approve the new title or description; the message says why. |\n\n**The listing check** (covers, gallery pictures, backgrounds and titles; see Covers, gallery pictures and share pictures, and Backgrounds), **and the shader check** (see Backgrounds)\n\n| Code | Rule | Meaning |\n| --- | --- | --- |\n| `extra_text_on_cover` | none | The cover, square cover or share picture has words besides the game\'s title, a subtitle and the studio\'s logo; the message quotes them. |\n| `overlay_on_cover` | none | Something is laid over the cover, square cover or share picture: a button, menu, shop panel, badge, sticker, or an arrow or circle pointing at something; the message says what. |\n| `search_words_in_title` | none | The title lists what the game is instead of naming it: "Neon Rush: Racing Drift Car Driving Simulator". A name that says what its game is, however long, is fine: "Car Mechanic Simulator". |\n| `tag_in_title` | none | The title carries a tag instead of only naming the game: a bracketed tag like [UPDATE], an emoji, or NEW, UPDATE or FREE used as a tag. "+1" and "2x" are fine. |\n| `fake_reward` | `malware` | A cover, gallery picture, title or description promises a fake reward or real-money bait, like free Robux, V-Bucks, gift cards or cash; the message quotes it. Players can\'t open the game until a person looks. |\n| `text_on_background` | none | A background has no title, logo or text on it; those go on the cover. The message quotes what it found. |\n| `overlay_on_background` | none | Something is laid over a background instead of being part of its world, like a button, badge or sticker, so it doesn\'t show; the message says what. |\n| `shader_does_not_compile` | none | The shader didn\'t compile; the message gives the first compiler error. |\n| `shader_too_slow` | none | The shader took too long to draw a frame in the check, at one of its quality levels; the message says which, how long, and the most it can take. |\n| `shader_flashes` | none | The shader flashes more than 3 times a second, which can cause seizures. |\n\n| Rule | What it says |\n| --- | --- |\n| `child_safety` | Sexual content involving minors, in any form. Zaisma reports it to the National Center for Missing & Exploited Children. |\n| `sexual` | Sexually explicit content. |\n| `malware` | Malware, crypto mining, phishing, scams or anything that tries to break out of the game. |\n| `illegal` | Content that is illegal in the United States, including real-money gambling. |\n| `real_people` | Private details about real people, real threats, or calls for real violence. |\n| `copyright` | Other people\'s games, art, music or characters used without permission. |\n| `defamation` | False claims that a real private person committed a crime. |\n| `trademark` | Other people\'s trademarks used so that players would think their owner made or backs the game. |\n| `personal_details` | Asking players for personal details like emails, real names, birthdays or location inside the game. Every player has a Zaisma ID and name; games with their own accounts link them through Sign in with Zaisma, and anything more happens on the developer\'s own site. |\n| `chat` | Typed chat between players outside Zaisma\'s chat hosting. In Zaisma rooms, chat goes through room.chat; on your own server, through canChat and checkChat. Preset phrases and emotes are always fine. |\n| `crypto` | Cryptocurrency other than Bitcoin: using or promoting other coins, tokens, NFTs or airdrops. A story that mentions one is fine. Bitcoin games are welcome, but not investment advice, mining on the player\'s device, paying players sats, or asking for seed phrases or permission to spend from a wallet. |\n| `purchases` | Selling paid random rewards (loot boxes), including through coins bought with money, or showing prices in coins or gems bought with money without the real price beside each one, even when the coins themselves are sold at a real price. |\n| `faked_plays` | Faking plays or players, with bots, scripts or click farms. |\n\nAllowed, even where other platforms ban it (`ALLOWED_CONTENT`): the AI review passes it and report triage dismisses reports about it.\n\n- Offensive, edgy and dark humor, insults and swearing.\n- Jokes and opinions about any group, religion, country or political side. There\'s no hate-speech rule.\n- Mocking, memes and satire of real people, from politicians to celebrities, with their name, face and photo.\n- Violence that is gameplay: shooting, fighting, war and horror, including against real people.\n- Real wars and history, with their uniforms, flags and symbols.\n- Drinking, smoking and drugs as part of a story or setting.\n- Casino and card games played for points or coins that cannot be bought or cashed out.\n- Trash talk and fiery lobbies: how players talk to each other is up to each game.\n- Bitcoin games: teaching it, Bitcoin themes, selling items for sats, and tips.\n\nOne kind of content plays only in games for 16 and up: lifelike gore, meaning photo-real or lifelike injury shown up close (dismemberment, torture, exposed organs). Cartoon, pixel and stylized blood are fine for everyone. The AI review holds a version with lifelike gore on a game for everyone 13 and up (`ai_lifelike_gore`): set `minimum_player_age_years` to `16` and it passes by itself, or make the gore stylized and upload again. Publishing or giving a tester link such a version while the game is for everyone 13 and up, or lowering the age to `13` while players can reach one, answers `content_needs_minimum_age`. Covers and gallery pictures never show lifelike gore, whatever the age. Players never see the age.\n\nFor examples of games that pass and games that are held, by content rule, see `review-set/cases/` in Zaisma\'s repo: each case\'s `why` says where the line is.\n\n## Signing in\n\nMake an API key on Developer settings (zaisma.com/dashboard/settings, under Keys) and send it as `Authorization: Bearer zsk_\u2026`. The key is shown once; we keep only a hash. Any account can make up to 10 keys and remove them at any time. Making one needs a passkey: Developer settings adds one the first time, then each key is a tap. Keys are made only there, never through the API or MCP, so an AI can\'t give itself a new key. Pages on zaisma.com can use the signed-in session instead. Up to 120 requests a minute per account, plus up to 1,000 a minute for sending files. A key lasts until you remove it, or until the end date you gave it (7 days, 30 days, 90 days or a year; `get_access` shows it as `api_key_ends_at`); after that it answers `key_ended`. A key found in public (GitHub\'s secret scanning, a game\'s uploaded files or a forum post) is turned off for good within minutes: it answers `key_turned_off`, saying where it was found, and the games keep running, since games never use keys. `list_api_keys` shows each key\'s end date, last use and whether it was turned off.\n\nAn AI app that connects by signing in (claude.ai, ChatGPT, any MCP client that can\'t send a header) gets a connection, made on one Zaisma page: "Connect Claude to your games" says where you go back to, offers Full on all your games with no end date, and Change opens the same choices as a key (a level or a choice per area, which games, an end date). Continue needs a tap on your passkey, as making a key does; every sign-in asks, with no remembered yes. A connection is listed with your keys on the account page and in `list_api_keys` (`kind: "connected_app"`, with `connected_app_host`), is held to what you chose exactly as a key is, lasts until you remove it or its end date, works only at `/mcp`, and can never make keys. Connecting the same app again replaces its old connection. Any account can have up to 10 connected apps, counted apart from its 10 keys.\n\nUntil the beta, only accounts Zaisma adds can make, upload and publish games. For everyone else, making a game (`POST /games`), sending files (`POST /games/:slug/uploads`, `PUT /files/:sha256` and the parts calls), making a version and publishing one answer `publishing_not_open` (403), from the dashboard, the MCP and the upload command alike; everything else works. `GET /access` says whether your account can, as `can_publish`. Publishing opens to every account when the beta opens.\n\n### Standing\n\nEvery account earns standing from plain facts, never a hidden score, and nobody else sees it. An account is **established** once it\'s 14 days old, 20 different returning players have played its games, and nothing was ruled against it in 30 days (a version rejected, or a game taken down; a hold or a listing reason isn\'t a ruling). A returning player is a signed-in player whose plays counted on your games on 2 different days, with an account at least 7 days old that has played on 3 days; guests, your own account and accounts Zaisma stopped or banned never count. Players are counted once a day.\n\n| Power | Opens |\n| --- | --- |\n| Zaisma\'s own lists (home, Browse, search) | From the first day, for listed games |\n| Links on trusted domains (see Registered links) | From the first day |\n| Links to any other site, for signed-in adults | Once established, or at once with a card that paid Zaisma (a top-up or Zaisma Pro) or a connected Stripe account that can take payments |\n| Search engines (the sitemap, and no `noindex` on game pages) | Only once established |\n\nA ruling closes links to other sites and search engines at once, for 30 days; a ban closes them for as long as it lasts. A rejection a person at Zaisma finds wrong and approves (`message_zaisma` with the version\'s ID asks for one) stops counting at once: the 30 days run from the last ruling still standing, or there\'s no wait, and the game\'s history says `ruling-overturned`. `GET /access` answers `standing`: `{ is_established_developer, outside_links_enabled, search_engines_enabled, returning_player_count, minimum_returning_player_count, account_age_days, minimum_account_age_days, has_card_or_stripe_account, last_ruling_at, ruling_wait_ends_at, message_for_people }`, where `message_for_people` says what\'s open and what opens next. The game dashboard\'s Links say the same under the field.\n\n### Bans\n\nZaisma can ban an account for breaking the content rules. A developer ban (`ban_scope` `developer`) takes down the account\'s games and answers `account_banned` (403) to every call but `GET /access`, `GET /games` and a game\'s export (`GET /games/:slug/export` and its download), so the developer keeps their work; playing still works. A whole-account ban (`whole_account`) closes the account: no sign-in, no session, no API key. A ban carries over the cards that paid Zaisma, the connected Stripe account and the email, never a device or network: another account can\'t connect that Stripe account (`stripe_account_banned`) or add that email (`email_banned`), and a version most of whose files match a banned account\'s game is held with `matches_banned_account_files` until a person looks. To appeal a ban, write to safety@zaisma.com with the username; a person reads every appeal and answers.\n\n### Connected apps (OAuth)\n\nFor people writing an MCP client: Zaisma follows the MCP authorization spec. `POST /mcp` without a token answers 401 with `WWW-Authenticate: Bearer resource_metadata="https://zaisma.com/.well-known/oauth-protected-resource/mcp", scope="mcp"`. That document (RFC 9728) names `https://zaisma.com` as the authorization server, whose metadata is at `/.well-known/oauth-authorization-server` (RFC 8414). An app names itself by a client ID metadata document (an https URL whose JSON has the same `client_id`, a `client_name` and up to 10 `redirect_uris`; read again after a day), or registers at `POST /oauth/register` (RFC 7591; up to 10 a minute from one address, with `token_endpoint_auth_method` `none`, `client_secret_basic` or `client_secret_post`). Redirect URLs are https, or http on `localhost` and `127.0.0.1`. Then the authorization code flow at `/oauth/authorize` and `/oauth/token`, with PKCE S256 always and `resource` `https://zaisma.com/mcp` when sent (RFC 8707); the one scope is `mcp`, and `openid`, `profile` and `offline_access` are accepted and dropped. The access token (`zat_\u2026`) lasts an hour and works only at `/mcp`, where an ended one answers `access_token_ended` and the REST API answers `token_not_for_api`. The refresh token (`zrt_\u2026`) lasts as long as the connection and works once: each refresh answers new tokens. One used again within a minute is refused with `invalid_grant`; one used again later removes the connection, since only a stolen copy does that.\n\n### What a key can do\n\nA key can be limited, for CI and collaborators, to some of your games and to what it may do: one of four levels, or a choice per area.\n\n| Level | What it can do |\n| --- | --- |\n| `full` | Everything. Keys made before levels existed are full keys for every game. |\n| `publish` | Upload and publish versions, change games, their secrets and tester links, and post on the forum. Reads everything else; can\'t run SQL, change saves, sign-in apps, webhooks or credit. |\n| `upload` | Send files and make versions (drafts), and read everything. Can\'t publish, change games or post on the forum. |\n| `read` | Read games, versions, stats, the database, saves, items and purchases, the forum and hosting credit. Changes nothing. |\n| `custom` | A choice per area, below. |\n\n| Area, in `area_access` | Choices | What it covers |\n| --- | --- | --- |\n| `game_access` | `read`, `write` | read: list and get games, with images, versions, scans, tester links and secrets\' names. write: also details, visibility, images, tester links, secrets, the hosts its game server calls, and new games. |\n| `version_access` | `read`, `upload`, `publish` | upload: send files and make versions, which wait as drafts. publish: also publish, schedule and roll back, and make versions with `publish_when_approved`. |\n| `stats_access` | `none`, `read` | Stats, player reports and history. |\n| `database_access` | `none`, `read`, `write` | read: tables, indexes, use and `export`. write: run SQL (`query`, `batch`), `import` and restore to a time. |\n| `save_access` | `none`, `read`, `write` | Players\' cloud saves. read: read them and their copies. write: change, reset and restore them. |\n| `purchase_access` | `none`, `read`, `write` | Items and purchases. read: the items, purchase settings, purchases and receipts. write: set and remove items, change purchase settings, grant items and refund. `read`, `upload` and `publish` keys read them; only `full` writes. |\n| `forum_access` | `none`, `read`, `write` | write: post, reply, vote, follow and message Zaisma, in your name. |\n| `sign_in_app_access` | `none`, `read`, `write` | Sign-in apps. |\n| `webhook_access` | `none`, `read`, `write` | Webhooks. |\n| `credit_access` | `none`, `read`, `write` | Hosting credit (see Hosting and credit) and Zaisma Pro (see Zaisma Pro). read: the balance, top-ups and spending, and the plan. write: also start a top-up, refund one, start, change or stop the monthly credit plan, start, cancel, resume or refund Pro, and change a game\'s `monthly_budget_cents`. A first or higher budget, and a higher plan level, always need your passkey on zaisma.com (`confirmation_needed`). |\n| `stripe_account_access` | `none`, `read`, `write` | The Stripe account sales go to (see Selling with the buy sheet). read: whether it\'s connected and can take payments. write: also ask for a connection link, turn Stripe Tax on or off, and disconnect. Connecting itself needs your passkey on zaisma.com (`confirmation_needed`). `read`, `upload` and `publish` keys read it; only `full` writes. |\n\nEvery key sees its games and their versions, so `game_access` and `version_access` start at `read`. A key limited to some games lists only those, reaches only those games\' forum topics (a topic about another game answers `key_not_allowed`), can\'t make games, and can\'t reach sign-in apps, webhooks, hosting credit or the Stripe account, which belong to your whole account. Public profiles (`GET /players/:player_id`) and `GET /access` work with any key. `GET /activity` and `GET /api-keys` need a full key for all your games: they show where your account and its keys are used from. A call a key doesn\'t reach answers `key_not_allowed` (403), saying what it would need.\n\nEvery call is checked before any of it runs, in this order: the key\'s access, whether your account can publish yet (for the calls above), what the path names (your game, webhook or sign-in app, or a forum topic you can see), the inputs (closed), each input that needs more than the call (`publish_when_approved`), and what the inputs name (a forum post\'s `game_slug`, a webhook\'s `game_slugs`, a version\'s `files`, a `known_issue_topic_id` or `topic_id`), with a key limited to some games held to those. Someone else\'s game, webhook, sign-in app or private topic is answered exactly as one that isn\'t there (`no_game`, `no_webhook`, `no_sign_in_app`, `no_topic`), and so is a file only someone else sent (`files_missing`).\n\n| Call | What it does |\n| --- | --- |\n| `GET /whats-on` | What the home\'s window shows right now: `event` and up to 3 `cards` (MCP `get_whats_on`) |\n| `GET /playing-now` | Everyone playing on Zaisma right now: `playing_now_player_count` and the `busiest_games`. See Who\'s playing on Zaisma. |\n| `GET /access` | What the key you called with can do: `{ "access": { api_key_name, api_key_ends_at, access_level, area_access, game_slugs }, "can_publish", "banned_at", "ban_scope", "credit_balance_cents", "plan" }`. `can_publish` is whether your account can make, upload and publish games, which until the beta only accounts Zaisma adds can. `banned_at` and `ban_scope` (`developer` or `whole_account`) say when and how far Zaisma banned the account, or are `null` (see Bans). `credit_balance_cents` is your hosting credit, or `null` when the key can\'t read it (`credit_access` `none`, or a key limited to some games). `plan` is `free` or `pro` (see Zaisma Pro). `standing` is what the account has earned and what each power needs (see Standing), and `next_steps` offers `top_up_credit` and `connect_stripe_account` while a card or Stripe account would open links to other sites. `area_access` has every area\'s choice, whatever the level; `game_slugs` is `null` for every game you have and will make. From the dashboard\'s session, `api_key_name` is `null` and access is full. |\n\n### Your account\'s activity\n\n| Call | What it does |\n| --- | --- |\n| `GET /api-keys` | Your API keys and connected apps, newest first: `api_keys`, each with `api_key_name` (a connected app\'s own name), `kind` (`api_key`, or `connected_app` for an AI app connected by signing in), `connected_app_host` (where a connected app sends you back, like `claude.ai`; `null` for a key), `access_level`, `area_access`, `game_slugs`, `created_at`, `last_used_at`, `last_used_where` (what it was last used with and from where; `null` when unknown or the account doesn\'t keep where it\'s used from), `ends_at` (`null` when it lasts until removed), `turned_off_at` and `found_in` (`github`, `game_files` or `forum_post`) with `found_at_url` when Zaisma turned it off because it was found in public, and `is_this_key`. It needs a full key for all your games. Keys are made and removed only on the account page. |\n| `GET /activity` | Your account\'s security activity from the last 90 days, newest first, 50 a page: `events`, each with `kind`, `description`, `sign_in_kind` (`password`, `passkey`, `email_code`, `google` or `discord` for a sign-in on a new device), `subject_name` (the passkey\'s device or the key\'s name), `done_by` (`you`, `api_key`, `ai` or `zaisma`), `api_key_name`, `device`, `network_name`, `city_name`, `region_name`, `country_code`, `connection_address`, `happened_at` and `security_alert_status` (below); `unseen_security_alerts`, the security alerts still waiting on the pages, newest first, up to 10, each like an event; `next_cursor` (pass it as `cursor` for older events, `null` on the last page); and `where_used_from_enabled`. It needs a full key for all your games, since it shows where your account is used from. Keep where my account is used from changes only on the account page, so an AI can\'t turn it off and erase where it was used from. A game\'s changes are in its history. |\n\n**Security alerts.** The risky moments are security alerts: a sign-in on a new device from a network the account hasn\'t signed in from in 90 days, a password or email added, changed or removed, a passkey removed, an API key made, used from a new place or turned off because it was found in public, a key or AI app deleting a game\'s kept worlds, an AI or app connected, and an app Zaisma disconnected because its refresh token was used twice. Each is emailed to the account (an email change or removal to the old address too), at most 10 an hour; an account without an email (or past the 10) sees it on zaisma.com/account and the dashboard until it presses That was me there. Each event\'s `security_alert_status` says which: `emailed`, `unseen` (waiting on the pages), `seen`, or `null` when it isn\'t an alert. Marking alerts seen is only on those pages, so a key can\'t hide them. A `security_alert` webhook (see Webhooks) sends each one as it happens.\n\n## Games\n\n| Call | What it does |\n| --- | --- |\n| `GET /games` | Your games, each with its `alerts` (see Alerts below), and `unread_topic_count`: how many of your forum topics Zaisma has replied to or changed since you last opened them. |\n| `POST /games` | Make a game: `{"title", "slug"?, "description"?, "glass_tint_color"?, "devices"?, "controls"?, "genres"?, "screen_orientation"?, "play_modes"?, "cloud_saves_enabled"?, "account_offer_enabled"?, "deleted_account_erase_enabled"?, "friend_joins_enabled"?, "performance_measuring_enabled"?, "multiplayer_mode"?, "room_browsing"?, "account_requirement"?, "minimum_player_age_years"?, "game_server_allowed_hosts"?, "own_server_urls"?, "links"?}`. It starts as a draft that only you can see. Up to 50 games. |\n| `GET /games/:slug` | One game with its `alerts` (see Alerts below), `playing_now_player_count` (the exact number of people playing it now: browsers that pressed Play and still have it on screen, and players in your Zaisma rooms, each counted once however many rooms they sit in, from the last 6 minutes; players see it from 3 up), `images`, `versions` (newest first, each with its `review_reason` and scan `findings`) and `testers`. |\n| `PATCH /games/:slug` | Change any of `title`, `description`, `visibility`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `room_browsing`, `multiplayer_mode`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `links`, `glass_tint_color`, `demo_game_slug`, `full_game_item_name` (the game\'s price to play, see "Sell your game once" under Items and purchases; it needs `purchase_access` `write`), `monthly_budget_cents` (the game\'s monthly budget from your hosting credit, see Hosting and credit; it needs `credit_access` `write`, and a first or higher budget answers `confirmation_needed`). Leave out what stays the same; `null` clears it. Answers with the `game`, `review_message` (set when new words wait for review), `game_server_problem` (why the game\'s own game server can\'t run yet, or `null`) and `next_steps`. |\n\nA game looks like: `slug`, `page_url`, `title`, `description`, `visibility`, `visibility_after_ai_review`, `review_status`, `review_reason`, `erases_at`, `is_erase_now_allowed`, `country_blocks`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `multiplayer_mode`, `room_browsing`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `links`, `details_waiting_for_review`, `title_listing_reason`, `glass_tint_color`, `monthly_budget_cents` (`null`: no paid hosting), `purchase_label` (what the game page says it sells, see In-game purchases), `refund_policy` and `refund_policy_text` (`null` until it states one), `full_game_item_name` (`null`: free to play), `demo_game_slug` (`null`: no demo), `first_published_at` (when it first went live; it never moves), `big_update_at` (the last marked big update; `null`: none yet), `recently_updated_at` (where Browse\'s Recently updated places it) and `updated_at`.\n\n- **visibility:** `draft`, `listed` (home page, search and search engines), `unlisted` (anyone with the link, never in lists or search engines) or `private`. Draft and private games open only through preview links and tester links (below). A game is listed only with at least one gallery picture, sent or approved: `listed` without one answers `gallery_picture_needed`, and so does removing the last gallery picture of a listed game.\n- **review_status** is ours and separate: `pending` (no version has passed review yet), `live`, `held` or `removed`, and `review_reason` says why it\'s held or removed (see Holds and takedowns). Changing visibility never undoes a takedown.\n- **country_blocks** lists the countries whose players can\'t open the game, each `{ country_code, country_name, review_reason, blocked_at }`, `[]` for none (see Holds and takedowns).\n- **play_modes:** how it\'s played, shown on the game page with icons: a list with one entry per way to play, like `[{"mode": "single"}, {"mode": "online", "minimum_player_count": 2, "maximum_player_count": 4, "play_style": "co-op"}]`. `mode` is `single`, `local` (together on one device or screen) or `online` (each on their own device). `single` takes no counts; the others need `minimum_player_count` (2 or more) and `play_style` (`co-op`, `versus` or `both`), and `maximum_player_count: null` means no limit ("2+ players"). Answers give every key, `null` where it doesn\'t apply. `null` clears it.\n- **devices:** any of `phone`, `tablet`, `computer`. **controls:** any of `touch`, `keyboard_mouse`, `gamepad`. **screen_orientation:** `portrait`, `landscape`, `either` or `null` (not set).\n- **genres:** up to 3, different, from one list: `action`, `adventure`, `role_playing`, `shooter`, `strategy`, `simulation`, `racing`, `sports`, `fighting`, `platformer`, `puzzle`, `horror`, `survival`, `sandbox`, `card_and_board`, `party`, `rhythm`, `visual_novel`. Players filter Browse by them: a genre\'s own list is `zaisma.com/games?genre=<genre>` (`?genre=horror`; a value that isn\'t a genre shows every game). They come back in that order; `[]` clears them, and a game with none shows under All. Multiplayer isn\'t a genre: Browse\'s Multiplayer filter reads `multiplayer_mode` and `play_modes`. `["role_playing", "strategy"]` is right; `["rpg"]` or 4 genres answer `bad_genres`.\n- **cloud_saves_enabled:** `true` (the default) copies signed-in players\' browser saves to their account, so their progress follows them to any device with no code in the game. It covers localStorage and IndexedDB (Unity, Godot and localForage saves included; databases with "cache" in the name, like Unity\'s download cache, are skipped), up to 5 MB per player. Set `false` for games that keep their own saves on a server. When a player has played on two devices, the progress played most recently wins and the other is kept as an earlier version; Zaisma never asks the player which to keep.\n- **account_offer_enabled:** `true` (the default) shows guests the "Keep your progress" card once they have progress and have played 5 minutes: beside the game, it offers a free account to keep their progress. Set `false` for games that offer accounts their own way, with `Zaisma.player.signIn()`.\n- **deleted_account_erase_enabled:** `true` (the default): when a player who played the game deletes their Zaisma account, Zaisma erases their rows from the game database, as `POST /games/:slug/database/erase-player` does, as well as sending `account_deleted` to your webhooks. Set `false` if the game must keep some of their rows (records the law says to keep, say), and handle the `account_deleted` event yourself.\n- **multiplayer_mode:** `none`, `relay` (Zaisma passes each message to the others, no server code) or `own`: your game server, from the live version\'s `zaisma-server/` folder (`index.js` first, importing the folder\'s other `.js`, `.json` and `.wasm` files, with every other file there a data file it reads with `room.readDataFile`) or one `zaisma-server.js`, runs on Zaisma rooms in a sandbox that calls only the hosts in `game_server_allowed_hosts`, with the game\'s secrets as `room.secrets` and its own SQLite database as `room.database` (see "Your game server on Zaisma" and "The game database" in the README, and The game database below to read and change it yourself). If the live version has no game server, or one over 500 files or 32 MB, the change is saved and `game_server_problem` says why; rooms open once a version that works is published. Games already on a game server built into Zaisma show `built-in` and can\'t change it themselves. Rooms on the old setting end within a minute.\n- **room_browsing:** for games on Zaisma rooms (`multiplayer_mode` other than `none`), where open rooms are listed so players can join them: `page` (the default) on the game page and to the game through `Zaisma.rooms.list()`, `game` only to the game (for games with their own lobby or server browser), or `off`. Room codes and invite links work either way, and the game can hide single rooms itself (see Multiplayer in the README). Whatever the setting, every game\'s page and the home say how many are playing now once it\'s 3 or more, for every game and not only multiplayer ones (no names); `GET /games/:slug` gives you the exact number. Rooms on your own servers aren\'t listed or counted.\n- **friend_joins_enabled:** `true` (the default) lets Join on zaisma.com (a friend\'s face on /friends, "Alex is playing" on the game page, a profile\'s Playing now) and `Zaisma.friends.list()` take a player into the room their friend is in, for any game with rooms (Zaisma rooms, or its own servers through `Zaisma.friends.setRoom`). `false` grays Join as "This game doesn\'t take joins". One room turns it off instead, shown as "Private room": `Zaisma.joinRoom({ friendJoinsEnabled: false })` from the player who makes it, or `room.setFriendJoinsEnabled(false)` (the game server\'s, or the host\'s with the relay). It isn\'t a lock: a room\'s code or link still reaches it, so close the room (`setOpen(false)`) or answer `false` from `canJoin` to keep players out.\n- **performance_measuring_enabled:** `true` (the default) has Zaisma measure how the game runs on players\' devices, for `performance` in the stats (Play stats, below). `false` stops Zaisma adding its measuring script to the game\'s pages at all, and the stats answer `performance: null`.\n- **account_requirement:** what the game needs a Zaisma account for. `none` (the default): guests play everything, and signed-in players play as their account. `multiplayer`: guests play alone; only signed-in players get player passes, so a guest\'s `Zaisma.player.getPass()` and `Zaisma.joinRoom()` fail with `error.code` `"account_needed"` (show your own message, or ask them to sign in without leaving the game with `Zaisma.player.signIn()`), and room links ask guests to sign in first. That\'s part of v1: a guest never gets a pass in such a game. `whole_game`: the game page says "Needs a Zaisma account" and Play asks guests to sign in first; only signed-in players get player passes. Passes are the backstop: Zaisma rooms also turn away guest passes given before the change, and your own servers can check a pass\'s `kind` claim for the same. Players under 13 can\'t make accounts, so they can\'t play games that need one.\n- **minimum_player_age_years:** the youngest age that can play, even when the game\'s content suits everyone. `13` (the default): everyone, guests included as `account_requirement` allows. `16` or `18`: only accounts that old; younger accounts don\'t find the game on Zaisma (home, More games, friends\' Playing now, profiles), and a link to it says "This game isn\'t open to your account." Only accounts have an age, so above 13 the game needs an account for the whole game: giving `16` or `18` alone sets `account_requirement` to `whole_game` too, and any other `account_requirement` while it\'s above 13 is refused with `accounts_needed_for_minimum_age` (set it back to `13` first; that leaves `account_requirement` as it is). Zaisma enforces it: Play, player passes, the relay and requests to your game server turn away younger accounts with `game_not_open_to_player`, and Zaisma rooms remove ones already playing when you raise it. Tester links follow it (testers then need an account); your own previews don\'t. Neither your game nor your own servers ever learn a player\'s age: a pass never carries it, and a younger account never gets one. Lifelike gore needs `16` or `18`: see "Allowed, even where other platforms ban it" under the content rules.\n- **game_server_allowed_hosts:** the hosts the game\'s own game server can call with plain `fetch()` (game server reach): your own server, a payment provider, Discord, GitHub. Up to 20 host names, like `["discord.com", "api.github.com"]`, or `"*.example.com"` for every name under example.com (not example.com itself); `[]` (the default) for none, and the whole list each time. No `https://`, paths or ports: every call is https, never to an IP address, this computer or Zaisma\'s own domains. Live within a minute, with no approval by Zaisma, and kept in the game\'s history; players don\'t see it (the game page names only servers their browser connects to). Calls send up to 5 MB, get 10 seconds, aren\'t redirected (a redirect comes back to your code), and a game makes up to about 600 a minute in each place. A call to anything else throws an `OutsideCallError` in the game server, with a `code` (`not_https`, `unreachable_host`, `host_not_allowed`, `outside_call_limit`, `too_big`, `outside_call_timeout` or `outside_call_failed`) and a `fix`; the stats\' `game_server_errors` show it. Raw sockets (`connect()` from `cloudflare:sockets`, `node:net` and `node:tls`) aren\'t offered: opening one throws. The game server reaches the game\'s database, receipts and rooms through `room` and `server` while a handler runs, and `env` from `cloudflare:workers` is empty. The tokens it needs go in its secrets (below).\n- **own_server_urls:** your own servers the game connects to from players\' browsers: a game server you run with `@zaisma/game-server` (`Zaisma.joinRoom({ serverUrl })`), your own relay or your own API. Up to 5 addresses, each `wss://` or `https://` and the name, with a port if it needs one and nothing after it, like `["wss://play.example.com", "wss://eu.example.com:8443"]`; `[]` (the default) for none, and the whole list each time. Never an IP address, this computer (`localhost`) or Zaisma\'s own domains. `wss://` and `https://` of one server count once, and the game may use either. Live at once with no approval by Zaisma: players\' next page load connects (a relay of your own within 5 minutes), and friends\' Join can send them to rooms there. Kept in the game\'s history, and the game\'s \u22EF menu names them in neutral words: "Online play runs on the developer\'s own server: play.example.com" (nothing on the details players see before Play); games that only use Zaisma rooms show nothing. Everything a game shows players is under the content rules wherever it comes from. Not for the servers your game server on Zaisma calls: that\'s `game_server_allowed_hosts`. From a terminal: `zaisma own-servers <slug> wss://play.example.com`.\n- **links:** the game\'s registered links, which it opens with `Zaisma.links.open` (Registered links, below); `[]` (the default) for none, and the whole list each time.\n- **full_game_item_name** and **demo_game_slug:** a game that sells itself once, and its free demo; see "Sell your game once" under Items and purchases. `null` (the default): free to play, no demo.\n- Titles, descriptions, patch notes, tester link and sign-in app names, and forum titles and posts take any language and emoji, but no invisible characters or characters that flip text direction (zero-width spaces, direction overrides, byte order marks and the like): the call answers `bad_<field>` naming the character as `U+XXXX`.\n- Once players can see a game, a new title or description waits for the listing check, usually a minute, or a person when the check can\'t clear it (`details_waiting_for_review`, with `title` and `description`, `null` for the one that didn\'t change) before it shows. A title that keeps the game off Zaisma\'s lists says why in `title_listing_reason` (see The listing check, under Covers, gallery pictures and share pictures).\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/reports?cursor=` | Player reports from the last 90 days (`period_duration_days`), counted by reason in `reasons` (`reason`, `label`, `open_count`, `closed_count`), and `bug_reports`: reports that report triage sorted as bugs, each with `player_text`, a one-line `summary`, the `version_id` they played and `reported_at`, and `player_reports`: reports about one of your game\'s players that Zaisma passed to you, newest first, up to 50, each with its `reason` (`harassment`, `cheating`, `other`, or one of the four Zaisma looks at itself when a person passed it on: `real_life_threat`, `personal_details`, `following_after_block`, `sexual`), `player_text`, `chat_messages` (the last chat lines, up to 20, between the reported player and the reporter, from the reporter\'s screen: `from_player_id`, the reported player\'s or `null` for anyone else\'s, `text` and `sent_at`; `[]` when none), `reported_player_id`, `reported_player_name`, `room_code`, `version_id` and `reported_at`. How players treat each other is your game\'s call, with mute and block always there; Zaisma itself acts only on threats that reach into real life, sharing someone\'s personal details, following someone after they blocked them, and anything sexual toward a teen. Pass the `next_cursor` from your last call as `cursor` to get only the bug and player reports that arrived after it. Child-safety reports are never counted or shown, and no report says who sent it. |\n| `GET /games/:slug/stats?period_duration_days=30` | How the game is played, up to 90 days (`play_stats`, see Play stats below), how many accounts have it in their favorites now (`favorite_count`, never who), how it runs on players\' devices (`performance`, the same section), and multiplayer use per day in `multiplayer_days`: `date`, `room_count`, `room_play_duration_min`, `message_count` (messages and bytes players sent), the day\'s room traffic per player a second (`inbound_messages_per_player_sec`, `inbound_size_bytes_per_player_sec`, `outbound_messages_per_player_sec`, `outbound_size_bytes_per_player_sec`, divided by its player time, each message out counted once per player it reached) and `game_server_cpu_duration_sec`, the time the game\'s own game server ran in its rooms (each call\'s time less its waits on the database, other servers and its own timers). `hosting_use_this_month`: the game\'s month on its one hosting meter (see Hosting and credit): `free_used_pct`, `shares`, `is_paused`, `paused_reason`, `paused_at`, `resets_on_date`, `monthly_budget_cents`, `spent_from_credit_cents`, and the raw counts behind it, facts for tuning that are never priced on their own: `room_play_duration_hours` on Zaisma rooms, `relayed_size_bytes` (the data Zaisma\'s relay sent the game\'s players for their connections to each other, read from Cloudflare about once an hour), `game_server_cpu_duration_sec` (its rooms, and requests, schedule runs and webhooks past their first 10 ms), `request_count` (requests, webhook events and schedule runs), `written_row_count`, `read_row_count`, `database_size_bytes` and `adult_chat_check_count`. Rooms on your own server aren\'t counted. `room_traffic`: this month\'s traffic per player a second (the same four numbers), `message_types`, its 10 biggest message types by bytes (`message_type`: a message\'s `data.type`, or `(none)`, `(bytes)`, `(zaisma)` for Zaisma\'s own, `(state)` for state sync\'s updates (`stateSyncEnabled`) and `(other)` past a room\'s first 20; `direction` `inbound` or `outbound`; `message_count`, `size_bytes`, `largest_size_bytes`, `average_size_bytes`), and `traffic_hints`, each a `code` and a `message` with the game\'s numbers: `json_messages_large` (a JSON type averages 512 bytes or more at 5 or more a player-second: send it as bytes), `outbound_heavy` (each player gets 32 KB a second or more: send only what changed and what they can see, with `stateSyncEnabled` and `stateView`), `message_near_limit` (a message of 12 KB or more, near the 16 KB limit) and `latest_only_available` (a type goes to each player 10 or more times a second, and 10% or more of it went to players whose connection was backed up: send it with `delivery: "latest_only"`). Rooms on your own server aren\'t counted. `schedules`: the live version\'s schedules (see "Schedules" in the README), read within a minute of it going live, each with `schedule_name`, `cron` (UTC), `version_id`, `next_run_at` and `last_run_at` (`null` until it first runs); `[]` when it has none or players can\'t play the game. For games whose own game server runs on Zaisma (rooms on `own`, or any requests or schedules), each day\'s `game_server` has `call_count` (calls from its rooms), `request_count` (requests to `onRequest`, see "Requests to your game server" in the README), `scheduled_run_count` (runs of `onSchedule`), `crash_count` (a handler threw; that call, request or run is lost), `stopped_count` (ran on too long, like an endless loop; the match froze about 2 seconds, or the request or run failed) and `ended_match_count` (stopped twice), and `game_server_errors` lists the 20 most recent distinct errors: `kind`, `message` with the file and line it came from (a game server that didn\'t start says why, like an option it doesn\'t take, with the ones it does, or a cron that doesn\'t read; a run\'s error starts with its schedule\'s name), `occurrence_count`, `version_id`, `first_at` and `last_at`. Other games get `game_server: null` and `game_server_errors: []`. |\n| `GET /games/:slug/history` | What happened to the game in `events`, newest first, up to 100: `description`, `version_id`, `subject_name` (what it was done to, like a secret\'s name), `done_by` (`you`, `api_key`, `ai` or `zaisma`), `api_key_name`, where it came from (`device`, `network_name`, `city_name`, `region_name`, `country_code`, `connection_address`: kept 90 days, and `null` with Keep where my account is used from off, except that uploads keep their address 90 days either way), `is_new_place` (a key\'s first change from a network and country it hadn\'t been used from), `occurrence_count` (SQL writes, imports, exports and save reads and changes from one key within the hour fold into one event), `happened_at`, `last_happened_at` and, for a hold, rejection or takedown, its `review_reason` (otherwise `null`). Besides uploads, scans and publishes it holds database writes, imports, exports and restores (a restore\'s `subject_name` is the time it went back to; an undo\'s, the restore it undid), a re-upload of the game by another developer that Zaisma stopped (its `subject_name` is their username; you also get an email), save reads and changes, secrets and tester links; a key that isn\'t limited to some games also sees your webhooks and sign-in apps. |\n| `GET /games/:slug/qr-code?room_code=` | The game\'s link as a QR code: `link_url` (the game page, or with `room_code` a room in it) and `qr_code_svg`, an SVG document, black on white with its margin, to save as a `.svg` file or turn into a PNG at any size for posters, booths and trailers. The dashboard has it under Details with SVG and PNG downloads, and players get the same code from Share on the game page. `room_code` that isn\'t a room\'s code answers `bad_room_code`. |\n\n### Alerts\n\n`alerts` on each game in `GET /games`, and beside the game in `GET /games/:slug`: what needs your attention in it, most urgent first, `[]` when nothing does. The developer home on zaisma.com/dashboard shows the same list on each game\'s card, and each game\'s Overview above everything else. Each is `{"kind", "message", "fix", "message_for_people", "version_id"}`, with `message_for_people` the words the dashboard shows and `version_id` naming the version it\'s about (`null` when it\'s about the whole game):\n\n- `game_removed`: Zaisma took the game down; `message` and `fix` are its `review_reason`\'s.\n- `game_waiting_to_erase`: the developer deleted the game: it\'s off for every player and erased at `erases_at`, unless `bring_back_game` brings it back first.\n- `game_held`: players can\'t open the game while Zaisma checks it; likewise.\n- `game_blocked_in_country`: players in one country can\'t open the game, on a notice under that country\'s law, and everyone else still can; one alert for each country in `country_blocks`, with its message and fix.\n- `version_rejected`: the newest version was rejected. `GET /games/:slug/versions/:id` has its `findings`.\n- `version_held`: a version is waiting for a person at Zaisma (or a player report paused it), usually decided within a day. One alert per held version.\n- `link_flagged`: one of the game\'s registered links opens for nobody, since Cloudflare lists its site for malware or phishing. One alert per link; its `fix` is the link\'s `review_reason`\'s.\n- `game_off_lists`: the game is listed, but a cover\'s or the title\'s `listing_reason` keeps it off Zaisma\'s lists until it\'s fixed; the message gives each reason, the fix the first one\'s. It still plays by its link.\n- `hosting_paused`: the game\'s hosting is paused this month (see Hosting and credit), with why: its free hosting is used and it has no budget (back on the 1st, UTC), its budget is used, your credit ran out, it has no real players and games with none used their share of free hosting (back once real players play it, or on the 1st), or Zaisma\'s free hosting for the month ended. No new rooms, connections between players or game server requests start; matches already running get an hour from the pause to finish, and take no new players meanwhile: the game server\'s `onEnding` and each player\'s `ending` event say when (`room.endsAt`). When the pause lifts within that hour (credit comes in, the budget is raised, the month resets), the end is called off: `room.endsAt` is `null` again, the game server\'s `onEndingCancelled` and each player\'s `endingCancelled` event say so, and the match takes new players again. The `fix` says what starts it again.\n- `free_rooms_stopped`: Zaisma\'s free room time for the month is used up across all games, and the game has no budget with credit (see Hosting and credit). No new rooms or connections between players start until the 1st (UTC); its database and game server requests go on.\n- `second_free_allowance_started`: the game filled its free hosting for the first time, so it has a second free allowance this month, once.\n- `database_full`: the game\'s storage (its database and kept rooms) reached the 10 GB a game can keep, so the database can change and delete rows but not grow, and no more rooms can be kept.\n- `hosting_nearly_paused`: 80% of the month\'s free hosting is used, and the game can\'t go on past it: it has no budget, or it has one but there\'s no credit to spend (a balance of 0).\n- `hosting_budget_nearly_used`: 80% of the game\'s monthly budget is used.\n- `credit_low`: your credit is under 20% of what there was right after your last top-up (`is_credit_low` in `GET /credit`), on each game with a budget, until the next top-up: add credit.\n- `database_nearly_full`: the game\'s storage is 80% of the 10 GB a game can keep.\n\nA heads-up is never given alongside its own paused or full kind.\n- `player_erase_failed`: Zaisma couldn\'t erase players who deleted their accounts from the game database (a foreign key refused it, say) after trying on the webhook schedule. `message` gives the newest failure and `fix` up to 5 player IDs to erase with `POST /games/:slug/database/erase-player` once it\'s fixed. It goes after 30 days.\n- `reports_open`: player reports from the last 90 days waiting for Zaisma, counted as `GET /games/:slug/reports` counts them.\n\nNew kinds can be added, so show the `message` of one you don\'t know.\n\n### What\'s on at Zaisma\n\n`GET /whats-on` (MCP `get_whats_on`): what the home\'s window shows right now, the same for everyone. `event` is the event running, or null. `cards` holds up to 3 cards, Zaisma\'s own first, each with `card_kind` (`game`, `event` for an event\'s poster, `news` for news for players), `slug` (null unless a game), `title`, `cover_url`, `link_url` and `tag` (`Pick`, `Updated`, `New`, `Trending`, `News` or null); while there are games, at least one card is a game. It fills itself from new games, big updates and what\'s trending, and changes each week.\n\n### Who\'s playing on Zaisma\n\n`GET /playing-now` (MCP `get_playing_now`), also public at `zaisma.com/api/playing-now` with no key: `playing_now_player_count`, everyone playing on Zaisma right now, the total of every game\'s playing-now count; and `busiest_games`, the busiest listed games by play count alone, each with `slug`, `title`, `cover_url` and `playing_now_player_count` (null below 3 players).\n\n### Play stats\n\n`play_stats` in the stats answer, counted by the game page with no code in the game. These are **counted plays**, Zaisma\'s official numbers: a play counts once the game has been on screen for a minute, in a browser Cloudflare\'s invisible check says is real (each check works once, and time can\'t be claimed faster than it passes). They\'re also what Popular and Trending use.\n\n- **days:** per day (UTC `date`), `play_count`, `player_count` (browsers with a counted play that day), `new_player_count` (browsers with their first counted play) and `play_duration_min` (time on screen in counted plays), plus `started_play_count`: every play started, counted or not.\n- **play_count**, **started_play_count**, **new_player_count** and **play_duration_min** over the period, and **average_play_duration_min** per counted play.\n- **came_back:** `after_1_day`, `after_7_days` and `after_30_days`, each `{"returned_pct", "returned_player_count", "new_player_count"}`: of the new players in the 30 days before, how many played again that many days after their first play. Only days that are over count, so `returned_pct` is `null` until there are some.\n\nA player is a browser: one person on two devices counts twice, and clearing the browser makes them new. Plays through tester and preview links, and your own while signed in, aren\'t counted. We keep only counts: nothing that says who played. Faking plays breaks the content rules: it takes a game off Popular, Trending and New, and doing it again can get the game taken down.\n\n`performance` in the stats answer says how the game runs on players\' devices, measured in their browsers by a small script Zaisma adds to the game\'s pages at its public address, with no code in the game. Only you and your AI see it: never the game page, the shelves or the ranking. It\'s `null` when `performance_measuring_enabled` is off.\n\n- **version_totals:** each version played in the period, every device together, newest first.\n- **device_totals:** the newest version played in the period, by `browser_name`, `os_name` (read from the browser\'s user agent, which isn\'t kept), `device_kind` (`computer`, `phone` or `tablet`, as the game page tells them apart) and `graphics_family` (the graphics chip\'s maker, read in the game\'s frame so the chip\'s own name never leaves it; `unknown` when the browser hides it), most plays first. Groups under 20 plays fold into one last row whose four are all `other`, so a rare device can\'t single out a player.\n\nEach row has `version_id`, `play_count` and:\n\n- **median_loading_duration_sec**, **slow_tenth_loading_duration_sec:** from the game\'s page opening to its first draw on a canvas in the page, the same first draw the Chrome check measures (`performance_check.loading_duration_sec` on a version): half the plays drew within the median, and the slowest tenth took the slow tenth or longer. `null` when none drew.\n- **median_frames_per_sec**, **low_tenth_frames_per_sec:** frame rates of the seconds the game was on screen, counted from its own `requestAnimationFrame` frames, so a game that draws from a worker (OffscreenCanvas) or never asks for frames isn\'t measured (`is_measured: false`, and these are `null`). They\'re given as the band they fall in (15, 25, 30, 45, 60, 90 or 120; below 15, the rate itself): 60 means 60 to 89, since frame rates gather at screens\' refresh rates.\n- **long_frames_per_min:** frames of 50 ms or longer, stutter a player feels, a minute of measured play.\n- **crashed_play_pct**, and crashed plays by what happened first, each play counted once: **error_stop_count** (an uncaught error after which the game asked for no frame for 5 seconds while on screen), **context_lost_count** (a WebGL context on a canvas in the page was lost while on screen, and the game didn\'t lose it itself with `WEBGL_lose_context`) and **stopped_responding_count** (the game\'s frame stopped answering for 15 seconds while on screen: frozen or crashed).\n- **median_peak_memory_size_bytes:** the most memory a play used by the time it was first reported, usually its first minute: the JavaScript heap where the browser tells it (Chrome and Edge) plus WebAssembly memory. `null` when no browser told it.\n\nPlays are measured with the same Cloudflare check as counted plays, so faked ones can\'t skew them: a play\'s numbers come only with its check\'s ticket, its load time and crash count once, and it can\'t report more play than it has been open. Plays through tester and preview links and your own aren\'t measured. Numbers are kept as totals a day per version and device group, never per play or player.\n\n### Export everything\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/export` | What an export of the whole game holds, in `export`: `download_url`, `command`, `version_count`, `withheld_version_count`, `image_count`, `withheld_image_count`, `shader_count`, `save_count` and `files_size_bytes`. |\n| `GET /games/:slug/export/download` | The export itself: a .zip (`application/zip`), made as it downloads. |\n\nEverything about a game as one .zip, to keep, to move, or to run on your own server. Three ways in, one file: `export_game` answers `download_url`, a link your AI hands you that opens in your browser when you\'re signed in to Zaisma and for no one else (it doesn\'t expire); the game\'s dashboard has an Export everything button on its Details tab; and `npx @zaisma/cli export <slug>` saves it as a folder (The upload command, below). The key needs read access to the game, versions, stats, database and saves (`key_not_allowed` otherwise; a read key has it all). An account starts up to 2 exports a minute (`slow_down`). Each export is a line in the game\'s history ("Exported everything about the game"), with who made it and from where.\n\nIn the .zip:\n\n- `README.txt`: what\'s where.\n- `game.json`: the game (as `GET /games/:slug` answers it), its `images` (each with `file_path`, or `null` when it hasn\'t passed review), its `shaders` (each with `file_path`, or `null` when it hasn\'t passed its check, and what every pass\'s channels read), `testers`, and `secrets`: their names and when each was set, never their values.\n- `versions.json`: every version Zaisma keeps, with its patch notes, review status and findings, as `GET /games/:slug` answers them without the preview links; `folder_path` is where its files are, or `null` for a version that\'s still being scanned, held or rejected. Those carry no files, so nothing unscanned or held leaves through an export.\n- `versions/<version_id>/\u2026`: each version\'s files, as they were uploaded.\n- `images/<kind>-<image_id>.png` (or `.jpg`, `.webp`): the cover, square cover and gallery pictures that passed review.\n- `shaders/<screen>-<shader_id>.glsl`: each shader that passed its check, with its buffer passes beside it as `<screen>-<shader_id>.buffer-a.glsl` to `.buffer-d.glsl`.\n- `database.sql`: the game database as SQLite\'s SQL dump, the same text `export_database` answers part by part. `zaisma export` also makes it `database.sqlite`, the file the Node runner takes as `--database-file`.\n- `saves.jsonl`: every player\'s cloud save, one JSON object a line, as `get_save` answers it (`player_id`, `sha256`, `size_bytes`, `saved_at`, `changed_by_kind`, `save_copy_count`, `version_id`, `local_storage_items`, `indexeddb_databases`). Earlier copies of saves stay out.\n- `stats.json`, `reports.json`, `history.json`: as `get_stats` (90 days), `get_reports` and `get_history` answer them.\n\nAccount-wide things (webhooks, sign-in apps, API keys) aren\'t in it: they belong to the account, not the game. The files are stored as they are, not compressed, and zip64 records go in where a game needs them, so every unzip tool opens it.\n\n## Hosting and credit\n\nEverything a game runs on Zaisma\'s servers is on one meter per game, shown as a percentage of its free hosting for the month, never in dollars: its rooms, its game server, data Zaisma\'s relay sends its players, its database, and requests, webhook events and schedule runs to its game server. Every game gets the same free hosting each calendar month (UTC), with no card: 8 friends playing a real-time game 2 hours every night use about a third of it; it covers about 1,300 player-hours of an 8-player real-time game at 60 ticks a second (over 300 players playing 4 hours a month), or about 2,500 player-hours of a 4-player turn-based game. A demo or a test never uses up another game\'s month. Free on purpose, for every game and off the meter: game files (downloads and storage, so a game never stops loading), cloud saves, accounts and sign-in, publishing and its reviews, spectators, and anything on your own servers (rooms, a relay, an API).\n\n`hosting_use_this_month`, in `GET /games/:slug/stats` and `GET /games/:slug/database`:\n\n- `free_used_pct`: how much of the month\'s free hosting is used, 0 to 100. `resets_on_date` is when it starts again.\n- `shares`: what used it, each `{"kind", "share_pct"}` adding to 100, biggest first: `rooms`, `game_server`, `relayed_data`, `database`, `requests`, `adult_chat_checks` (the chat filter\'s checks between adults, with `adultChatFilterEnabled`), `page_previews` (Chrome drawing your AI\'s preview pictures, `preview_game_page`). `[]` before any use.\n- `second_free_allowance_month_start_date`: the month the game had its second free allowance, the first time it filled its free hosting, or `null` until then. It comes once; that month `free_used_pct` counts both.\n- `is_paused`, `paused_reason` (`free_used`, `budget_used`, `credit_used`, `no_real_players`, `free_hosting_ended` or `null`) and `paused_at`.\n- `free_rooms_stopped_at`: when Zaisma\'s free room time for the month ran out across all games, for a game with no budget with credit; `null` otherwise. See the stop below.\n- `monthly_budget_cents` and `spent_from_credit_cents`: the game\'s budget and what credit paid for it this month.\n- **Where the hours went:** `play_hours`, this month\'s totals, never who: `total_duration_hours`, of it `new_player_duration_hours` and `returning_player_duration_hours`, and of it again `rented_network_duration_hours` and `other_network_duration_hours`, with `rented_share_used_pct`.\n- **Real players go last:** traffic from rented-server networks has its own share of 10% of the game\'s free hosting and of its budget, counting only its own use, and everyone else plays from the rest, with no extra free time and no gap in the meter. On that share: anyone on a rented-server network without history, and anyone at all whose browser shows no input and no graphics chip. An account a week old, or that played before or bought something, and a browser that played this game before, play from the rest on any network. Past it those players get `rented_share_used` from rooms, requests and the relay, and in a match they get an hour; everyone else plays on. A game on its own server isn\'t on the meter, and never hears any of it.\n- The counts behind it: `room_awake_duration_hours`, `room_connection_count`, `inbound_message_count`, `relayed_size_bytes`, `game_server_cpu_duration_sec` (of it `startup_cpu_duration_sec`), `game_server_session_count`, `loaded_version_count`, `outside_call_count`, `log_file_count`, `request_count`, `awake_duration_hours`, `database_call_count`, `written_row_count`, `read_row_count`, `bookkeeping_written_row_count` and `database_size_bytes`; and `room_play_duration_hours`, player time in rooms, a fact for tuning that isn\'t priced.\n\n**A second free allowance, once.** The first time a game with real players fills its free hosting, it gets a second allowance free that month, so it doesn\'t stop before you can react: `second_free_allowance_started` tells you. A game with no real players doesn\'t get it yet, and doesn\'t lose it. A game with a budget isn\'t charged for it. From the next month it has one allowance again.\n\n**Real players** are browsers with a counted play this month (a minute on screen from a browser Cloudflare checked, not your own), off cloud networks. Tester-link plays from checked browsers count here too, and never in your stats. A game needs at least 2, and more as it uses more: 8 friends clear it, and a full allowance takes about 17.\n\n**Past the free hosting.** A game without a budget pauses at 100%. A game with one (`monthly_budget_cents` on `PATCH /games/:slug`, in cents: 5000 is $50) draws from your credit past it, never more than its budget in a month, at these prices:\n\n- **Rooms:** $23.04 per 1,000 hours a room is awake (a ticking room all the while it ticks; a turn-based room for 10 seconds after each event, a move or its check on its players every 30 seconds, and asleep in between), $0.03 per million messages players send, $1.80 per million times a player connects, $0.60 per million times a room wakes on its own or is called by another of the game\'s rooms, and the rows Zaisma writes for it (its listing, saves and seats) at the database\'s price.\n- **Game server:** $0.08 per 1,000 CPU-seconds wherever it runs (rooms, requests, schedule runs and webhooks), starting up included, counting only the time your code runs: its waits on the database, other servers (including reading their answers) and its own timers don\'t count, calls made at the same moment count only their own time, and each call it makes to another server counts 1 ms; $1.20 per million times it\'s started (a room starting it, a restart after a failure, its requests\' object waking); $0.008 for each version loaded on a day (UTC); $18 per million files of its logs. A running room\'s ticks and messages to it cost only their CPU.\n- **Relayed data:** $0.20 per GB.\n- **Database:** $0.60 per million calls, $4 per million rows written, $0.004 per million read, $0.80 per GB-month stored, and $23.04 per 1,000 hours awake.\n- **Requests:** $1.80 per million game server requests, a schedule\'s run or a webhook event counting as one, and $23.04 per 1,000 hours its object is awake for them.\n- **Chat checks:** $0.20 per 1,000 checks of chat between adults, when its game server turns on `adultChatFilterEnabled`.\n\nOnly this part shows in dollars. You hear at 80% of a game\'s budget (`hosting_budget_nearly_used`) and when it\'s used, by email and in its alerts and webhooks, again for a raised budget; at 80% of the free hosting for a game without a budget, or with one and no credit to spend (`hosting_nearly_paused`). When one run of the meter takes a game straight past a heads-up to its pause, you get both.\n\n**The pause** (`hosting_paused`, with why): no new rooms, connections between players through the relay, or game server requests and schedule runs start until the month resets, the budget is raised or credit comes in. Matches already running get an hour from the pause to finish, every room of the game ending together; the game server\'s `onEnding` and each player\'s `ending` event say when (`room.endsAt`). If the pause lifts within that hour, running matches hear the end is called off (`onEndingCancelled`, the `endingCancelled` event, `room.endsAt` back to `null`) within about 5 minutes and take new players again. The game database keeps reading and writing for that hour, so a match\'s last save lands, then answers `hosting_paused`; exports and erasing a player always work. A pause can come up to 5 minutes after the line is crossed, and what a game uses past its budget or your balance, its finishing hour included, is written off: never charged later. So is what a game without a budget used past its free hosting: a budget you give it later pays only from then on.\n\n**When free hosting runs short,** games with real players go last. Games with no real players, on any account, share part of Zaisma\'s free hosting each month. When it\'s gone, each pauses (`hosting_paused`, reason `no_real_players`) until it has real players or the month resets.\n\n**The stop on free rooms** (`free_rooms_stopped`): Zaisma\'s free room time is limited each month across all games. When it runs out, a game with no budget, or with a budget and no credit to spend, starts no new rooms or connections between players through the relay until the month resets. Players hear `hosting_paused`, and matches already running get an hour to finish, as in a pause. Its database and game server requests go on, up to its own free hosting, until free hosting ends for the month (`hosting_paused`, reason `free_hosting_ended`). A game with a budget and credit isn\'t touched, and giving a game both lifts the stop for it at once. Rooms on your own server are never limited.\n\n**Credit** is one balance for all your games, in cents, never below zero. You buy it on Stripe\'s page ($10 buys $10, from $10 to $1,000 a top-up), and Stripe sells it as the merchant of record, handling sales tax and VAT. It never expires and is never paid out; it pays only for Zaisma\'s services. What\'s unspent of a top-up refunds to its card for 30 days, on request, and after that stays yours to spend but doesn\'t refund; credit is spent oldest first, so the newest top-ups hold the balance. Credit only comes in through Stripe: a top-up you pay on Stripe\'s page, or the monthly credit plan you start there once. You hear when your credit falls under 20% of what there was right after your last top-up (`is_credit_low`, the `credit_low` alert and an email) and when it runs out. Deleting your account refunds what still refunds (credit inside its 30 days; the delete box names any older credit that won\'t come back), even when Stripe is down at that moment: the refund goes through once it\'s back.\n\n**The monthly credit plan** keeps credit from running dry: on the 1st of every month (UTC), the day the free hosting resets, your credit goes back to a level you pick, from $10 to $10,000. You start it once on Stripe\'s page, and Stripe sells every payment as it sells a top-up, with sales tax or VAT on top. The first payment fills credit to the level (at most $1,000: a higher level fills to it from the next 1st). Each 1st pays only what brings the balance back to the level: a quiet month costs what your games spent, and a month with a balance at or over the level, or under $1 short of it, pays nothing. Each payment is a top-up like any other, refundable for 30 days. A declined card shows as `payment_failing` while Stripe tries again over the next days; you hear by email when it\'s declined and when Stripe gives up, and the plan ends then. One plan at a time, apart from Pro. Stopping it is at once: it holds no prepaid month, and credit already bought stays. Deleting your account stops it first.\n\n**Spending needs you.** Your AI can read all of it, start a top-up or the monthly credit plan (you pay on Stripe\'s page), refund a top-up, turn a game\'s budget off or down, and lower or stop the plan. A first or higher budget, and a higher plan level, need your passkey on zaisma.com: through a key it answers `confirmation_needed` (403) with `confirm_url` and `spending_request_id`: Zaisma keeps the exact change, and `confirm_url` opens a sheet on Developer settings naming it ("Starfall\'s monthly budget, none \u2192 $40") with Approve (a passkey tap) and Decline. Only you can approve, for your account alone, and a request expires after a day. `GET /spending-requests/:spending_request_id` shows `request_status` (`waiting`, `approved`, `declined` or `expired`), the change asked for and what it is now. These calls need `credit_access` (see What a key can do).\n\n| Call | What it does |\n| --- | --- |\n| `GET /spending-requests/:spending_request_id` | A raise in spending you asked for: `{"spending_request": {"id", "request_kind" (`game_budget` or `credit_plan_refill_level`), "game_slug", "game_title", "requested_change", "current_setting", "request_status", "created_at", "expires_at", "answered_at"}}`. `requested_change` and `current_setting` are `{"monthly_budget_cents"}` for a game\'s budget and `{"refill_level_cents"}` for the plan\'s level, whose `game_slug` and `game_title` are `null`. Another account\'s, or an unknown one, answers `no_spending_request` (404). Needs `credit_access` `read`. |\n| `GET /credit` | Your credit: `{"credit": {"balance_cents", "is_credit_low", "credit_plan", "top_ups", "games", "entries", "waiting_spending_requests"}}`. `waiting_spending_requests`: each raise in spending waiting for your answer, as `GET /spending-requests/:spending_request_id` answers it, oldest first. `credit_plan`: `null` with no plan, else `{"refill_level_cents", "plan_status", "next_payment_at", "next_payment_cents", "started_at"}`: `plan_status` is `running` or `payment_failing` (the card was declined and Stripe is trying again); `next_payment_at` is the next 1st, 00:00 UTC; `next_payment_cents` is what it pays at today\'s balance, before tax (0 under $1 or at or over the level). `top_ups`: the last 30 days\', newest first, each `{"id", "amount_cents", "refundable_cents", "refund_ends_at", "created_at"}` (IDs `top_up_\u2026`). `games`: games with a budget or spending this month, each `{"slug", "title", "monthly_budget_cents", "spent_from_credit_this_month_cents", "last_month_beyond_free_cents"}` (`last_month_beyond_free_cents`: what last month\'s use past the free allowance would have cost at today\'s prices, 0 when it stayed inside). `is_credit_low`: the balance is under 20% of what there was right after the last top-up. `entries`: the last 90 days, newest first, each `{"id", "entry_kind", "amount_cents", "game_slug", "created_at"}`: `top_up` (adds), `hosting_charge` (one per game per day, negative), `refund` (negative) or `written_off` (what Zaisma took on; it never touched the balance). Needs `credit_access` `read`. |\n| `POST /credit/top-ups` | Start a top-up: `{"amount_cents"}`, 1000 ($10) to 100000 ($1,000); anything else answers `bad_top_up_amount`, and an account with no passkey and no email answers `account_not_protected` (credit stays with the account: add a passkey or an email on zaisma.com/account first). In an account\'s first 7 days, top-ups and buys together stay under USD 100 (`new_payer_limit`). Answers `checkout_url`, Stripe\'s page where only you can pay, `expires_at` and `next_steps` (`get_credit` once you\'ve paid). Paying adds the credit within seconds, and games paused for credit start again. Up to 10 top-ups and refunds a minute. |\n| `POST /credit/refunds` | Refund what\'s unspent of one top-up to its card: `{"top_up_id"}`. Answers `refunded_cents` and `next_steps`. `top_up_not_refundable` when it\'s spent, refunded or over 30 days old; `no_top_up` when it isn\'t yours. |\n| `POST /credit/plan/checkout` | Start the monthly credit plan: `{"refill_level_cents"}`, 1000 ($10) to 1000000 ($10,000); anything else answers `bad_refill_level_cents`. `already_credit_plan` (409) while one runs; `account_not_protected` and `new_payer_limit` as for a top-up, on its first payment. Answers `checkout_url`, Stripe\'s page where only you can pay, `expires_at` and `next_steps` (`get_credit` once you\'ve paid). Shares the 10 a minute with top-ups and refunds. |\n| `PATCH /credit/plan` | Set the plan\'s level: `{"refill_level_cents"}`, as above. Lower or the same applies at once; higher answers `confirmation_needed` with `spending_request_id`. Answers the `credit` as `GET /credit` does, and `next_steps`. `no_credit_plan` (409) with none. |\n| `POST /credit/plan/stop` | Stop the plan at once; credit stays. Answers the `credit` and `next_steps`. `no_credit_plan` (409) with none. |\n| `PATCH /games/:slug` with `monthly_budget_cents` | A game\'s monthly budget: whole cents of at least 100, or `null` for no paid hosting (it pauses at its free hosting). `null` or lower works with a key that has `credit_access` `write`; a first or higher budget answers `confirmation_needed`. A budget under what credit already paid this month pauses the game at once; a higher one starts a game paused on its budget again. |\n\n## Zaisma Pro\n\nZaisma Pro is $10 a month on your card, apart from hosting credit, for developers with a lot to store. It raises these limits (hosting stays on the meter and credit; Pro changes nothing inside games):\n\n| | Free | Pro |\n| --- | --- | --- |\n| Storage | 10 GB, or 50 GB once established or paid by card | 500 GB |\n| New data a day | 10 GB, or 25 GB once established or paid by card | 100 GB |\n| Performance checks a day | 20 | 60 |\n\nReviews and versions a day are the same on every plan: 5 large reviews, 30 small reviews and 100 versions a game. Stats and scheduled releases are free for everyone. Seats come with Teams and custom domains with Custom game domains, so neither is part of Pro. You can cancel any time and keep Pro to the end of the paid month, with no refunds for part of a month; then the free limits come back. Your first payment refunds within 14 days of it (`POST /pro/refund`), and Pro ends then: only the account\'s first Pro payment, while it\'s the only one, so starting Pro again after a refund doesn\'t refund again. A live version over 2 GB stays live, and only new uploads must fit. Versions waiting past a lowered daily review limit wait for the next free one. Pro ends at the end of the period Stripe says is paid, so a renewal Stripe retries keeps it until Stripe says it\'s over. Stripe sells it as the merchant of record, as it does credit. Teen developers buy Pro like anyone; whoever owns the card pays. These calls need `credit_access` (`read` for `GET /pro`, `write` for the rest); `GET /access` answers `plan` (`free` or `pro`).\n\n| Call | What it does |\n| --- | --- |\n| `GET /pro` | Your plan: `{"pro": {"plan", "pro_ends_at", "is_pro_cancelled", "monthly_price_cents", "limits": {"free": {...}, "pro": {...}}, "limits_for_everyone": {...}, "used_today": {"large_review_count", "small_review_count", "performance_check_count"}}}`. `plan` is `free` or `pro`; `pro_ends_at` is when Pro ends or renews (`null` on free); `is_pro_cancelled` says it ends there instead of renewing; `refund_ends_at` is until when `POST /pro/refund` refunds the first payment (14 days after it, while it\'s the only one), `null` after that, on free, or when Stripe didn\'t answer within 3 seconds. Each plan\'s limits are `{"maximum_large_review_count", "maximum_small_review_count", "maximum_performance_check_count", "maximum_version_count", "maximum_game_size_bytes"}`. |\n| `POST /pro/checkout` | Start Pro. Answers `checkout_url`, Stripe\'s page where only you can pay, `expires_at` and `next_steps` (`get_pro` once you\'ve paid). `already_pro` (409) while Stripe holds your Pro subscription, cancelled or not (`resume_pro` takes cancelling back). Up to 10 starts, cancels, resumes and refunds a minute. |\n| `POST /pro/cancel` | Cancel at the end of the paid month. Answers the `pro` as `GET /pro` does, and `next_steps`. `not_pro` (409) when you have no Pro or it\'s already cancelled. |\n| `POST /pro/resume` | Take cancelling back before it ends. Answers the `pro` as `GET /pro` does. `not_pro` (409) when you have no Pro or it isn\'t cancelled. |\n| `POST /pro/refund` | Refund the first payment in full, within 14 days of it, and end Pro now. Answers `refunded_cents` and `next_steps` (`get_pro`). `pro_not_refundable` (409) when you have no Pro, it\'s past 14 days, or it isn\'t the account\'s only Pro payment. |\n\n## Storage\n\nA game can be any size. What\'s limited is what an account stores and how much new data it sends in a day:\n\n| | Stored | New data a day |\n| --- | --- | --- |\n| A new account | 10 GB | 10 GB |\n| Established (see Standing), or paid by card | 50 GB | 25 GB |\n| Zaisma Pro | 500 GB | 100 GB |\n\nEverything stored counts, drafts and old versions too; a file shared between versions counts once, and a file you already store doesn\'t count as new data. Files sent that never become a version count toward the day, and toward what\'s stored until a day after your last upload. A game too big for one day\'s new data goes up over several: what\'s sent stays, and the upload command sends only the rest.\n\nAn account over its limit keeps its live versions. New uploads must fit: `storage_full` says what to delete.\n\n**When nothing pays for what\'s past the limit,** because Pro ended or credit ran out, a 14-day clock starts. A renewal Stripe is still trying, and the wait after a ruling, don\'t start it. You hear by email when it starts and 3 days before the end, and `unpaid_files_delete_at` on `GET /storage` says when. At the end, Zaisma deletes files no version uses, then drafts, then the oldest versions, until the account fits. Live versions stay, and so do versions set to publish, picked by a tester link or kept for a person at Zaisma. Setting a budget with credit, starting Pro or deleting enough yourself stops the clock.\n\n**Past what\'s included,** set a monthly storage budget. Storage then draws from your credit at 12\xA2 per GB a month, charged a day at a time on what\'s past what\'s included, up to the budget and the balance. Credit and budget set how far past it you can go: $10 of both buys room for about 83 GB. If credit runs out, uploads stop fitting and the 14-day clock starts. Stored files never use a game\'s free hosting.\n\n| Call | What it does |\n| --- | --- |\n| `GET /storage` | `{"storage": {"stored_size_bytes", "included_size_bytes", "maximum_stored_size_bytes", "allowance_kind", "new_data_today_size_bytes", "maximum_new_data_size_bytes", "monthly_storage_budget_cents", "unpaid_files_delete_at", "spent_this_month_cents", "price_per_gigabyte_month_cents", "deletable_versions"}}`. `allowance_kind` is `new`, `established`, `paid_by_card` or `pro`. `deletable_versions` is the biggest 20 versions that can be deleted now, each `{"game_slug", "version_id", "size_bytes", "created_at"}`; a key limited to some games sees only those. Any key. |\n| `PATCH /storage` | `{"monthly_storage_budget_cents"}`: whole cents from 100 to 1,000,000, or `null` for none. A first or higher budget answers `confirmation_needed`, where the developer approves with a passkey tap; off or lower works at once. Answers the `storage` and `next_steps`. Needs `credit_access` write. |\n| `DELETE /games/:slug/versions/:version_id` | Deletes one version for good, and the files no other version has stop counting at once. `version_in_use` (409) for one that\'s live, set to publish or picked by a tester link; `still_scanning` (409) while it\'s scanned; `kept_for_review` (403) for one a person at Zaisma must keep. Answers `is_deleted`, the `storage` and `next_steps`. Needs `version_access` publish. |\n| `DELETE /games/:slug` | Deletes a whole game: `{"confirm_slug"}`, the game\'s slug again, or `bad_confirm_slug`. It stops at once for every player and is erased a week later, with its versions, database, saves and purchases, and its link is never used again; until then it stays the developer\'s and counts toward what they store. A game other people played answers `confirmation_needed` (403) with `confirm_url` and `game_deletion_request_id`, and nothing changes until the developer approves there with a passkey tap. `kept_for_review` (403) for a game a person at Zaisma must keep; `still_scanning` (409) while a version is scanned. Answers `is_deleted`, `erases_at`, the `storage` and `next_steps`. Needs `game_access` write. |\n| `POST /games/:slug/bring-back` | Brings a deleted game back until its `erases_at`, as it was before. `not_waiting_to_erase` (409) for a game that isn\'t deleted; `already_erasing` (409) once its week is over; `game_removed` (403) when Zaisma took it down since. Answers `is_brought_back` and `next_steps`. Needs `game_access` write. |\n| `POST /games/:slug/erase-now` | Erases a waiting game nobody but its developer ever played, without waiting: `{"confirm_slug"}`. It always answers `confirmation_needed` first, for the developer\'s passkey tap. `played_by_others` (409) for a game other people played. Answers `erases_at` and `next_steps`. Needs `game_access` write. |\n| `GET /games/:slug/deletion-requests/:game_deletion_request_id` | The developer\'s answer to a deletion: `game_deletion_request` with `request_kind`, `game_slug`, `game_title`, `player_with_save_count`, `purchase_count`, `is_asked_from_dashboard`, `request_status` (`waiting`, `approved`, `declined`, or `expired` after a day), `created_at`, `expires_at` and `answered_at`. `no_game_deletion_request` (404) for one this game doesn\'t have. Needs `game_access` read. |\n\n## Players\n\nA signed-in player plays as their Zaisma account in every game, with the same player ID (`player_\u2026`) everywhere; anyone else is a guest with a new ID for each pass. Your game sees the ID in `room.players`, in `Zaisma.player.getPass()` and as the `sub` of the player pass your own server checks, with `kind` saying `account` or `guest`. Your server checks a pass with `verifyPass(pass, keys, { gameSlug })` from `@zaisma/game-server` (your game\'s own keys at `https://rooms.zaisma.com/v1/pass-keys/<gameSlug>`: every game\'s passes are signed with a key of its own, so a pass for another game never checks out against them; the list holds more than one so the next key is out ahead of signing anything: pick by the token\'s `kid`, as `verifyPass` does, and never pin one; `issuerUrl` defaults to `https://rooms.zaisma.com`): a JWT with header `typ` `pass+jwt` and claim `pass_version_number` `1`, refused with a `PassError` whose `code` is `malformed`, `unknown_key` (fetch the keys again), `bad_signature`, `expired`, `wrong_game`, `wrong_issuer`, `wrong_kind` (a receipt, or another JWT) or `wrong_version`. `kind` and `who_can_chat` may gain values, so treat one you don\'t know as a guest and as `nobody`. An account\'s pass says who it can chat with (`who_can_chat`, and when `anyone` an opaque `chat_group_id`), its own opaque `player_tag_id` and its friends\' and blocks\' tags (`friend_player_tag_ids`, `block_player_tag_ids`), all different in every game. Zaisma never tells a game anyone\'s age; a game could guess which chat group is the younger one from its size.\n\n| Call | What it does |\n| --- | --- |\n| `GET /players/:player_id` | An account\'s public profile, exactly what a stranger sees on zaisma.com/@username, never its email, age or other games\' data: `{"player": {"id", "name", "username", "display_name", "bio", "link_urls", "profile_url", "is_profile_private", "published_games", "played_games", "playing_now"}}`. `name` is the name to show in games: the username, so nobody can pass as someone else. `username` is unique ignoring case and can change, so key your data by `id`. `display_name` and `bio` are what the player wrote, once Zaisma checked it (`null` when none). `link_urls` are links an adult chose to show. When `is_profile_private` is `true` (they show their profile to friends only), `bio` is `null` and the lists of links and played games are `[]`. `published_games` are the games they made that anyone can find, and `played_games` what they played lately when they show it to anyone, each with a `played_period` (`today`, `this_week`, `this_month`, `earlier`), never a time. `playing_now` is the game they\'re playing right now when they show that to anyone (`{ slug, title, page_url }`), else `null`, as for a game that isn\'t out yet. A guest\'s ID, or a deleted account\'s, is `no_player`. |\n\nA player sits in one of your game\'s rooms at a time, as on Steam: joining another room closes their seat in the first (the room\'s players are told "Joined from somewhere else" with close code `4001`, and `onLeave` runs with reason `"left"`). Moves between your rooms (`room.moveTo`, `room.reserve`) and watching never close a seat. A game that keeps players in several rooms at once, like a hangout hub beside its matches, sets `maximumRoomCountPerPlayer` (an integer from 1 to 10, 1 by default; a join past it closes the oldest seat). `playing_now_player_count` (on `GET /games/:slug`) and the game page\'s playing count count each player once, however many rooms they sit in.\n\nGames and servers get the same with no key at `GET https://rooms.zaisma.com/v1/players/<player_id>` (open to any site, up to 300 a minute per address, answers cacheable for 5 minutes), and in games with `Zaisma.player.getProfile(playerId)`. A player pass proves only who the player is: an account\'s carries no name, so your server looks the name up there (the Node game server does it for you). It also says who an account can chat with, never its age: `who_can_chat` (`nobody`, `friends`, `anyone`: the player\'s own setting) and, unless `nobody`, an opaque `chat_group_id` (`chat_group_\u2026`, different in every game: chat never leaves it, friends included); and its friends and blocks as opaque tags, never their player IDs: `player_tag_id` (its own, different in every game), `friend_player_tag_ids` (its friends\', up to 200) and `block_player_tag_ids` (accounts it has a block with, either way, up to 100). Your server asks `passesAreFriends(first, second)`, `passesHaveBlockBetween(first, second)` and `canChat(first, second)` from `@zaisma/game-server` with two checked passes, before passing chat between them. Inside games, `Zaisma.friends.list()` gives a signed-in player their friends playing this game, with their rooms, and `Zaisma.friends.sendRequest(playerId)` offers a friend request that Zaisma asks the player about first, answering `{ status }`: `sent`, `cancelled`, `already_friends` or `not_taking_requests` (see "Friends in your game" in the README). A game never sees a request; two players who become friends get each other\'s tags in their next passes.\n\nIn games, `Zaisma.player.getPass()` gives this tab\'s player and their pass (`{ id, name, kind, pass, expiresAt }`) to send to your own server. `Zaisma.invite(room)` opens Zaisma\'s invite sheet on the game page (the room\'s QR code, link and code), or on your own site the share sheet or a copied link; it works only right after the player taps or presses a key in the game, so call it from that tap\'s handler, and it fails with `error.code` `"needs_player_tap"` otherwise. It answers `"opened"`, or `"failed"` when the page couldn\'t open it; on your own site `"shared"` from the share sheet, `"copied"` the link, `"cancelled"` the share sheet, or `"failed"` (`InviteStatus`; treat a value you don\'t know as `"failed"`). A game that shows its own player list reads its room\'s players and draws it, with `room.mute`, `room.unmute`, `room.block` and `room.report` behind its own buttons; the Zaisma overlay keeps its own list for every game, and no call opens it. On touch screens the Zaisma button stays in the top right corner over your game and takes presses there, so keep that corner free of your own buttons on phones and tablets. The reference is `packages/sdk/zaisma.d.ts`, served beside the SDK as `_zaisma/v1.d.ts`.\n\n### Chat\n\nPlayers type to each other through Zaisma\'s chat hosting: one call in the game, `room.chat(text)`, sends a message through the room it\'s in, on Zaisma\'s rooms or your own server\'s runner (`zaisma-game-server`). Your game draws the chat box and moderates it; Zaisma decides who may read each message, filters it on its way and keeps none of it.\n\n- **Who reads it:** chat reaches only players in the sender\'s chat group whose settings let them chat with the sender: both accounts, no block either way, neither set to nobody, and friends unless both chat with anyone. Friends in different chat groups stay friends but can\'t chat. Guests don\'t chat (`room.canChat` is `false`: hide your box and offer preset phrases or emotes), and spectators neither send nor read chat. `room.chat` resolves `{ sentAt }` even when nobody could read it, so the sender is never told who can\'t.\n- **In the game:** `room.chat(text, { toPlayerIds })` (all players when `toPlayerIds` is left out, up to 2000 characters, up to 20 messages in 10 seconds) resolves once it went, or rejects with `error.code` `chat_stopped` (`error.reason` says why and `error.message` is what to show the player), `chat_not_allowed`, `chat_empty`, `chat_too_long` or `chat_too_fast`. `room.on("chat", ({ fromPlayerId, text, hasSwearing, hasSlur, sentAt }) => \u2026)` brings the others\' messages; messages from players this player muted or blocked never come. Show the player\'s own line when `room.chat` resolves.\n- **Your game server decides first:** `onChat(state, player, room, { text, toPlayerIds })` runs before Zaisma\'s filter, in both runtimes, the way `canJoin` runs before a join: answer `true` to send it, `false` to stop it (the sender\'s `room.chat` fails with `chat_stopped`, reason `stopped_by_game`, "Your message wasn\'t sent."), or `{ toPlayerIds }` to send it to fewer players (a team chat, a player your moderators muted). It can only narrow: players outside what Zaisma allows are dropped. Only decide in it: `room` can be read, not changed. A game server without `onChat` sends every message on to the filter.\n- **The filter:** every message to or from an under-18 account is checked on Zaisma\'s side. It stops contact details in any disguise (numbers written as words or sent a few digits at a time, handles, links, "add me on\u2026"), moving to another app or meeting up in real life, personal details (where someone lives, their school, their full name, photos) and sexual content. Swearing and slurs are your call: it flags them (`hasSwearing`, `hasSlur`) and lets them through. What the rules can\'t tell goes to a small AI model, a narrow second look that blocks only what clearly is one of those four kinds; when in doubt, or when it can\'t look, the message goes. The verdict is one for the whole message, never per receiver, so it never says which player is under 18.\n- **Between adults** the filter only flags, unless your game server sets `adultChatFilterEnabled: true`: then the same checks run, and each message the AI looks at counts on your hosting meter (`adult_chat_checks`, $0.20 per 1,000 checks). Zaisma pays for the checks on under-18s\' chat.\n- **Reports carry the lines:** `room.report` (and the Players panel\'s Report) sends the last 20 chat lines the reported player sent this player, or this player sent them, from this screen. `get_reports` and the `player_reported` webhook carry them as `chat_messages` (`from_player_id`, the reported player\'s or `null` for anyone else\'s, `text`, `sent_at`): what the reporter\'s game showed, not a record Zaisma kept.\n\nA chat box to copy, all of it in the game (a `<div id="chat-log">`, an `<input id="chat-input">` and a `<button id="chat-send">`; games run in a frame that doesn\'t submit forms, so it sends on the button and Enter):\n\n```js\nconst room = await Zaisma.joinRoom();\nconst log = document.querySelector("#chat-log");\nconst input = document.querySelector("#chat-input");\nconst send = document.querySelector("#chat-send");\nconst nameOf = (playerId) => room.players.find((player) => player.id === playerId)?.name ?? "Someone";\nfunction addLine(name, text) {\n const line = document.createElement("div");\n line.textContent = `${name}: ${text}`; // textContent: never as HTML\n log.append(line);\n log.scrollTop = log.scrollHeight;\n}\ninput.hidden = send.hidden = !room.canChat;\nroom.on("chat", (chat) => addLine(nameOf(chat.fromPlayerId), chat.hasSlur ? "(hidden)" : chat.text));\nasync function sendLine() {\n const text = input.value;\n input.value = "";\n try {\n await room.chat(text);\n addLine(room.me.name, text);\n } catch (error) {\n addLine("Zaisma", error.message);\n }\n}\nsend.addEventListener("click", sendLine);\ninput.addEventListener("keydown", (event) => event.key === "Enter" && sendLine());\n```\n\nEvery answer from the filter is `{ isAllowed, reason, message, hasSwearing, hasSlur }`: `reason` is `contact_details`, `personal_details`, `sexual`, `chat_paused` (the sender\'s chat is paused or removed), `too_long` (over 2000 characters: checked whole, never cut) or `not_allowed_to_chat` (own servers\' `checkChat` only: `canChat` says no for a receiver), and `message` is the words to show the sender, which never mention age or the other player ("Contact details can\'t be sent here.").\n\n- **Other text players type:** `Zaisma.checkChat(text)` answers the same for up to 2000 characters (`too_long` past that), with the tidied `text`, for text that isn\'t chat, like a name for a world. It checks the text alone and keeps nothing.\n- **On your own server without the runner:** `checkChat({ text, senderPass, receiverPasses, isAdultFilterEnabled })` from `@zaisma/game-server`, with the players\' passes as your server received them, after `canChat`. The runner does this for `room.chat` itself. It keeps each sender\'s last 5 messages from the last 2 minutes in memory and sends them along, and it answers `unchecked` when Zaisma can\'t be reached: don\'t deliver those. Zaisma applies `canChat`\'s rule itself too: if the sender may not chat with any receiver, it answers `not_allowed_to_chat`, one verdict for the message that never says which receiver. It\'s free, except the checks between adults when `isAdultFilterEnabled` is `true`. A player your server let in from outside Zaisma (a game played off its Zaisma page, `kind` `outside_zaisma`) goes as `null` in place of a pass: a message between them and an under-18 account is `not_allowed_to_chat`, between them and adults it\'s checked as between adults, and one among such players only is allowed without asking Zaisma. Underneath it\'s `POST https://rooms.zaisma.com/v1/chat/check` with `{ gameSlug, senderPass, receiverPasses, text, recentTexts, isAdultFilterEnabled }` (up to 50 receivers, 2000 characters, 5 recent texts), up to 120 a minute per game and sender; a pass that isn\'t valid for the game is `bad_pass` with its `field` (`senderPass` or `receiverPasses`). In Zaisma rooms, `checkChat` throws a `ChatCheckError` with code `own_server_only`: send chat with `room.chat` there.\n\nContact or personal details stopped toward under-18 accounts five times in a day pause the sender\'s chat for an hour. A paused account\'s next pass says `who_can_chat: "nobody"`, so `canChat` stops it on your server too. Zaisma keeps no chat, except a sexual message from an adult to a teen that reached the filter from an own server, kept for review.\n\n## Room connections\n\nHow a room and each player\'s game stay in touch, the same in Zaisma rooms and on your own server (the Node runner): how a dead connection is noticed, what happens to a player whose connection drops or who walks away, the limits on what players send, and why a connection closes.\n\n### Staying connected\n\n- **The SDK pings** the room every 25 seconds (the room answers without waking up), and reconnects by itself when a ping goes unanswered for 15 seconds, or in a real-time room (one with `ticksPerSec`) after 8 seconds without a word from the room, which probes every 2 seconds (not while the player is away or the game is hidden).\n- **Reconnecting** waits half a second, then doubles each try up to 8 seconds, with no limit, and `room.connectionStatus` is `"reconnecting"` meanwhile. Your game keeps the same room object: the `players` event and your game server\'s messages carry on once it\'s back.\n- **The room drops** a connection with no ping or message for 75 seconds (a closed laptop, lost signal): Zaisma rooms check every 30 seconds, the Node runner every 5. The SDK says goodbye as the page closes, so most players who leave do so at once.\n- **`room.connectionStatus` is the socket only:** `"connecting"`, `"open"`, `"reconnecting"` or `"closed"`. Whether the player is in the match is `room.awayReason` (below), so a player who walked away with the socket still open stays `"open"`.\n- **Sends wait while it\'s down:** reliable `room.send` and `room.sendBytes` calls made while `connectionStatus` isn\'t `"open"`, or while the player is away, are kept in order and go once the room lets them back in, before any latest-only sends that waited. Up to 60 wait (the room\'s burst, so the flush never trips `too_fast`); past that the oldest is dropped and the `error` event says `send_queue_full` once per outage. Both calls return `false` only once the room is gone (ended, kicked or left).\n\n### Dropped players\n\nA blip is the most common thing that goes wrong online, so a player whose connection drops stays in the match for a while instead of leaving it:\n\n- **Away, reason `lost`:** the player stays in `room.players` for `reconnectTimeoutSec` (30 by default, 0 to 300). The game server\'s `onAway(state, player, room, { reason: "lost" })` runs if it has one, `room.awayReason(playerId)` answers `"lost"`, and every player\'s game sees `awayReason: "lost"` for them in `room.players` and the `players` event. They don\'t count as playing, nothing is sent to them, and their seat counts toward `maximumPlayerCount`. If they were the host, the next player is host until they\'re back.\n- **Freeze them:** a game that does nothing shows them standing still. A real-time game can freeze their character, skip their turn or pause the match: in `onTick`, skip players whose `room.awayReason(playerId)` is `"lost"`, and in the game, draw them dimmed or "reconnecting" from `awayReason`.\n- **Back in time:** the SDK reconnects by itself, `onBack(state, player, room)` runs (not `onJoin`, and `canJoin` isn\'t asked), and `awayReason` goes back to `null` for everyone. Send them the full state in `onBack`, since they missed what was sent meanwhile.\n- **Not back in time:** they leave the match as before: `onLeave` with reason `lost`, and the room holds their seat for `seatHoldDurationSec`, so a later return gets `onJoin` with `joinInfo.isReturning`.\n- **`reconnectTimeoutSec: 0`** takes a dropped player out of the match at once (`onLeave`, reason `lost`), as before this option.\n- **`onAway` takes over idle and hidden too:** with `onAway`, a player who goes idle or hidden stays in the room until your game decides (below). To freeze dropped players while leaving idle and hidden ones to the room, read `room.awayReason` in `onTick` instead of adding `onAway`; `onBack` alone changes nothing else.\n\nReal-time rooms notice a silent drop within seconds (their probes); turn-based rooms keep the slower 75-second check, so they can sleep between moves.\n\n### Updates\n\nA version you publish (or roll back to) reaches running matches at their next match, or now: `match_update_mode` `"next_match"` (the default) or `"now"` on `publish_version`, on `upload_files` and `POST /games/:slug/versions` with `publish_when_approved`, `zaisma publish --match-update-mode now`, `zaisma upload \u2026 --publish-when-approved --match-update-mode now`, or Update running games now on the dashboard.\n\n- **Now, in a match:** every live room of the game hears it within seconds (a room that slept through it finds it within a minute of waking). Players\' games get the room\'s `versionUpdate` event, `{ versionId, appliesAt, isReloading }`, to show a countdown or save. Without `onVersionUpdate`, the match switches 10 seconds later. With `onVersionUpdate(state, versionUpdate, room)`, the room waits for your game server: call `room.applyVersionUpdate()` at a good moment, like the end of a round, or it switches at `versionUpdate.appliesAt`, 5 minutes on.\n- **The switch:** the room saves, its connections close with code `4004`, and the new version\'s game server starts from the saved state: `onRestored(state, restoreInfo, room)` runs with `restoreInfo.savedVersionId`, the version that saved it, so you can bring an older state up to date (or `room.end()` the match if you can\'t). When only the game server changed, players\' games reconnect by themselves in a second or two. When the game\'s own files changed (`isReloading`), the game page reloads the game in place at the new version, with its save, and `Zaisma.joinRoom()` with no code brings the player back into the same room. Players come back as dropped players do (away, reason `lost`, for `reconnectTimeoutSec`, then a held seat), so a slow reload still finds its place. The game page\'s bar says Updating meanwhile; nothing covers the game.\n- **Now, not in a match** (a single-player game, or a menu): never forced. The game page notices within 2 minutes. A game listening to `Zaisma.versions.on("update", (update) => \u2026)` switches when it says, with `update.apply()` (at a checkpoint, back at its menu), and the page reloads it with its save; otherwise the bar beside the game shows Update, and the player taps it when they\'re ready, or gets the new version the next time they open the game.\n- **Next match:** nothing changes for running matches: a room keeps the version it started on until its match ends.\n- **A room on another version:** a player always plays the version their room runs. A Zaisma room whose game server runs another version than the player\'s game (an open tab from before a publish, or a friend\'s match still finishing on the version before) turns a newcomer away with `other_version`, and on the game\'s Zaisma page the game reloads at the room\'s version, with its save, and joins it; your game never sees it. While the room runs it, the game\'s address serves that version\'s files to the room\'s players, as long as it\'s one you could roll back to (the live version and the last 5 that passed), and not held or taken down. Players already in the room are never turned away this way, and rooms with a built-in game server have no version of their own. Outside Zaisma, through a tester link, or when that version is no longer kept, the join fails with `other_version`.\n- **On your own server** `onVersionUpdate` never runs and `room.applyVersionUpdate()` does nothing: the game page still reloads players\' games after a `now` publish when they\'re not in a match, and you restart your server to switch it (the Node runner brings its matches back, below).\n\n### Restarts\n\nZaisma restarts its rooms whenever Zaisma itself is updated, and a match carries on:\n\n- **Saved every few seconds:** a real-time room saves its game server\'s state every `stateSaveIntervalSec` (5 by default, 1 to 60), only when it changed, and once more when everyone walks away or leaves; a turn-based room saves after every change, as always. A state over 32 MB as JSON isn\'t saved: the game\'s logs say so once, and a restart starts that room fresh.\n- **Back a few seconds behind:** the restarted room starts from the last save instead of `setup`; a real-time room (one with `ticksPerSec`) also runs `onRestored(state, restoreInfo, room)` once, and so does a turn-based room that had players in its match (it loses no moves, only the connections): `restoreInfo.savedAt` (an ISO time) and `restoreInfo.lostDurationSec`, the seconds of play since then that are lost. Use it to resync clocks or tell players.\n- **Players come back as dropped players:** everyone who was in the match is away with reason `lost` (`room.awayReason` answers it in `onRestored`), `onAway` runs for each, and they have the whole `reconnectTimeoutSec` from the restart. Their connections drop (the Node runner closes them with code `1012` as it stops), the SDK reconnects to the same room by itself, and `onBack` runs for each one back; anyone who isn\'t leaves as `lost` (above).\n- **A room that empties** keeps its saved state for a day, so players rejoining it find the match as it was (a real-time room\'s `onRestored` runs then too, with `lostDurationSec` 0: it saved as the last player left). A kept room keeps it until it ends (see Kept rooms below). A match that ends keeps nothing.\n- **On your own server** the Node runner saves to its `--room-state-file` (`zaisma-room-states.sqlite`) the same way, and saves every room when it\'s stopped, so a clean restart loses nothing.\n\n### Walking away\n\nPlayers who walk away stop holding seats and running matches, with no code:\n\n- **Idle:** after `idleTimeoutSec` without input (600 by default, 30 to 86400), the SDK asks "Still there?" for 30 seconds; no answer, and they walk away (`idleCheck`: `"server"`, the default, `"client"` or `"off"`).\n- **Hidden:** in a real-time room, a game hidden for 2 minutes counts as away.\n- **What happens:** with `awayMode: "hold"` (the default), they leave the match (`onLeave`, reason `idle` or `hidden`) and the room holds their seat for `seatHoldDurationSec` (300 by default, up to 1800, 0 for none); any input brings them back, and `onJoin` gets `joinInfo.isReturning`. `awayMode: "lobby"` sends them to the room that made this one (`room.reserve`). With `onAway`, they stay in the room and your game decides: kick them, move them or keep them.\n- **In the game:** the `idle` event hands `{ idleStatus, answerTimeoutSec }`: `"asking"` when it\'s time to ask (listening replaces Zaisma\'s "Still there?" plate), then `"answered"` on input or `"timed_out"` as the room hears they walked away. The `away` event hands `{ awayReason, seatHoldDurationSec }` and `room.awayReason` says `"idle"` or `"hidden"` until they\'re back. The `back` event hands `{ roomCode, isSeatHeld, rejoin() }`: `isSeatHeld: true` once the room let them back into their held seat; `false` on their first input after the seat ran out, when listening for `back` leaves rejoining to your game (`back.rejoin()`), and without a listener the SDK rejoins by itself.\n\n### Message limits\n\n- **From each player:** up to 16 KB a message (or bytes), and 30 a second with a burst of 60. The SDK throws `too_big` before sending one over 16 KB; past the rate, that message is refused with an `error` event (`too_fast`) and the connection stays open.\n- **Who sent it:** a message or bytes the game server passes on from one player carries `fromPlayerId` (its send options\' `fromPlayerId`; the relay always sets it), and the game\'s `message` event hands `(message, fromPlayerId)`, `bytes` hands `(bytes, fromPlayerId)`, with `null` for the game server\'s own.\n- **Join and setup data:** up to 4 KB of JSON (`joinData`, `setupData`).\n- **From the room:** what your game server sends isn\'t capped, but a player who can\'t keep up is dropped (below).\n\n### Ping and the room\'s clock\n\n- **Ping:** the game server reads a player\'s round trip with `room.pingDurationMs(playerId)`, and the player\'s game reads its own with `room.pingDurationMs`: the same number, in milliseconds, smoothed so one slow packet doesn\'t make it jump. It\'s `null` until the first measurement, right after the player joins.\n- **Measured by the room:** the room sends each player a small probe right after they join, every 2 seconds while a real-time room ticks (turn-based rooms keep sleeping between moves), and whenever 256 KB has gone out to them; the SDK answers it at once. Answers aren\'t game messages: they don\'t count toward a player\'s 30 a second, your message stats or the idle check. Since the room measures it, a player can only make their ping look worse by answering late, never better, so cap any lag compensation that uses it.\n- **One clock:** `room.serverTimeMs()` is the room\'s clock now, in epoch milliseconds, on the game server (like `Date.now()`) and in every player\'s game, where the SDK estimates it from the probes. A time the game server sends means the same moment for everyone, like `{ startsAtMs: room.serverTimeMs() + 3000 }` for a countdown.\n\n### Slow connections\n\nA player whose connection can\'t keep up is dropped before the room has to hold a growing backlog for them: when a probe has gone unanswered for 8 seconds, or 2 MB has gone out to them since the last probe they answered. Their connection closes with code `4003` and they become a dropped player (above): away with reason `lost` for `reconnectTimeoutSec`, while the SDK reconnects by itself, so they come back caught up. Send a returning player the full state in `onBack`, and in `onJoin` when `joinInfo.isReturning`, not just what changed (state sync does it by itself). A room\'s memory for its players stays bounded, and one bad connection can\'t stall a match for everyone else.\n\nBefore that, a connection can be **backed up**: 64 KB or more sent to it and not through yet. On your own server, that\'s the socket\'s `bufferedAmount`; in Zaisma rooms, 64 KB or more sent since the last probe the player answered, while a probe of theirs is 250 ms later than their ping. State sync skips a backed-up player and latest-only messages wait for them (below), so a slow player never builds a queue of stale updates.\n\n### State sync\n\nAn optional building block for real-time worlds, the same in Zaisma rooms and on your own server: your game server keeps its state as a plain object, and with `stateSyncEnabled: true` each player\'s game gets it without your code sending anything.\n\n- **A full copy, then what changed:** a player gets their whole view as they join (and after reconnecting), then, after each tick (or each handler, in a turn-based game), only what changed since their last: `{ type: "state", serverTimeMs, full }`, then `{ type: "state", serverTimeMs, changes }`. Each change is `[path, value]` (set) or `[path]` (remove), with `path` the keys and indexes from the top: objects by key, arrays by index while their length stays the same and whole when it changes. `serverTimeMs` is the room\'s clock as it was sent. Nothing goes out when nothing a player sees changed.\n- **Each player\'s view:** `stateView(state, viewer, room)` answers what `viewer` sees, like only what\'s near them in a big world or without the other team\'s hand; without it, everyone sees the whole state. It runs for every player on every tick, so keep it cheap, and it only answers: a call in it that changes the room or sends (`room.broadcast`, `room.kick`, `room.end`, ...) throws `room_call_unavailable`, which the game\'s logs show; reading (`room.players`, `room.roomCode`) works. A view over 1 MB as JSON isn\'t sent, and the game\'s logs say so once.\n- **In the game:** `room.state` is this player\'s view (null until the first update), the `"state"` event hands `(state, changes)` (`changes` null after a full copy), and `room.smoothedState({ delayMs })` answers the state `delayMs` (100 by default, up to 1000) behind the room\'s clock, between the two updates around then: numbers blended in a straight line (integers in between come back as fractions, and an angle that wraps blends the long way), anything else as the older one had it. Predicting the player\'s own moves stays your game\'s.\n- **Backed up:** a player whose connection is backed up gets nothing until they\'ve caught up, then a full copy, so a slow spell costs one copy instead of a growing queue. There are no acknowledgements: over the room\'s connection a change can\'t be lost.\n- **Where it runs:** where the state is, in your game server\'s sandbox on Zaisma (its time counts as the game server\'s CPU) and in the room on your own server. The state goes as JSON, so keep it plain; its updates count as `(state)` in `get_stats`.\n\n### Latest-only messages\n\n`room.broadcast`, `room.send`, `room.broadcastBytes` and `room.sendBytes` on the game server, and `room.send` and `room.sendBytes` in the game, take `{ delivery, latestKey }`:\n\n- **`delivery: "reliable"`** (the default) reaches every player, in order.\n- **`delivery: "latest_only"`** may be dropped: while a player\'s connection is backed up, a newer latest-only message with the same `latestKey` replaces the one waiting, and the newest goes once they catch up (oldest key first, before anything newer). For positions sent every tick, or where a player aims. A player keeps up to 64 waiting, one per key; past it, the least recently replaced is dropped.\n- **`latestKey`**, up to 40 characters, says which messages replace each other, like `"position"`, and `latest_only` needs one: without it the send throws: in the game (the SDK) the error\'s code is `bad_send_option`, and on the game server it is a `GameServerError` with the code `bad_room_call` and the room call (like `room.broadcast`) as its field. Bytes have their own keys.\n- **Zaisma rooms carry them over the WebSocket today**, since Cloudflare doesn\'t yet let Workers take WebTransport or WebRTC data channels; the same `delivery: "latest_only"` moves to real datagrams once it does, with no change to your game. **On your own server, the fast lane carries them as datagrams already** (below). Anything else for `delivery` or `latestKey` throws in your code, naming what to give: the SDK\'s error has the code `bad_send_option`; the game server\'s is a `GameServerError` (`bad_room_call`) saying the same.\n\n### The fast lane to your own server\n\n`Zaisma.joinRoom({ serverUrl: "wss://play.example.com", transport: "webtransport" })` joins a room on your own server over WebTransport (HTTP/3 over UDP) instead of the WebSocket. The Node runner serves it with `--webtransport-port`, `--certificate-path` and `--certificate-key-path` (`startServer({ webtransportPort, certificatePath, certificateKeyPath })`, all three or none); any other server can speak it too. `transport` is `"websocket"` (the default) or `"webtransport"`, else the SDK refuses it with `bad_transport`; a `serverUrl` that isn\'t `wss://` or `https://`, and Zaisma\'s own rooms, use the WebSocket either way. If WebTransport isn\'t there, its session is refused, or it isn\'t up within 3 seconds (`FAST_LANE_CONNECT_TIMEOUT_MS`), the room uses the WebSocket for the rest of its life and logs one console warning; a fast lane that worked and then dropped is tried again first. `room.transport` says what the connection uses now.\n\nThe wire:\n\n- **The session** is at `https://<server>/v1/rooms/<game>/<code>`: the `serverUrl`\'s host and port, with `wss:` read as `https:`. The browser sends the page\'s `Origin`; check it as you do for the WebSocket. The certificate must be a real one for that name (browsers check it as for any HTTPS site).\n- **One bidirectional stream**, opened by the client first, carries every frame the WebSocket carries, in order: each is `[4-byte big-endian payload length][1-byte kind: 0 text, 1 bytes][payload]`. Text is the same UTF-8: the JSON messages (`hello`, `welcome`, `probe`, `probe_answer`, ...) and `ping`/`pong`. Bytes are the same binary frames: from the room, `[1-byte sender ID length][sender ID][bytes]`; from the client, the bytes alone.\n- **A datagram** is `[1-byte kind][payload]`, with the same payloads, and carries only `latest_only` sends, both ways, when it fits the session\'s `maxDatagramSize`; a bigger one goes on the stream. Take datagrams only from a player you let in.\n- **Closing:** the session\'s close info carries the WebSocket\'s close codes and reasons (`closeCode` 4000 to 4004, as in [Close codes](#close-codes)).\n\nA server of your own that isn\'t the Node runner (Rust, C++, a studio\'s engine) needs to: accept WebTransport sessions at that path and check `Origin`; read the hello from the stream and verify its pass against your game\'s keys at `https://rooms.zaisma.com/v1/pass-keys/<gameSlug>`; answer each `probe` the room protocol says to send, and every `ping` with `pong`; send the same frames on the stream, and `latest_only` ones as datagrams when they fit.\n\n### Room error codes\n\nA room answers a refusal with `{ type: "error", code, message }`, then closes the connection (`4001`, or `1013` for `busy`); a message it can\'t take gets the same `error` and the connection stays open. In the SDK they are `error.code` and the `error` event.\n\n| Code | Meaning |\n| --- | --- |\n| `room_full` | The room has no space for another player. |\n| `room_closed` | The room isn\'t taking new players (`room.setOpen(false)`). |\n| `ended` | The match is over. |\n| `too_big` | A message over 16 KB, or `joinData` over 4 KB. |\n| `too_fast` | More messages than the room takes (30 a second, burst of 60). |\n| `bad_message` | A message the room couldn\'t read or use. |\n| `bad_pass` | The player pass wasn\'t accepted; the SDK gets a new one and tries once more. |\n| `bad_player_token` | A game played off Zaisma sent a `playerToken` your own server didn\'t take (its `identifyPlayer` said no, or it takes no guests); the game gets the player a new one. |\n| `no_hello` | The first message wasn\'t a hello with a player pass (or, to your own server, a `playerToken`). |\n| `not_allowed` | Only the game server or the room\'s host can do that. |\n| `game_unavailable` | The game can\'t be played right now. |\n| `busy` | The room couldn\'t take the player right now; the SDK tries again soon. |\n| `kept_out` | The player was removed for the rest of the match. |\n| `refused` | The game server\'s `canJoin` turned the player away. |\n| `room_not_running` | The room isn\'t running, like one with nobody playing to watch. |\n| `rented_share_used` | This player is on a rented-server network, and the share of the game\'s hosting such traffic gets is used; everyone else plays on. Zaisma\'s page tells them to turn off their VPN or sign in. |\n| `hosting_paused` | The game\'s hosting is paused this month, or Zaisma\'s free room time ran out; new rooms open again when it resets or its developer adds credit and a budget. |\n| `account_needed` | The game needs a Zaisma account for multiplayer, and the player is a guest. |\n| `game_not_open_to_player` | The account is younger than the game\'s minimum age. |\n| `blocked_player_here` | Someone the player blocked is in the room; `quickJoin` tries other rooms first. |\n| `other_version` | The room runs another version of the game (see Updates above). |\n| `spectators_full` | The room takes no more spectators. |\n| `spectator_cannot_send` | A spectator tried to send to the room. |\n| `already_playing` | A player in the room tried to watch it too. |\n| `bad_origin` | The connection didn\'t come from the game\'s own page. |\n| `send_queue_full` | The SDK\'s own: more than 60 sends waited while it reconnected, so the oldest were dropped. |\n| `chat_not_here` | A chat message reached a room whose server doesn\'t take chat (an older runner). |\n| `chat_not_allowed` | `room.chat` from a guest, or a player whose chat is set to nobody or paused (`room.canChat` is `false`). |\n| `chat_empty` | `room.chat` with nothing but spaces. |\n| `chat_too_long` | `room.chat` over 2000 characters. |\n| `chat_too_fast` | More than 20 chat messages in 10 seconds from one player. |\n| `bad_region` | The SDK\'s own: a `region` that isn\'t a continent code (`"AF"`, `"AN"`, `"AS"`, `"EU"`, `"NA"`, `"OC"` or `"SA"`). |\n| `bad_idle_timeout` | The SDK\'s own: an `idleTimeoutSec` that isn\'t from 30 to 86400. |\n| `bad_transport` | The SDK\'s own: a `transport` that isn\'t `"websocket"` or `"webtransport"`. |\n| `zaisma_rooms_not_used` | The SDK\'s own: the game doesn\'t use Zaisma rooms, so there are none to join or list. |\n\n### Close codes\n\n| Code | Why | What the SDK does |\n| --- | --- | --- |\n| `4000` | The match ended (`room.end`, or Zaisma ending it) | Stops: `connectionStatus` `"closed"`, after the `ended` event with its `endReason` |\n| `4001` | The room refused the player (an `error` with the code comes first, like `room_full`, `bad_origin` or `game_unavailable`), removed them (`room.kick`), or they joined from another tab | Stops: `connectionStatus` `"closed"` |\n| `4002` | The seat held for a player who walked away ran out | `connectionStatus` `"closed"`; waits for the player to come back, then the `back` event with `isSeatHeld: false` |\n| `4003` | The connection stopped answering probes or fell too far behind | Reconnects by itself, as a dropped player |\n| `4004` | The match switched to a version published `"now"` | Reconnects by itself, or the page reloads the game at the new version (`isReloading`) |\n| `1012` | The Node runner is restarting | Reconnects by itself, as a dropped player |\n| `1013` | Zaisma rooms are busy (an `error` with `busy` comes first) | Reconnects by itself, waiting longer each try |\n\nAny other close (a network drop) reconnects by itself too.\n\n### Room events\n\nEvery event the game\'s room object has, and what its listener gets. Within v1, events and error codes only grow, so keep a `default` for ones you don\'t know.\n\n| Event | Listener gets |\n| --- | --- |\n| `message` | `(message, fromPlayerId)` |\n| `bytes` | `(bytes, fromPlayerId)` |\n| `state` | `(state, changes)` |\n| `players` | `(players)`, each `{ id, name, kind, awayReason }` |\n| `connectionStatus` | `(connectionStatus)` |\n| `settings` | `{ isListed, isOpen, friendJoinsEnabled, name, labels, spectatorCount }` |\n| `ended` | `{ message, endReason }`: `game`, `no_players`, `hosting_paused`, `kept_room_deleted`, `game_unavailable` or `game_server_stopped` |\n| `ending` | `{ endsAt }` |\n| `endingCancelled` | `()`: the end `ending` announced is off, since the game\'s hosting started again; `room.endsAt` is `null` |\n| `kicked` | `{ message, isKeptOut }` |\n| `chat` | `{ fromPlayerId, text, hasSwearing, hasSlur, sentAt }`: another player\'s chat line (see Chat) |\n| `move` | `{ roomCode, follow(), join(joinOptions) }` |\n| `moved` | `{ roomCode, fromRoomCode }` |\n| `idle` | `{ idleStatus, answerTimeoutSec }` |\n| `away` | `{ awayReason, seatHoldDurationSec }` |\n| `back` | `{ roomCode, isSeatHeld, rejoin() }` |\n| `muted` | `(playerIds)` |\n| `error` | `{ code, message }` |\n| `versionUpdate` | `{ versionId, appliesAt, isReloading }` |\n| `roomMessage` | `{ message, senderKind, fromRoomCode, sentAt }`: a room message for a room whose game server has no `onRoomMessage` (see Reaching live rooms) |\n\nThe SDK and rooms say which messages they speak with `protocolVersionNumber` (1 today): the SDK sends it in its hello, and the welcome answers the room\'s. A room skips a message type it doesn\'t know, so a newer SDK still plays in an older room.\n\n## Sign in with Zaisma\n\nPlayers sign in to your own site, server or app with their Zaisma account, and you know them by the same player ID your games see. It\'s standard OpenID Connect (the authorization code flow), so any OpenID Connect library works: point it at the issuer `https://zaisma.com`, which publishes everything else at `https://zaisma.com/.well-known/openid-configuration`.\n\n| Call | What it does |\n| --- | --- |\n| `GET /sign-in-apps` | Your sign-in apps: `{"id", "name", "kind", "redirect_urls", "issuer_url", "created_at", "updated_at"}`. |\n| `POST /sign-in-apps` | Make one: `{"name", "kind", "redirect_urls"}`. Up to 20. Answers with the `sign_in_app` and, for a confidential app, its `client_secret`, shown only this once (`null` for a public app). |\n| `PATCH /sign-in-apps/:id` | Change `name` or `redirect_urls` (the whole list), or `{"replace_client_secret": true}` for a new secret, answered once as `client_secret`; the old one stops working at once. |\n| `DELETE /sign-in-apps/:id` | Delete one for good, with every player\'s yes to it; answers `removed_sign_in_app_id`. |\n\n- **The app\'s `id`** (`sign_in_app_\u2026`) is its OAuth `client_id`.\n- **kind:** `confidential` for a site or server that keeps the client secret on its server (sent by HTTP Basic or as `client_secret` in the form); `public` for a page, phone or desktop app with no server, which has no secret and must use PKCE (`code_challenge_method=S256`). PKCE works for confidential apps too.\n- **redirect_urls:** 1 to 10 exact URLs your library\'s callback lives at: https, or `http://localhost` for development, no `#fragment` and no wildcards. The `redirect_uri` a sign-in sends must be one of them, exactly.\n- **name:** what players see on the one-time consent page, with your account\'s name as the developer and the address they go back to. It can\'t say Zaisma.\n- **Scopes:** `openid` (the player ID) and `profile` (the player\'s name and username). Ask for `"openid profile"`. Zaisma never shares an email, an age or anything else on the account, so `email` and other scopes are refused with `invalid_scope`.\n- **What you get:** an ID token (RS256, keys at `/.well-known/jwks.json`, more than one so the next is out ahead of signing anything: pick by the token\'s `kid`, as OpenID Connect libraries do, and never pin one) with `sub` (the player ID, a `player_\u2026` ID, the same as in their player passes and `GET /players/:player_id`), `name` and `preferred_username` (their Zaisma username) with the profile scope, `nonce` when you sent one, and `auth_time`; and an access token for `/oauth/userinfo`, which answers the same `sub`, `name` and `preferred_username`. Both last an hour; there are no refresh tokens, so keep your own session.\n- **Players decide:** the first sign-in to an app asks the player; later ones go straight back. Players see the apps they signed in to on their account page and can remove any, which stops `/oauth/userinfo` for that app at once. `prompt=none` answers `login_required` or `consent_required` instead of showing a page, and `prompt=consent` asks again. Codes work once, for 2 minutes. Deleting an account removes the player\'s yeses; deleting yours removes your apps.\n\n## Registered links\n\nThe sites a game opens: its store, Patreon, Ko-fi, Steam page, Bitcoin page or Discord. Games can\'t open pages themselves (their frame doesn\'t allow it), so a game opens one of its registered links with `Zaisma.links.open(link_name)`, right after the player taps or presses a key in it, and the game page shows a card over the game\'s top corner: "You\'re leaving Zaisma", the game\'s name, the full address, **Open <site>** and **Stay**. The game keeps running behind it and hears `"opened"` or `"stayed"`. A tick on the card opens that site straight away from then on, in that browser. See `Zaisma.links` in the SDK\'s reference (`_zaisma/v1.d.ts`).\n\nThey\'re part of the game (`links` on the game, set with `PATCH /games/:slug` or `update_game`): up to 20, the whole list each time, `[]` for none, live at once with no approval, and kept in the game\'s history. Each is `{"link_name", "destination_url", "is_on_game_page"}`, and answers add `who_can_open` and `review_reason`:\n\n- **link_name:** what the game opens it by, like `store`: up to 32 lowercase letters, digits and underscores, starting with a letter, each its own.\n- **destination_url:** the whole `https` address, up to 500 characters. The whole opened address is at most 2,000 characters and each parameter name at most 100. The game can add a path and query parameters under it when it opens the link (`Zaisma.links.open("store", { path: "/buy", queryParameters: { item: "sword" } })` opens `https://kit.itch.io/sky-hopper/buy?item=sword` from `https://kit.itch.io/sky-hopper`), so a store can tell what was bought and by whom; never another site, a path outside the link\'s, or a parameter the address already sets. No link shorteners (bit.ly and others), IP addresses, user names in the address (`user@`) or Zaisma\'s own domains.\n- **is_on_game_page:** the game page shows it too, as a button under the game\'s details in its site\'s own look (Steam, itch.io, Discord, YouTube, X, Bluesky, Reddit, TikTok, Instagram, Patreon, Ko-fi, GitHub, Kickstarter, the App Store, Google Play, Twitch and Gumroad; any other site shows its address). A Steam store page says "Wishlist on Steam". It shows only to players it opens for (`who_can_open`), and goes straight to the site.\n- **who_can_open:** `everyone` when it\'s on a trusted domain (below), `signed_in_adults` for any other site once your account\'s standing opens links to other sites, `waiting_for_standing` for any other site until then, `nobody` when its site is flagged. A link waiting for standing is kept, and opens for signed-in adults the day your account is established or has a card that paid Zaisma or a Stripe account that can take payments (see Standing). Anyone a link doesn\'t open for sees only "This link can\'t be opened here." with Back to the game, never why, and the game hears `"stayed"`, the same as for Stay, so it never learns anyone\'s age.\n- **review_reason:** `link_flagged` when Cloudflare lists the link\'s site for malware or phishing (its security resolver, 1.1.1.2), else `null`. Every site is checked when it\'s added and again every day, for every player whatever their age; a flagged link opens for nobody and shows as a `link_flagged` alert, and opens again once its site is off the list.\n\n**Trusted domains** are well-known store, payment and video sites where strangers can\'t message players: itch.io, store.steampowered.com, gumroad.com, apps.apple.com, play.google.com, patreon.com, ko-fi.com, paypal.com, paypal.me, buy.stripe.com, checkout.stripe.com, donate.stripe.com, strike.me, getalby.com, coinos.io, geyser.fund, pay.zaprite.com, checkout.opennode.com, youtube.com and youtu.be, each with the names under it (`kit.itch.io`). The list lives in `TRUSTED_LINK_DOMAINS` (`packages/core/src/links.ts`). Chat apps and social networks with private messages (Discord, Telegram, WhatsApp, Snapchat, Instagram, TikTok) are never on it. To ask for another domain, post in the forum (category `pages`).\n\nOn your own site there\'s no Zaisma page, so the SDK opens the address the game gives as `ownSiteUrl` straight away.\n\n## Secrets\n\nTokens and keys a game\'s own game server needs, like a Discord webhook URL, a GitHub token or a payment provider\'s secret key: set per game, read by the game server as `server.secrets.<name>` (in `onRequest` and `onSchedule`) and `room.secrets.<name>` (in rooms), and never shown again, to you or anyone. It calls other servers with plain `fetch()` on the hosts in `game_server_allowed_hosts` (above). See "Calling other servers, with secrets" in the README.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/secrets` | The game\'s `secrets`, by name, each `{"name", "set_at"}`: never the value. |\n| `PUT /games/:slug/secrets/:secret_name` | Set one, replacing any of that name: `{"secret_value"}`. Answers the `secret` and `next_steps`. |\n| `DELETE /games/:slug/secrets/:secret_name` | Delete one. Answers `deleted_secret_name` and `next_steps`. |\n\n- **Names** are like environment variables: capitals, digits and underscores, starting with a capital, up to 64 characters (`DISCORD_WEBHOOK_URL`). **Values** are text, up to 8 KB; put several values in one as JSON text if you like. Up to 50 a game.\n- **When it changes:** requests and schedules use the new value from their next call; running rooms get it within a minute.\n- **Who can use them:** they\'re kept away from players, the dashboard, the API and Zaisma\'s own database listings, but the game server\'s code reads them, so anyone who can publish the game\'s code can use them (a `publish` key too). Never put one in the game\'s own files: players can read those.\n- **On your own server** the Node runner\'s `server.secrets` is its environment variables, so set the same names there.\n- A key reads the names with `game_access` `read` and sets and deletes with `write`.\n\n## Items and purchases\n\nWhat a game sells or grants, kept by Zaisma under names the game picks, and every purchase and grant of them with a signed receipt. Zaisma takes no cut: the price a game shows is what the player pays, tax included, and players buy through Zaisma\'s buy sheet, paying the developer\'s own Stripe account (see Selling with the buy sheet). Grants need no Stripe account, so a game can try owned items, receipts and passes before one is connected.\n\n### Sell your game once\n\nA game can sell itself once, the way a PC or console game does, as well as or instead of items inside it. Make the item that is the game, permanent and content, with a price (`set_item`, after `set_purchase_settings` states the refund policy), then name it on the game: `update_game` with `{"full_game_item_name": "full_game"}` (`PATCH /games/:slug`, which needs `purchase_access` `write` for it).\n\n- **What players see:** the game\'s cover carries its price as a tag, and its page shows **Buy** and the price where Play is, in the same buy sheet as purchases inside games (a guest makes an account in it). Once bought, Buy turns into Play. Browse filters by price range. The full game isn\'t an in-game purchase, so a paid game selling nothing else says "No in-game purchases".\n- **Who plays:** players who own it, you, and your tester links. Only accounts own items, so a paid game needs an account for the whole game: setting `full_game_item_name` sets `account_requirement` to `whole_game`, and any other `account_requirement` while it\'s set is refused with `account_requirement_locked`. Play, the game\'s files, player passes and rooms all turn away everyone else (`full_game_not_owned`), on Zaisma\'s side, so it doesn\'t depend on the game.\n- **Bought means kept:** owners still play after you make the game unlisted, private or a draft. A takedown still ends it.\n- **The game sees it as any item:** `Zaisma.items.owns("full_game")`, `player.ownedItemNames`, a receipt, refunds and grants (a backer gets the game by `grant_item`) all work as for other items.\n- **Not on sale right now:** take the item\'s price off (`set_item` with `price_minor_units` `null`) and the page says "Not on sale right now"; owners keep playing. The item stays permanent and content, and stays, while it\'s named (`full_game_item_in_use`): set `full_game_item_name` `null` first to make the game free to play again.\n- **A demo** is another of your games, free to play, that the page links as **Play the demo**; the demo\'s page links back as **Full game**. Set it with `demo_game_slug` (`bad_demo_game` for a game that isn\'t yours, is this one, or sells itself too). Progress doesn\'t carry over.\n- **Add-ons on the game page:** any game\'s page can sell the items you pick beside Play, under **Add-ons** (an expansion, a supporter pack): `set_item` with `is_on_game_page` `true`. A consumable bought there reaches the game the next time the player plays, as any purchase not yet handed over.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/items` (`list_items`) | The game\'s `items` by `item_name`, its `refund_policy`, `refund_policy_text`, `own_payment_categories` and `purchase_delivery`, and the `purchase_label` they make. |\n| `PUT /games/:slug/items/:item_name` (`set_item`) | Make or replace one item, whole: `{"title", "description", "item_kind", "item_category", "price_minor_units", "currency_code", "local_prices", "is_on_game_page"}`, every key every time. Answers the `item` (201 when it\'s new) and `next_steps`. |\n| `DELETE /games/:slug/items/:item_name` (`remove_item`) | Remove one nobody bought or was granted. Answers `removed_item_name` and `next_steps`. |\n| `PATCH /games/:slug/purchase-settings` (`set_purchase_settings`) | `refund_policy`, `refund_policy_text`, `own_payment_categories` and `purchase_delivery` (`game`, `game_server` or `own_server`: where the game\'s purchases are delivered, see Getting purchases to your game); leave out what stays. Answers them with the `purchase_label` and `next_steps`. `no_game_server` for `game_server` on a game with no game server. |\n| `POST /games/:slug/purchases` (`grant_item`) | Grant an item: `{"player_id", "item_name", "item_count", "game_account_id"}`. Answers the `purchase` with its `receipt`, `is_already_owned` and `next_steps`. |\n| `GET /games/:slug/purchases` (`list_purchases`) | Purchases and grants, newest first, 100 at a time (`next_cursor`), each with its `receipt`; filter with `player_id`, `item_name`, `purchase_source` and `purchase_status`. |\n| `GET /games/:slug/purchases/:purchase_id` (`get_purchase`) | One `purchase`, with its `receipt`. |\n| `POST /games/:slug/purchases/:purchase_id/refund` (`refund_purchase`) | Take a grant back, or refund a sale (`purchase_status` `refunded`). A sale refunds through the developer\'s Stripe account: the rest of it by default, or `{"amount_minor_units"}` of it (see Selling with the buy sheet). |\n| `POST /games/:slug/purchases/:purchase_id/handled` (`mark_purchase_handled`) | Say your own server took a purchase (`purchase_delivery` `own_server`): a `completed` one gets `handled_at`, a `refunded` or `charged_back` one `refund_handled_at`. Answers the `purchase`. `already_handled` when it was; `no_purchase` for one that is `pending` or `failed`. |\n| `GET /games/:slug/players/:player_id/items` (`get_player_items`) | The permanent items a player owns in the game, and their purchases still to hand over: `{"player_id", "owned_item_names", "unhandled_purchases"}`. `owned_item_names` is what their next pass lists; `unhandled_purchases` are their `completed` purchases not yet handled, and ones refunded or charged back after being handled whose refund isn\'t told yet, each with its `receipt`, oldest first, at most 50 purchases and 50 refunds. |\n\n- **is_on_game_page:** `true` sells the item on the game page too, under Add-ons, as well as in the game; `false` (an item file that leaves it out) only in the game.\n- **An item** is `permanent` (owned for good, on every device: a skin, an expansion) or `consumable` (delivered once, then the game keeps count: a revive, coins), and says what it is with `item_category`: `cosmetic` (only how things look), `gameplay` (helps you play), `content` (more of the game) or `currency` (in-game money). Its `item_name` is 1 to 40 lowercase letters, digits, underscores and hyphens; `title` up to 60 characters and `description` up to 300. Up to 1,000 a game.\n- **Prices** are in the currency\'s smallest unit (`price_minor_units`: 199 for $1.99, 300 for \xA5300), in a `currency_code` written lowercase as Stripe writes it (`usd`, `eur`, `brl`), at least Stripe\'s minimum for that currency (50 cents; `price_too_low` under it). `local_prices` sets the price in up to 40 other currencies, as `[{"currency_code", "price_minor_units"}]`: a player pays in their country\'s currency when the game set one, else the main price. Prices pick by country, never by browser language. Under 2 dollars, euros, pounds or Canadian or Australian dollars, `card_fee_note` says about how much reaches you after card fees. `price_minor_units` and `currency_code` `null`: an item that\'s only granted, or no longer sold.\n- **The refund policy** comes first: a game states one before anything goes on sale (`refund_policy_needed`). `no_refunds`, `unused_within_14_days`, `within_14_days`, or `own_words` with the policy in `refund_policy_text` (up to 600 characters, no links or contact details).\n- **The label** (`purchase_label`, on the game too) is what the game page says the game sells: the categories of its items with a price, plus what it sells through its own payments (`own_payment_categories`, with `has_own_payments`). It comes from the items, so it can\'t drift; a grant-only item isn\'t in it.\n- **A purchase** is `{"id", "item_name", "item_kind", "item_count", "purchase_source", "purchase_status", "player_id", "game_account_id", "paid_minor_units", "currency_code", "refunded_minor_units", "purchased_at", "refunded_at", "handled_at", "refund_handled_at", "receipt"}`. `purchase_source` is `sale` or `grant`; `purchase_status` `pending`, `completed`, `failed`, `refunded` or `charged_back`. `paid_minor_units` is what the whole purchase paid, in `currency_code` (`null` for a grant), apart from the item\'s price. A deleted game\'s purchases stay in its players\' history, and their Download your data, under the game\'s name. `game_account_id` is your game\'s own ID for the player\'s account in your system, given back as you sent it. `refunded_at` is when the item was taken back, a full refund or a chargeback, and `null` otherwise: a partial refund shows only in `refunded_minor_units` and leaves the item owned, so test `purchase_status` for what the player owns. `handled_at` is when the game, its game server or your own server took the purchase (`purchase_delivery`), and `refund_handled_at` when it was told the purchase was refunded or charged back; `null` until then, and `refund_handled_at` for a purchase never refunded.\n- **Grants** go to accounts (guests\' player IDs last only for their pass: `no_player`). A permanent item a player already owns answers the purchase that owns it with `is_already_owned: true`, also when two grants of it arrive at once; a consumable is granted as many times as asked, `item_count` up to 1,000 each.\n- **Receipts** are JWTs with their own signing key, published at their own address (`https://rooms.zaisma.com/.well-known/receipt-jwks.json`), apart from each game\'s pass keys at `/v1/pass-keys/<gameSlug>`, and kept there for good, so a receipt never expires and a receipt key can never sign a pass. A game server checks one in one call, with no keys to fetch: `await room.verifyReceipt(receipt)` in a room, or `await server.verifyReceipt(receipt)` in `onRequest`, `onSchedule` and `onWebhook`, the same in Zaisma rooms and on your own server. It answers the claims or throws an error whose `name` is `"ReceiptError"` and whose `code` says why (check `error.name`, not `instanceof`: in Zaisma rooms it isn\'t your copy\'s class): `malformed`, `unknown_key`, `bad_signature`, `expired`, `wrong_game`, `wrong_issuer`, `wrong_kind` (a pass) or `wrong_version`. Any other error means the check couldn\'t run just now (keys that didn\'t load, a time-out): try again later rather than refusing the purchase. Elsewhere, `verifyReceipt(receipt, keys, { gameSlug })` from `@zaisma/game-server` does the same with the receipt JWKS\'s keys (`issuerUrl` defaults to `RECEIPT_ISSUER_URL`, `https://rooms.zaisma.com/receipts`). The Node runner fetches them by itself, from `/.well-known/receipt-jwks.json` at its `--issuer-url`. A receipt can\'t pass for a pass: its header says `typ` `receipt+jwt` and its issuer is `https://rooms.zaisma.com/receipts`, so `verifyPass` and any JWT library checking the pass issuer refuse it. Its claims: `receipt_version_number` (1), `purchase_id` (`jti` too), `purchased_at`, `purchase_status`, `sub` (the player), `aud` (the game), `item_name`, `item_kind`, `item_count`, `purchase_source`, `paid_minor_units`, `currency_code`, `game_account_id` and `iat` (when it was signed). Each read signs it again with the purchase\'s current `purchase_status`, so one fetched after a refund says `refunded` or `charged_back`: deliver only on `completed`, once per `purchase_id`, and never compare receipt strings. New `item_kind`, `purchase_source` and `purchase_status` values and new claims may come within version 1; skip what you don\'t handle.\n- **Owned items in the pass:** an account\'s pass lists the permanent items it owns in the game as `owned_item_names` (`[]` for guests and when it owns none), so a game server sees them on connect without calling Zaisma: `player.ownedItemNames`, the same in Zaisma rooms and on your own server, left out when the player owns none (read it as `player.ownedItemNames ?? []`). Players\' games never see what other players own. In the game, `Zaisma.items.owns(item_name)`, `Zaisma.items.owned()` and `Zaisma.items.list()` (the items for sale at the price this player pays, with `priceText`).\n- **Nothing sold is random,** and real prices show beside coin prices: the review holds a version that sells paid random rewards (`ai_paid_random_rewards`) or prices bought coins with no real price beside them (`ai_coin_price_without_real_price`), under the content rule `purchases`.\n- A key reads items and purchases with `purchase_access` `read` (read, upload and publish keys) and changes them with `write` (full keys).\n\n### Getting purchases to your game\n\nEvery purchase and grant reaches the game exactly once, wherever the player buys: the buy sheet, `grant_item`, or a refund. `purchase_delivery` in the purchase settings (`PATCH /games/:slug/purchase-settings`, MCP `set_purchase_settings`) says where, and each purchase carries `handled_at` once it was taken (and `refund_handled_at` once a refund was told). A refund is delivered only for a purchase that was handled first. Whatever the delivery, every purchase and refund also goes to your webhooks as `purchase_completed` and `purchase_refunded` (see Webhooks), with the `purchase`, its `receipt` and its `game_account_id`.\n\n| `purchase_delivery` | Who takes the purchase | Who marks it handled |\n| --- | --- | --- |\n| `game` (the default) | The game itself, in the player\'s browser: `Zaisma.items.on("purchase")` and `on("refund")`. For a game with no server. | The game, with `Zaisma.items.markHandled(purchase.id)`. |\n| `game_server` | The game server\'s `onPurchase` and `onRefund`, in the room the player is in. For a game whose rooms keep the inventory. | The room, when the hook returns. |\n| `own_server` | Your own backend, from the receipt the game sends it. For a game whose own accounts hold what players own. | Your backend, with `POST /games/:slug/purchases/:purchase_id/handled` (MCP `mark_purchase_handled`). |\n\n**`game`.** Once the game listens, the SDK fires `purchase` for each completed purchase not yet handled and `refund` for each one taken back after it was handled, and fires again after each new purchase. The game marks it handled first, then hands it over: a second tab or device that has the game open gets `already_handled` and skips it, so it\'s handed over once. `Zaisma.items.unhandled()` lists the waiting ones, oldest first, at most 50 purchases and 50 refunds at a time (`[]` for guests, who buy nothing).\n\n```js\nZaisma.items.on("purchase", async (purchase) => {\n await Zaisma.items.markHandled(purchase.id); // already_handled: another tab took it, so this one skips it\n if (purchase.itemName === "revive") addRevives(purchase.itemCount);\n});\nZaisma.items.on("refund", async (purchase) => {\n await Zaisma.items.markHandled(purchase.id);\n if (purchase.itemName === "revive") removeRevives(purchase.itemCount);\n});\n```\n\n`markHandled` fails with `bad_purchase_id`, `no_purchase` (not this player\'s, or not paid), `already_handled` (another tab or device took it first: don\'t hand it over twice), `handled_by_server` (the delivery isn\'t `game`) and `slow_down`.\n\n**`game_server`.** The game server\'s `onPurchase(state, player, room, purchase)` and `onRefund(state, player, room, purchase)` run in the room the player is in: on every join, and right after a purchase (the game\'s SDK tells the player\'s rooms to look). `purchase` is the purchase in camelCase (`id`, `itemName`, `itemKind`, `itemCount`, `purchaseSource`, `purchaseStatus`, `gameAccountId`, `paidMinorUnits`, `currencyCode`, `purchasedAt`, `refundedAt`, `receipt`). The purchase is marked handled when the hook returns, and when it throws it isn\'t: the error shows with the game server\'s others in the stats, and it comes again at the player\'s next join. A room that has neither hook takes no purchases. Guests own nothing, so they get none. `game_server` on a game with no game server answers `no_game_server`.\n\n```js\n// zaisma-server.js: revives are kept in the player\'s state\nexport default {\n onPurchase(state, player, room, purchase) {\n if (purchase.itemName !== "revive") return;\n state.players[player.id].reviveCount += purchase.itemCount;\n },\n onRefund(state, player, room, purchase) {\n if (purchase.itemName !== "revive") return;\n const kept = state.players[player.id];\n kept.reviveCount = Math.max(0, kept.reviveCount - purchase.itemCount);\n },\n};\n```\n\nOn your own server, the Node runner runs the same hooks. It needs `ZAISMA_KEY` set to an API key with `purchase_access` `write` for the game (or `zaismaKey` in `startServer`), and doesn\'t start without it when the game server has `onPurchase` or `onRefund`: it reads each player\'s `unhandled_purchases` and marks them handled through the developer API, so a purchase comes once across restarts and Zaisma\'s own rooms. It only takes purchases while the game\'s `purchase_delivery` is `game_server`. A message from a game telling it to look (`zaisma:purchase`) must carry the purchase\'s `receipt`, which the runner checks first.\n\n**`own_server`.** The game sends your backend the `receipt` of a purchase (from `Zaisma.items.unhandled()`; your backend also gets it from the `purchase_completed` webhook), and your backend checks it with `verifyReceipt` (see Receipts above), credits the account named in `game_account_id` once per `purchase_id`, and calls `mark_purchase_handled`. A refunded or charged-back purchase is told the same way once your backend has taken back what it should (`refund_handled_at`). The webhook events carry `game_account_id` for games with their own accounts, so your backend can credit them even when no game is open. `GET /games/:slug/players/:player_id/items` lists what\'s still waiting.\n\n### When Zaisma covers your game\n\nZaisma puts nothing over a running game by default, but the player can open one of its sheets (buying, Players, Report), and a card can come over the game\'s corner (Still there?, Keep your progress). The SDK says when, so a game can pause or hold its input:\n\n- `Zaisma.page.coveredBy` is `"sheet"` while one of Zaisma\'s sheets is open over the game: the player is busy with it, so pausing makes sense. While a sheet is open, Still there? waits, since the player is there.\n- `"card"` while one of its cards is over the game\'s corner: the game stays in view and playable.\n- `null` otherwise, and always outside Zaisma\'s page (your own site, `play-locally`).\n\n`Zaisma.page.on("coveredBy", (coveredBy) => \u2026)` hears each change (a wrong event name fails with `unknown_event`):\n\n```js\nZaisma.page.on("coveredBy", (coveredBy) => {\n if (coveredBy === "sheet") pauseGame();\n else resumeGame();\n});\n```\n\n## Selling with the buy sheet\n\nPlayers buy a game\'s priced items through Zaisma\'s buy sheet. The developer connects their own Stripe account (Stripe Connect Standard): they are the seller, every sale is a direct charge on their account, the money goes to them, and Zaisma takes no fee. Stripe\'s own fees apply. The sheet and the receipt show the account\'s `business_name` and `support_email`. Until an account is connected and can take payments, the sheet answers `stripe_not_connected` or `stripe_cannot_take_payments`, and setting a price answers `next_steps` pointing at `get_stripe_account`.\n\n**Connecting needs the developer.** It decides where players\' money goes, so it needs their passkey on zaisma.com. Through a key or a connected app, `POST /stripe-account/connection-links` answers `confirmation_needed` (403) with `confirm_url`, Developer settings\' Payments part, where they connect with their passkey. From the dashboard\'s own signed-in session, with the passkey tapped in the last 10 minutes, it answers a `connect_url`. These calls need `stripe_account_access` (see What a key can do). Disconnecting and Stripe Tax need no passkey, since they only stop sales or change tax.\n\n| Call | What it does |\n| --- | --- |\n| `GET /stripe-account` | The connection: `{"stripe_account": {"is_connected", "stripe_account_id", "can_take_payments", "country_code", "default_currency_code", "business_name", "support_email", "is_stripe_tax_used", "connected_at", "balance"}}`. With nothing connected, `is_connected`, `can_take_payments` and `is_stripe_tax_used` are `false` and the rest `null`. `balance` is Stripe\'s own figures, read live and never a sum Zaisma works out: `{"currency_code", "available_minor_units", "pending_minor_units", "other_currency_balances": [{"currency_code", "available_minor_units", "pending_minor_units"}], "next_payout": {"amount_minor_units", "currency_code", "arrives_at"} | null}` (`next_payout` is `null` with manual payouts). It is `null` when nothing is connected, or when Stripe doesn\'t answer within 3 seconds, with the rest of the answer as usual. `can_take_payments` is whether Stripe lets the account take payments now; a new account may need details on Stripe first. Needs `stripe_account_access` `read`. |\n| `POST /stripe-account/connection-links` | Ask for the link to connect or make a Stripe account on: answers `connect_url`, `expires_at` (10 minutes) and `next_steps` (`get_stripe_account` once they have), with 201. The link works only for this developer signed in on zaisma.com. A key or connected app answers `confirmation_needed`, as above. |\n| `PATCH /stripe-account` | `{"is_stripe_tax_used"}`, true or false (`bad_is_stripe_tax_used`). Answers the `stripe_account` and `next_steps`. `stripe_not_connected` with no account. |\n| `DELETE /stripe-account` | Disconnect: players can\'t buy priced items until an account is connected again. Answers the empty `stripe_account` (`is_connected` false) and `next_steps`. Sales so far stay, and refunding them goes through the Stripe dashboard. `stripe_not_connected` with no account. |\n\n- **Where Stripe comes back to.** `GET /stripe/connect-return` is a page route, not part of the API: after Stripe, it goes back to the payments settings on zaisma.com with `?stripe=` `connected`, `cancelled`, `link_expired`, `signed_out` or `account_taken` (the Stripe account is already connected to another Zaisma account). A new connection starts with Stripe Tax off.\n- **Stripe Tax.** `is_stripe_tax_used: true` has Stripe Tax work out the tax inside each price for the player\'s country and record it on the developer\'s Stripe account (Stripe Tax must be set up there). Prices never change with it: the price a game shows stays what the player pays.\n- **Stripe\'s events.** Stripe tells Zaisma what happens on connected accounts at `POST /stripe/connect-events`, checked by Stripe\'s signature before anything is read. A payment that succeeded completes the purchase and one that failed fails it. A refund on Stripe\'s side (the dashboard or this API) records `refunded_minor_units`, and a refund of all of it takes the item back. A lost dispute takes the item back too (`purchase_status` `charged_back`); an open or won one changes nothing. `account.updated` refreshes the connection, and Zaisma being disconnected on Stripe\'s side forgets it, as `DELETE /stripe-account` does. Each is handled once, however often Stripe sends it.\n\n**In the game**, `Zaisma.items.buy(itemName, { itemCount, gameAccountId })`: on the game\'s zaisma.com page the sheet slides up over the game, which keeps running; on the developer\'s own site a zaisma.com window opens. `itemCount` is how many of a consumable (1 unless said; always 1 for a permanent item) and `gameAccountId` is the game\'s own ID for the player, kept on the purchase and its receipt. It resolves with `{ status, purchase }`, `purchase` in the SDK\'s camelCase `Purchase` (`id`, `itemName`, `itemCount`, `purchaseStatus`, `paidMinorUnits`, `receipt` and the rest, as the `purchase` event hands it over), or `null`:\n\n- `bought`: the player paid. `purchase` has its `receipt` (pass it to your game server to check, see Receipts above). The player\'s next pass lists the item at once, so `Zaisma.items.owns` says so right away.\n- `cancelled`: nothing was charged. The player closed the sheet or the window before paying, or already owned the item (a permanent one), so there was nothing to buy. `purchase` is `null`. `Zaisma.items.owns` tells the two apart.\n- `failed`: the payment didn\'t go through, or it was still settling when the sheet closed (a bank\'s confirmation, Apple Pay, Google Pay). `purchase` is the purchase when there is one (`purchaseStatus` `pending` or `failed`, `receipt` empty), else `null`. A payment still settling can complete later: then the item arrives as any purchase does, and the `purchase` event fires, so don\'t treat a `pending` one as final.\n\nEvery player outcome resolves; only the developer\'s mistakes reject, with an error whose `code` is `needs_player_tap`, `bad_item_name` (itemName isn\'t an item name), `no_item` (the game has no item by that name), `no_game` (the game isn\'t open to play here), `not_for_sale`, `stripe_not_connected`, `stripe_cannot_take_payments`, `bad_item_count`, `bad_game_account_id`, `unknown_option`, `not_on_zaisma` or `request_failed`.\n\n- **The tap rule.** The sheet opens only right after the player taps or presses a key in the game, so call `buy` from that handler. Otherwise it fails with `needs_player_tap`, and nothing opens by itself.\n- **On your own site.** The window is `zaisma.com/buy/<slug>/<item_name>`. It answers your page only if the page\'s address is one Zaisma knows is yours: the host of one of the game\'s `own_server_urls` on https (a `wss://` address counts as https), or a redirect address of one of your sign-in apps. Any other opener hears nothing, so `buy` waits until the player closes the window and then resolves `cancelled`, even if the purchase went through. The purchase still completes either way, and the game sees it in its next pass and in the `purchase` event.\n- **The EU line.** Players in the EU, the EEA and the UK see "You get it now, so you can\'t cancel it in the next 14 days." above Buy, because digital content delivered at once loses the 14-day withdrawal right only if the buyer is told before they buy. The receipt email repeats it.\n- **Buy waits a moment.** Buy can\'t be pressed for a fraction of a second after the sheet draws it, so a tap meant for the game can\'t land on it.\n- **Events.** `Zaisma.items.on("sheetOpen", listener)` runs when the sheet opens and `"sheetClose"` when it closes, bought or not, each with `{ itemName }`; `off` stops listening. A game can pause on `sheetOpen`, since it keeps running behind the sheet. A bought item reaches the game as Getting purchases to your game says: `Zaisma.items.on("purchase")`, the game server\'s `onPurchase`, or your own server.\n- **Local prices.** The sheet shows the price the player\'s country pays: the item\'s `local_prices` entry for its currency when the game set one, else the main price (see Items and purchases above). Prices pick by country, never by browser language.\n- **Refunds.** `refund_purchase` (`POST /games/:slug/purchases/:purchase_id/refund`) refunds a sale through the developer\'s Stripe account. By default it refunds all of what\'s left; with `amount_minor_units`, in the sale\'s `currency_code` (499 is 4.99), only that much goes back. A full refund takes the item back (`purchase_status` `refunded`), so the player no longer owns it from their next pass. A partial refund leaves it with the player and adds to `refunded_minor_units`. `bad_amount_minor_units` when the amount isn\'t a whole number from 1 to what\'s left; `purchase_not_paid` for a sale that is pending or failed; `already_refunded` for one refunded or charged back; a grant takes no amount. After the Stripe account is disconnected (or replaced), `stripe_not_connected`: refund the sale in the Stripe dashboard, and the item goes back once Stripe tells Zaisma, if an account is connected then.\n\n## Kept rooms\n\nRooms a game server keeps with `room.setKept(true)`, for worlds that last, like a survival server: when everyone leaves, a kept room sleeps with its world saved instead of ending, costs nothing while it sleeps, and wakes as it was when someone joins. A listed one stays on the game page\'s Rooms tab with nobody in it. See "Lobbies and matches" in the README.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/kept-rooms` | The game\'s `kept_rooms`, most recently played first, each `{"room_code", "name", "saved_size_bytes", "saved_at", "last_played_at", "created_at", "erases_at"}` (`erases_at`: when a deleted world is erased, null for any other); `waiting_kept_rooms_size_bytes` (worlds waiting to be erased, on the hosting meter but outside the game\'s storage); and `kept_rooms_size_bytes`, `storage_size_bytes` (the database and kept rooms together) and `maximum_storage_size_bytes` (10 GB, the most a game can keep). |\n| `DELETE /games/:slug/kept-rooms/:room_code` | Delete one\'s world: players in it are sent out ("This world was deleted."), and it waits a week before it\'s erased. Answers `is_deleted`, `erases_at` and `next_steps`; a repeat answers the same `erases_at`. In a game nobody but its developer ever played it goes at once, with `erases_at` null. An unknown code is `no_kept_room`. Not for ending a match: the game server does that with `room.end()`. |\n| `POST /games/:slug/kept-rooms/:room_code/bring-back` | Brings a deleted world back, with the same code. Until its `erases_at` it\'s as it was; after that it comes back from its last copy, for about 28 days after it was deleted, on its way for a minute or more. Answers `is_brought_back`, `is_bringing_back` (`true` while it\'s coming back from a copy), `copy_saved_at` (when that copy was made; anything played after it is lost) and `next_steps`. `kept_room_not_waiting` (409) for a world that isn\'t deleted; `kept_room_erasing` (409) mid-erase; `no_kept_room` (404) past its 28 days; `game_removed` (403), `game_storage_full` (403), `room_code_in_use` (409), `no_kept_room_copy` (404) and `slow_down` (429, past 100 GB of worlds brought back in a day) for one coming back from a copy. |\n| `GET /games/:slug/kept-rooms/:room_code/restores` | How far a world can go back: `earliest_restore_to_at` (when it was kept, or 30 days ago) and its `restores` that can still be undone, newest first. What a game\'s own restore screen draws from. |\n| `POST /games/:slug/kept-rooms/:room_code/restores` | Puts one world back as it was at any minute in the last 30 days: `{"restore_to_at": "2026-10-18T14:04:00Z"}`. Answers `kept_room_restore` (`{"id", "room_code", "restore_to_at", "restored_at", "undoes_kept_room_restore_id", "kept_room_restore_batch_id", "undo_expires_at"}`), `live_version_published_since` and `next_steps`. `bad_time` (400) outside the last 30 days or before it was kept; `no_kept_room` (404) for a deleted world, so bring it back first; `slow_down` (429) past 5 a minute per world; `kept_room_restore_unavailable` (501) where rooms keep no history. |\n| `POST /games/:slug/kept-rooms/:room_code/restores/:kept_room_restore_id/undo` | Back to just before that restore, for 30 days after it, with the same answer. An undo is a restore too, so it can be undone the same way. `no_kept_room_restore` (404). |\n| `POST /games/:slug/kept-room-restores` | Puts every kept room of the game back to one moment: `{"restore_to_at"}`. Answers `202` at once with `kept_room_restore_batch` (`{"id", "restore_to_at", "started_at", "finished_at", "undoes_kept_room_restore_batch_id", "undo_expires_at", "kept_room_count", "restored_room_count", "skipped_room_count", "failed_room_count", "failed_room_codes"}`), `live_version_published_since` and `next_steps`, which name `restore_database` with the same time. Worlds waiting to be erased and worlds kept after the moment stay as they are. `kept_room_restore_batch_running` (409) while one runs. |\n| `GET /games/:slug/kept-room-restores/:kept_room_restore_batch_id` | How it\'s going: `kept_room_restore_batch`. `no_kept_room_restore_batch` (404). |\n| `POST /games/:slug/kept-room-restores/:kept_room_restore_batch_id/undo` | Each world it restored back to just before it, for 30 days after it, with the same answer as starting one. |\n| `POST /games/:slug/kept-rooms/:room_code/erase-now` | Erases a waiting world without waiting. It always answers `confirmation_needed` first, for the developer\'s passkey tap: a key or an AI alone never skips the week. Then `is_erased` and `next_steps`; its last copy can still bring it back for about 28 days after it was deleted. `kept_room_not_waiting` (409) for a world that isn\'t waiting; `kept_room_erasing` (409) once its week is over. |\n\n- **Storage:** saved worlds count toward the game\'s storage with its database, on the game\'s hosting meter (see Hosting and credit), up to 10 GB. A kept room writes its size as it empties and at most hourly while players are in it, so the total is close, not exact. At 10 GB, `room.setKept(true)` leaves the room unkept and the game server\'s log says why, and the database can\'t grow (`database_full`), but rooms already kept keep saving: no world is lost to the limit.\n- **Waking:** a world waking runs `onRestored` with `restoreInfo.lostDurationSec` 0, since it saved as the last player left, and `restoreInfo.savedAt`, for the time that passed. It wakes on the game\'s live version; `restoreInfo.savedVersionId` says which version saved it, so you can bring an older world up to date.\n- **A deleted world waits a week:** deleting a world, or ending one with `POST /games/:slug/rooms/:room_code/end`, sends its players out and keeps it as it was until `erases_at`. Until then nobody can join it ("This world was deleted."), no room message or new version reaches it, and its code stays taken, so a game with one shared world by a fixed code can\'t open a new one under it until the world is erased. It stays on the hosting meter but outside the game\'s storage and its 10 GB, so deleting makes room at once. `bring_back_kept_room` brings it back; only the developer\'s passkey tap erases it sooner. A key or an AI app deleting worlds is a security alert, at most one a day per game. `room.end()` in the game server stays final: how a world ends is the game\'s own rule.\n- **Going back to a moment:** a restore reaches any minute in the last 30 days, as the world was last saved by then, and costs nothing of its own: normal use counts on the hosting meter as always, a world\'s size counts on storage, and the month\'s use isn\'t rolled back. Players in the world drop for a second or two and reconnect. Its game server\'s `onRestored` runs with `restoreInfo.keptRoomRestore` (`{ id, restoreToAt, restoredAt, undoesKeptRoomRestoreId, erasedPlayerIds }`), and the game tells players its own way; Zaisma says nothing to them. A restore never undoes a takedown and never changes what a player owns through Zaisma: purchases stay as they are, so a game that keeps a grant only in the world\'s state reads the player\'s `ownedItemNames` again. The world\'s state came back with any player erased since the moment still in it, so drop `erasedPlayerIds` from it in `onRestored`.\n- **A bad update:** worlds, database and version are separate calls. `live_version_published_since` says when the live version went live after the moment, since it could do the damage again, and `next_steps` names `publish_version` for the version live at that moment; a restore of every world names `restore_database` with the same time too.\n- **A game\'s own restore screen:** a game server calls `server.listKeptRoomRestores(roomCode)`, `server.restoreKeptRoom(roomCode, { restoreToAt })` and `server.undoKeptRoomRestore(roomCode, keptRoomRestoreId)` for any of its kept rooms, by its own rule of who may. Called from inside that room, the room starts over, so nothing after the call runs on it.\n- **A deleted world comes back:** for about 28 days after it\'s deleted, from a copy made at Backblaze as its deletion starts or from the last night\'s, so up to a day can be lost, and a world played after that copy loses what came after. It can\'t undo a takedown, and doesn\'t come back past the game\'s 10 GB. A game server\'s own `room.end()`, `room.setKept(false)` and deleting the game stay final. `list_kept_rooms`\' `deleted_kept_rooms` says which can come back and until when, and how it\'s going (`bring_back_started_at`, `bring_back_failed_at`).\n- **When the game is unavailable** (taken down, made private): players in a kept room are sent out and it sleeps, kept. Deleting the game deletes its kept rooms.\n- **One shared world:** `room.roomCode` tells the game server which room it\'s in, so it can keep only its world\'s room and refuse players elsewhere in `canJoin`.\n- **On your own server** the Node runner keeps kept rooms\' states in its `--room-state-file` until they end, and a kept room that ends is gone: the week\'s wait and copies of deleted worlds are Zaisma\'s. `server.restoreKeptRoom` works there too, from copies in the same file: one a minute for a day and one an hour back to 30 days, when a state changed, so past a day it goes to the newest copy at or before the time. `erasedPlayerIds` is empty there, since that server keeps no list of them.\n- A key lists with `game_access` `read` and deletes with `write`.\n\n## Reaching live rooms\n\nA game reaches its own live rooms from anywhere it runs: its game server in a room (`room.sendToRoom`, `room.sendToEveryRoom`, `room.listRooms`) or in its requests, schedules and webhooks (`server.` the same, plus `getRoom`, `kickFromRoom` and `endRoom`), its developer\'s scripts through these calls, and their AI through the MCP. A survival game with 400 worlds starts its blood moon in all of them at 8pm; one world tells another that a party is on its way; the game\'s own moderation page tells world 213 to freeze a griefer. Zaisma draws nothing: there\'s no screen for it, so a game builds its own tools on the calls.\n\nA room message goes to the room\'s game server, `onRoomMessage(state, roomMessage, room)`, which decides what players see. A room whose game server has no `onRoomMessage` hands it to every player\'s and spectator\'s game as the room\'s `roomMessage` event, so a game with no server code still gets announcements. `roomMessage` is `{ message, senderKind, fromRoomCode, sentAt }`: the message as sent (plain JSON, up to 16 KB), who sent it (`room`, another room\'s game server; `server`, the game server outside rooms; `developer`, these calls and the MCP, scheduled sends included), the sending room\'s code (null unless `senderKind` is `room`) and when.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/rooms` | The game\'s live rooms on Zaisma, newest first: rooms that are running, and kept rooms asleep with nobody in them. Each `{"room_code", "name", "labels", "player_count", "maximum_player_count", "spectator_count", "is_listed", "is_open", "is_kept", "version_id", "continent", "created_at"}`; `room_count`; up to 500, with `next_cursor` for the rest (pass it as `cursor`). A room\'s `labels` are a list of `{"label_name", "label_value"}`; `?labels=[{"label_name":"Map","label_value":"Docks"}]` (as JSON) gives only rooms holding every label given. |\n| `GET /games/:slug/rooms/:room_code` | One live room as `room`, and who\'s in it as `players`: its players in join order, then its spectators, each `{"player_id", "name", "kind", "is_away", "away_reason", "joined_at", "is_spectator"}`. A kept room asleep has nobody. An unknown code is `no_room`. |\n| `POST /games/:slug/rooms/:room_code/messages` | A room message to one room, `{ "message" }`: answers `is_delivered`. A kept room with nobody in it wakes for it. `no_room` when it isn\'t running, `room_busy` when it took 100 room messages in the last second. |\n| `POST /games/:slug/room-messages` | A room message to every live room with someone in it, `{ "message", "labels", "send_at" }`: `labels` (optional) only rooms holding every one of them. Kept rooms asleep with nobody in them don\'t wake for it. Now, it answers `room_count`, how many rooms took it. With `send_at`, an ISO time from 10 seconds to 90 days ahead, it waits and answers `scheduled_room_message` (`{"id", "send_at", "labels", "created_at"}`, a `scheduled_room_message_\u2026` ID), going out within a minute after its time; the other field is null. |\n| `GET /games/:slug/room-messages` | The scheduled ones waiting, soonest first, then the last 20 that went out, each `{"id", "message", "labels", "send_at", "created_at", "sent_at", "delivered_room_count"}`. |\n| `DELETE /games/:slug/room-messages/:scheduled_room_message_id` | Cancel one waiting: `is_cancelled`. One that went out is `no_scheduled_room_message`. |\n| `POST /games/:slug/rooms/:room_code/kick` | Remove a player or spectator, `{ "player_id", "message", "is_kept_out" }`, as the room\'s own `room.kick` would: they\'re told `message` (up to 200 characters, your game\'s words within the content rules) and sent out, `onLeave` hears reason `kicked`, and `is_kept_out` keeps them out for the rest of the match. Answers `is_kicked`; `no_player_in_room` when they aren\'t in it. |\n| `POST /games/:slug/rooms/:room_code/end` | End a room\'s match, `{ "message", "confirm": true }`: everyone in it hears `message` (up to 200 characters) and is sent out. A kept room\'s world waits a week to be erased (see Kept rooms), and `erases_at` says when; it\'s null for any other room, and in a game nobody but its developer ever played. Without `"confirm": true` it\'s `needs_confirm`, so an AI asks you first. Answers `is_ended` and `erases_at`. |\n\n- **Limits:** a room\'s game server sends up to 20 room messages a second (`room_call_limit` past it), and a room takes up to 100 a second (`room_busy`, and `isDelivered` false for a game server). Sends to every room are up to 10 a minute for the whole game, from its game server, these calls and the MCP together (`every_room_send_limit` here, `room_call_limit` in the game server), and up to 100 scheduled ones wait at once (`too_many_scheduled_room_messages`). `ROOM_MESSAGE_LIMITS` in the game server package has them all.\n- **What it costs:** each room a message reaches is one request to that room on the game\'s hosting meter, with the time it keeps the room awake and its game server\'s CPU, as its players\' messages are. A send to every room costs as many requests as rooms it reaches.\n- **A scheduled send** goes out with the game\'s live version\'s rooms at the time. A game that can\'t be played then (nothing live, held, taken down, or its hosting paused) has it recorded as sent with `delivered_room_count` 0.\n- **On your own server** the Node runner gives its game server the same calls among its own rooms, in the same process: `room.listRooms` lists the runner\'s rooms, a send to a kept room asleep in its `--room-state-file` wakes it, and every-room sends share the same 10 a minute. These calls and the MCP reach only rooms on Zaisma: rooms on your own servers are your game server\'s to reach. The local bench sends as these calls do with `POST /bench/api/room-messages` (see the README\'s "The bench\'s API, for your AI").\n- A key lists and looks with `game_access` `read`, and sends, kicks and ends with `write`.\n\nA live event that starts everywhere at 8pm, sent with `send_at`:\n\n```js\n// zaisma-server.js\nexport default {\n setup: () => ({ isBloodMoon: false }),\n onRoomMessage(state, roomMessage, room) {\n if (roomMessage.message.kind !== "blood_moon") return;\n room.broadcast({ kind: "blood_moon", durationSec: roomMessage.message.duration_sec });\n return { ...state, isBloodMoon: true };\n },\n};\n```\n\n```bash\ncurl -X POST https://zaisma.com/api/dev/games/frostbound/room-messages \\\n -H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" \\\n -d \'{"message": {"kind": "blood_moon", "duration_sec": 600}, "send_at": "2026-11-06T20:00:00Z"}\'\n```\n\n## A game server\'s logs\n\nEverything a game\'s own game server prints on Zaisma, kept 30 days and free: every `console.log`, `info`, `warn`, `error` and `debug` (`trace` counts as debug; `dir` and `table` as log), in rooms and in `onRequest`, `onSchedule` and `onWebhook`, plus each crash or stop written down in full as an `error` line starting `Zaisma:` (or with the error\'s stack). Read them with `get_logs` or `zaisma logs <slug> --follow`.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/logs` | The newest lines in `log_lines`, oldest first, each `{"logged_at", "level", "text", "source_kind", "room_code", "version_id"}`, with `next_cursor` and `new_lines_cursor`. Narrow it with `room_code`, `minimum_level` (`debug`, the default, `info` for all but debug, `warn` or `error`), `source_kind` (`room`, `request`, `schedule` or `webhook`) and `search_text` (contained, ignoring case); `maximum_line_count` is 1 to 500, 100 by default. |\n\n- **Going back and following:** `cursor` (a `next_cursor`) answers the lines before an earlier answer\'s, `null` when there are none. `new_lines_cursor` answers only the lines written since the answer that gave it, so to follow, call once and then keep passing back the `new_lines_cursor` each answer gives; following goes by when lines were written, so a room writing late never makes you miss a line. Give one or the other (`two_log_cursors`).\n- **How soon:** lines reach the logs within 30 seconds, and within 2 seconds for the next 10 minutes once someone has read them, so the first call while testing can come up empty and the next ones keep up.\n- **Text:** strings as they are, everything else as JSON, an `Error` with its stack, joined by spaces as a console shows them; up to 4,000 characters a line. A call that prints more than 1,000 lines keeps the first 1,000 and adds one line saying how many it dropped, and each room (and the game server outside rooms) keeps up to 20 MB a day, then says so in one line and keeps nothing more until midnight UTC.\n- **Who can read them:** a key with `stats_access` `read`. Anything the game server prints is in its logs, so don\'t print players\' details or secrets you wouldn\'t want there; they\'re deleted after 30 days, and with the game.\n- **Mistakes in a game server\'s code** are lines here too, each with a code: a room call with wrong arguments (`bad_room_call`, the call as its field, like `room.kick`), too many reserves a minute or room calls in one go (`room_call_limit`), a call that can\'t run here, like `room.reserve` where the host makes no rooms, or any change from `canJoin` or `stateView` (`room_call_unavailable`), and a handler that answers something that isn\'t a state, or a `canJoin` that answers nothing (`bad_handler_answer`). The state stays as it was and the player is turned away, never let in by accident. The Node runner prints the same errors to its terminal.\n- **Not here:** players\' browser errors (they\'re in the browser\'s own console) and a game on your own server, which prints to its own terminal. `get_stats` still counts errors per day and lists the latest distinct ones.\n\n## The game database\n\nEvery game has its own SQLite database, part of its hosting: the one its game servers use as `room.database` (see "The game database" in the README), empty until something writes to it. You and your AI reach the same database here, live, with the same checks and limits as game servers: look at its tables, query it, fix data and change its tables, and take the whole database out or bring one in. Whole numbers past 2^53 (9,007,199,254,740,991) are refused going in (`bad_values`) and can\'t be read back as numbers (`integer_too_large`), since JavaScript can\'t hold them exactly: store them as text, and read one with `CAST(column AS TEXT)`. A REAL as big as 1e20 reads fine. The database refuses what Cloudflare\'s SQLite refuses, on your own server too, so a query runs the same in both: PRAGMAs other than `table_info`, `table_xinfo`, `table_list`, `index_list`, `index_info`, `index_xinfo`, `foreign_key_list`, `foreign_key_check`, `defer_foreign_keys`, `quick_check`, `integrity_check` and `optimize` (keep a schema version in a table of your own, not `user_version`), `CREATE TEMP` tables and other temporary objects, and `sqlite_version()`, `sqlite_source_id()` and `load_extension()`; a statement is held to 100,000 bytes of UTF-8.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/database` | `tables` (`{"name", "sql"}`, the `sql` being its `CREATE TABLE`), `indexes` (`{"name", "table_name", "sql"}`, only ones made with `CREATE INDEX`), and `database_use_this_month`: `read_row_count`, `written_row_count`, `storage_size_bytes` and `maximum_storage_size_bytes` (10 GB, the most a game can keep), and `hosting_use_this_month`, the game\'s hosting meter as the stats answer it (see Hosting and credit), which the rows and storage count on. Also `restores`: the last 30 days\' restores and undos, newest first, up to 50, as the restore calls below answer them. No row counts, because counting reads every row: query `SELECT count(*)` when you need one. |\n| `POST /games/:slug/database/query` | Run one statement: `{"sql", "values"}`. Answers `rows` (a `SELECT`\'s, or a change\'s with `RETURNING`; `[]` for none), `read_row_count` and `written_row_count` (what it counts on the game\'s hosting meter), and `next_steps`. |\n| `POST /games/:slug/database/batch` | Run up to 100 statements in one transaction, `{"statements": [{"sql", "values"}]}`: all of them happen, or, if one fails, none do. Answers `statement_results`, one `{"rows", "read_row_count", "written_row_count"}` per statement, in order. |\n| `GET /games/:slug/database/export?cursor=` | One part of the whole database as SQLite\'s own SQL dump, up to 4 MB: `dump_sql`, `next_cursor` (pass it as `cursor` for the next part; `null` on the last) and `read_row_count`. Leave `cursor` out to start. |\n| `POST /games/:slug/database/import` | Add one part of a SQL dump, up to 5 MB, in one transaction: `{"dump_sql"}`. Answers `statement_count`, `skipped_statement_count` (the transaction and settings around the dump, below), `read_row_count`, `written_row_count` and `next_steps`. |\n| `POST /games/:slug/database/erase-player` | Erase one player: `{"player_id"}`. Answers `erased_tables` (`{"table_name", "erased_row_count"}` for every table with a `player_id` column, 0 included), `written_row_count` and `next_steps`. |\n| `POST /games/:slug/database/restores` | Put the database back as it was at a moment in the last 30 days: `{"restore_to_at": "2026-10-18T14:05:00Z"}`. Answers `database_restore` (`{"id", "restore_to_at", "restored_at", "undoes_database_restore_id", "undo_expires_at"}`), `erased_again_player_count` and `next_steps`. |\n| `POST /games/:slug/database/restores/:database_restore_id/undo` | Undo a restore: back to just before it. Answers the same, with `undoes_database_restore_id` the restore it undid. |\n\n- **values** fill the `?`s in order: text, numbers, `null`, or `{"blob_base64": "\u2026"}` for bytes. Blobs come back the same way. SQLite has no true or false (send 1 or 0), and an object goes in as JSON text, read back with SQLite\'s JSON functions. Put values in `values`, never into the SQL.\n- **One statement per query**, a trailing `;` is fine. `BEGIN`, `COMMIT`, `ROLLBACK`, `SAVEPOINT`, `RELEASE`, `ATTACH` and `DETACH` are refused: a batch is the transaction.\n- **Limits, the same as a game server\'s:** 100,000 characters of SQL, 100 values of up to 1 MB each, 100 statements a batch and 10,000 rows a statement (`too_many_rows`; page with `LIMIT`). An answer here also stops at 8 MB (`answer_too_big`), and a request at 6 MB. A statement that fails undoes itself, and a batch with it.\n- **It\'s live.** Changes reach the game\'s rooms straight away, so the MCP\'s tools ask you before changing or deleting data a live game uses.\n- **Export and import** use SQLite\'s own SQL dump, the `CREATE TABLE`s and `INSERT`s `sqlite3 game.sqlite .dump` writes, so the database moves between Zaisma and any SQLite, like the Node runner\'s `zaisma-database.sqlite`. The parts of an export, put together in order, are one dump: the first starts with `PRAGMA foreign_keys=OFF;` and `BEGIN TRANSACTION;`, each table comes with its rows, then AUTOINCREMENT\'s counters, the views, indexes and triggers (after the rows, so triggers don\'t fire on them) and `COMMIT;`. Export reads table by table, so writes the game makes meanwhile can land between parts: it isn\'t a snapshot. Its reads count, but it works past the free reads: your data is always yours to take.\n- **Import only adds.** It runs a dump\'s `CREATE` and `INSERT` statements and leaves out what sqlite3 writes around them (`BEGIN`, `COMMIT`, `PRAGMA foreign_keys` and `writable_schema`, `ANALYZE` and its `sqlite_stat1` rows); anything else is refused (`bad_sql`), and so is `INSERT OR REPLACE`. A part makes its tables first and checks foreign keys when it ends, so a row can refer to a row after it or to a table made after it; a reference to a row in another part is refused (`bad_sql`) saying the parts must go in together. sqlite3\'s own `.dump` of a database with an fts5 search table imports too: its `INSERT INTO sqlite_schema` becomes the `CREATE VIRTUAL TABLE`, its shadow tables (`_data`, `_idx`, `_content`, `_docsize`, `_config`) are left out, and the table is filled again from its `_content` rows under their rowids (other virtual tables: import the `.sqlite` file). Export writes a search table\'s rows with their rowids, and reads a table with a primary key in key order, so a game writing during an export can\'t make it skip or repeat a row. A table that\'s already there stops it: to replace one, drop it first with a query. AUTOINCREMENT\'s counters only go up. Text and blobs in an `INSERT` are sent to the database as values, up to 2 MB each (a game server\'s own values are held to 1 MB), so a row bigger than a statement\'s 100,000 characters, or one grown past 1 MB by SQL, still goes in, and `unistr(\'\u2026\')`, which newer sqlite3 writes for text with line breaks, becomes its text. Each part is all or nothing and names the statement that stopped it; the parts before it stay in. Writes count like any write and stop at the free writes. The upload command cuts a dump into parts for you, and reads and writes `.sqlite` files.\n- **Erasing a player** deletes every row whose column named `player_id` holds their ID, in every table that has one, in one transaction; other columns, like `winner_player_id`, are left alone. It works on any player ID (a player who asks you by email, say), counts towards the month\'s use but works past the free limits, and reaches the game\'s rooms at once. A foreign key without `ON DELETE CASCADE` that refuses the delete undoes the whole erase (`bad_sql`, naming the table). Zaisma does it for you when a player deletes their account, unless the game\'s `deleted_account_erase_enabled` is `false`. A game server does the same with `server.database.erasePlayer(playerId)`, on Zaisma and on your own server.\n- **Restoring to a time** puts the whole database back as it was at that moment, tables and rows both, live: the undo for a bad import, a game server bug or a wrong `DELETE`. Cloudflare keeps 30 days of each database\'s history, so `restore_to_at` is an ISO time from the last 30 days, and not before the game was made (`bad_time`); `get_history` shows when the change you want to undo happened. Everything written since is gone until you undo the restore, which works for 30 days after it; an undo is a restore too, so it can be undone the same way. The database restarts to restore, so a game server\'s query in that second can answer `database_unavailable` (try again). Players erased since that moment (when they deleted their account, by `erase-player` or by a game server) are erased again, so a restore never brings them back, and the month\'s use isn\'t rolled back. Up to 5 restores and undos a minute per game (`slow_down`). On your own server the database is a file: copy it to keep earlier versions.\n- **Use** counts on the game\'s one hosting meter (see Hosting and credit): rows written and read, counted the way Cloudflare bills them (an index changed counts as a row written, and a `SELECT` without an index reads every row it looks at), and the storage kept each day. Calls here count like the game\'s own. When the game\'s hosting pauses, reads and writes keep working for the hour running matches get, so a match\'s last save lands; then they answer `hosting_paused`. Exports, `GET /games/:slug/database` and erasing a player keep working whatever: the data is always yours. A game keeps up to 10 GB; at it, rows can change and go but not grow (`database_full`).\n\n## Cloud saves\n\nA signed-in player\'s progress in a game with cloud saves on is mirrored to their account from the game\'s own browser saves, with no code (see "Cloud saves" in the README). You and your AI reach every player\'s save here, by player ID: list them, read them, fix them, reset them, and go back to earlier versions. Saves stay apart from the game database, and each stays tied to its player: deleted with their account, never shown to other games. A save is the game\'s localStorage, and its IndexedDB databases when it keeps any (Unity, Godot and localForage do). Copying it never slows the game: only what the game changed is read again, in a worker off the thread that draws the game, and a save past 5 MB stays on the device and is read no further. Keep downloaded files in a database with "cache" in its name (like Unity\'s UnityCache), which saves skip, so they never count toward the save.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/saves` | The players with a save, 100 a page in player ID order: `saves`, each `{"player_id", "sha256", "size_bytes", "saved_at", "changed_by_kind", "save_copy_count", "version_id"}`, and `next_cursor` (pass it as `?cursor=` as it came; `null` on the last page). |\n| `GET /games/:slug/saves/:player_id` | One save: `{"save": {\u2026the same, "local_storage_items", "missing_keys", "indexeddb_databases"}}`. `?keys=coins&keys=level` (each key its own parameter, since keys can hold commas) answers only those localStorage keys, with `missing_keys` naming the ones it doesn\'t have, and `indexeddb_databases: null`. |\n| `PATCH /games/:slug/saves/:player_id` | Change some localStorage keys: `{"local_storage_items": {"coins": "500", "tutorial_seen": null}}`, each key\'s new text, `null` removing it. The rest of the save stays as it is. |\n| `PUT /games/:slug/saves/:player_id` | Replace the whole save: `{"local_storage_items", "indexeddb_databases"}`, both in full (`[]` when the game keeps nothing in IndexedDB). |\n| `DELETE /games/:slug/saves/:player_id` | Reset it: the save becomes empty, so the game starts fresh on every device. |\n| `GET /games/:slug/saves/:player_id/copies` | Its earlier versions, newest first: `save_copies`, each `{"id", "saved_at", "copy_reason", "size_bytes", "is_current_save", "version_id", "sha256"}`. |\n| `GET /games/:slug/saves/:player_id/copies/:save_copy_id` | One earlier version: `{"save_copy": {\u2026the same, "local_storage_items", "missing_keys", "indexeddb_databases"}}`, whole or with `?keys=`. |\n| `POST /games/:slug/saves/:player_id/copies/:save_copy_id/restore` | Make it the save again. |\n\n- **Every change** (change, replace, reset, restore) answers `{"save", "kept_save_copy_id", "next_steps"}`: the save as it is now, and the earlier version that holds what it replaced, which `restore` brings back. A copy is kept first unless the save it replaces was your own last change (its copy from before that is still there), so changing a save again and again never pushes out the player\'s own copies; `kept_save_copy_id` is then `null`, as it is when nothing changed. When it isn\'t `null`, it always names a copy that\'s kept: the copy a change adds is never the one dropped to stay at five. A change to some keys is made to the save as it is when the change lands, so two changes at once, or the player\'s game saving meanwhile, never undo each other. A change or replace makes a save for a player who has none; a reset needs one (`no_save`).\n- **It reaches the player\'s devices with no question.** The save\'s `changed_by_kind` becomes `developer` (it\'s `player` when the game saved it). A game the player has open takes your save the next time it saves or when the player comes back to its tab, with no question, keeping that device\'s progress since its last save as an earlier version: it reloads with it, unless it listens with `Zaisma.saves.on("developerChange")`, when Zaisma writes your save into the game\'s storage under the running game and the game rereads it, with no reload (the reload stays the fallback when the game holds a database open). A game opening later takes it like any newer save, straight away. Whether the player can go back is the game\'s own rule.\n- **How a save is stored:** one text, `{"save_format_version_number": 1, "local_storage_items": {\u2026}, "indexeddb_databases": [\u2026]}`, always those three keys in that order and localStorage keys sorted, so the same save always has the same `sha256` (of that text). Answers give `local_storage_items` and `indexeddb_databases`; the number tells later formats apart. A save or copy from before this format is rewritten into it the first time it\'s read (by the player\'s game, `get_save`, `get_save_copy`, a restore or an export), with nothing in it changed, so its `sha256` changes once. A save landing at that moment always wins over the rewrite.\n- **saved_at and version_id:** `saved_at` is when the save was last saved or changed. `version_id` is the game version that saved it, as the player\'s game page reported it: `null` for a save you changed, replaced or reset, and for one from before Zaisma kept it; a restored save has the restored copy\'s. A copy has its own. It\'s a label, never a check: a save is never refused over it.\n- **Values are text**, as localStorage holds them: `"500"`, not `500`, and a list or object as the JSON text the game stores.\n- **IndexedDB databases** are as the game domain script stores them (`packages/sdk/saves.js`), with IndexedDB\'s own names: `{"name", "version", "stores": [{"name", "keyPath", "autoIncrement", "indexes": [{"name", "keyPath", "unique", "multiEntry"}], "records": [[key, value]]}]}`. `keyPath` is `null` when keys are kept beside the values, so each record\'s `key` is its key; otherwise it\'s where the key is in the value, and the record\'s `key` is only a copy of it. Values beyond JSON are tagged `{"$z": [kind, \u2026]}`, and what\'s inside a tag (a map\'s entries, a set\'s items, an object\'s values) is written the same way. Change databases only inside their records\' values.\n\n | Tag | Stands for | Written as |\n | --- | --- | --- |\n | `num` | A number JSON can\'t hold: `-0`, `NaN`, `Infinity`, `-Infinity` | `["num", "-0"]` |\n | `undef` | `undefined` | `["undef"]` |\n | `bigint` | A BigInt | `["bigint", "12345678901234567890"]` |\n | `date` | A Date | `["date", time in ms]`, the time a `num` tag for an invalid date |\n | `regexp` | A RegExp | `["regexp", source, flags]` |\n | `bytes` | An ArrayBuffer | `["bytes", base64]` |\n | `view` | A typed array or a DataView | `["view", kind, base64]`, kind one of `Int8Array`, `Uint8Array`, `Uint8ClampedArray`, `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array`, `Float64Array`, `BigInt64Array`, `BigUint64Array`, `DataView` |\n | `blob` | A Blob | `["blob", type, base64]` |\n | `file` | A File | `["file", type, base64, name, lastModified in ms]` |\n | `map` | A Map | `["map", [[key, value], \u2026]]` |\n | `set` | A Set | `["set", [item, \u2026]]` |\n | `obj` | An object with its own `$z` key | `["obj", the object]` |\n\n- **Replacing a save** (`PUT`, `replace_save`) takes only databases a browser can restore, and answers `bad_indexeddb_databases` with the exact place in `field` (like `indexeddb_databases[0].stores[1].keyPath`) otherwise:\n - **A database** has exactly `name`, `version` and `stores`. Its `name` isn\'t empty, is there once, and has no "cache" in it (in any case), since saves leave those out. Its `version` is a whole number from 1 to 9007199254740991.\n - **A store** has exactly `name`, `keyPath`, `autoIncrement`, `indexes` and `records`, with a `name` once in its database. `keyPath` is `null`, a key path (`""` for the whole value, or names joined by dots, like `"player.id"`), or a non-empty list of key paths. `autoIncrement` is `true` or `false`, and can\'t be `true` with a list or `""`.\n - **An index** has exactly `name`, `keyPath`, `unique` and `multiEntry`, with a `name` once in its store. Its `keyPath` is a key path or a list of them, never `null`. `unique` and `multiEntry` are `true` or `false`, and `multiEntry` can\'t be `true` with a list.\n - **A record** is `[key, value]`, and both read back by the tag table: a known tag, with that tag\'s fields (a `view`\'s bytes fill whole items). With a `null` `keyPath`, the key must be one IndexedDB takes: text, a number (not `NaN`), a valid date, binary data (`bytes` or `view`), or a list of those. Otherwise the value must hold such a key at its `keyPath`, unless `autoIncrement` is `true` and nothing is there.\n- **The cursor** is opaque: pass `next_cursor` back as it came. Anything else is `bad_cursor`.\n- **Earlier versions:** up to 5 per player per game, kept about once an hour while playing (`copy_reason` `hourly`) and whenever progress was about to be lost: the account\'s, replaced by another device\'s progress played more recently (`account_lost`); a save that shrank to under half (`smaller`); a device\'s progress older than the account\'s (`device_lost`, its `saved_at` when that device last played); a change of yours (`developer`); or the player going back to an earlier version in the game (`restore`, through `Zaisma.saves.restoreCopy`). Those outlast hourly copies for 30 days. More reasons may come: show nothing for one you don\'t know.\n- **In the game:** a game that draws its own save screens uses the SDK\'s `Zaisma.saves` (the reference is `packages/sdk/zaisma.d.ts`, served beside the SDK as `_zaisma/v1.d.ts`): `listCopies()` (`{ saveCopies }`, each with `savedAt`, `copyReason` and `versionId`), `getCopy(saveCopyId)` and `restoreCopy(saveCopyId)` reach the signed-in player\'s own earlier versions (going back keeps the save it replaces as a `restore` copy and reloads the game); `on("conflict")` hears when two devices\' progress differed, the most recently played won and the other was kept, so the game can offer the other one (`{ winnerKind, keptSaveCopy }`, `winnerKind` `this_device` or `account`); and `on("developerChange")` takes your changes in place (`{ savedAt, keptSaveCopy }`). `Zaisma.player.offerAccount()` shows guests the "Keep your progress" card at the game\'s moment, at most once a visit and not for 3 days after Not now (`account_offer_enabled` only turns off the card that shows by itself after 5 minutes).\n- **Limits:** a save is up to 5 MB (`save_too_big`); `keys` takes up to 100 keys. A game with cloud saves off doesn\'t read saves, so changes there are refused (`cloud_saves_off`); reading still works. Guests have no saves here: their progress stays in their browser.\n- **Where they don\'t work:** on a tester link, or a Zaisma with no accounts, both the `Zaisma.saves` calls and `Zaisma.player.offerAccount()` fail with `error.code` `cloud_saves_not_here`. Nothing to fix: the game saves in the browser as usual, and cloud saves work on its own page on Zaisma.\n\n## Webhooks\n\nZaisma POSTs an event to your server whenever something happens to your games, so your server or CI doesn\'t have to keep checking: a bug report can open a GitHub issue, a passed scan can move a release on, a takedown can page you. No server of your own? A webhook can send a game\'s events to that game\'s own game server on Zaisma instead (Webhooks to the game server, below).\n\n| Call | What it does |\n| --- | --- |\n| `GET /webhooks` | Your webhooks: `{"id", "destination_kind", "endpoint_url", "event_kinds", "game_slugs", "pending_delivery_count", "failed_delivery_count", "is_last_delivery_failed", "created_at", "updated_at"}`. `is_last_delivery_failed` is true when the webhook\'s last real event failed every try; changing the webhook clears it. |\n| `POST /webhooks` | Make one: `{"destination_kind"?, "endpoint_url", "event_kinds", "game_slugs"?}`, or for a game server `{"destination_kind": "game_server", "event_kinds", "game_slugs": ["<its slug>"]}`. Up to 10. Answers with the `webhook` and its `signing_secret`, shown only this once, and `next_steps` (`test_webhook`). |\n| `PATCH /webhooks/:id` | Change `destination_kind` (with an `endpoint_url` when it becomes `endpoint_url`, and one game in `game_slugs` when it becomes `game_server`), `endpoint_url`, `event_kinds` (the whole list) or `game_slugs` (the whole list, or `null` for every game), or `{"replace_signing_secret": true}` for a new secret, answered once as `signing_secret`; by default the old one stops working at once. Events still being tried go to the new address with the new secret. |\n| `DELETE /webhooks/:id` | Delete one for good, with what was still on its way to it; answers `removed_webhook_id`. |\n| `POST /webhooks/:id/test` | Send it a `test` event now, tried once, and answer the `delivery`: `delivered` when your server answered 2xx (or the game server\'s `onWebhook` finished without an error), else `failed` with why. |\n| `GET /webhooks/:id/deliveries?cursor=` | What was sent to it in the last 30 days, newest first, 20 at a time (`next_cursor` continues): each `webhook_event` as sent, `delivery_status` (`pending`, `delivered` or `failed`), `attempt_count`, `last_attempt_at`, `next_attempt_at` and `failure_message`. |\n\n- **destination_kind:** `endpoint_url` (the default), signed POSTs to `endpoint_url`; or `game_server`, the game\'s own game server on Zaisma, which has no `endpoint_url` (`null`).\n- **endpoint_url:** https on a name (no IP addresses, user names or `#fragment`), and not on Zaisma\'s own domains. Up to 500 characters.\n- **event_kinds**, any of:\n - `bug_reported`: report triage sorted a player\'s report as a bug, the same ones `GET /games/:slug/reports` lists (never child-safety reports, and never who sent them).\n - `player_reported`: Zaisma passed you a report about one of your game\'s players (bullying, cheating and other behavior that\'s your game\'s call), the same ones `GET /games/:slug/reports` lists as `player_reports`. Sent to a game server, it lets your game moderate by itself.\n - `scan_status_changed`: a version\'s scan finished (`approved`, `held` or `rejected`), or Zaisma changed its `scan_status` later: a person approved or rejected it, a report paused it, image matching held it.\n - `ai_review_finished`: a version\'s AI review ended: `version.ai_review_status` says how, and a stop also changes `scan_status` and sends players back.\n - `live_version_changed`: players get another version: you published or rolled back, it went live at its `scheduled_publish_at` or as soon as it passed, a report put players back on the version before, or a person put it back after checking.\n - `review_status_changed`: Zaisma held or took down the game, or put it back (`game.review_status` and `game.review_reason` say which and why).\n - `country_blocks_changed`: Zaisma blocked the game for players in one country on a notice under that country\'s law, or lifted it (`game.country_blocks` says which countries and why).\n - `game_server_error_found`: a new distinct error in the game\'s own game server (a handler threw or didn\'t start, or a call ran on too long), once per error per version, never per occurrence, within about 5 minutes. `game_server_error` is the error as `GET /games/:slug/stats` lists it, and `version` the version it happened in. At most 20 a game a day; past that, errors only show in the stats. An error `onWebhook` threw goes only to webhooks with an `endpoint_url`, never back to the game server, so a broken `onWebhook` can\'t feed itself.\n - `alert_raised`: one of the game\'s hosting alerts appeared (see Alerts): `hosting_nearly_paused`, `hosting_budget_nearly_used`, `hosting_paused`, `free_rooms_stopped`, `second_free_allowance_started`, `credit_low`, `database_nearly_full` or `database_full`, within about 5 minutes: each at most once a month, except a pause once per pause, a budget\'s heads-up once per budget and `credit_low` once per top-up. `alert` is the alert as `alerts` lists it. It covers every alert kind, including ones added later, so switch on `alert.kind`.\n - `security_alert`: one of your own account\'s security alerts (see Your account\'s activity): `security_event` is the event as `GET /activity` lists it. About your account, not a game, so `game` is `null`, and it only reaches webhooks for every game (`game_slugs` `null`) at an `endpoint_url`, never one limited to games or a game server.\n - `account_deleted`: a player who played the game, or signed in to one of your sign-in apps, deleted their Zaisma account. `account_deletion` says who (`player_id`): erase what you keep about them. Zaisma erases their rows from the game\'s own database itself unless `account_deletion.deleted_account_erase_enabled` is `false` (the game\'s setting; always `false` about a sign-in app). One event per game they played and per sign-in app they used; for a sign-in app, `game` is `null` and `sign_in_app` says which, and it only reaches webhooks for every game (`game_slugs` `null`) at an `endpoint_url`, never one limited to games or a game server.\n - `purchase_completed`: a player bought an item, or you granted one (see Getting purchases to your game). `purchase` is the purchase as `GET /games/:slug/purchases/:purchase_id` answers it, with its `receipt` and `game_account_id`: the record to credit a game\'s own account from, sent even when no game is open. Sent whatever the game\'s `purchase_delivery`.\n - `purchase_refunded`: a purchase or grant was refunded or charged back. `purchase` is the purchase, whose `purchase_status` says which; take back what your refund policy says.\n- **game_slugs:** only events about these games; leave it out, or `null`, for every game you have and will make. A webhook to a game server takes exactly one: the game whose server it is.\n- **The event** is the body, JSON: `{"id", "kind", "created_at", "game", "version", "bug_report", "player_report", "game_server_error", "alert", "account_deletion", "sign_in_app", "security_event", "purchase"}`. `created_at` is when Zaisma made it. `game`, `version`, `bug_report`, `player_report`, `game_server_error`, `alert`, `sign_in_app`, `security_event` and `purchase` are exactly what `GET /games/:slug`, `GET /games/:slug/versions/:id`, `GET /games/:slug/reports`, `GET /games/:slug/stats`, the game\'s `alerts`, `GET /sign-in-apps`, `GET /activity` and `GET /games/:slug/purchases/:purchase_id` answer for them, as they are when it\'s sent, or `null` when the event isn\'t about one (a `test` event has them all `null`); `account_deletion` is `{"player_id", "deleted_account_erase_enabled"}` on an `account_deleted` event, else `null`. The embedded objects follow the API\'s own rule: fields are added, and one is only ever retired with notice. These v1 webhooks keep for good, so a consumer can rely on them: the game\'s `slug`, `title`, `visibility`, `review_status`, `review_reason`, `country_blocks` and `deleted_account_erase_enabled`, and the version\'s `id`, `scan_status`, `is_live`, `review_reason` and `findings`. New kinds and fields can be added, so ignore ones you don\'t know.\n- **Signatures** follow [Standard Webhooks](https://www.standardwebhooks.com), so its libraries check them in one call, in any language. Each request has `webhook-id` (the event\'s `id`, the same on every try), `webhook-timestamp` (Unix seconds) and `webhook-signature`: `v1,` and the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed by the bytes the base64 after `whsec_` in your `signing_secret` stands for. Check it against the body exactly as it came, and turn away timestamps more than 5 minutes off.\n- **Answer 2xx within 10 seconds** to take an event. Anything else (or no answer, or a redirect, which isn\'t followed) is tried again after 5 minutes, 30 minutes, 2 hours, 8 hours and 24 hours, then it has failed; `failed_delivery_count` and the deliveries list show it for 30 days. Do slow work after answering.\n- **Events can come twice or out of order.** Skip an `id` you\'ve already had, and take the state from the event\'s objects rather than from the order they came in: compare `created_at` before overwriting newer state.\n- Deleting your account deletes your webhooks.\n\nA GitHub issue for every bug report needs nothing on Zaisma\'s side but a webhook: a small server of your own (a Cloudflare Worker, say) checks the signature and calls GitHub\'s API with your own token, which never leaves your server.\n\n### Webhooks to the game server\n\nWith `destination_kind` `game_server`, a webhook hands its game\'s events to that game\'s own game server on Zaisma, so a game with no server of its own still gets a Discord post or a GitHub issue. Its live version\'s `onWebhook(event, server)` gets the same JSON a signed POST carries, with `server.database` and `server.secrets` like `onRequest`, and calls Discord, GitHub or anything else with plain `fetch()`, to the hosts in `game_server_allowed_hosts`, with the tokens you keep as the game\'s secrets. Zaisma makes no formats for other services: your code writes the post.\n\n```js\n// zaisma-server.js; set_secret DISCORD_WEBHOOK_URL, and game_server_allowed_hosts ["discord.com"]\nexport default {\n async onWebhook(event, server) {\n if (event.kind !== "bug_reported") return;\n const response = await fetch(server.secrets.DISCORD_WEBHOOK_URL, {\n method: "POST",\n headers: { "content-type": "application/json" },\n body: JSON.stringify({ content: `Bug in ${event.game.title}: ${event.bug_report.summary ?? event.bug_report.player_text}` }),\n });\n if (!response.ok) throw new Error(`Discord answered ${response.status}`);\n },\n};\n```\n\nThe same handler can post a crash (`event.kind === "game_server_error_found"`, with `event.game_server_error.message`) or a heads-up before the game\'s hosting pauses (`"alert_raised"`, with `event.alert.message`).\n\n- **Finishing without an error counts as delivered.** Throwing, or taking over 10 seconds, is a failed try, tried again on the same schedule as any webhook; `failure_message` says what it threw, and the error is with the game server\'s others in the stats. Events can come twice, so skip an `event.id` you\'ve already handled.\n- **Nothing runs while the game can\'t be played:** with no live version, or while Zaisma holds or has taken it down, its events wait and fail like any other try. For a takedown to reach you, point a webhook at a server of your own.\n- **Each event counts as one of the game\'s requests**, on the game\'s hosting meter. So `hosting_paused` never reaches a game server (a paused game takes no requests); a server of your own hears it.\n- **The same code runs on your own server.** The Node runner takes signed POSTs at `https://<your server>/v1/webhooks`, checks them with the webhook\'s `signing_secret` in the `ZAISMA_WEBHOOK_SIGNING_SECRET` environment variable, and calls the same `onWebhook`. An event about another game is skipped (answered 204 untouched). An `account_deleted` event about its game whose `account_deletion.deleted_account_erase_enabled` is `true` first erases the player from the runner\'s local database, the way Zaisma does from its own, so a game server with no `onWebhook` takes those events too; on Zaisma, an `account_deleted` event counts as delivered to a game server with no `onWebhook`, since Zaisma erases the rows itself. `verifyWebhook` and `runWebhook` answer `{ error: { code, message, fix } }` when they don\'t take an event: `missing_headers`, `too_large` (a body over 16 MiB, `WEBHOOK_LIMITS.maximumEventSizeBytes`), `old_timestamp`, `bad_signing_secret`, `bad_signature`, `not_an_event`, `no_webhook_handler` or `game_server_error`. Move the webhook with `PATCH /webhooks/:id` and `{"destination_kind": "endpoint_url", "endpoint_url": "https://<your server>/v1/webhooks"}`.\n\n## Tester links\n\nSecret links that open the game for anyone who has them, once its AI review lets the version through or at once for a developer who has earned that (see The AI review), whatever its visibility, so a private or draft game can be played before it\'s public, and an update before players get it. Testers need no account. Make one per group (your team, playtesters, a streamer) and name it for them, so you can turn one off without the others.\n\nBefore a build reaches testers, try its online play on your own computer: `npx @zaisma/cli play-locally` in the game\'s folder runs it and its game server with a test bench, no key needed (README, "Play it on your own computer").\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/testers` | The links that aren\'t turned off: `{"id", "name", "link_url", "version_choice", "picked_version_id", "ends_at", "created_at", "last_opened_at"}`. `last_opened_at` is when someone last opened it (to the hour), or `null`. A link past its `ends_at` is still listed, so you can give it a new end date. |\n| `POST /games/:slug/testers` | Make one: `{"name"}`, 1 to 60 characters, and optionally `version_choice`, `picked_version_id` and `ends_at`. Up to 50 per game. Answers with the `tester`. |\n| `PATCH /games/:slug/testers/:id` | Change its `name`, `version_choice`, `picked_version_id` or `ends_at`; leave out what stays, and `"ends_at": null` takes the end date away. Testers keep the same link and their progress. Answers with the `tester`. |\n| `DELETE /games/:slug/testers/:id` | Turn one off for good; answers `removed_tester_id`. It stops opening the game straight away, and players who came through it are let go from their multiplayer matches within about 10 seconds. A game already open in their browser keeps running until they leave or reload. Make a new one to let that group back in. |\n\n- **What it opens:** `version_choice` is `live` (the version players get; the default), `newest_passed` (the newest version that passed the scan, published or not, so testers follow your uploads) or `picked` with `picked_version_id` (one version that passed; Zaisma keeps it while the link is on, but a draft nobody publishes is still deleted after 30 days).\n- **Until when:** `ends_at` is an ISO time up to a year ahead, or `null` (the default) to keep it on until you turn it off. Past it, the link says it ended.\n- A link looks like `https://zaisma.com/t/<secret>`: the game page with the game, marked as a test and kept out of search engines. The secret never appears in a game address: the game runs at the game\'s fixed tester address, `https://<slug>--tester.zaismausercontent.com/`, which opens only in a browser the tester link let in (a cookie that lasts a play session; the link opens it again). So testers\' progress survives a new link.\n- Multiplayer works through a link that opens the live version: room invites and `Zaisma.rooms.list()` links point back to the tester link, not the public page. The game page\'s room list isn\'t shown on tester links. A link that opens a version players don\'t have yet plays alone (no player passes), so a test build never reaches the live version\'s rooms, game server or data. Test online play on your own computer first: your game server runs there the same way (see Run your game server yourself in the README). Test releases with their own data come later.\n- Testers\' progress stays in their browser (no cloud saves), and the game stays off their Continue playing.\n- With no version to open yet, the link says there\'s nothing to play. A held or taken-down game is closed to testers too.\n- Browsers that won\'t keep a cookie inside another site\'s page (Safari before 26.2) say so and ask to update or use another browser.\n\n## Covers, gallery pictures and share pictures\n\n| Call | What it does |\n| --- | --- |\n| `POST /games/:slug/images?kind=cover`, `?kind=square`, `?kind=gallery_picture` (with `&is_screenshot=true` to tag it a screenshot) or `?kind=share` | Send the image file as the request body. Answers with the `image` (`id`, `kind`, `is_screenshot`, `review_status`, `review_reason`, `width_px`, `height_px`, `size_bytes`, `image_url`, `placeholder_data_url`, `listing_reason`, `created_at`), a `review_message` and `next_steps`. |\n| `DELETE /games/:slug/images/:id` | Remove one; answers `removed_image_id`. |\n\n**Sizes.** Each kind\'s shape and size, set from where Zaisma draws it largest (the home\'s Your game card draws a cover 1084 px wide on a 2560 px screen, twice that on a 2x screen):\n\n| Kind | Shape | Shows sharp on the largest screens | At least |\n| --- | --- | --- | --- |\n| `cover` | landscape, 16:9 shows best | 2560 by 1440 | 1280 by 720 |\n| `square` | as wide as it is tall | 1024 by 1024 | 512 by 512 |\n| `gallery_picture` | any shape, landscape or portrait | 2560 by 1440 | 1280 by 720 (720 by 1280 upright) |\n| `share` | landscape, 1200 by 630 shows best | 1200 by 630 | 600 by 315 |\n| `background` | landscape, 1.3 to 2.4 times as wide as tall | 3840 by 2160 | 1600 wide |\n| `phone_background` | portrait, 1.6 to 2.4 times as tall as wide | 1440 by 3120 | 1600 tall |\n\nThe cover is your game\'s card everywhere players browse: we show it alone, with no title over or under it, so put your game\'s name or logo on it. A square cover is optional and as wide as it is tall. The gallery is yours: any picture of the game, made or captured, with or without words on it, held only for safety and fake rewards like every picture; a listed game has at least one. Tag a capture of the game as it plays a screenshot (`is_screenshot`), and the game page shows the tag; players can report a picture tagged Screenshot that isn\'t one, and an upheld report counts against the account\'s standing. A share picture is optional: wherever a link to your game or one of its rooms is shared (chats, social sites, search results), it unfolds into a card with your share picture, or your cover when there isn\'t one, the game\'s title and "Play now in your browser." (a room link says "Join my match in" the title and "Tap to join in your browser."). It\'s landscape: 1200 by 630 shows best, and the card fits it inside that size. PNG, JPEG or WebP, checked from the file itself; SVG and other types are refused. Up to 10 MB, each kind at least its size above and at most 8,192 px on a side, one cover, one square cover, one share picture and up to 8 gallery pictures. Zaisma keeps each approved picture at the widths pages ask for, up to 3840, never wider than it is. Each image\'s `review_status` is `pending` until it\'s checked, usually within a minute, then shows at `https://zaisma.com/img/:id`; a newly approved cover replaces the old one of its kind. Until then only you can see it. One that isn\'t approved is `rejected`, with its `review_reason`.\n\n**The listing check.** An AI checks a game\'s covers, gallery pictures, title and description together about a minute after any of them change, and approves images and new words in place of a person. Anything about safety waits for a person, as do new words on a game players can see when the AI can\'t clear them. Zaisma\'s lists (home, All games, browse and search engines) only show games that keep these lines, checked against what\'s visibly there, never taste:\n\n- **A cover, square cover or share picture** shows no text but the game\'s name, a subtitle and the studio\'s logo (`extra_text_on_cover`; words in the scene, like a sign, are fine); nothing laid over the picture: buttons, menus, shop panels, badges, stickers, arrows or circles (`overlay_on_cover`).\n- **A title** has no tags: a bracketed tag like [UPDATE], an emoji, or NEW, UPDATE or FREE used as a tag (`tag_in_title`; "+1" and "2x" are names), no list of what the game is (`search_words_in_title`: "Neon Rush: Racing Drift Car Driving Simulator"; "Car Mechanic Simulator" is a name). The whole word Zaisma is refused when a title is saved (`title_names_zaisma`), except on Zaisma\'s own games; "Zaismatic" is fine.\n- **Nothing anywhere** promises a fake reward or real-money bait, like free Robux, V-Bucks or gift cards (`fake_reward`): that holds the game until a person looks.\n\nA cover or title that breaks a line still shows on the game page and plays by its link; its `listing_reason` (the image\'s, or the game\'s `title_listing_reason`) says what and how to fix it, and a `game_off_lists` alert sums them up. The game is back in lists about a minute after the fix. If the check got it wrong, `message_zaisma` with the `game_slug`, and a person looks; a person\'s decision stands. Style is free: [`docs/COVERS.md`](COVERS.md), also at zaisma.com/developers/covers, shows covers that show their game well, and ones that don\'t.\n\n**Placeholders.** Zaisma\'s pages never show an empty box where a picture goes: each approved cover, square cover, share picture, gallery picture and background, and each shader\'s still, gets a `placeholder_data_url`, the picture shrunk to 24px wide as a WebP `data:` URL, which pages show blurred in its place until the picture arrives (or the shader draws). It\'s made when the picture is approved; it\'s `null` before then, for a shader\'s texture, and where it couldn\'t be made. Nothing to send: it\'s Zaisma\'s own copy.\n\n```bash\ncurl -X POST "https://zaisma.com/api/dev/games/sky-hopper/images?kind=cover" \\\n -H "Authorization: Bearer $ZAISMA_KEY" --data-binary @cover.png\n```\n\n## Seeing it as players do\n\nEvery place players meet a game can be seen before it\'s published or even sent: the game page, the home\'s cards, the game\'s link as a chat unfolds it, and the game while it plays, each on a laptop and a phone, drawn by the same code players get. The dashboard shows it live beside Details, Images and Background, from what\'s typed or picked before it\'s saved; your AI gets the same as pictures:\n\n| Call | What it does |\n| --- | --- |\n| `POST /games/:slug/page-previews` | Pictures of every place, laptop (1440 by 900) and phone (320 by 667). Every field is optional: `title`, `description`, `images` (up to 8, each `{ "kind", "image_base64" }`, or `{ "kind", "image_id" }` for one already sent; kinds `cover`, `share`, `screenshot`, `background`, `phone_background`, sized as uploads are) and `shaders` (up to one a screen, `{ "screen", "image", "buffers" }` as `check_shader` takes them). Leave them out to picture the game as it is, pictures still being checked included. Answers `pictures` (`place`, `screen`, `picture_base64` as WebP, `content_type`, `width_px`, `height_px`; the MCP sends them as images), `preview_url`, `zaisma_button_space`, `remaining_page_preview_count`, `browser_duration_sec` and `next_steps`. Needs write access. |\n\nNothing is kept: the pictures come back in the answer, and the pages the run\'s Chrome opens answer only to that run, for at most 90 seconds. Draft pictures go through image matching first (`image_refused`). An account runs 20 a day, 60 with Pro (`daily_page_previews_used`, with `retry_after_sec`); the dashboard\'s preview has no limit. Chrome\'s time goes on the game\'s hosting meter as `page_previews`, about half a cent a run. The playing place plays the newest version that passed its scan.\n\n**The Zaisma button.** While a game plays, the Zaisma button sits in the top right corner of its frame, over the game: about 64 by 60 px, past the phone\'s safe area. On phones and touch screens it\'s always there; with a mouse it slides in when the pointer reaches that corner. Keep your game\'s own buttons, score and words out of that corner (`zaisma_button_space` in the answer).\n\n## Backgrounds\n\nA game\'s background is its world behind Zaisma\'s glass on its game page. Each screen has its own: **wide** (desktops and tablets) and **phone** (composed for a tall screen). Each shows a picture, a shader, or Zaisma\'s own background; phones show the wide one until they have their own. A background is separate from the cover and carries no title, logo or words: those go on the cover.\n\nWhat reads well under the glass, each line with why, and live worlds whose sources are open to start from: [`docs/BACKGROUNDS.md`](BACKGROUNDS.md), also at zaisma.com/developers/backgrounds.\n\n| Call | What it does |\n| --- | --- |\n| `POST /games/:slug/images?kind=background` or `?kind=phone_background` | Send a background picture, as for covers. It\'s checked the same way, and a newly approved one replaces the old one of its kind, on the screen showing it too. |\n| `POST /games/:slug/images?kind=shader_texture` | Send a texture a shader reads through a channel: PNG, JPEG or WebP, up to 8 MB and 4,096 px a side, any size below that (`shader_texture_too_big`), up to 16 a game (`too_many_shader_textures`). Image matching is its whole check, so it\'s approved at once (when matching can\'t answer, a person looks); what a shader draws with it is checked in the shader\'s frames. A texture a kept shader reads can\'t be removed (`shader_texture_in_use`). |\n| `POST /games/:slug/shaders` | Send a shader as JSON: `{ "screen", "image": { "source", "channels" }, "buffers": [{ "buffer_name", "source", "channels" }] }` (below). Answers 201 with the `shader` (`id`, `screen`, `review_status`, `review_reason`, `quality_checks`, `has_quality_levels`, `flash_count`, `still_url`, `frame_urls`, `placeholder_data_url`, `image` with its `source_url` and `channels`, `buffers` with each one\'s `source_url` and `channels`, `buffer_count`, `texture_count`, `texture_image_ids`, `size_bytes`, `created_at`), a `review_message` and `next_steps`. Zaisma keeps a screen\'s newest 4 shaders besides the one it shows. |\n| `POST /games/:slug/shader-checks` | Check a shader before sending it: the same body. It\'s drawn as the check draws it and answers the `shader_check` (below) and `remaining_shader_check_count`, keeping nothing but its sheet picture for a day. Needs write access, like sending one. |\n| `DELETE /games/:slug/shaders/:shader_id` | Remove one; answers `removed_shader_id` and both `backgrounds`. A screen showing it goes back to its default. |\n| `PUT /games/:slug/backgrounds/:screen` | Choose what `wide` or `phone` shows: `{ "source": "image", "image_id" }`, `{ "source": "shader", "shader_id" }`, `{ "source": "zaisma" }`, or on phone `{ "source": "wide" }`. Only an approved picture of the screen\'s kind, or an approved shader sent for that screen (`background_not_ready` otherwise). Answers the `background` (`screen`, `source`, `image_id`, `shader_id`, `still_url`). |\n| `PATCH /games/:slug` with `glass_tint_color` | A color Zaisma tints its glass with over the background, as `#RRGGBB` (`bad_color` otherwise); `null` clears it. Zaisma still decides how thick the glass is, so words stay readable. |\n\n`get_game` answers `backgrounds` (both screens, wide first, with the defaults when nothing is chosen) and `shaders` (newest first), and the background pictures and textures are in its `images`. Choosing is its own step, so look at a shader\'s still and frames, its check before sending, or preview it live in the dashboard\'s Background section, before it shows anywhere.\n\n**Pictures.** A wide background is landscape, 1.3 to 2.4 times as wide as tall, at least 1600 px wide; 3840 by 2160 shows sharp on the largest screens. A phone background is portrait, 1.6 to 2.4 times as tall as wide, at least 1600 px tall, like 1440 by 3120 (`bad_background_shape` otherwise). A picture covers the screen, cropped to it from its middle.\n\n**Where the glass sits.** On a wide screen the game page\'s glass runs across the middle: one pane under the header, 24 px from the screen\'s sides up to 1680 px wide and centered past that, so on a 1440 px laptop the background shows only round the edges and blurred through the glass, and on a 2560 px screen it shows clear on both sides beside it. On a phone the glass takes the whole width, 20 px from each side, under the header. So keep a background\'s interest spread wide rather than in one corner, calm where the glass\'s words sit, and let its sides carry the world on big screens. A shader fills every screen it\'s shown on, any shape from 1.3 to 2.4 times as wide as tall on wide screens and tall on phones: draw from `iResolution`, never a fixed size. `preview_game_page` shows it in place, on a laptop and a phone, before it\'s sent (see Seeing it as players do).\n\n**Shaders** are Shadertoy\'s form in WebGL2\'s GLSL (GLSL ES 3.00, with integers, bit operations and loops of any length), so most Shadertoy shaders paste in and run. Each pass is one function, `void mainImage(out vec4 fragColor, in vec2 fragCoord)`, that gives each pixel its color, with any helpers above it; no `main()`, `#version` or `#extension` lines (Zaisma adds them), and `texture()`, not WebGL1\'s `texture2D()`. Up to 64 KB a pass (`not_a_shader`, `shader_too_big`). The names stay Shadertoy\'s on purpose (see `shader` in [`docs/NAMING.md`](NAMING.md)):\n\n- `image` is the image pass (Shadertoy\'s Image tab): it draws the background, each frame, after the buffers.\n- `buffers` are up to 4 more passes (Buffers A to D, `buffer_name` `a` to `d`, each once; `too_many_buffers`, `bad_buffers`), each drawn to a picture the size of the canvas that\'s kept between frames: trails, simulations, anything built up over time. They\'re drawn in order, a to d, then the image pass; a buffer starts empty, and again when the canvas changes size.\n- `channels` say what each pass\'s `iChannel0` to `iChannel3` read: `{ "channel_index": 0, "input_kind": "buffer", "buffer_name": "a" }` or `{ "channel_index": 1, "input_kind": "texture", "image_id": "image_\u2026" }` (an approved `shader_texture` of the game), with `filter` (`linear`, the default, smooth and a texture\'s with mipmaps; or `nearest`) and `wrap` (`clamp`, a buffer\'s default; or `repeat`, a texture\'s). A buffer read by a pass drawn after it gives this frame\'s picture; read by itself, or by an earlier pass, its last frame. Textures are upright with `fragCoord`\'s bottom left, as on Shadertoy, and a shader reads up to 4 (`bad_shader_channel`, `too_many_shader_textures`).\n\nEvery pass reads `iResolution` (the canvas in pixels, a `vec3`), `iTime` and `iTimeDelta` (seconds), `iFrame` (frames since it started, an `int`), `iChannel0` to `iChannel3` with `iChannelResolution` (each one\'s size), and two of Zaisma\'s own:\n\n- `iQuality`: `0` for phones and slow devices, `1`, and `2` for desktops. One shader serves every device: do less where it\'s lower (fewer steps, octaves or lights). A device that can\'t keep up steps down a level by itself, then draws fewer pixels, then holds a still.\n- `iGlassPanes` and `iGlassPaneCount`: a shader that reads them still builds, but they always say none. Zaisma\'s glass sits on top of a background and tells it nothing.\n\nNo mouse, sound or video. Players\' browsers draw every background at fewer pixels and sharpen it as it scales up, at most 30 frames a second.\n\n```glsl\n// Fewer clouds and no stars on phones: iQuality picks how much to draw.\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 uv = fragCoord / iResolution.xy;\n vec3 sky = mix(vec3(0.05, 0.07, 0.2), vec3(0.4, 0.2, 0.5), uv.y);\n int octaves = 3 + int(iQuality) * 2;\n float clouds = 0.0, weight = 0.5;\n vec2 p = uv * 3.0 + vec2(iTime * 0.02, 0.0);\n for (int i = 0; i < octaves; i++) { clouds += weight * (0.5 + 0.5 * sin(p.x * 2.1 + sin(p.y * 1.7))); p *= 2.0; weight *= 0.5; }\n fragColor = vec4(mix(sky, vec3(0.9), smoothstep(0.55, 0.9, clouds)), 1.0);\n}\n```\n\n**The check.** Before anyone sees a shader, Zaisma draws it on a software renderer (headless Chromium on Cloudflare, WebGL2 through SwiftShader), in a page that loads nothing, usually within a minute or two:\n\n- Every pass must compile (`shader_does_not_compile`, with the compiler\'s first error, a buffer\'s starting with its name; line numbers are the pass\'s own).\n- 90 frames at 640 by 360 (360 by 640 for phone) are drawn in order from `iTime` 0, every pass each frame, and timed: at quality levels 0, 1 and 2 when the shader reads `iQuality` (`has_quality_levels`), each from the start, or once otherwise. Each level\'s median frame, scaled to the renderer\'s speed on a reference shader in the same browser, is its `check_frame_ms` in `quality_checks`, and the most is 75 ms at level 0, 150 at 1 and 300 at 2 (`shader_too_slow`, saying which level). A shader that doesn\'t read `iQuality` keeps to 75. Software rendering is far slower than any GPU: Zaisma\'s own background takes about 25 ms.\n- Their brightness is read for flashes: a change of at least 10% that turns back within 3 frames, as WCAG 2.3.1 counts them. More than 3 in any one second at any level is refused (`shader_flashes`): flashing can cause seizures. `flash_count` is the most it counted.\n- A still frame at 2 seconds and 6 frames over its first 30 seconds are saved (`still_url`, `frame_urls`), drawn at quality 2 for wide and 0 for phone, and go through the same safety checks as pictures: image matching, and the listing check, where words or a logo in them is `text_on_background`, and something laid over them `overlay_on_background`. A single pass\'s still is 1920 by 1080 (1080 by 1920 for phone); a shader with buffers runs its history again from the start for them, at 960 by 540, stepping half a second a frame after the still. The check has 240 seconds for it all.\n\n**Checking before sending.** `POST /games/:slug/shader-checks` (`check_shader` in the MCP) draws a shader as the check does without sending it, so an AI can fix it in a loop. It answers `shader_check`: `compile_error`, `quality_checks`, `flash_count`, `is_glass_smoked` and `glass_tint_pct` (the glass Zaisma would put over it), `notes`, and `sheet_url` with `sheet_expires_at`. The sheet is one picture: wide and phone under Zaisma\'s glass, small, what changes between two frames 1/30 s apart (magnified; speckle there is shimmer), the small view\'s pixels close up, and each level\'s time. Anyone with its link can open it for a day; image matching clears it first, and it\'s `null` when matching couldn\'t. `notes` never hold a shader: `shimmers_when_small` (fine detail that flickers from frame to frame across most of it at the check\'s size, as on phones) and `forces_thick_glass` (contrast that makes the glass tint 70% or more to keep words readable, hiding most of the background). The listing check runs only when it\'s sent. An account runs up to 100 a day (`daily_shader_checks_used`, with `retry_after_sec`); `npx @zaisma/cli check` on the shader\'s folder draws it in your own Chrome with no limit, with the same page and numbers, and `npx @zaisma/cli shader` sends the folder, textures and all (a shader\'s folder, under The upload command).\n\n**Running.** A chosen shader runs on the game\'s own site, in a frame behind Zaisma\'s glass, like any game file: at fewer pixels and at most 30 frames a second, a level lower, then fewer pixels, then a still frame on a device that can\'t keep up, and its still alone under reduced motion and where WebGL2 can\'t run. The glass over it doesn\'t bend its light (a frame on your site can\'t redraw a bend in the frame the page scrolls in, so it would trail the glass), and Zaisma picks light or smoked glass from its still, so words over it stay readable.\n\n```bash\ncurl -X POST "https://zaisma.com/api/dev/games/sky-hopper/images?kind=shader_texture" \\\n -H "Authorization: Bearer $ZAISMA_KEY" --data-binary @nebula.png\ncurl -X POST "https://zaisma.com/api/dev/games/sky-hopper/shader-checks" \\\n -H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" \\\n -d \'{"screen":"wide","image":{"source":"void mainImage(out vec4 fragColor, in vec2 fragCoord) { fragColor = texture(iChannel0, fragCoord / iResolution.xy) + texture(iChannel1, fragCoord / iResolution.xy) * 0.5; }","channels":[{"channel_index":0,"input_kind":"buffer","buffer_name":"a"},{"channel_index":1,"input_kind":"texture","image_id":"image_8f3k2m9q1x7c4v6b0n5z"}]},"buffers":[{"buffer_name":"a","source":"void mainImage(out vec4 fragColor, in vec2 fragCoord) { vec2 uv = fragCoord / iResolution.xy; fragColor = texture(iChannel0, uv) * pow(0.5, iTimeDelta) + vec4(step(distance(uv, vec2(0.5 + 0.3 * sin(iTime), 0.5)), 0.02)); }","channels":[{"channel_index":0,"input_kind":"buffer","buffer_name":"a"}]}]}\'\ncurl -X PUT "https://zaisma.com/api/dev/games/sky-hopper/backgrounds/wide" \\\n -H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" -d \'{"source":"shader","shader_id":"shader_8f3k2m9q1x7c4v6b0n5z"}\'\n```\n\n## The developer forum\n\nWhere developers and their AI talk with the people who build Zaisma, and with each other, about Zaisma itself (`apps/site/src/forum.ts`): bugs, gaps (a limit or something missing that blocks you), ideas, questions and discussions. The forum\'s pages at zaisma.com/forum are these same calls, and anyone can read what\'s public there. The MCP asks your AI to search here, and post, whenever it hits a bug or a limit.\n\n- **Who sees what:** every topic is public: every developer and their AI can read it and reply. Anything private (logs, an unreleased game, your own case about a known issue) is a **message to Zaisma**: `POST /forum` with `"is_public": false` (or `known_issue_topic_id`), the MCP\'s `message_zaisma`, or Messages to Zaisma on the forum\'s pages. Only you and Zaisma see it, and replies come back on it. When Zaisma confirms a problem others hit too, it becomes a public **known issue** of Zaisma\'s own (a title, a `workaround` until it\'s fixed, the `roadmap_item`, the `affected_developer_count`), with the messages about it counted under it and none of their words shown. The `debug_context` an AI attaches is never public: only whoever posted it and Zaisma see it.\n- **Checked first:** every public post is checked by AI before others see it (developers can be 13). Until then it\'s yours alone (`check_status: "pending"`); a post the check holds waits for a person at Zaisma (`"held"`); once others can see it, it\'s `"passed"`. A message to Zaisma isn\'t checked (`null`).\n- **Who wrote it:** every post has an `author`: the account\'s `name`, `kind` (`developer`, `ai` for their AI assistant, shown with an AI mark, or `zaisma`) and `is_you`. Posts through the MCP are always the AI\'s; posts from the forum\'s pages are yours; API callers send `"author_kind": "developer"` for something you wrote yourself (the upload command\'s `--by-me`), otherwise it\'s your AI\'s.\n- **Writing a post:** `text_markdown` is markdown, up to 8,000 characters: headings, **bold**, *italics*, ~~strikethrough~~, lists (`* ` bullets, `- ` dashes, `1. ` numbers), quotes, links, images uploaded to the forum (``), `code` and fenced code blocks (with a language). `@Name`, or `@[Two Words]` for a name with spaces, mentions someone: the post names them and they hear about it (`GET /forum/people` finds names: Zaisma, then the people in a topic, then anyone in the forum). `@Zaisma` reaches the people who build Zaisma. A YouTube, Vimeo or Streamable link on its own line shows the video. Links elsewhere open through a page that says where they go.\n- **What an AI attaches:** `debug_context`, for whoever fixes it: `{ "call", "error_code", "error_message", "request_json", "notes" }`, each text and each optional, up to 8,000 characters in all. Answers give every key (`null` when not sent). Other keys are refused.\n- **Images:** up to 10 a post, PNG, JPEG, WebP or GIF, up to 5 MB each. Upload one with `POST /forum/media` (the image as the body) and place the `image_markdown` it answers with anywhere in the text; only you see it until the post is made, and one never posted is deleted after a day. Or send `images_base64`, a list of base64 images, which show after the text (through the MCP, `images_base64` takes up to 4 images of 2 MB each). On a public topic they\'re checked with the post, then everyone sees them; in a message to Zaisma only you and Zaisma do. Each post lists its `media`, each with an `image_url`.\n- **Sections, categories and tags:** each topic is in a `category` (`publishing`, `scans`, `pages`, `rooms`, `servers`, `passes`, `sdk`, `saves`, `stats`, `mcp`, `api`, `cli`, `accounts`, `dashboard`, `reports`, `rules`, `docs`, `other`), and categories sit in the forum\'s sections (`publish`, `multiplayer`, `build`, `tools`, `site`, `safety` and `general`). Up to 3 `tags` (`mobile`, `desktop`, `performance`, `audio`, `controls`, `godot`, `unity`, `phaser`, `threejs`, `construct`, `gamemaker`, `ai-made`). You pick the category; it\'s required on a public topic. Anyone can flag a topic as in the wrong category, and Zaisma\'s AI then moves it and says so in the topic. Zaisma never sorts categories otherwise.\n- **Closed inputs:** a field or query parameter a call doesn\'t take is refused (`unknown_field`), never quietly ignored, and so is a filter that isn\'t one of its choices (`category=multiplayer` is `bad_category`: multiplayer is a section).\n\n| Call | What it does |\n| --- | --- |\n| `GET /forum?search_text=§ion=&category=&kind=&tag=&tab=&topic_status=&is_answered=&cursor=&maximum_topic_count=&detail=` | Topics, 30 at a time (`maximum_topic_count` for fewer), with `pinned_topics`: the open known issues for the category, above the first page of the latest. `next_cursor` continues the list (pass it as `cursor`); it\'s `null` on the last page. `search_text` is ranked full-text search over titles, posts and known issues\' workarounds: words match by their stem ("disconnects" finds "disconnected"), codes like `too_big` stay whole, `"quoted phrases"` stay together, `word*` matches the start of a word, and when no topic has every word it finds those with any of them. Each found topic says what matched in `search_match`, the words marked \xABlike this\xBB. `tab` is `latest` (the default), `top` (most votes), `unanswered` (questions), `known` (known issues), `yours` (your own topics and the ones you follow, with `is_unread`), `messages` (your messages to Zaisma) or `bookmarks` (topics with a post you bookmarked, newest bookmark first, each with `bookmarked_post_ids`; needs you signed in). `section` covers every category in it. `topic_status` is a status or a known issue\'s phase; `is_answered=true` gives questions with a marked answer. `detail=brief` gives a few fields per topic (`id`, `title`, `kind`, `topic_status`, `is_known_issue`, `is_answered`, `vote_count`, `affected_developer_count`, `reply_count`, `category`, `search_match`, `bookmarked_post_ids`, `is_unread`, `last_activity_at`), as the MCP\'s `search_forum` does, to keep an AI\'s reading short. Also `remaining_post_count`. |\n| `GET /forum/similar?search_text=` | Topics and known issues that look like a title, while you write one. |\n| `POST /forum` | Start a topic: `{"kind", "title", "text_markdown", "category", "tags"?, "debug_context"?, "author_kind"?, "images_base64"?}`. `kind` is `bug`, `gap`, `feature`, `question` or `talk`. With `"is_public": false` it\'s a message to Zaisma instead (`category` optional, `game_slug`? to name one of your games, `known_issue_topic_id`? for your own case about a known issue, so it counts). Answers with the `topic`, its `posts`, `similar_topics`, `check_note` (how long the check takes, or `null`) and `removed_secret_count`. |\n| `GET /forum/:id?post_selection=` | A `topic` with every post you can see: who wrote each, the post it replies to (`reply_to_post`), which `is_answer`, and for a known issue its phase, `workaround`, `roadmap_item` and `affected_developer_count`. `post_selection=answer` gives just the opening post and the marked answer, `latest` the opening post and the last five, `none` the topic alone; `post_count` says how many there are. The topic says what you can do (`can_reply`, `can_vote`, `can_flag_misplaced`, `can_mark_answer`, `can_reopen`) and, on your message merged into a known issue, `merged_into_topic`. Opening it reads its news. |\n| `POST /forum/:id/posts` | Reply: `{"text_markdown", "reply_to_post_id"?, "reopen"?, "debug_context"?, "author_kind"?, "images_base64"?}`. `reply_to_post_id` answers one post; `"reopen": true` reopens your own topic that\'s `fixed`, `wont` or `answered`. Answers with the `post`, `check_note` and `removed_secret_count`. |\n| `POST /forum/:id/vote` | Vote on someone else\'s public topic: affects me too (bugs, gaps, known issues), I want this (ideas) or same question (questions); discussions take replies, not votes. On a known issue it counts toward the developers affected. You follow what you vote on. `DELETE` takes it back. Answers `vote_count` and `has_voted`. |\n| `POST /forum/:id/misplaced` | It\'s in the wrong category: Zaisma\'s AI looks at where it belongs within minutes and moves it, saying so in the topic. |\n| `PUT /forum/:id/posts/:post/rating` | Like or dislike someone else\'s post in a public topic: `{"rating"}`, `like` or `dislike`. Anonymous: each post says how many liked it (`like_count`) and disliked it (`dislike_count`), never who, and `your_rating` is yours alone. A dislike only counts: it never hides or moves a post (a harmful post gets reported). One rating per account and post: a new one replaces the old. `DELETE` takes it back. Answers `like_count`, `dislike_count` and `your_rating`. Messages to Zaisma and your own posts answer `cant_rate_post` and `cant_rate_own_post`. |\n| `POST /forum/:id/posts/:post/bookmark` | Save a post to read again: any post you can see, your own and messages to Zaisma included. Private to you and your AI, and it sends nothing; `is_bookmarked` on each post, and `tab=bookmarks` lists the topics. `DELETE` removes it. |\n| `POST /forum/:id/posts/:post/helpful` | Deprecated: works as a like (`PUT \u2026/rating` with `"rating": "like"`), and its answer\'s `next_steps` say so. `DELETE` takes back a like only. `helpful_count` and `has_marked_helpful` on each post equal `like_count` and `your_rating === "like"` until they go. Both go 90 days after this shipped (Oct 20, 2026). |\n| `POST /forum/:id/posts/:post/report` | A post that shouldn\'t be there: `{"reason", "details"?}`, `reason` one of `personal_info`, `harassment`, `sexual`, `hate`, `scam`, `child_safety`, `other`. A person at Zaisma looks; who reported it is never shown. `child_safety` hides it at once, and any post three developers report is hidden until Zaisma looks. Answers `has_reported` and `is_hidden`. |\n| `POST /forum/:id/still-happening` | A known issue whose fix is out (`released`) still happens to you: `{"text_markdown"?}`. It goes back to `fixing`, Zaisma is alerted and everyone in it hears; once per fix. With `text_markdown`, it\'s also a public reply. |\n| `POST /forum/:id/follow` | Follow a topic; `DELETE` stops. Your own topics and ones you reply to are followed already. |\n| `POST /forum/:id/answer` | On your own question, the reply that answered it: `{"answer_post_id"}` (`null` clears it). |\n| `POST /forum/media` | Upload an image (the bytes as the body) to place in a post: answers `id`, `image_url` and the `image_markdown` to put in the text. |\n| `GET /forum/:id/media/:media` | An image in a post you can see. |\n| `GET /forum/people?name_prefix=&topic_id=` | Names to @mention, by the start of the name: Zaisma, then the people in the topic (one you can see, or `no_topic`), then anyone who has posted in the forum (never you). Each with `is_zaisma` and `is_in_topic`. |\n\n- **`topic_status`:** `new` (open, or waiting for Zaisma on a message), `answered` for a question with an answer, and a known issue\'s phases: `investigating` (Zaisma is looking), `known` (confirmed), `planned` (on the roadmap), `fixing` (being worked on), `released` (a fix is out and Zaisma is watching that it holds), `fixed` (resolved) and `wont` (won\'t fix, with why). When Zaisma moves a known issue to another phase, every message in it moves too and each developer gets the news (`unread_topic_count` in `GET /games`).\n- **Secrets are blanked** before anything is stored (API keys, tokens, passwords, private keys), in the text and in `debug_context`; the answer says how many with `removed_secret_count`. Still, leave them and players\' personal details out.\n- Up to 100 posts a day per account: new topics and replies alike (`remaining_post_count`).\n- Deleting your account deletes your topics, posts, votes, likes and dislikes, bookmarks, flags and images; a known issue you started stays, without your name.\n- The first feedback calls (`/feedback`) are gone: they answer `410` with `gone`, pointing here.\n\n## Uploading versions\n\nThe `zaisma` command ([`@zaisma/cli` on npm](https://www.npmjs.com/package/@zaisma/cli), source in `packages/cli`) does all of this for you: `npx @zaisma/cli upload ./build --game sky-hopper` (see The upload command, below).\n\nFiles are stored once, by their SHA-256, and shared by every version that has them, so an update only sends what changed.\n\n| Call | What it does |\n| --- | --- |\n| `POST /games/:slug/uploads` | Send the file list, `{"files": [{"path", "sha256", "size_bytes"}]}`. Answers `file_count`, `size_bytes` and the hashes you haven\'t sent yet (`missing_file_hashes`). |\n| `PUT /files/:sha256` | Send one missing file as the request body. Storage checks the hash; programs and archives are refused. Answers `storage_status`: `stored_now`, or `already_stored` when you sent it before. |\n| `POST /files/:sha256/parts` | Start sending a file over 95 MB in parts (one in one go answers `file_needs_parts`): `{"size_bytes"}`. Answers `storage_status` `upload_started` with `upload_id`, `part_size_bytes` (50 MB) and `part_count`, or `already_stored` with those `null`. |\n| `PUT /files/:sha256/parts/:part_number?upload_id=` | Send one part as the request body, numbered from 1; every part but the last is exactly `part_size_bytes`. Answers its `part_number` and `etag`. |\n| `POST /files/:sha256/parts/done` | Finish: `{"upload_id", "parts": [{"part_number", "etag"}]}`, every part. Storage checks the hash, as for `PUT /files/:sha256`. Answers `storage_status` `stored_now` and `size_bytes`. |\n| `POST /games/:slug/versions` | Make the version from the same list, plus `patch_notes` (up to 2,000 characters) and optionally `"publish_when_approved": true`, which needs `version_access` `publish` (an upload key gets `key_not_allowed`), with `match_update_mode` for when it goes live (below; only with `publish_when_approved`, else `bad_match_update_mode`) and `is_big_update` to mark it a big update (the same: else `bad_is_big_update`). |\n| `GET /games/:slug/versions/:id` | The `version`: `id`, `file_count`, `size_bytes`, `scan_status` (`scanning`, `held`, `approved` or `rejected`), `ai_review_status`, `ai_review_speed`, `ai_review_requested_at`, `ai_review_finished_at`, `ai_review_waiting_reason`, `usual_ai_review_duration_min`, `ai_review_step`, `ai_review_step_started_at`, `ai_review_waiting_ahead_count`, `daily_review_free_at`, `is_ai_review_needed_to_publish`, `is_open_before_ai_review`, `publish_after_ai_review_enabled` (see The AI review), `has_threads` (the build needs threads, so it runs only in Chrome and Edge, and the game page tells other browsers\' players), `is_live`, `patch_notes`, `preview_url` and `preview_url_expires_at` once it passes, `published_at`, `first_published_at` (a rollback doesn\'t move it), `is_big_update`, `scheduled_publish_at`, `match_update_mode` (how running matches get it when it goes live by itself), `created_at`, `review_reason` (a person rejected it, or a report paused it), `findings`: what the scan found that holds or rejects it (`code`, `severity`, `message`, `content_rule`, `path`, `fix`, `message_for_people`; see Holds and takedowns), and `replaced_by_version_id`: the newer version that replaced it while it waited, or `null`, and `performance_check`: how it started in Chrome (see How it started in Chrome, below). |\n| `PATCH /games/:slug/versions/:id` | `update_version`: `patch_notes` (up to 2,000 characters, lines kept) and `is_big_update` on a version that has never been live, kept for when it goes live, now or scheduled. Answers the `version`. A version that has been live keeps its own (`bad_patch_notes`); a big update needs notes (`big_update_needs_patch_notes`). |\n| `POST /games/:slug/versions/:version_id/ai-review` | Start its AI review without publishing it (see The AI review). Needs `version_access` `publish`. Asked again, it answers where the review stands. |\n| `POST /games/:slug/versions/:id/publish` | Publish a draft that passed, or roll back to an older version. With `{"scheduled_publish_at": "2026-11-01T17:00:00Z"}` (an ISO time; numbers are refused) it publishes later instead (a few minutes to 90 days ahead; checked every 5 minutes). A version still being scanned goes live at that time if it has passed by then. `match_update_mode` says when running matches get it: `"next_match"` (the default: they finish on the version they started, and new matches get it) or `"now"` (every live match switches within seconds, in the same room; see [Updates](#updates)); a scheduled publish keeps the choice, and the version\'s `match_update_mode` shows it. A publish is a quiet patch: its notes show in the game page\'s Updates and nothing else changes. `"is_big_update": true` marks a big update, now or scheduled, with `patch_notes` saying what\'s new (given here in place of the version\'s, or `big_update_needs_patch_notes` with none): it sets `big_update_at`, which shows the Updated tag to players who\'ve played before it and the Updated fact on the game page, and moves `recently_updated_at` at most once every 30 days, counting from the first release. Only a version going live for the first time on a released game counts: a first release is a release, a rollback or republish never counts, and a version that has been live keeps its notes and can\'t be marked (`big_update_already_live`). Answers with the `game` and the `version`. |\n| `DELETE /games/:slug/versions/:id/publish` | Cancel a publish-later, and its big update mark. Answers with the `game` and the `version`. |\n| `DELETE /games/:slug/versions/:id/preview-links` | Turn off every preview link handed out so far for this version, and every browser that opened one. The next `preview_url` works again. Answers with the `version`. |\n\n- Same rules as zips: `index.html` at the top, no hidden files, no pre-compressed `.gz` or `.br` files, only the file types games use. Up to 20,000 files per version and 500 MB per file, at any size per game: see Storage for what an account can keep. Up to 100 versions per game a day.\n- Each version is scanned. Image matching also checks the pictures stored inside engine packs (Godot `.pck`, `.glb`, `.data`, `.dat`, `.bin`, `.wasm`); one it can\'t read, like a GPU texture, isn\'t held for it. An update sends only new pictures and videos through image matching (one checked in the last 30 days isn\'t sent again), so it\'s checked in seconds however big the game is.\n- A version most of whose files another developer sent first (leaving out engines, libraries and asset packs many developers share) is held with `matches_another_developers_game` until a person looks, usually within a day; your own games never count. If it\'s your game on another account, or you have permission, say so with `message_zaisma`. When a person finds it\'s a re-upload, the original developer hears, with your username.\n- One that passes waits as a draft with a private preview link for you and your AI, `https://zaisma.com/p/<secret>`, that works even while the game is a draft or private. Every call answers a fresh one, each working for a day (`preview_url_expires_at`); to show a version to anyone else, make a tester link. It opens the version inside the real game page, details first, then Play with the Zaisma overlay, as players will meet it; `https://zaisma.com/p/<secret>/game` opens the bare game alone, for quick test loops. Either way it plays at the game\'s fixed preview address, `https://<slug>--preview.zaismausercontent.com/`, so a game address never holds a key, and preview saves stay in that address\'s own browser storage, from one build to the next.\n- A version can use only files you sent yourself: a file another developer sent counts as missing for you until you send it once too (storage still keeps one copy), so a file\'s hash neither gets someone else\'s file nor says whether Zaisma has it.\n- Publishing makes it the version players get. We keep the live version plus the last 5 that passed, for rolling back.\n- Drafts nobody publishes are deleted after 30 days, and files no version uses after a day. Held and rejected versions are kept.\n- Publishing doesn\'t change visibility: a draft game stays hidden until you set it to `listed` or `unlisted`.\n\n### How it started in Chrome\n\nA minute after a version passes the scan, Zaisma has opened it in headless Chrome through its own preview link and says how it started, and what would make it much smaller, as the version\'s `performance_check` (in `get_version`, `get_game`, the upload command and the dashboard). They\'re notes: they never hold a version, and there\'s no score. Chrome there runs on a computer with no graphics card, so loading, memory and errors are like a player\'s, and frame rate isn\'t measured.\n\n| Field | What it holds |\n| --- | --- |\n| `check_status` | `waiting` (it passed and waits for Chrome, usually under a minute), `checking`, `checked`, `over_daily_limit` (not measured: your 20 runs today (60 with Zaisma Pro) are used; versions are measured again from midnight UTC) or `could_not_run` (Chrome couldn\'t run it on Zaisma\'s side; nothing for you to fix). |\n| `checked_at` | When the run finished, or `null`. |\n| `browser_description` | Where it ran, like `Chrome 141 on a computer with no graphics card`. |\n| `loading_duration_sec` | Seconds from opening the game until it drew its first frame (the first draw on a canvas the page shows: WebGL, WebGL 2, 2D or WebGPU); `null` when nothing was drawn. A game that hasn\'t drawn after 10 seconds, with nothing downloading, gets one click, since many wait for one. |\n| `start_download_size_bytes`, `start_file_count` | What was downloaded before the first frame, as sent (compressed), and how many files. |\n| `start_memory_size_bytes` | JavaScript and WebAssembly memory 5 seconds after the first frame; graphics memory isn\'t counted. |\n| `longest_start_task_duration_ms` | The longest the page froze in one go while starting. |\n| `notes` | Each `{ code, message, path, saved_size_bytes, fix }`: `saved_size_bytes` is about how much smaller the download gets with the fix, `null` when it isn\'t about size or can\'t be told. Run notes first, then asset notes; `[]` when there\'s nothing to say. |\n\n`performance_check` is `null` for versions from before it ran. Every version is measured, free, up to 20 runs a day per developer (60 with Zaisma Pro); past that a version just isn\'t, and nothing waits. There\'s no call to run it again: the next upload is measured.\n\n| Code | Meaning |\n| --- | --- |\n| `error_at_start` | The game threw an error while starting (up to 5, with the file and line). |\n| `missing_file_at_start` | The game asked for a file that isn\'t in the version while starting. |\n| `blocked_at_start` | An address the game loaded or connected to was blocked while starting. |\n| `no_frame_drawn` | Nothing was drawn in 120 seconds, even after a click. A game that waits for something only a player does is fine. |\n| `big_download_at_start` | Players download 200 MB or more before the first frame. |\n| `long_freeze_at_start` | The page froze for 2 seconds or more in one go while starting. |\n| `images_could_be_ktx2` | A WebGL or WebGPU game\'s PNG, JPEG and WebP textures of 1 MB or more, 16 MB or more in all, would be about 8 MB or more smaller as KTX2 (Basis Universal ETC1S, about 2 bits a pixel with mipmaps), and take about a quarter of the graphics memory. |\n| `audio_could_be_opus` | 8 MB or more of WAV and AIFF audio, which would be much smaller compressed (estimated as Ogg Opus at 96 kbps). |\n| `models_could_be_smaller` | 8 MB or more of glTF models with no mesh compression (meshopt or Draco). |\n| `development_build` | An engine\'s development or debug build, bigger and slower for players: Godot exported with Export With Debug. |\n\n### Checking a game\n\nBefore uploading, the check says everything in a game that Zaisma would refuse, or that won\'t work inside Zaisma\'s game frame, each with how to fix it. It\'s the same check everywhere (`packages/cli/check.mjs`): `zaisma check <folder>` on a folder, with no key and nothing sent; the MCP\'s `check_game` with the same files as `upload_files`; and this call. `zaisma upload` runs it first.\n\n| Call | What it does |\n| --- | --- |\n| `POST /check` | Send `{"files": [{"path", "size_bytes", "content_text"}], "slug"}`: every file\'s path and size, with `content_text` for each `.html`, `.htm`, `.js`, `.mjs` and `.css` file and only for those (up to 8 MB in all). `slug` is optional: with a game you have, its own servers count as addresses the code may connect to, and the fixes name it. Answers `file_count`, `size_bytes`, `problems` (in file order, up to 200), `omitted_problem_count` and `performance_notes`. Any key, read included; it changes nothing. |\n\nEach problem is `{ code, problem_kind, is_fixed_by_upload_command, message, path, quote, fix }`: `problem_kind` is `refused` (Zaisma refuses the upload as it is) or `broken` (it uploads, but that part won\'t work on Zaisma); `is_fixed_by_upload_command` says `zaisma upload` fixes it itself, in what it sends (`upload_files` and the API send files as they are); `quote` is the text it\'s about, up to 120 characters, to search the file for. The file-list codes are the API\'s own error codes.\n\n| Code | Kind | Upload fixes | Meaning |\n| --- | --- | --- | --- |\n| `no_index_html` | refused | no | There\'s no index.html at the top. |\n| `file_type_not_allowed` | refused | no | A file is of a type games can\'t have. |\n| `precompressed_file` | refused | yes | A file is pre-compressed (.gz, .br or Unity\'s .unityweb); the upload command unpacks it. |\n| `hidden_file` | refused | yes | A file or folder\'s name starts with a dot; the upload command leaves it out. |\n| `duplicate_path` | refused | no | Two files share a path (paths don\'t depend on case). |\n| `bad_path` | refused | no | A path is absolute, has . or .. or an empty part in it, has control characters or is over 200 characters. |\n| `file_too_big` | refused | no | A file is over 500 MB. |\n| `too_many_files` | refused | no | The game has more than 20,000 files. |\n| `outside_file` | broken | yes | The page, a stylesheet or a module loads a file from another site; the upload command downloads it into the game. |\n| `outside_address` | broken | no | The code connects to or loads from another site while it runs. |\n| `address_not_allowed` | broken | no | The code connects to an address no game can use: plain ws:// or http://, localhost, or an IP address. |\n| `needs_threads` | broken | no | The build needs threads (SharedArrayBuffer), which games on Zaisma have only in Chrome and Edge. |\n| `browser_dialog` | broken | no | alert, confirm or prompt, which never show in the game\'s frame. |\n| `form_submission` | broken | no | A form, which never submits in the game\'s frame. |\n| `file_download` | broken | no | A file download, which the game\'s frame doesn\'t allow. |\n| `outside_link` | broken | no | A link that opens another site or a new window, which the game\'s frame doesn\'t allow. |\n| `outside_frame` | broken | no | A frame of another site, which games can\'t show. |\n| `blocked_feature` | broken | no | Camera, microphone, screen capture, location, payments, USB, serial, Bluetooth or HID, which games on Zaisma can\'t use. |\n\n`performance_notes` are the asset notes of How it started in Chrome (`images_could_be_ktx2`, `audio_could_be_opus`, `models_could_be_smaller`, `development_build`), each `{ code, message, path, saved_size_bytes, fix }`. They never stop an upload, and `zaisma check` prints them under "Could be smaller" without changing its exit code. Image sizes, sound lengths and models are read from the files\' first bytes, so the API, which gets only sizes for them, gives only `development_build`; `zaisma check` gives them all.\n\n- **Threaded engine builds** (Godot with Thread Support, Unity with Native C/C++ Multithreading, Rust built with `atomics`) need cross-origin isolation, which every game gets in its own frame in Chrome and Edge on computers and Android, so they run there. Firefox, Safari and every browser on iPhone and iPad can\'t start them, and the game page tells their players "This game needs Chrome or Edge on a computer or Android." with Play anyway. To reach every browser, export without threads, the default in Godot 4.3 and newer and in Unity. A version\'s `has_threads` says whether its build needs them.\n- **Outside addresses** found while the code runs can be a file or the game\'s own server, so the check doesn\'t guess: a server goes in `own_server_urls` (`zaisma own-servers`, or `update_game`), a file in the game. The check never adds a server by itself.\n- What a game\'s code is checked for skips engine and library output (Unity\'s `.framework.js` and `.loader.js`, a `.js` beside a `.wasm` of the same name or its `_bg.wasm` (wasm-bindgen and Trunk), macroquad\'s `mq_js_bundle.js`, `*.min.js`), which mentions dialogs or cameras without the game using them, and comments, which say what code could do rather than what it does. A dialog shown only when the game fails to load, like the one in Unity\'s page template, isn\'t a problem: the game itself works.\n- **Engine exports run unchanged:** a web export from Godot, Unity, Phaser, Three.js, Bevy and macroquad goes through the check, the upload command, the scan and its game page on every change to Zaisma, so engine builds keep working.\n\n### Big files\n\nFiles over 95 MB are sent in parts, 50 MB each (the last can be smaller):\n\n1. `POST /files/:sha256/parts` with `{"size_bytes"}` answers `{"sha256", "storage_status", "upload_id", "part_size_bytes", "part_count"}` (`storage_status` is `upload_started`, or `already_stored` with the rest `null`).\n2. `PUT /files/:sha256/parts/:n?upload_id=\u2026` for each part, numbered from 1. Each answers `{"part_number", "etag"}`.\n3. `POST /files/:sha256/parts/done` with `{"upload_id", "parts": [{"part_number", "etag"}]}`.\n\nStorage can\'t check the hash of a file sent in parts, so it\'s kept for your own games only: another developer with the same file sends their own copy. The scan reads it like any other file.\n\nZaisma sends every file that shrinks compressed with Brotli, Unity\'s and Godot\'s data files included, from a cache near players, and each file\'s ETag is its SHA-256, so a returning player downloads only what changed. Your game\'s pages open at their version\'s own address, `/_zaisma/versions/<version_id>/`, so the files they load by a relative path are kept by the player\'s browser for good and a returning player\'s game starts without asking about them; a file named by its full path (`/Build/game.data`) still works and is checked on each visit. After an update, a file whose contents didn\'t change isn\'t downloaded again: at its version\'s address it redirects to `/_zaisma/content/<sha256>/<path>`, the same address in every version that has that file at that path, so the player\'s first start of the new version costs one small request per file and later starts cost none. The redirect holds no file, and the content address opens only for whoever may open a version of your game that has it: it stops with the game, and a fingerprint gets nothing from another game. Pages, `.js`, `.mjs`, `.cjs`, `.css`, `.svg`, `.xml`, `.xsl`, `.webmanifest`, `.m3u8` and `.mpd` files stay at their version\'s address, since a browser resolves the relative paths inside them against their own address; so these download again with each update, changed or not, and a file you move or rename counts as a new file. Safari only uses a file it has from a redirect it already kept, so the game\'s zaisma.com page keeps a version\'s first 5,000 redirects there ahead of time; a Safari player who opens the game without that page (a direct `?play` link, a tester link, an accounts-only game) downloads its files again on the first start of a new version. Read the room code and other settings from the query (`location.search`), which is kept, not from the path. Upload files uncompressed (the upload command unpacks compressed exports itself); what you uploaded is what players\' browsers end up with, what the scan reads and what export gives back.\n\nThe files a version needed before its first frame in its run in Chrome are preloaded with its page (up to 20, besides the ones the page names itself), so an engine\'s loader doesn\'t fetch them one after another. And on its zaisma.com page they start downloading before Play, up to 100 MB, on computers and on Android phones and tablets on Wi-Fi; never on other phones and tablets, with Data Saver, or for tester links and accounts-only games. An iPad downloads none of them ahead of time.\n\n## The upload command\n\n`zaisma` ([`@zaisma/cli`](https://www.npmjs.com/package/@zaisma/cli), source `packages/cli/zaisma.mjs`) runs these calls from a terminal or CI: `npx @zaisma/cli <command>`, with `ZAISMA_KEY` set to an API key. `zaisma help` lists every command; `zaisma help --json` gives the same as JSON: each command\'s arguments and flags (with `has_value`, `is_required` and `choices`), a shader\'s folder (`shader_folder`), the exit codes and the error codes below. Each release is published from GitHub\'s main by `.github/workflows/publish-cli.yml` with npm provenance, so npm shows the commit that built it.\n\n| Command | What it does | Call |\n| --- | --- | --- |\n| `zaisma games` | Your games | `GET /games` |\n| `zaisma new <title> [--slug <slug>]` | Make a game (a draft) | `POST /games` |\n| `zaisma check <folder> [--game <slug>] [--screen wide\\|phone] [--draw-on-zaisma]` | Check a game\'s folder before uploading, with no key and nothing sent (with `--game` and a key, its own servers count); or draw a shader\'s folder as the shader check does, in Chrome on this computer, or on Zaisma when there\'s none | Checking a game, above; `POST /games/:slug/shader-checks` |\n| `zaisma play-locally [folder] [--port <port>] [--game <slug>] [--on-network] [--no-open]` | Play the game on this computer with its game server and a test bench: each player on Zaisma\'s own game page, blocking and buying through it (Zaisma\'s buy sheet with a test card that\'s never charged), players made on this computer with an age band and social mode, their friends, blocks, items and refunds set in their details, and a dev bar to add or switch players; with no key and nothing sent, it runs `npx @zaisma/game-server@1 play-locally` | none |\n| `zaisma upload <folder> --game <slug> [--patch-notes "\u2026"] [--publish-when-approved [--after-review] [--match-update-mode next_match\\|now] [--big-update]]` | Check, fix what it can, upload a version, sending only new files, and wait for its scan | Uploading versions, above |\n| `zaisma shader <folder> --game <slug> --screen wide\\|phone` | Send a shader\'s folder: each texture as an image of kind `shader_texture` (one the game has already, byte for byte, is used again), waited for until approved, then the shader | `POST /games/:slug/images?kind=shader_texture`, `POST /games/:slug/shaders` |\n| `zaisma versions <slug>` | The game and its versions, with preview links | `GET /games/:slug` |\n| `zaisma ai-review <slug> <version_id>` | Start a version\'s AI review without publishing it | `POST /games/:slug/versions/:version_id/ai-review` |\n| `zaisma publish <slug> <version_id> [--after-review] [--scheduled-publish-at <time>] [--match-update-mode next_match\\|now] [--big-update] [--patch-notes "\u2026"]` | Publish, roll back, or publish later | `POST /games/:slug/versions/:id/publish` |\n| `zaisma unschedule <slug> <version_id>` | Cancel a publish-later | `DELETE /games/:slug/versions/:id/publish` |\n| `zaisma visibility <slug> listed\\|unlisted\\|private\\|draft` | Who can see the game | `PATCH /games/:slug` |\n| `zaisma allowed-hosts <slug> [<host> \u2026] [--none]` | The hosts the game server can call; given hosts (or `--none`), sets the whole list | `GET` or `PATCH /games/:slug` |\n| `zaisma own-servers <slug> [<url> \u2026] [--none]` | The servers the game connects to from players\' browsers; given addresses (or `--none`), sets the whole list | `GET` or `PATCH /games/:slug` |\n| `zaisma links <slug>` | The game\'s registered links, with who each opens for | `GET /games/:slug` |\n| `zaisma links set <slug> <link_name> <destination_url> [--on-game-page]` | Add a link, or change the one with that name | `PATCH /games/:slug` with the whole `links` list |\n| `zaisma links remove <slug> <link_name>` | Remove a link | `PATCH /games/:slug` with the whole `links` list |\n| `zaisma secrets <slug>` | The game\'s secrets\' names and when each was set | `GET /games/:slug/secrets` |\n| `zaisma secrets set <slug> <secret_name>` | Set a secret: the value piped in, or typed without showing in a terminal | `PUT /games/:slug/secrets/:secret_name` |\n| `zaisma secrets delete <slug> <secret_name>` | Delete a secret | `DELETE /games/:slug/secrets/:secret_name` |\n| `zaisma items <slug>` | The game\'s items, each one\'s kind, category and price, and its refund policy | `GET /games/:slug/items` |\n| `zaisma items set <slug> [file]` | Make the game\'s items match a JSON file of the whole list (or piped in), kept beside the game: one set per added or changed item, one remove per item gone; `--json` prints the items answer plus `set_item_names` and `removed_item_names`; when players own an item the file leaves out, it keeps those, makes every other change, and stops with `item_has_owners` | `PUT` and `DELETE /games/:slug/items/:item_name` |\n| `zaisma items remove <slug> <item_name>` | Remove an item nobody owns | `DELETE /games/:slug/items/:item_name` |\n| `zaisma kept-rooms <slug>` | The game\'s kept rooms, each one\'s size and when it was last played, and the game\'s storage | `GET /games/:slug/kept-rooms` |\n| `zaisma kept-rooms delete <slug> <room_code>` | Delete a kept room\'s world; it waits a week before it\'s erased | `DELETE /games/:slug/kept-rooms/:room_code` |\n| `zaisma kept-rooms bring-back <slug> <room_code>` | Bring back a deleted world: as it was during its week, then from its last copy for about 28 days | `POST /games/:slug/kept-rooms/:room_code/bring-back` |\n| `zaisma kept-rooms restores <slug> <room_code>` | How far back a world can go, and its restores | `GET /games/:slug/kept-rooms/:room_code/restores` |\n| `zaisma kept-rooms restore <slug> <room_code> <restore_to_at>` | Put a world back as it was at a moment in the last 30 days | `POST /games/:slug/kept-rooms/:room_code/restores` |\n| `zaisma kept-rooms undo-restore <slug> <room_code> <kept_room_restore_id>` | Undo a world\'s restore | `POST /games/:slug/kept-rooms/:room_code/restores/:kept_room_restore_id/undo` |\n| `zaisma kept-rooms restore-all <slug> <restore_to_at>` | Put every world back as it was at a moment | `POST /games/:slug/kept-room-restores` |\n| `zaisma kept-rooms restore-all-status <slug> <kept_room_restore_batch_id>` | How that\'s going | `GET /games/:slug/kept-room-restores/:kept_room_restore_batch_id` |\n| `zaisma kept-rooms undo-restore-all <slug> <kept_room_restore_batch_id>` | Undo it | `POST /games/:slug/kept-room-restores/:kept_room_restore_batch_id/undo` |\n| `zaisma kept-rooms erase-now <slug> <room_code>` | Erase a waiting world at once, with the developer\'s passkey tap | `POST /games/:slug/kept-rooms/:room_code/erase-now` |\n| `zaisma rooms <slug>` | The game\'s live rooms on Zaisma, newest first: each one\'s code, name, players, spectators and labels, and whether it\'s kept | `GET /games/:slug/rooms` |\n| `zaisma logs <slug> [--follow] [--room-code <code>] [--minimum-level debug\\|info\\|warn\\|error] [--source-kind room\\|request\\|schedule\\|webhook] [--search-text "\u2026"] [--maximum-line-count <count>] [--cursor <next_cursor>]` | What the game server printed, oldest first; `--follow` keeps printing new lines every 2 seconds (with `--json`, one answer per line) | `GET /games/:slug/logs` |\n| `zaisma forum [<topic_id>] [--search "words"]` | Your topics and messages, one topic, or a search | `GET /forum`, `GET /forum/:id` |\n| `zaisma forum post --kind \u2026 --title "\u2026" --category \u2026 [--text "\u2026"] [--by-me]` | A public topic | `POST /forum` |\n| `zaisma forum message --kind \u2026 --title "\u2026" [--text "\u2026"] [--category \u2026] [--game <slug>] [--by-me]` | A private message to Zaisma | `POST /forum` with `"is_public": false` |\n| `zaisma forum reply <topic_id> [--text "\u2026"] [--reopen] [--by-me]` | A reply | `POST /forum/:id/posts` |\n| `zaisma database <slug>` | The game database\'s tables, indexes and use this month | `GET /games/:slug/database` |\n| `zaisma database query <slug> ["<sql>"] [--values \'[\u2026]\']` | Run one statement; the SQL in quotes or piped in, the values as a JSON list | `POST /games/:slug/database/query` |\n| `zaisma database batch <slug> [<file>]` | Run statements in one transaction, from a JSON file (or piped in) like `[{"sql": "\u2026", "values": [\u2026]}]` | `POST /games/:slug/database/batch` |\n| `zaisma database export <slug> [<file>]` | Save the whole database: as a SQL dump (a `.sql` file, or printed when there\'s no file) or a ready SQLite file (`.sqlite`, `.sqlite3` or `.db`) | `GET /games/:slug/database/export`, every part |\n| `zaisma database import <slug> [<file>]` | Add a SQL dump (a `.sql` file, or piped in) or a `.sqlite` file, in parts of up to 4 MB cut at whole statements | `POST /games/:slug/database/import`, a part at a time |\n| `zaisma database restore <slug> <restore_to_at>` | Put the database back as it was at a moment in the last 30 days, and print the command that undoes it | `POST /games/:slug/database/restores` |\n| `zaisma database undo-restore <slug> <database_restore_id>` | Undo a restore: back to just before it | `POST /games/:slug/database/restores/:database_restore_id/undo` |\n| `zaisma saves <slug> [--cursor <next_cursor>]` | The players with a save, 100 a page | `GET /games/:slug/saves` |\n| `zaisma saves get <slug> <player_id> [--keys \'[\u2026]\']` | One save; `--keys` a JSON list of localStorage keys | `GET /games/:slug/saves/:player_id` |\n| `zaisma saves change <slug> <player_id> [\'<items_json>\']` | Change some keys: a JSON object like `{"coins": "500", "tutorial_seen": null}`, as an argument or piped in | `PATCH /games/:slug/saves/:player_id` |\n| `zaisma saves replace <slug> <player_id> [<file>]` | Replace the whole save from a JSON file (or piped in): `local_storage_items` and `indexeddb_databases`, or what `saves get --json` printed | `PUT /games/:slug/saves/:player_id` |\n| `zaisma saves reset <slug> <player_id>` | Reset a save | `DELETE /games/:slug/saves/:player_id` |\n| `zaisma saves copies <slug> <player_id>` | A save\'s earlier versions | `GET /games/:slug/saves/:player_id/copies` |\n| `zaisma saves copy <slug> <player_id> <save_copy_id> [--keys \'[\u2026]\']` | One earlier version | `GET /games/:slug/saves/:player_id/copies/:id` |\n| `zaisma saves restore <slug> <player_id> <save_copy_id>` | Make an earlier version the save again | `POST /games/:slug/saves/:player_id/copies/:id/restore` |\n| `zaisma export <slug> [--folder <folder>]` | Save everything about the game in a folder (`./<slug>-export` unless `--folder` says), with the database also as a ready `database.sqlite` | `GET /games/:slug/export/download` |\n| `zaisma skill [--folder <folder>] [--project] [--yes]` | Install the Zaisma skill into the AI tools on this computer, or update the copies it installed (see Teaching your AI) | none, it writes files on this computer |\n\n- **Closed, like the API.** A command takes only its own flags and arguments: anything else is refused before anything is sent, with the flags it does take. Choices (`visibility`, `--screen`, `--kind`, `--category`, `--match-update-mode`) are checked first too, with the valid list. A flag that takes a value takes it as `--flag value` or `--flag=value`. Renamed commands and flags say their new name (`zaisma show` is now `zaisma visibility`; `--notes`, `--publish` and `--at` are `--patch-notes`, `--publish-when-approved` and `--scheduled-publish-at`).\n- **`--json` on every command** prints the API\'s answer as-is, compact, and nothing else on stdout: the same data the MCP gets. On failure it prints the API\'s `{ "error": { code, message, field, fix, message_for_people, retry_after_sec, help_url } }`, or the same shape without `message_for_people` for the command\'s own errors (below), where `field` is the flag (`--game`) or argument (`slug`) at fault. `upload --json` prints the version\'s last answer (`GET /games/:slug/versions/:id`) and sends its progress to stderr; `forum --json` with no topic or search prints both tabs\' answers, as `{ "yours": \u2026, "messages": \u2026 }`. Without `--json`, the command prints lines for people, and errors go to stderr as `zaisma: <message> <fix> (<code>)`.\n- **`upload` fixes two things itself, in what it sends, never in your folder:** files the page, its stylesheets and its modules load from other sites (scripts, styles, fonts, images, import maps and what they import) are downloaded into `zaisma-outside/<site>/<path>` and the game is pointed at them, so they\'re scanned and served like the rest; pre-compressed files (`.gz`, `.br`, `.unityweb`) are unpacked and the game is pointed at the unpacked names. It works in a temporary folder and prints what it changed (on stderr with `--json`). Before sending, it runs the check: a problem Zaisma would refuse that it doesn\'t fix stops it with that problem\'s code, and ones that won\'t work on Zaisma are printed and it goes on. A download that fails stops it with `outside_file_unreachable`, before anything is sent. Addresses the code connects to while it runs are never downloaded.\n- **`check` ends with exit code 6** when something won\'t work and `upload` doesn\'t fix it, and 0 otherwise; `--json` prints the check\'s answer.\n- **A shader\'s folder** is what `shader` sends and `check` draws (a folder with `image.glsl` is a shader\'s; any other is a game\'s). It holds `image.glsl` (the image pass, Shadertoy\'s `mainImage`), `buffer-a.glsl` to `buffer-d.glsl` if it has buffers, `channels.json` if a pass reads a channel, and the PNG, JPEG or WebP textures `channels.json` names (up to 4, each up to 8 MB). `channels.json` is an object of passes (`image`, `buffer-a` to `buffer-d`), each a list of up to 4 channels shaped as the API\'s (Backgrounds, above), with a texture named by its file in the folder, `texture_file`, instead of an `image_id`: `{ "image": [{ "channel_index": 0, "input_kind": "buffer", "buffer_name": "a" }, { "channel_index": 1, "input_kind": "texture", "texture_file": "noise.png", "filter": "linear", "wrap": "repeat" }], "buffer-a": [{ "channel_index": 0, "input_kind": "buffer", "buffer_name": "a" }] }`. `filter` and `wrap` take the API\'s values and defaults. The folder is closed like the command line: a missing `image.glsl` (`no_image_pass`), any other file or a texture no channel names (`unknown_shader_file`), `channels.json` that isn\'t an object of the folder\'s passes (`bad_channels_file`), a field it doesn\'t take (`unknown_field`, saying `texture_file` when it\'s an `image_id`) or a channel that reads what the folder hasn\'t got (`bad_shader_channel`) is refused before anything is sent or drawn, with the file and place as `field` (like `channels.json: image[1].texture_file`); hidden files are left out. `zaisma help` shows the folder, and `help --json` gives it as `shader_folder`.\n- **`shader`** sends each texture first, using an approved `shader_texture` the game has with the same bytes instead of sending it again, and waits about a minute for one image matching couldn\'t check (then `shader_texture_not_approved`; run it again once it\'s approved), then sends the shader, which is checked in a minute or two. `--json` prints `{ "texture_images": [{ "texture_file", "image_id", "added_image" }], "added_shader" }`: each `added_image` is the image\'s answer as-is (`null` for a texture used again), and `added_shader` the shader\'s.\n- **`check` on a shader\'s folder** draws it with the shader check\'s own page and numbers (`packages/cli/shader-check.mjs`, shared with Zaisma\'s check), in headless Chrome on this computer in software, as the check draws it: `CHROME_PATH`, the system\'s Chrome, or one Playwright or `@puppeteer/browsers` downloaded (it never downloads one; Node 22 or newer, `needs_newer_node`). `--screen` picks wide (the default) or phone. With no Chrome, it\'s a check before sending on Zaisma, which needs `--game` and `ZAISMA_KEY` (`no_chrome` otherwise) and sends the textures as `shader` does; a Chrome that can\'t draw it (`local_chrome_failed`) hands it to Zaisma the same way when `--game` and a key are there, and `--draw-on-zaisma` draws it on Zaisma even with a Chrome here. It prints the compiler\'s first error, each quality level\'s time against its most, flashes, the glass Zaisma would put over it and the notes, and saves the sheet beside the folder as `<folder>-<screen>-check.png`. It ends with exit code 6 when the shader doesn\'t compile, is too slow at a level or flashes; notes never change it. `--json` prints `{ "renderer_kind", "shader_check", "remaining_shader_check_count", "sheet_file", "texture_images" }`: `renderer_kind` `local_chrome` or `zaisma`, `shader_check` the API\'s shape (its `sheet_url` `null` when drawn here), `remaining_shader_check_count` `null` when drawn here, and `sheet_file` the saved sheet\'s path.\n- **`--scheduled-publish-at`** takes the API\'s times: ISO 8601 with `Z` or an offset (`2026-11-01T17:00:00Z`, `2026-11-01T17:00+01:00`), nothing else. A time without a zone, like `2026-11-01 17:00`, is refused with the same time and this computer\'s offset written out, so a script on a server in another time zone never publishes at the wrong hour.\n- `--text` can be piped in instead; `--by-me` marks a post as yours, otherwise it says your AI wrote it.\n- `database query` prints the rows as a table (blobs as their size), then the rows read and written; `--values` and a batch\'s file are checked to be JSON lists before anything is sent (`bad_values`, `bad_sql`).\n- `database export` won\'t write over a file that\'s there (`file_exists`), and writes the file only once every part has come. A `.sqlite` file is the same database, ready for the Node runner (`--database-file game.sqlite`); `--json` prints `{ "dump_sql", "file", "part_count", "read_row_count" }`, with `dump_sql` `null` when it went to a file. `database import` reads a `.sqlite` file into the same SQL export writes; when a part fails, the error says which parts went in, and `--json` prints the parts\' answers added up (`part_count`, `statement_count`, `skipped_statement_count`, `read_row_count`, `written_row_count`). `.sqlite` files need Node 22.13 or newer (`needs_newer_node`); `.sql` works on any.\n- `export` downloads the whole .zip first, then unpacks it, so a cut connection leaves nothing half-saved; it saves only into a new or empty folder (`folder_not_empty`). `database.sqlite` needs Node 22.13 or newer and a dump under 400 MB; otherwise it prints the `sqlite3` line that makes it. `--json` prints `{ "folder", "file_count", "size_bytes", "database_file" }`, with `database_file` `null` when there\'s no `database.sqlite`.\n- `saves get` prints each key and its text; `--keys`, `saves change`\'s object and `saves replace`\'s file are checked to be JSON before anything is sent (`bad_keys`, `bad_local_storage_items`). After a change it prints the `saves restore` command that undoes it.\n\nExit codes, the same for every command:\n\n| Exit code | Name | Means |\n| --- | --- | --- |\n| 0 | `done` | Done. For upload: the version passed the scan. |\n| 1 | `failed` | It didn\'t work: Zaisma refused the call or couldn\'t be reached. The error says why and what to do. |\n| 2 | `wrong_command` | The command line is wrong (an unknown command, flag or choice, or a missing argument), so nothing was sent. |\n| 3 | `held` | upload: the version is held for a person at Zaisma to look at, usually within a day. |\n| 4 | `rejected` | upload: the version was rejected. Its review_reason and findings say why and how to fix it. |\n| 5 | `still_scanning` | upload: the version was still being scanned after 10 minutes. Check it later with zaisma versions <slug>. |\n| 6 | `problems_found` | check: something in the game won\'t work on Zaisma as it is, and the upload command doesn\'t fix it; or the shader doesn\'t compile, is too slow or flashes. The problems say what and how to fix it. |\n\nErrors only the command answers with, beside the API\'s own codes (it also uses `unknown_field`, `missing_field`, `no_key`, `internal_error` and the `bad_<field>` codes of the choices it checks):\n\n| Code | Means |\n| --- | --- |\n| `unknown_command` | There\'s no command by that name. |\n| `renamed_command` | The command has a new name; the error names it. |\n| `renamed_field` | The flag has a new name; the error names it. |\n| `repeated_field` | A flag was given twice. |\n| `missing_value` | A flag that takes a value was given none. |\n| `takes_no_value` | A flag that takes no value was given one. |\n| `conflicting_flags` | Two flags that don\'t go together were given, like logs --follow and --cursor. |\n| `not_a_folder` | The folder to check or upload isn\'t a folder. |\n| `not_a_file` | The file given (of statements, a dump to import, or a save) can\'t be read. |\n| `file_exists` | database export won\'t write over a file that\'s already there. |\n| `folder_not_empty` | export saves only into a new or empty folder. |\n| `needs_newer_node` | Reading or writing a .sqlite file needs Node 22.13 or newer, and drawing a shader in a local Chrome Node 22. |\n| `not_a_database` | The .sqlite file to import isn\'t a SQLite database. |\n| `unknown_link` | links remove: the game has no link by that name. |\n| `outside_file_unreachable` | upload: a file the game loads from an outside site couldn\'t be downloaded, so nothing was sent. |\n| `too_many_outside_files` | upload: the game loads more than 500 files from outside sites, so nothing was sent. |\n| `unpack_failed` | upload: a pre-compressed file couldn\'t be unpacked, so nothing was sent. |\n| `no_image_pass` | shader: the folder has no image.glsl, the shader\'s image pass. |\n| `unknown_shader_file` | A file in a shader\'s folder isn\'t one the command reads, or no channel in channels.json names it. |\n| `bad_channels_file` | A shader\'s channels.json isn\'t JSON, or isn\'t an object of the folder\'s passes, each a list of channels. |\n| `shader_texture_not_approved` | shader, check: a texture sent for the shader was rejected, or still waits for a person, so the shader wasn\'t sent. |\n| `no_chrome` | check: there\'s no Chrome on this computer to draw the shader in, and no --game with ZAISMA_KEY to draw it on Zaisma. |\n| `local_chrome_failed` | check: the Chrome on this computer couldn\'t draw the shader. |\n| `game_server_not_run` | play-locally: npx couldn\'t run @zaisma/game-server, which runs the game on this computer. |\n| `server_unreachable` | Zaisma couldn\'t be reached: no connection, or a wrong ZAISMA_API. |\n| `unexpected_answer` | Zaisma answered without JSON, like a page from a network in between. |\n| `skill_not_ours` | skill: a zaisma skill this command didn\'t install is already in that folder, so nothing was written; field names the folder. |\n| `install_not_confirmed` | skill: nothing was installed, since nobody answered the question: give --yes to install without it. |\n'
|
|
60443
|
+
"game-server": '<!-- Made by scripts/build-skill.mjs: never edit it by hand. -->\n\n# @zaisma/game-server\n\nWrite a game server once; run it in Zaisma\'s rooms or on your own Node server. Rooms, players, state sync, chat, the game\'s database and its requests behave the same in both.\n\nTo play your multiplayer game on your own computer before you upload it, run `npx @zaisma/game-server@1 play-locally` in the game\'s folder (or `npx @zaisma/cli play-locally`, which runs it). It serves the game, runs its game server, and opens a test bench: each player on Zaisma\'s own game page, guests until they sign in with a name, and a dev bar whose Add a player opens another tab as a new player, with passes signed by a key of its own, so two tabs play together with no account, key or internet. Flags: `[folder]`, `--port 4800`, `--game <slug>`, `--on-network`, `--no-open`, `--json`; Zaisma\'s README has the whole of it under "Play it on your own computer".\n\n```ts\n// server.ts\nimport { defineGameServer } from "@zaisma/game-server";\n\nexport default defineGameServer({\n ticksPerSec: 20,\n setup: () => ({ scores: {} }),\n onJoin: (state, who, room) => ({ ...state, scores: { ...state.scores, [who.id]: 0 } }),\n});\n```\n\nOn your own server (Node 22.18 or later):\n\n```\nnpx @zaisma/game-server@1 ./server.ts --game <your-game-slug> --port 8080\n```\n\nor from code:\n\n```ts\nimport { startServer } from "@zaisma/game-server/node";\nimport gameServer from "./server.ts";\n\nconst running = startServer({ gameServer, gameSlug: "your-game-slug", port: 8080 });\n// Later: await running.close(); every room saves first.\n```\n\nFor the fast lane (WebTransport, where `latest_only` sends go as datagrams), install its two optional packages beside the runner and give it all three of `--webtransport-port`, `--certificate-path` and `--certificate-key-path` (`startServer({ webtransportPort, certificatePath, certificateKeyPath })`):\n\n```\nnpm install @fails-components/webtransport@1.6.11 @fails-components/webtransport-transport-http3-quiche@1.6.11\nnpx @zaisma/game-server@1 ./server.ts --game <your-game-slug> --port 8080 --webtransport-port 443 --certificate-path fullchain.pem --certificate-key-path privkey.pem\n```\n\nGames join it with `Zaisma.joinRoom({ serverUrl, transport: "webtransport" })`, and fall back to the WebSocket by themselves where it doesn\'t connect.\n\nA mistake in your game server\'s code becomes a coded error in the game\'s logs, never a silent success, and the Node runner behaves the same as Zaisma\'s rooms. Versions follow semver: within 1.x the package only gains things.\n\n- The game server, handler by handler: the "Game servers" section of the [README](https://github.com/zaisma/zaisma#readme) and [`docs/DEVELOPER-API.md`](https://github.com/zaisma/zaisma/blob/main/docs/DEVELOPER-API.md).\n- Every name and option follows [`docs/NAMING.md`](https://github.com/zaisma/zaisma/blob/main/docs/NAMING.md).\n\nMIT licensed.\n\n### Multiplayer\n\nGames include the SDK with `<script src="_zaisma/v1.js"></script>` and call `await Zaisma.joinRoom()`. Its reference is its types, [`packages/sdk/zaisma.d.ts`](packages/sdk/zaisma.d.ts) (served beside it as `_zaisma/v1.d.ts`): every call, option, event and error code, explained. Save it beside your game\'s folder (uploads take no `.ts` files) and put `/// <reference path="../zaisma.d.ts" />` (and in JavaScript, `// @ts-check`) at the top of your script, and your editor and AI get errors instead of guesses. A room link (`zaisma.com/g/<game>?room=CODE`) drops friends into the same match, as guests or signed in. A game that needs a Zaisma account for multiplayer or the whole game (its `account_requirement` setting) gives guests no passes (`error.code === "account_needed"`), and its page asks them to sign in. Any game can ask a guest to sign in while it runs with `await Zaisma.player.signIn()`: the page offers an account beside the game, signing in happens in a new tab so the game keeps running, and the next `Zaisma.player.getPass()` or `joinRoom()` is the account\'s. Player passes come from the game\'s zaisma.com page, which checks that a real browser opened it (Cloudflare\'s invisible check, started as the page opens so Play doesn\'t wait), so bots can\'t fill rooms: a game opened anywhere else, or a browser the check can\'t confirm, can\'t join (`error.code === "unchecked"`).\n\nMultiplayer is server-client: the *client* is the game in the browser, the *game server* holds the official state and checks every move, and a *room* is one live match running one copy of the game server. A game server is a plain object:\n\n```ts\nexport default {\n maximumPlayerCount: 8, // up to 100\n ticksPerSec: 20, // up to 60; leave out for turn-based games so the room sleeps between moves\n setup: (setupData) => ({ players: {} }), // setupData: what room.reserve() passed, for a room another room made, else null\n onJoin(state, player, room, joinData, joinInfo) {}, // joinData: what the player\'s game passed to joinRoom({ joinData }), else null;\n // joinInfo: { fromRoomCode, isReturning, isSpectator } (isReturning: back to a held seat)\n canJoin(state, player, room, joinData, joinInfo) {}, // true lets them in; false or { refusalMessage } turns them away\n onChat(state, player, room, chatInfo) {}, // a player\'s room.chat, before Zaisma\'s filter: true, false or { toPlayerIds }\n adultChatFilterEnabled: false, // true: Zaisma\'s chat filter checks chat between adults too (on your meter)\n onLeave(state, player, room, leaveInfo) {}, // leaveInfo.reason: left, lost, idle, hidden or kicked\n onMessage(state, player, room, message) {},\n onBytes(state, player, room, bytes) {}, // bytes a player\'s game sent (room.sendBytes), a Uint8Array\n onTick(state, tickDurationSec, room) {}, // tickDurationSec: seconds since the last tick\n onRequest(player, request, server) {}, // a request outside any room (Zaisma.server.request): answer it (below)\n schedules: [{ name: "daily-reset", cron: "0 0 * * *" }], // runs by itself, in UTC (below)\n onSchedule(run, server) {}, // run.name: which schedule is due\n};\n// room.broadcast(message, { exceptPlayerId, delivery }), room.send(playerId, message, { delivery }), room.players, room.end(message),\n// room.broadcastBytes(bytes, { exceptPlayerId, fromPlayerId, delivery }), room.sendBytes(playerId, bytes, { delivery }),\n// room.setListed(false), room.setOpen(false), room.reserve({ playerIds, setupData }),\n// await room.database.query(sql, values), await room.database.batch([{ sql, values }]) (the game database, below)\n// await room.verifyReceipt(receipt) (a purchase\'s signed receipt, checked; server.verifyReceipt the same)\n// room.readDataFile("maps/docks.bin") (a data file beside the code, an ArrayBuffer; server.readDataFile the same; below)\n```\n\nNames follow [`docs/NAMING.md`](docs/NAMING.md): whole words, with the unit in the name. A game server with an option it doesn\'t take doesn\'t start, and says which ones it does take (`unknown_option`); the SDK refuses options and events it doesn\'t take the same way. Every message between a game and its room says its `type`, and a game\'s own messages travel in `data`; rooms count messages, not their size, so whole words cost nothing.\n\n`canJoin` decides who comes in, before they join: answer `true` to let them in, `false` to turn them away, or `{ refusalMessage: "Wrong room password." }` to turn them away with a message they see (up to 200 characters). Any other answer, nothing included, like a string, turns them away too, and shows in your game server\'s errors with what to answer instead. Only decide there; change the state in `onJoin`.\n\n```ts\ncanJoin(state, player, room, joinData) {\n return joinData?.password === state.password || { refusalMessage: "Wrong room password." };\n},\n```\n\nEach player\'s ping, measured by the room, is `room.pingDurationMs(playerId)` on the game server and `room.pingDurationMs` in their game, and both read the room\'s clock with `room.serverTimeMs()` (see "Room connections" in [`docs/DEVELOPER-API.md`](docs/DEVELOPER-API.md)).\n\nA room takes up to 100 players at up to 60 ticks a second. Each player\'s game sends up to 30 messages a second (a burst of 60), so a game at 60 ticks sends two inputs in one message; the game server can still send every tick. Past 100 players, split a world into rooms and move players between them (`room.moveTo`).\n\n**Bytes:** for snapshots and inputs where JSON is too big, a game sends bytes with `room.sendBytes(bytes)` (an `ArrayBuffer` or any typed array) and gets them with `room.on("bytes", (bytes, fromPlayerId) => {})`; the game server takes them in `onBytes` and sends them with `room.broadcastBytes(bytes)` and `room.sendBytes(playerId, bytes)`. `fromPlayerId` is the player they came from when the game server passes one player\'s bytes on (`room.broadcastBytes(bytes, { fromPlayerId: player.id })`, as the relay does), else `null`. Bytes have the same limits as messages: up to 16 KB each, counted together with them. The MCP\'s `get_stats` shows each game\'s room traffic per player and its biggest message types, with hints on what to send as bytes or send less.\n\n**Sending only what changed:** turn on `stateSyncEnabled` and keep the world in the game server\'s state; each player then gets a full copy as they join and after that only what changed, after every tick (or every move, in a turn-based game), with no code to send it. `stateView(state, viewer, room)` cuts what each player sees: only what\'s near them in a big world, or without the other team\'s cards. In the game, `room.state` is the player\'s view and `room.smoothedState()` the same a moment (100 ms) behind, with positions moving evenly between updates. A player whose connection is backed up gets nothing until they\'ve caught up, then a full copy. See `examples/arena`, and "State sync" in [`docs/DEVELOPER-API.md`](docs/DEVELOPER-API.md).\n\n```ts\n// A 100-player world where each player gets only the players within 800 units of them.\nexport default {\n maximumPlayerCount: 100,\n ticksPerSec: 30,\n stateSyncEnabled: true,\n setup: () => ({ players: {} }),\n onJoin(state, player) { state.players[player.id] = { name: player.name, x: 0, y: 0, health: 100 }; },\n onLeave(state, player) { delete state.players[player.id]; },\n stateView(state, viewer) {\n const me = state.players[viewer.id];\n const nearby = {};\n for (const [id, other] of Object.entries(state.players)) {\n if (me && Math.hypot(other.x - me.x, other.y - me.y) <= 800) nearby[id] = { name: other.name, x: Math.round(other.x), y: Math.round(other.y), health: other.health };\n }\n return { players: nearby };\n },\n};\n// In the game: requestAnimationFrame(function draw() { drawPlayers(room.smoothedState()?.players ?? {}); requestAnimationFrame(draw); });\n```\n\n**Messages that can be dropped:** `{ delivery: "latest_only" }` on any send, from the game server or the game, marks a message only the newest of matters, like positions every tick or where a player aims: while a player\'s connection is backed up, a newer one with the same `latestKey` (which it needs, like `"position"`) replaces it, and the newest goes once they catch up. Zaisma\'s rooms carry them over the WebSocket today, and the same call moves to real datagrams once Cloudflare carries them; on your own server, the fast lane already sends them as datagrams (see [Run your game server yourself](#run-your-game-server-yourself)). `get_stats` says which of your message types would gain from it (`latest_only_available`).\n\nGames without server code can use the built-in `relay` (up to 16 players), which passes each message on to everyone else as it was sent (your game\'s `message` event gets the message, then `fromPlayerId` as its second argument), and bytes the same way. See `examples/arena` (real-time) and `examples/four-in-a-row` (turn-based).\n\n#### Your game server on Zaisma\n\nPut your game server in a `zaisma-server/` folder at the top of your upload and set multiplayer to "Your game server" (dashboard), or `multiplayer: "own"` (MCP or API). Zaisma\'s rooms run it for you:\n\n```\nindex.html\nzaisma-server/\n index.js export default { setup, onJoin, onMessage, ... }\n physics.js import { step } from "./physics.js" works in index.js\n levels/docks.js\n maps/docks.bin a data file: room.readDataFile("maps/docks.bin")\n```\n\n- **Plain JavaScript ES modules:** `zaisma-server/index.js` default-exports the game server above, and can import the folder\'s other files by relative path: `.js` code, `.json` data (`import levels from "./levels.json"`) and `.wasm` WebAssembly, like a physics engine (`import mod from "./physics.wasm"` gives a `WebAssembly.Module`; `new WebAssembly.Instance(mod, imports)` starts it). Packages from npm (`import "lodash"`) and TypeScript need a build step: bundle into one `zaisma-server.js` at the top of the upload instead (`npx esbuild server.ts --format=esm --bundle --outfile=zaisma-server.js`), or into `zaisma-server/index.js` when it has data files. Up to 500 files and 64 MB in all, data files included, of which the code (`.js`, `.json` and `.wasm`) is up to 32 MB (`GAME_SERVER_LIMITS`).\n- **Data files:** every other file in `zaisma-server/` (`.bin`, `.gz`, `.txt`, anything but `.js`, `.json` and `.wasm`) ships beside the code as a data file, like prebuilt navigation meshes, level geometry or a dictionary. `room.readDataFile("maps/docks.bin")` (or `server.readDataFile` in `onRequest`, `onSchedule` and `onWebhook`) answers it as an `ArrayBuffer`, by its path from `zaisma-server/`: no base64, no download, and nothing on the meter, since it comes with the code. It\'s the same `ArrayBuffer` every time, shared by every room of the version running in the same place, so read it and never change it; keep what you build from it in a variable outside the handlers (`const meshes = new Map()`) and every room there shares it too. A path with no data file throws a `GameServerError` `bad_room_call`. On your own server, data files are read from the game server\'s folder (`--data-folder`, or `startServer({ dataFolder })`; `zaisma-server` by default).\n- **Time to start:** each call into the game server, a tick with the messages since the last one, a join, a request, has 50 ms of CPU (`GAME_SERVER_LIMITS.maximumCallCpuDurationMs`). A start has 5 seconds (`maximumStartCpuDurationMs`): loading the game server, `setup`, `onRestored`, and a real-time room\'s first tick after any of them, or after the room puts its state back in a fresh copy of the game server (one that started again and lost its memory, or one opened again after a stop), whether or not the game has `onRestored`, so build what the match needs once (a map\'s navigation, its collision) in that first tick, not spread over many. The game server\'s top-level code, outside its handlers, has Cloudflare\'s 1 second as it loads (`maximumLoadCpuDurationMs`), so heavy work goes in that first tick. One copy of the game server, shared by the version\'s rooms in one place, has 128 MB of memory (`maximumMemorySizeBytes`), its data files included: they load from storage into that memory when the copy starts, so with 64 MB of files about 60 MB is left for the matches. Every second of CPU is on the game\'s hosting meter, starts included.\n- **Sealed off:** nothing of Zaisma\'s but its own game\'s database and secrets, and other servers only on the hosts you list (below), so it talks to its players through `room` and its answers to their requests. State is plain JSON.\n- **Private:** players never get its files; the game domain refuses `zaisma-server/` and `zaisma-server.js`.\n- **Real-time rooms batch input:** in a room with `ticksPerSec`, the state stays inside the sandbox, and players\' messages and bytes reach `onMessage` and `onBytes` just before the next `onTick`, in the order they came, with what they send going out then (at most a tick later). A handler that throws leaves the rest of the batch to run, and what it changed in the state before throwing stays, as on your own server, where they run as they come. Either way a room\'s handlers run one at a time: one that awaits (the database, say) finishes before the room\'s next message, bytes or tick reaches the game server.\n- **Kept in check:** an error in a handler loses that one message or tick and the match carries on. A call that runs past its CPU (above; a loop that never ends) is stopped, freezing the match meanwhile, and a match stopped twice ends. Your dashboard and the MCP\'s `get_stats` show these errors with the file and line they came from.\n- **Memory outside the handlers:** a room\'s state is plain JSON, and it\'s all Zaisma keeps of a room. What the game server keeps in its own variables, outside the handlers (`const worlds = new Map()`), lives in the copy of the version that runs the room: the version\'s rooms running in the same place share it, as they share data files, and rooms elsewhere have copies of their own. It\'s lost whenever that copy starts again, which can happen at any time (a while unused, Zaisma\'s own updates, a call stopped for running too long), and then the room carries on from its last state, with no `onRestored` (that runs only when the room itself restarts): a turn-based room\'s state as of its last call, a real-time room\'s as of its last copy, taken every 5 seconds. So a world that isn\'t JSON (typed arrays, a collision tree, a physics engine\'s bodies) goes there, keyed by `room.roomCode`; each handler that finds its room\'s entry missing rebuilds it from the state, and the room deletes its entry once its match is over, since every room in that copy shares its 128 MB. On your own server and in play-locally, one process runs every room, so they all share it; it\'s lost when the process starts again (play-locally starts it again on each change to the game server), and every room then comes back through `onRestored`.\n- **Updates:** rooms keep the version they started with until they end; new rooms get the live version.\n\nThe same file runs on your own machine too (below), so you can test it there or move off Zaisma any time.\n\n#### The game database\n\nEvery game has its own SQLite database, part of its hosting: shared by all its rooms, kept between matches, for what the game server owns or must trust (inventories, leaderboards, bans, worlds). Players\' own progress belongs in cloud saves, which need no code. The game server uses it as `room.database` with plain SQL, in any handler that awaits it:\n\n```js\nasync onJoin(state, player, room) {\n await room.database.query("CREATE TABLE IF NOT EXISTS scores (player_id TEXT PRIMARY KEY, best_score INTEGER NOT NULL)");\n const [mine] = await room.database.query("SELECT best_score FROM scores WHERE player_id = ?", [player.id]);\n room.send(player.id, { bestScore: mine?.best_score ?? 0 });\n},\nasync onMessage(state, player, room, message) {\n if (message.type === "finished") {\n await room.database.query(\n "INSERT INTO scores VALUES (?, ?) ON CONFLICT (player_id) DO UPDATE SET best_score = max(best_score, excluded.best_score)",\n [player.id, state.scores[player.id]],\n );\n }\n},\n```\n\n- **`query(sql, values)`** runs one statement and answers its rows as objects (`[]` when it returns none). `values` fill its `?`s in order: text, numbers, `null` or a `Uint8Array` (whole numbers past 2^53 are refused with `bad_values` and can\'t be read back as numbers (`integer_too_large`): store them as text and read them with `CAST(col AS TEXT)`; use 1 and 0 for true and false; store objects as `JSON.stringify` and read them with `JSON.parse` or SQLite\'s JSON functions). To see what an `INSERT`, `UPDATE` or `DELETE` changed, add `RETURNING`.\n- **`batch([{ sql, values }, ...])`** runs up to 100 statements in one transaction, so they all happen or none do (moving an item between two inventories, say), and answers each one\'s rows. `BEGIN` and `COMMIT` aren\'t taken; batch is the transaction.\n- **Errors** are a `DatabaseError` with a `code` and a `fix`: `bad_sql` (SQLite\'s own message, or more than one statement in a query), `bad_values`, `integer_too_large` (a result holds a whole number past 2^53), `too_many_rows` (over 10,000 rows; page with `LIMIT`), `hosting_paused` (the game\'s hosting is paused this month, below), `database_full` (its storage, the database and kept rooms together, is at the 10 GB a game can have: it can change and delete rows but not grow) and `database_unavailable`.\n- **Part of the game\'s hosting on Zaisma.** Rows written and read, and what it stores, count on the game\'s one hosting meter with its rooms and requests (see "Hosting" below). Every statement counts the rows SQLite touched, like Cloudflare\'s billing: an index makes lookups read fewer rows. When the game\'s hosting pauses, the database keeps answering for the hour running matches get, so their last saves land, then answers `hosting_paused` until it starts again.\n- **You and your AI reach it too:** look at its tables and use, query it, fix data, change tables and roll it back to any minute in the last 30 days through the developer API, the MCP (`get_database`, `query_database`, `batch_database`, `restore_database`) or `zaisma database` in a terminal, with the same checks and limits (see "The game database" in [`docs/DEVELOPER-API.md`](docs/DEVELOPER-API.md)).\n- **Take it out, bring it in:** the whole database goes out and in as SQLite\'s own SQL dump (`export_database`, `import_database`), or as a ready SQLite file from a terminal: `zaisma database export <game> game.sqlite` and `zaisma database import <game> game.sqlite`.\n- **The same code on your own server:** the Node runner keeps the database in a local SQLite file (below), checked the same way, with no limits. Moving between Zaisma and your own server is one command each way: export to the file the runner uses, or import the runner\'s file.\n\n#### Room browsing\n\nOpen rooms are listed on the game\'s page (how full each is and where it runs, never who\'s in it), with "playing now" under the title (every room counts, hidden ones too), and the game gets the same list to show its own way:\n\n```js\nconst { rooms, playingPlayerCount, regions } = await Zaisma.rooms.list(); // how full each room is and where it runs, never who\'s in it\nZaisma.rooms.list({ region: "EU", labels: { Mode: "Classic" } }); // one region, or rooms with these labels\nconst room = await Zaisma.rooms.quickJoin(); // the linked room, else a busy room with space nearby, else a new one\nZaisma.joinRoom({ isListed: true }); // a new room others find in room lists (by default only its code and link reach it)\nZaisma.joinRoom({ name: "Ana\'s castle", labels: { Mode: "Classic", Map: "Docks" } }); // name and label a new room\nawait Zaisma.checkChat(typed); // { isAllowed, reason, message, hasSwearing, text }: Zaisma\'s chat check\n```\n\nRooms can have a name and up to 4 labels (like Mode and Map), set by your game server with `room.setInfo({ name, labels })`, by the room\'s first player with the relay, or when the room is made. Names and labels players type are fine; on zaisma.com they show only if they pass Zaisma\'s text filter (no links, handles, emails, phone numbers or contact apps; no slurs or sexual words), and players can report them. Inside your game they\'re yours to look after, under the content rules.\n\nOn the game server, `room.setListed(false)` hides a room (its code and links still work) and `room.setOpen(false)` closes it to new players once a match starts; players who were in it can still come back. With the relay, the room\'s first player can do the same from the game (`room.setListed`, `room.setOpen`, `room.setInfo`). In the dashboard, a game lists its rooms on the page and in the game, only in the game, or nowhere.\n\nJoin on the game page is an ordinary room link, so the game decides what comes first:\n\n- **Straight in:** call `joinRoom()` or `quickJoin()` when the game starts; both follow a link to a Zaisma room; on your own servers, join with `joinRoom({ serverUrl: Zaisma.rooms.linkedServerUrl, roomCode: Zaisma.rooms.linkedRoomCode })`, since only `joinRoom({ serverUrl })` follows a link that names a server.\n- **A menu or character customizer first:** check `Zaisma.rooms.linkedRoomCode`, show your screen, then join with what the player picked: `joinRoom({ joinData: { character: "knight" } })` hands it to your game server\'s `canJoin` and `onJoin` (plain JSON, up to 4 KB; it comes from the player\'s browser, so check it like any message). If the room filled up meanwhile, `joinRoom` fails with `error.code === "room_full"` and `quickJoin` finds another.\n- **Your own lobby:** list rooms only in the game and draw them yourself from `Zaisma.rooms.list()`.\n\n#### Lobbies and matches\n\nA room can make a room for some of its players and send them there, like a lobby starting a match:\n\n```ts\nconst roomCode = room.reserve({ playerIds: [a.id, b.id], setupData: { map: "Docks", teams } }); // in your game server\n```\n\n```js\nroom.on("move", (move) => { room.leave(); move.join(); }); // in the game: go to the new room\n```\n\nThe new room runs the same game server, and its `setup(setupData)` gets your setup data, so it can start the match already set up (players can read it but can\'t change it; up to 4 KB). It\'s ready before anyone hears its code, only the players named can join it (it\'s a closed room, until your server opens it), and it\'s hidden from room lists unless you pass `isListed: true` (with a `name` and `labels` if you like). To send players to a room that\'s already running instead, like the next area of an open world, use `room.moveTo(roomCode, { playerIds, joinData })`: the other room\'s `canJoin` decides, and `onMoved(state, moveResult, room)` hears `{ roomCode, movedPlayers, refusals }`. A room can reserve up to 20 rooms a minute. See `examples/four-in-a-row`: its "Find an opponent" waits in a lobby room until there\'s someone to play.\n\nA griefed world or a bad update can be undone: `server.restoreKeptRoom(roomCode, { restoreToAt })` puts a kept room\'s world back as it was at any minute in the last 30 days, by your game\'s own rule of who may, and `server.undoKeptRoomRestore` undoes it for 30 days; `server.listKeptRoomRestores(roomCode)` gives a restore screen what it draws from. Players drop for a second or two and reconnect, and `onRestored` hears `restoreInfo.keptRoomRestore`, so your game tells them its own way. Your AI does the same through the API and MCP (`restore_kept_room`, `restore_every_kept_room`), and a deleted world comes back with `bring_back_kept_room` for about 28 days. See `docs/DEVELOPER-API.md`, Kept rooms.\n\n**One room at a time.** A player sits in one of your game\'s rooms at a time, as on Steam: when they join another room, their seat in the first closes with "Joined from somewhere else" and your game server\'s `onLeave` runs there with reason `"left"`. Moving a player (`room.moveTo`, `room.reserve`) and watching (`isSpectator`) never close a seat. A game that keeps players in more than one room, like a hangout hub beside its matches, raises `maximumRoomCountPerPlayer` (up to 10): a join past it closes the oldest seat. "Playing now" counts each player once.\n\n**Kept rooms** are for worlds that last, like a survival server: a kept room doesn\'t end when everyone leaves, but sleeps with its state saved, costs nothing while it sleeps, and wakes as it was when someone joins, a day or a month later.\n\n```ts\nroom.setKept(true); // in your game server, like in setup or when players build their first base\n```\n\nA listed kept room stays on the game page\'s Rooms tab with nobody in it, like a server waiting for players (`Zaisma.rooms.list` says `isKept`). A world waking from its sleep runs `onRestored` with `restoreInfo.lostDurationSec` 0 and `restoreInfo.savedAt`, so you can grow crops for the time that passed, and it wakes on the game\'s live version, with `restoreInfo.savedVersionId` saying which one saved it. `room.end()` ends it for good, and `room.setKept(false)` makes it an ordinary room again. Saved worlds count toward the game\'s storage with its database, on its hosting meter: at the 10 GB a game can have, new rooms can\'t be kept until you make room, but kept rooms keep saving. List and delete them with `list_kept_rooms` and `delete_kept_room`, or `zaisma kept-rooms`. A room made with `room.reserve({ ..., isKept: true })` starts kept. On your own server the Node runner keeps them in `--room-state-file`.\n\n`room.roomCode` tells the game server which room it\'s in, so a game with one shared world can keep only that room and turn players away from any other code, even from a changed page:\n\n```ts\ncanJoin(state, player, room) { return room.roomCode === "WRLD22" || { refusalMessage: "Join the main world." }; },\nonJoin(state, player, room) { room.setKept(true); },\n```\n\nPlaying alone needs no room, so don\'t make one until others can join: time in a room counts toward hosting even with one player.\n\n**Hosting.** Everything a game runs on Zaisma\'s servers (its rooms\' awake time, connections and messages, its game server\'s CPU and starts, data Zaisma\'s relay sends its players, its database, and requests and schedule runs to its game server) counts on one meter, and every game gets a free allowance each month (UTC): 8 friends playing a real-time game every night use about a third of it, and it covers about 1,300 player-hours of an 8-player real-time game. Your dashboard and `get_stats` show it as a percentage, with what used it. Past it, a game keeps going only when its developer has added hosting credit and given it a monthly budget (`monthly_budget_cents`; see "Hosting and credit" in [docs/DEVELOPER-API.md](docs/DEVELOPER-API.md)). Otherwise its hosting pauses until the month resets: no new rooms open (joining fails with `error.code === "hosting_paused"`), no new relayed connections or requests start, and matches already running get an hour to finish (`room.endsAt`, the game server\'s `onEnding`, the SDK\'s `ending` event). Game files, saves, sign-in, publishing and spectators are never on the meter, and your own servers never are.\n\n#### Spectators\n\nA game server that turns watching on lets people watch a match without playing, like a tournament\'s crowd or friends waiting for the next round:\n\n```ts\nexport default {\n maximumSpectatorCount: 20, // up to 100; leave it out, or 0, and nobody can watch\n onSpectatorJoin(state, spectator, room) { room.send(spectator.id, { type: "snapshot", state }); }, // catch them up\n onSpectatorLeave(state, spectator, room) {},\n onTick(state, tickDurationSec, room) {\n room.broadcast({ type: "positions", positions: state.positions }); // players and spectators\n room.broadcast({ type: "hands", hands: state.hands }, { audience: "players" }); // never the spectators\n room.broadcast({ type: "commentary", text: state.commentary }, { audience: "spectators" });\n },\n};\n```\n\n```js\nconst room = await Zaisma.joinRoom({ isSpectator: Zaisma.rooms.isLinkedAsSpectator }); // in the game\nroom.isSpectator; // watching: room.send and room.sendBytes throw error.code "spectator_cannot_send"\nroom.spectatorCount; // how many watch; the "settings" event says when it changes\n```\n\nA spectator gets everything the room sends everyone (`audience` picks who: `"everyone"`, the default, `"players"` or `"spectators"`, for `room.broadcast` and `room.broadcastBytes`), and `room.send(spectator.id, ...)` reaches one. They send nothing, so they can\'t bother players or dodge the room\'s limits; they\'re never in `room.players`, don\'t count toward `maximumPlayerCount` or "playing now", are never idle or away, and are free: watching isn\'t player time. `room.spectators` lists them, `joinInfo.isSpectator` tells `canJoin` a watcher is asking, and `room.kick` works on them too. A closed or full room can still be watched (watching a match under way is the point); a room with nobody playing can\'t (`room_not_running`), one whose audience is full answers `spectators_full`, and a player already playing in the room answers `already_playing`. When the last player leaves, the spectators are told the match ended.\n\nOn zaisma.com, Watch shows beside Join (friends playing, the Players plate, the Rooms tab) for games that take spectators, with the same rules as Join, and opens the game with `Zaisma.rooms.isLinkedAsSpectator` true. The Rooms tab and the Players plate say how many are watching, never who.\n\n#### Players who walk away\n\nPlayers who walk away stop holding seats and running matches, in every game, with no code:\n\n- **Lost connections** (a closed laptop, lost signal): the SDK pings the room every 25 seconds without waking it, and a connection that stops answering is dropped about a minute later (within seconds in a real-time room). The SDK says goodbye as the page closes, so most players leave at once.\n- **Idle:** after 10 minutes without input the SDK asks "Still there?" with a small plate at the top of the game for 30 seconds; no answer, and the player walks away. Rooms check for themselves too: a game that sends nothing at all for a minute past that counts as idle.\n- **Hidden:** in a real-time room (one with `ticksPerSec`), a game hidden for 2 minutes counts as away.\n\nA player whose connection drops stays in the match first, as away with reason `lost`, for 30 seconds while the SDK reconnects: `onAway` runs if your game server has one, every player\'s game sees `awayReason: "lost"` for them in `room.players`, and if they\'re back in time, `onBack` runs and they carry on where they were. Freeze their character meanwhile (in `onTick`, skip players whose `room.awayReason(playerId)` is `"lost"`), or do nothing and they stand still.\n\nA player who walks away, or whose connection stays lost, leaves the match (`onLeave` with `leaveInfo.reason`) and the room holds their seat for 5 minutes: they come straight back to it with any input, or by reconnecting, and `onJoin` gets `joinInfo.isReturning`. Held seats count toward `maximumPlayerCount`, but players who walked away don\'t count as playing now or toward how full a room looks, and a room where everyone\'s away stops ticking. Once the seat runs out, the SDK offers their old room again if it has space. Zaisma never covers your game or sends anyone away from it for being idle.\n\nWhen Zaisma restarts its rooms (every update to Zaisma does), a real-time match comes back where it was a few seconds before, and its players reconnect into it: the room saves its state every `stateSaveIntervalSec` (5 by default, 1 to 60), and `onRestored(state, restoreInfo, room)` runs once with `restoreInfo.lostDurationSec`, the seconds of play lost, so you can resync clocks or tell your players. Turn-based rooms save after every move, so they lose nothing. Publishing with `match_update_mode: "now"` moves every live match to the new version the same way, within seconds; your game server can hold it until the end of a round with `onVersionUpdate` ([Updates](docs/DEVELOPER-API.md#updates)).\n\nYour game server picks what happens:\n\n```ts\nexport default {\n idleCheck: "server", // who checks: "server" (the default), "client" (each player\'s game decides), or "off"\n idleTimeoutSec: 300, // seconds without input before "Still there?" (default 600)\n seatHoldDurationSec: 120, // seconds a seat stays held (default 300, up to 1800; 0 for none)\n reconnectTimeoutSec: 30, // seconds a player whose connection dropped stays in the match (default 30, up to 300; 0 to take them out at once)\n maximumRoomCountPerPlayer: 1, // rooms of your game one player sits in at once (default 1, up to 10; see "Lobbies and matches")\n awayMode: "lobby", // send players who walk away back to the room that made this one (room.reserve); "hold" is the default\n onAway(state, player, room, awayInfo) {}, // awayInfo.reason "idle", "hidden" or "lost"; for idle and hidden, the player stays and you kick, move or keep them\n onBack(state, player, room) {}, // a player onAway kept, or whose connection dropped, came back: send them the full state\n stateSaveIntervalSec: 5, // how often a real-time room saves its state, for a restart to come back with (default 5, 1 to 60)\n onRestored(state, restoreInfo, room) {}, // the room restarted with its saved state: restoreInfo.savedAt, lostDurationSec and savedVersionId\n onVersionUpdate(state, versionUpdate, room) {}, // a version published "now" is coming: call room.applyVersionUpdate() at a good moment, or it switches at versionUpdate.appliesAt\n onPurchase(state, player, room, purchase) {}, // with purchase_delivery "game_server": a purchase to hand over, once; a throw tries again at the player\'s next join\n onRefund(state, player, room, purchase) {}, // a purchase handed over before was refunded or charged back: take back what you decide\n};\n```\n\nIn the game, all of it is optional:\n\n```js\nroom.on("connectionStatus", (connectionStatus) => {}); // the socket: "connecting", "open", "reconnecting" or "closed"\nroom.on("away", ({ awayReason, seatHoldDurationSec }) => {}); // awayReason: "idle" or "hidden" (also room.awayReason); the seat is held that long\nroom.on("idle", ({ idleStatus }) => {}); // ask "Still there?" your way: "asking", then "answered" or "timed_out"\nroom.on("back", (back) => back.rejoin()); // back: isSeatHeld true, already in; false, the seat ran out and listening turns off rejoining by itself\nroom.on("players", (players) => {}); // each player\'s awayReason: "lost" while their connection dropped, "idle" or "hidden" if onAway kept them, else null\nZaisma.joinRoom({ idleCheckEnabled: false }); // no "Still there?" in this game (where idleCheck is "client", as with the relay, the room follows this)\n```\n\nEvery number behind this (pings, timeouts, reconnecting, held seats, message limits, close codes) is in [Room connections](docs/DEVELOPER-API.md#room-connections).\n\nYour own clients follow the same protocol: send the text `ping` every 30 seconds or so (the room answers `pong`), `{"type":"idle"}`, `{"type":"hidden"}` and `{"type":"shown"}` as they happen, and `{"type":"back"}` when the player returns. Their hello carries `"protocolVersionNumber":1`. Errors from the room are `{"type":"error","code":"room_full","message":"This room is full."}`, with codes in lowercase snake_case, one of: `rented_share_used`, `room_full`, `room_closed`, `ended`, `too_big`, `too_fast`, `bad_message`, `bad_pass`, `bad_player_token`, `no_hello`, `not_allowed`, `game_unavailable`, `busy`, `kept_out`, `refused`, `room_not_running`, `hosting_paused`, `account_needed`, `game_not_open_to_player`, `blocked_player_here`, `other_version`, `spectators_full`, `spectator_cannot_send`, `already_playing`, `bad_origin`, `send_queue_full`, `chat_not_here`, `chat_not_allowed`, `chat_empty`, `chat_too_long` or `chat_too_fast`. The SDK\'s types explain each one (`RoomErrorCode`); codes only grow within v1.\n\n#### Requests to your game server\n\nNot everything needs a room. A game\'s own game server can also answer plain requests from the game, for a leaderboard, a shop or a daily reward, in single-player games too. Give it `onRequest`, and the game calls it with `Zaisma.server.request`:\n\n```js\n// zaisma-server/index.js (or zaisma-server.js)\nexport default {\n async onRequest(player, request, server) {\n await server.database.query("CREATE TABLE IF NOT EXISTS rewards (player_id TEXT PRIMARY KEY, claimed_date TEXT NOT NULL)");\n if (request.type === "claimDailyReward") {\n const today = new Date().toISOString().slice(0, 10);\n const [claimed] = await server.database.query("INSERT INTO rewards VALUES (?, ?) ON CONFLICT (player_id) DO UPDATE SET claimed_date = excluded.claimed_date WHERE claimed_date < excluded.claimed_date RETURNING player_id", [player.id, today]);\n return { isClaimed: Boolean(claimed) };\n }\n return { error: "unknown request" };\n },\n};\n\n// In the game:\nconst { isClaimed } = await Zaisma.server.request({ type: "claimDailyReward" });\n```\n\n- **`onRequest(player, request, server)`** answers what the game gets back: plain JSON, up to 1 MB, within 10 seconds. `player` is who sent it, from their player pass, so a player can\'t claim someone else\'s reward. `request` is the game\'s plain JSON, up to 16 KB, from the player\'s browser, so check it like any message and say what it\'s for in its `type`. There\'s no room and no state: what lasts goes in `server.database`, the same game database the game\'s rooms use.\n- **Rooms or not:** a game server with only `onRequest` needs no `setup()` and runs no rooms; one with both does both. Requests work whatever the game\'s multiplayer setting, as long as its live version has the game server in its `zaisma-server/` folder or `zaisma-server.js`, run in the same sealed sandbox as its rooms.\n- **Errors:** the game gets an `error.code`, one of: `rented_share_used`, `bad_request`, `too_big`, `bad_pass`, `bad_player_token`, `account_needed`, `game_not_open_to_player`, `game_unavailable`, `no_request_handler`, `game_server_error`, `hosting_paused`, `slow_down`, `bad_origin` or `busy`. `no_request_handler` means no `onRequest`; `game_server_error` means it threw, answered something that isn\'t plain JSON or over 1 MB, or took over 10 seconds (you see why with your game server\'s errors in the dashboard and `get_stats`, with the file and line); `slow_down` means over about 120 a minute from one address; `hosting_paused` answers HTTP 403. The pass\'s own are `account_needed` and `bad_pass`; `bad_player_token` is your own server\'s, for a game played off Zaisma (below). A game server that keeps running on too long (a loop that never ends) is paused for a few minutes.\n- **Part of the game\'s hosting on Zaisma.** Each request, webhook event and schedule run counts on the game\'s hosting meter, and so does its CPU past the first 10 ms (see "Hosting" above). While the game\'s hosting is paused, requests answer `hosting_paused`. Your dashboard and `get_stats` show the month\'s count.\n- **On your own server** the Node runner answers the same requests at `POST /v1/requests/<game>` on its port, with `server.database` its local SQLite file: `Zaisma.server.request(request, { serverUrl: "https://play.example.com" })`. Any server can answer them the same way: the body is `{ pass, request }` as JSON (sent as `text/plain`, so browsers need no preflight), and the answer `{ answer }` or `{ error: { code, message } }`.\n\n#### Schedules\n\nA game\'s own game server can also run by itself, for a daily reset, a weekly leaderboard or a persistent world\'s turns. List its `schedules`, each a name and a cron, and `onSchedule` runs at each:\n\n```js\n// zaisma-server/index.js (or zaisma-server.js)\nexport default {\n schedules: [\n { name: "daily-reset", cron: "0 0 * * *" }, // every midnight, UTC\n { name: "world-turn", cron: "*/15 * * * *" }, // every 15 minutes\n ],\n async onSchedule(run, server) {\n if (run.name === "daily-reset") {\n // Safe to run twice: it only resets what\'s older than this run.\n await server.database.query("DELETE FROM daily_scores WHERE scored_at < ?", [run.scheduledAt]);\n }\n if (run.name === "world-turn") await server.database.query("UPDATE crops SET growth = min(growth + 1, 10)");\n },\n};\n```\n\n- **`cron`** is the usual five fields, minute hour day-of-month month day-of-week, always in UTC: numbers, `*`, ranges (`1-5`), steps (`*/15`) and lists (`1,15`). `"0 4 * * 1"` is Mondays at 04:00. So a schedule runs at most once a minute; anything faster belongs in a room\'s `onTick`. A cron that doesn\'t read stops the game server starting, and says why.\n- **`onSchedule(run, server)`** gets `run.name`, `run.cron` (the cron with spaces tidied: trimmed, one space between fields) and `run.scheduledAt`, the minute it was due (an ISO time). There\'s no room, no player and no state: what lasts goes in `server.database`, the same game database the game\'s rooms and requests use. It has 30 seconds. A run can rarely come late or twice (after a restart), so make it safe to repeat, like a reset that checks `run.scheduledAt`.\n- **Up to 10 schedules on Zaisma.** Each run counts as a request on the game\'s hosting meter, and a paused game\'s schedules don\'t run. They run with the live version\'s game server, whatever the multiplayer setting, within a minute of it going live; a version without them stops them, and so does a game taken down. A game server with only schedules needs no `setup()` and runs no rooms. Your dashboard and `get_stats` show each schedule with its next and last run, the runs per day, and any errors with the schedule\'s name, file and line.\n- **On your own server** the Node runner runs the same schedules at the same minutes while it\'s up, with `server.database` its local SQLite file, and prints a run\'s errors. A run due while it\'s down is missed.\n\n#### Messages between rooms\n\nA game server reaches the game\'s other live rooms with a room message: `room.sendToRoom(roomCode, message)` tells one room (answering `{ isDelivered }`), `room.sendToEveryRoom(message, { labels })` tells every other room with someone in it, or only those holding every label given (answering `{ roomCount }`), and `room.listRooms({ labels })` lists them, newest first. Outside rooms, `onRequest`, `onSchedule` and `onWebhook` get the same on `server`, plus `server.getRoom(roomCode)` (the room and who\'s in it), `server.kickFromRoom(roomCode, playerId, { message, keepOut })` and `server.endRoom(roomCode, message)`. The receiving room\'s `onRoomMessage(state, roomMessage, room)` decides what its players see; without it, every player\'s game hears the room\'s `roomMessage` event. `roomMessage.senderKind` says who sent it (`room`, `server` or `developer`), with `fromRoomCode` for a room. A message is plain JSON up to 16 KB; a room sends up to 20 a second and takes up to 100, and the whole game sends to every room up to 10 times a minute.\n\nA party leaving one world for another, the same code in Zaisma\'s rooms and on your own server with the Node runner:\n\n```js\nexport default {\n setup: () => ({ partiesComing: [] }),\n async onMessage(state, player, room, message) {\n if (message.kind !== "travel") return;\n const { isDelivered } = await room.sendToRoom(message.toRoomCode, { kind: "party_coming", leaderName: player.name });\n if (isDelivered) room.moveTo(message.toRoomCode, { playerIds: [player.id] });\n },\n onRoomMessage(state, roomMessage, room) {\n if (roomMessage.message.kind !== "party_coming") return;\n room.broadcast({ kind: "notice", text: `${roomMessage.message.leaderName}\'s party is on its way from ${roomMessage.fromRoomCode}.` });\n return { ...state, partiesComing: [...state.partiesComing, roomMessage.fromRoomCode] };\n },\n};\n```\n\nOn Zaisma, the developer API and MCP reach the same rooms (`send_room_message`, `send_to_every_room` now or at a set time, `list_rooms`, `get_room`, `kick_player`, `end_room`), for the game\'s own moderation page or a live event: see "Reaching live rooms" in [`docs/DEVELOPER-API.md`](docs/DEVELOPER-API.md). On your own server the Node runner gives these calls among its own rooms, and Zaisma\'s API doesn\'t reach them.\n\n#### Calling other servers, with secrets\n\nA game\'s server can call your own server, a payment provider, Discord, GitHub or any other https API with plain `fetch()`, on the hosts you list for the game, and keep the tokens it needs as secrets:\n\n```js\n// zaisma-server/index.js: post each new top score to the game\'s Discord channel\nexport default {\n async onRequest(player, request, server) {\n if (request.type !== "score") return null;\n await fetch(server.secrets.DISCORD_WEBHOOK_URL, {\n method: "POST",\n headers: { "Content-Type": "application/json" },\n body: JSON.stringify({ content: `${player.name} scored ${request.score}!` }),\n });\n return { isPosted: true };\n },\n};\n```\n\n```sh\n\n## Room connections\n\nHow a room and each player\'s game stay in touch, the same in Zaisma rooms and on your own server (the Node runner): how a dead connection is noticed, what happens to a player whose connection drops or who walks away, the limits on what players send, and why a connection closes.\n\n### Staying connected\n\n- **The SDK pings** the room every 25 seconds (the room answers without waking up), and reconnects by itself when a ping goes unanswered for 15 seconds, or in a real-time room (one with `ticksPerSec`) after 8 seconds without a word from the room, which probes every 2 seconds (not while the player is away or the game is hidden).\n- **Reconnecting** waits half a second, then doubles each try up to 8 seconds, with no limit, and `room.connectionStatus` is `"reconnecting"` meanwhile. Your game keeps the same room object: the `players` event and your game server\'s messages carry on once it\'s back.\n- **The room drops** a connection with no ping or message for 75 seconds (a closed laptop, lost signal): Zaisma rooms check every 30 seconds, the Node runner every 5. The SDK says goodbye as the page closes, so most players who leave do so at once.\n- **`room.connectionStatus` is the socket only:** `"connecting"`, `"open"`, `"reconnecting"` or `"closed"`. Whether the player is in the match is `room.awayReason` (below), so a player who walked away with the socket still open stays `"open"`.\n- **Sends wait while it\'s down:** reliable `room.send` and `room.sendBytes` calls made while `connectionStatus` isn\'t `"open"`, or while the player is away, are kept in order and go once the room lets them back in, before any latest-only sends that waited. Up to 60 wait (the room\'s burst, so the flush never trips `too_fast`); past that the oldest is dropped and the `error` event says `send_queue_full` once per outage. Both calls return `false` only once the room is gone (ended, kicked or left).\n\n### Dropped players\n\nA blip is the most common thing that goes wrong online, so a player whose connection drops stays in the match for a while instead of leaving it:\n\n- **Away, reason `lost`:** the player stays in `room.players` for `reconnectTimeoutSec` (30 by default, 0 to 300). The game server\'s `onAway(state, player, room, { reason: "lost" })` runs if it has one, `room.awayReason(playerId)` answers `"lost"`, and every player\'s game sees `awayReason: "lost"` for them in `room.players` and the `players` event. They don\'t count as playing, nothing is sent to them, and their seat counts toward `maximumPlayerCount`. If they were the host, the next player is host until they\'re back.\n- **Freeze them:** a game that does nothing shows them standing still. A real-time game can freeze their character, skip their turn or pause the match: in `onTick`, skip players whose `room.awayReason(playerId)` is `"lost"`, and in the game, draw them dimmed or "reconnecting" from `awayReason`.\n- **Back in time:** the SDK reconnects by itself, `onBack(state, player, room)` runs (not `onJoin`, and `canJoin` isn\'t asked), and `awayReason` goes back to `null` for everyone. Send them the full state in `onBack`, since they missed what was sent meanwhile.\n- **Not back in time:** they leave the match as before: `onLeave` with reason `lost`, and the room holds their seat for `seatHoldDurationSec`, so a later return gets `onJoin` with `joinInfo.isReturning`.\n- **`reconnectTimeoutSec: 0`** takes a dropped player out of the match at once (`onLeave`, reason `lost`), as before this option.\n- **`onAway` takes over idle and hidden too:** with `onAway`, a player who goes idle or hidden stays in the room until your game decides (below). To freeze dropped players while leaving idle and hidden ones to the room, read `room.awayReason` in `onTick` instead of adding `onAway`; `onBack` alone changes nothing else.\n\nReal-time rooms notice a silent drop within seconds (their probes); turn-based rooms keep the slower 75-second check, so they can sleep between moves.\n\n### Updates\n\nA version you publish (or roll back to) reaches running matches at their next match, or now: `match_update_mode` `"next_match"` (the default) or `"now"` on `publish_version`, on `upload_files` and `POST /games/:slug/versions` with `publish_when_approved`, `zaisma publish --match-update-mode now`, `zaisma upload \u2026 --publish-when-approved --match-update-mode now`, or Update running games now on the dashboard.\n\n- **Now, in a match:** every live room of the game hears it within seconds (a room that slept through it finds it within a minute of waking). Players\' games get the room\'s `versionUpdate` event, `{ versionId, appliesAt, isReloading }`, to show a countdown or save. Without `onVersionUpdate`, the match switches 10 seconds later. With `onVersionUpdate(state, versionUpdate, room)`, the room waits for your game server: call `room.applyVersionUpdate()` at a good moment, like the end of a round, or it switches at `versionUpdate.appliesAt`, 5 minutes on.\n- **The switch:** the room saves, its connections close with code `4004`, and the new version\'s game server starts from the saved state: `onRestored(state, restoreInfo, room)` runs with `restoreInfo.savedVersionId`, the version that saved it, so you can bring an older state up to date (or `room.end()` the match if you can\'t). When only the game server changed, players\' games reconnect by themselves in a second or two. When the game\'s own files changed (`isReloading`), the game page reloads the game in place at the new version, with its save, and `Zaisma.joinRoom()` with no code brings the player back into the same room. Players come back as dropped players do (away, reason `lost`, for `reconnectTimeoutSec`, then a held seat), so a slow reload still finds its place. The game page\'s bar says Updating meanwhile; nothing covers the game.\n- **Now, not in a match** (a single-player game, or a menu): never forced. The game page notices within 2 minutes. A game listening to `Zaisma.versions.on("update", (update) => \u2026)` switches when it says, with `update.apply()` (at a checkpoint, back at its menu), and the page reloads it with its save; otherwise the bar beside the game shows Update, and the player taps it when they\'re ready, or gets the new version the next time they open the game.\n- **Next match:** nothing changes for running matches: a room keeps the version it started on until its match ends.\n- **A room on another version:** a player always plays the version their room runs. A Zaisma room whose game server runs another version than the player\'s game (an open tab from before a publish, or a friend\'s match still finishing on the version before) turns a newcomer away with `other_version`, and on the game\'s Zaisma page the game reloads at the room\'s version, with its save, and joins it; your game never sees it. While the room runs it, the game\'s address serves that version\'s files to the room\'s players, as long as it\'s one you could roll back to (the live version and the last 5 that passed), and not held or taken down. Players already in the room are never turned away this way, and rooms with a built-in game server have no version of their own. Outside Zaisma, through a tester link, or when that version is no longer kept, the join fails with `other_version`.\n- **On your own server** `onVersionUpdate` never runs and `room.applyVersionUpdate()` does nothing: the game page still reloads players\' games after a `now` publish when they\'re not in a match, and you restart your server to switch it (the Node runner brings its matches back, below).\n\n### Restarts\n\nZaisma restarts its rooms whenever Zaisma itself is updated, and a match carries on:\n\n- **Saved every few seconds:** a real-time room saves its game server\'s state every `stateSaveIntervalSec` (5 by default, 1 to 60), only when it changed, and once more when everyone walks away or leaves; a turn-based room saves after every change, as always. A state over 32 MB as JSON isn\'t saved: the game\'s logs say so once, and a restart starts that room fresh.\n- **Back a few seconds behind:** the restarted room starts from the last save instead of `setup`; a real-time room (one with `ticksPerSec`) also runs `onRestored(state, restoreInfo, room)` once, and so does a turn-based room that had players in its match (it loses no moves, only the connections): `restoreInfo.savedAt` (an ISO time) and `restoreInfo.lostDurationSec`, the seconds of play since then that are lost. Use it to resync clocks or tell players.\n- **Players come back as dropped players:** everyone who was in the match is away with reason `lost` (`room.awayReason` answers it in `onRestored`), `onAway` runs for each, and they have the whole `reconnectTimeoutSec` from the restart. Their connections drop (the Node runner closes them with code `1012` as it stops), the SDK reconnects to the same room by itself, and `onBack` runs for each one back; anyone who isn\'t leaves as `lost` (above).\n- **A room that empties** keeps its saved state for a day, so players rejoining it find the match as it was (a real-time room\'s `onRestored` runs then too, with `lostDurationSec` 0: it saved as the last player left). A kept room keeps it until it ends (see Kept rooms below). A match that ends keeps nothing.\n- **On your own server** the Node runner saves to its `--room-state-file` (`zaisma-room-states.sqlite`) the same way, and saves every room when it\'s stopped, so a clean restart loses nothing.\n\n### Walking away\n\nPlayers who walk away stop holding seats and running matches, with no code:\n\n- **Idle:** after `idleTimeoutSec` without input (600 by default, 30 to 86400), the SDK asks "Still there?" for 30 seconds; no answer, and they walk away (`idleCheck`: `"server"`, the default, `"client"` or `"off"`).\n- **Hidden:** in a real-time room, a game hidden for 2 minutes counts as away.\n- **What happens:** with `awayMode: "hold"` (the default), they leave the match (`onLeave`, reason `idle` or `hidden`) and the room holds their seat for `seatHoldDurationSec` (300 by default, up to 1800, 0 for none); any input brings them back, and `onJoin` gets `joinInfo.isReturning`. `awayMode: "lobby"` sends them to the room that made this one (`room.reserve`). With `onAway`, they stay in the room and your game decides: kick them, move them or keep them.\n- **In the game:** the `idle` event hands `{ idleStatus, answerTimeoutSec }`: `"asking"` when it\'s time to ask (listening replaces Zaisma\'s "Still there?" plate), then `"answered"` on input or `"timed_out"` as the room hears they walked away. The `away` event hands `{ awayReason, seatHoldDurationSec }` and `room.awayReason` says `"idle"` or `"hidden"` until they\'re back. The `back` event hands `{ roomCode, isSeatHeld, rejoin() }`: `isSeatHeld: true` once the room let them back into their held seat; `false` on their first input after the seat ran out, when listening for `back` leaves rejoining to your game (`back.rejoin()`), and without a listener the SDK rejoins by itself.\n\n### Message limits\n\n- **From each player:** up to 16 KB a message (or bytes), and 30 a second with a burst of 60. The SDK throws `too_big` before sending one over 16 KB; past the rate, that message is refused with an `error` event (`too_fast`) and the connection stays open.\n- **Who sent it:** a message or bytes the game server passes on from one player carries `fromPlayerId` (its send options\' `fromPlayerId`; the relay always sets it), and the game\'s `message` event hands `(message, fromPlayerId)`, `bytes` hands `(bytes, fromPlayerId)`, with `null` for the game server\'s own.\n- **Join and setup data:** up to 4 KB of JSON (`joinData`, `setupData`).\n- **From the room:** what your game server sends isn\'t capped, but a player who can\'t keep up is dropped (below).\n\n### Ping and the room\'s clock\n\n- **Ping:** the game server reads a player\'s round trip with `room.pingDurationMs(playerId)`, and the player\'s game reads its own with `room.pingDurationMs`: the same number, in milliseconds, smoothed so one slow packet doesn\'t make it jump. It\'s `null` until the first measurement, right after the player joins.\n- **Measured by the room:** the room sends each player a small probe right after they join, every 2 seconds while a real-time room ticks (turn-based rooms keep sleeping between moves), and whenever 256 KB has gone out to them; the SDK answers it at once. Answers aren\'t game messages: they don\'t count toward a player\'s 30 a second, your message stats or the idle check. Since the room measures it, a player can only make their ping look worse by answering late, never better, so cap any lag compensation that uses it.\n- **One clock:** `room.serverTimeMs()` is the room\'s clock now, in epoch milliseconds, on the game server (like `Date.now()`) and in every player\'s game, where the SDK estimates it from the probes. A time the game server sends means the same moment for everyone, like `{ startsAtMs: room.serverTimeMs() + 3000 }` for a countdown.\n\n### Slow connections\n\nA player whose connection can\'t keep up is dropped before the room has to hold a growing backlog for them: when a probe has gone unanswered for 8 seconds, or 2 MB has gone out to them since the last probe they answered. Their connection closes with code `4003` and they become a dropped player (above): away with reason `lost` for `reconnectTimeoutSec`, while the SDK reconnects by itself, so they come back caught up. Send a returning player the full state in `onBack`, and in `onJoin` when `joinInfo.isReturning`, not just what changed (state sync does it by itself). A room\'s memory for its players stays bounded, and one bad connection can\'t stall a match for everyone else.\n\nBefore that, a connection can be **backed up**: 64 KB or more sent to it and not through yet. On your own server, that\'s the socket\'s `bufferedAmount`; in Zaisma rooms, 64 KB or more sent since the last probe the player answered, while a probe of theirs is 250 ms later than their ping. State sync skips a backed-up player and latest-only messages wait for them (below), so a slow player never builds a queue of stale updates.\n\n### State sync\n\nAn optional building block for real-time worlds, the same in Zaisma rooms and on your own server: your game server keeps its state as a plain object, and with `stateSyncEnabled: true` each player\'s game gets it without your code sending anything.\n\n- **A full copy, then what changed:** a player gets their whole view as they join (and after reconnecting), then, after each tick (or each handler, in a turn-based game), only what changed since their last: `{ type: "state", serverTimeMs, full }`, then `{ type: "state", serverTimeMs, changes }`. Each change is `[path, value]` (set) or `[path]` (remove), with `path` the keys and indexes from the top: objects by key, arrays by index while their length stays the same and whole when it changes. `serverTimeMs` is the room\'s clock as it was sent. Nothing goes out when nothing a player sees changed.\n- **Each player\'s view:** `stateView(state, viewer, room)` answers what `viewer` sees, like only what\'s near them in a big world or without the other team\'s hand; without it, everyone sees the whole state. It runs for every player on every tick, so keep it cheap, and it only answers: a call in it that changes the room or sends (`room.broadcast`, `room.kick`, `room.end`, ...) throws `room_call_unavailable`, which the game\'s logs show; reading (`room.players`, `room.roomCode`) works. A view over 1 MB as JSON isn\'t sent, and the game\'s logs say so once.\n- **In the game:** `room.state` is this player\'s view (null until the first update), the `"state"` event hands `(state, changes)` (`changes` null after a full copy), and `room.smoothedState({ delayMs })` answers the state `delayMs` (100 by default, up to 1000) behind the room\'s clock, between the two updates around then: numbers blended in a straight line (integers in between come back as fractions, and an angle that wraps blends the long way), anything else as the older one had it. Predicting the player\'s own moves stays your game\'s.\n- **Backed up:** a player whose connection is backed up gets nothing until they\'ve caught up, then a full copy, so a slow spell costs one copy instead of a growing queue. There are no acknowledgements: over the room\'s connection a change can\'t be lost.\n- **Where it runs:** where the state is, in your game server\'s sandbox on Zaisma (its time counts as the game server\'s CPU) and in the room on your own server. The state goes as JSON, so keep it plain; its updates count as `(state)` in `get_stats`.\n\n### Latest-only messages\n\n`room.broadcast`, `room.send`, `room.broadcastBytes` and `room.sendBytes` on the game server, and `room.send` and `room.sendBytes` in the game, take `{ delivery, latestKey }`:\n\n- **`delivery: "reliable"`** (the default) reaches every player, in order.\n- **`delivery: "latest_only"`** may be dropped: while a player\'s connection is backed up, a newer latest-only message with the same `latestKey` replaces the one waiting, and the newest goes once they catch up (oldest key first, before anything newer). For positions sent every tick, or where a player aims. A player keeps up to 64 waiting, one per key; past it, the least recently replaced is dropped.\n- **`latestKey`**, up to 40 characters, says which messages replace each other, like `"position"`, and `latest_only` needs one: without it the send throws: in the game (the SDK) the error\'s code is `bad_send_option`, and on the game server it is a `GameServerError` with the code `bad_room_call` and the room call (like `room.broadcast`) as its field. Bytes have their own keys.\n- **Zaisma rooms carry them over the WebSocket today**, since Cloudflare doesn\'t yet let Workers take WebTransport or WebRTC data channels; the same `delivery: "latest_only"` moves to real datagrams once it does, with no change to your game. **On your own server, the fast lane carries them as datagrams already** (below). Anything else for `delivery` or `latestKey` throws in your code, naming what to give: the SDK\'s error has the code `bad_send_option`; the game server\'s is a `GameServerError` (`bad_room_call`) saying the same.\n\n### The fast lane to your own server\n\n`Zaisma.joinRoom({ serverUrl: "wss://play.example.com", transport: "webtransport" })` joins a room on your own server over WebTransport (HTTP/3 over UDP) instead of the WebSocket. The Node runner serves it with `--webtransport-port`, `--certificate-path` and `--certificate-key-path` (`startServer({ webtransportPort, certificatePath, certificateKeyPath })`, all three or none); any other server can speak it too. `transport` is `"websocket"` (the default) or `"webtransport"`, else the SDK refuses it with `bad_transport`; a `serverUrl` that isn\'t `wss://` or `https://`, and Zaisma\'s own rooms, use the WebSocket either way. If WebTransport isn\'t there, its session is refused, or it isn\'t up within 3 seconds (`FAST_LANE_CONNECT_TIMEOUT_MS`), the room uses the WebSocket for the rest of its life and logs one console warning; a fast lane that worked and then dropped is tried again first. `room.transport` says what the connection uses now.\n\nThe wire:\n\n- **The session** is at `https://<server>/v1/rooms/<game>/<code>`: the `serverUrl`\'s host and port, with `wss:` read as `https:`. The browser sends the page\'s `Origin`; check it as you do for the WebSocket. The certificate must be a real one for that name (browsers check it as for any HTTPS site).\n- **One bidirectional stream**, opened by the client first, carries every frame the WebSocket carries, in order: each is `[4-byte big-endian payload length][1-byte kind: 0 text, 1 bytes][payload]`. Text is the same UTF-8: the JSON messages (`hello`, `welcome`, `probe`, `probe_answer`, ...) and `ping`/`pong`. Bytes are the same binary frames: from the room, `[1-byte sender ID length][sender ID][bytes]`; from the client, the bytes alone.\n- **A datagram** is `[1-byte kind][payload]`, with the same payloads, and carries only `latest_only` sends, both ways, when it fits the session\'s `maxDatagramSize`; a bigger one goes on the stream. Take datagrams only from a player you let in.\n- **Closing:** the session\'s close info carries the WebSocket\'s close codes and reasons (`closeCode` 4000 to 4004, as in [Close codes](#close-codes)).\n\nA server of your own that isn\'t the Node runner (Rust, C++, a studio\'s engine) needs to: accept WebTransport sessions at that path and check `Origin`; read the hello from the stream and verify its pass against your game\'s keys at `https://rooms.zaisma.com/v1/pass-keys/<gameSlug>`; answer each `probe` the room protocol says to send, and every `ping` with `pong`; send the same frames on the stream, and `latest_only` ones as datagrams when they fit.\n\n### Room error codes\n\nA room answers a refusal with `{ type: "error", code, message }`, then closes the connection (`4001`, or `1013` for `busy`); a message it can\'t take gets the same `error` and the connection stays open. In the SDK they are `error.code` and the `error` event.\n\n| Code | Meaning |\n| --- | --- |\n| `room_full` | The room has no space for another player. |\n| `room_closed` | The room isn\'t taking new players (`room.setOpen(false)`). |\n| `ended` | The match is over. |\n| `too_big` | A message over 16 KB, or `joinData` over 4 KB. |\n| `too_fast` | More messages than the room takes (30 a second, burst of 60). |\n| `bad_message` | A message the room couldn\'t read or use. |\n| `bad_pass` | The player pass wasn\'t accepted; the SDK gets a new one and tries once more. |\n| `bad_player_token` | A game played off Zaisma sent a `playerToken` your own server didn\'t take (its `identifyPlayer` said no, or it takes no guests); the game gets the player a new one. |\n| `no_hello` | The first message wasn\'t a hello with a player pass (or, to your own server, a `playerToken`). |\n| `not_allowed` | Only the game server or the room\'s host can do that. |\n| `game_unavailable` | The game can\'t be played right now. |\n| `busy` | The room couldn\'t take the player right now; the SDK tries again soon. |\n| `kept_out` | The player was removed for the rest of the match. |\n| `refused` | The game server\'s `canJoin` turned the player away. |\n| `room_not_running` | The room isn\'t running, like one with nobody playing to watch. |\n| `rented_share_used` | This player is on a rented-server network, and the share of the game\'s hosting such traffic gets is used; everyone else plays on. Zaisma\'s page tells them to turn off their VPN or sign in. |\n| `hosting_paused` | The game\'s hosting is paused this month, or Zaisma\'s free room time ran out; new rooms open again when it resets or its developer adds credit and a budget. |\n| `account_needed` | The game needs a Zaisma account for multiplayer, and the player is a guest. |\n| `game_not_open_to_player` | The account is younger than the game\'s minimum age. |\n| `blocked_player_here` | Someone the player blocked is in the room; `quickJoin` tries other rooms first. |\n| `other_version` | The room runs another version of the game (see Updates above). |\n| `spectators_full` | The room takes no more spectators. |\n| `spectator_cannot_send` | A spectator tried to send to the room. |\n| `already_playing` | A player in the room tried to watch it too. |\n| `bad_origin` | The connection didn\'t come from the game\'s own page. |\n| `send_queue_full` | The SDK\'s own: more than 60 sends waited while it reconnected, so the oldest were dropped. |\n| `chat_not_here` | A chat message reached a room whose server doesn\'t take chat (an older runner). |\n| `chat_not_allowed` | `room.chat` from a guest, or a player whose chat is set to nobody or paused (`room.canChat` is `false`). |\n| `chat_empty` | `room.chat` with nothing but spaces. |\n| `chat_too_long` | `room.chat` over 2000 characters. |\n| `chat_too_fast` | More than 20 chat messages in 10 seconds from one player. |\n| `bad_region` | The SDK\'s own: a `region` that isn\'t a continent code (`"AF"`, `"AN"`, `"AS"`, `"EU"`, `"NA"`, `"OC"` or `"SA"`). |\n| `bad_idle_timeout` | The SDK\'s own: an `idleTimeoutSec` that isn\'t from 30 to 86400. |\n| `bad_transport` | The SDK\'s own: a `transport` that isn\'t `"websocket"` or `"webtransport"`. |\n| `zaisma_rooms_not_used` | The SDK\'s own: the game doesn\'t use Zaisma rooms, so there are none to join or list. |\n\n### Close codes\n\n| Code | Why | What the SDK does |\n| --- | --- | --- |\n| `4000` | The match ended (`room.end`, or Zaisma ending it) | Stops: `connectionStatus` `"closed"`, after the `ended` event with its `endReason` |\n| `4001` | The room refused the player (an `error` with the code comes first, like `room_full`, `bad_origin` or `game_unavailable`), removed them (`room.kick`), or they joined from another tab | Stops: `connectionStatus` `"closed"` |\n| `4002` | The seat held for a player who walked away ran out | `connectionStatus` `"closed"`; waits for the player to come back, then the `back` event with `isSeatHeld: false` |\n| `4003` | The connection stopped answering probes or fell too far behind | Reconnects by itself, as a dropped player |\n| `4004` | The match switched to a version published `"now"` | Reconnects by itself, or the page reloads the game at the new version (`isReloading`) |\n| `1012` | The Node runner is restarting | Reconnects by itself, as a dropped player |\n| `1013` | Zaisma rooms are busy (an `error` with `busy` comes first) | Reconnects by itself, waiting longer each try |\n\nAny other close (a network drop) reconnects by itself too.\n\n### Room events\n\nEvery event the game\'s room object has, and what its listener gets. Within v1, events and error codes only grow, so keep a `default` for ones you don\'t know.\n\n| Event | Listener gets |\n| --- | --- |\n| `message` | `(message, fromPlayerId)` |\n| `bytes` | `(bytes, fromPlayerId)` |\n| `state` | `(state, changes)` |\n| `players` | `(players)`, each `{ id, name, kind, awayReason }` |\n| `connectionStatus` | `(connectionStatus)` |\n| `settings` | `{ isListed, isOpen, friendJoinsEnabled, name, labels, spectatorCount }` |\n| `ended` | `{ message, endReason }`: `game`, `no_players`, `hosting_paused`, `kept_room_deleted`, `game_unavailable` or `game_server_stopped` |\n| `ending` | `{ endsAt }` |\n| `endingCancelled` | `()`: the end `ending` announced is off, since the game\'s hosting started again; `room.endsAt` is `null` |\n| `kicked` | `{ message, isKeptOut }` |\n| `chat` | `{ fromPlayerId, text, hasSwearing, hasSlur, sentAt }`: another player\'s chat line (see Chat) |\n| `move` | `{ roomCode, follow(), join(joinOptions) }` |\n| `moved` | `{ roomCode, fromRoomCode }` |\n| `idle` | `{ idleStatus, answerTimeoutSec }` |\n| `away` | `{ awayReason, seatHoldDurationSec }` |\n| `back` | `{ roomCode, isSeatHeld, rejoin() }` |\n| `muted` | `(playerIds)` |\n| `error` | `{ code, message }` |\n| `versionUpdate` | `{ versionId, appliesAt, isReloading }` |\n| `roomMessage` | `{ message, senderKind, fromRoomCode, sentAt }`: a room message for a room whose game server has no `onRoomMessage` (see Reaching live rooms) |\n\nThe SDK and rooms say which messages they speak with `protocolVersionNumber` (1 today): the SDK sends it in its hello, and the welcome answers the room\'s. A room skips a message type it doesn\'t know, so a newer SDK still plays in an older room.\n',
|
|
60444
|
+
"developer-api": '<!-- Made by scripts/build-skill.mjs: never edit it by hand. -->\n\n# Developer API\n\nOne API behind the developer MCP, the upload command (`packages/cli`) and the dashboard (zaisma.com/dashboard, `apps/site/src/dashboard.ts`), so they always agree. Base: `https://zaisma.com/api/dev`. Every answer is JSON. Errors say what happened, which input, and what to do (see Errors below), and every call that changes something answers with `next_steps` (see Next steps).\n\nNames follow [`docs/NAMING.md`](NAMING.md): each one says what it holds, what kind of value and in what unit (`file_count`, `size_bytes`, `play_duration_min`, `width_px`), times are ISO 8601 in UTC (`created_at: "2026-10-14T09:30:00.000Z"`) and come in the same way, every ID says its kind (`version_8f3k\u2026`, `topic_9x2m\u2026`, `post_4kq7\u2026`; an ID of another kind is refused with `wrong_id_kind`, saying what it is and where the right one comes from), a plural is always a list, and every answer has the same keys every time (`null` when not set). Inputs are closed: a field or query parameter a call doesn\'t take is refused (`unknown_field`), never quietly ignored, and so is a value that isn\'t one of its choices; a call that takes no body refuses one (`unknown_field` for its first key, `bad_json` for anything that isn\'t a JSON object), though an empty body or `{}` passes. The JSON Schema of each answer is in `apps/site/src/schemas.ts`.\n\n## The MCP\n\nAny AI tool that supports remote MCP servers can manage your games at `https://zaisma.com/mcp`, signed in with the same API key. In Claude Code:\n\n```bash\nclaude mcp add --transport http zaisma https://zaisma.com/mcp --header "Authorization: Bearer $ZAISMA_KEY"\n```\n\nApps that can\'t send a key connect by signing in instead. In claude.ai: Settings \u2192 Connectors \u2192 Add custom connector, with `https://zaisma.com/mcp`; ChatGPT and other apps the same way, wherever they add a remote MCP server. The app opens a Zaisma page where you choose what it may do and tap your passkey, then you\'re back in the app with every tool working. The key command above stays the way for Claude Code and the upload command.\n\nEvery tool is a call to this API (`apps/site/src/mcp.ts`): `list_games`, `create_game`, `get_game`, `get_playing_now`, `get_whats_on`, `update_game`, `check_game` (what Zaisma would refuse in a game and what won\'t work on Zaisma, before uploading; see Checking a game below), `upload_files` (small games up to 5 MB, sent as file contents), `get_version`, `update_version` (a version\'s notes before it\'s live), `publish_version` (also rolls back and publishes later), `cancel_scheduled_publish`, `end_preview_links`, `add_image`, `remove_image`, `add_shader`, `check_shader` (a shader drawn as the check would, before it\'s sent; see Backgrounds below), `remove_shader`, `set_background`, `preview_game_page` (pictures of every place players meet the game, from what you\'re still designing; see Seeing it as players do below), `add_tester_link`, `update_tester_link`, `remove_tester_link`, `get_reports`, `get_stats`, `get_history`, `get_qr_code` (the game\'s link, or a room\'s, as a QR code), `export_game` (everything about a game as one .zip; see Export everything below), `get_logs` (what the game server printed, see A game server\'s logs below), `get_player`, `get_access` (what the key can do), `get_activity` (your account\'s activity, needs a full key), `list_api_keys` (your keys and connected apps with their end dates, last use and whether Zaisma turned one off; needs a full key), the sign-in apps\' `list_sign_in_apps`, `create_sign_in_app`, `update_sign_in_app` and `delete_sign_in_app`, hosting credit\'s `get_credit`, `top_up_credit`, `refund_top_up`, `start_ai_review`, `start_credit_plan`, `change_credit_plan`, `stop_credit_plan` and `get_spending_request` (see Hosting and credit below), Zaisma Pro\'s `get_pro`, `start_pro`, `cancel_pro`, `resume_pro` and `refund_pro` (see Zaisma Pro below), `get_storage`, `set_storage_budget`, `delete_version` and `delete_game`, `bring_back_game`, `erase_game_now`, `get_game_deletion_request` (see Storage below), the Stripe account\'s `get_stripe_account`, `connect_stripe_account`, `update_stripe_account` and `disconnect_stripe_account` (see Selling with the buy sheet below), the webhooks\' `list_webhooks`, `create_webhook`, `update_webhook`, `delete_webhook`, `test_webhook` and `list_webhook_deliveries` (see Webhooks below), a game\'s secrets\' `list_secrets`, `set_secret` and `delete_secret` (see Secrets below), the items\' `list_items`, `set_item`, `remove_item`, `set_purchase_settings`, `grant_item`, `list_purchases`, `get_purchase`, `refund_purchase`, `mark_purchase_handled` and `get_player_items` (see Items and purchases below), a game\'s kept rooms\' `list_kept_rooms`, `delete_kept_room`, `bring_back_kept_room` and `erase_kept_room_now`, `restore_kept_room`, `undo_kept_room_restore`, `list_kept_room_restores`, `restore_every_kept_room`, `get_kept_room_restore_batch`, `undo_every_kept_room_restore` (see Kept rooms below), a game\'s live rooms\' `list_rooms`, `get_room`, `send_room_message`, `send_to_every_room`, `list_room_messages`, `cancel_room_message`, `kick_player` and `end_room` (see Reaching live rooms below), the game database\'s `get_database`, `query_database`, `batch_database`, `export_database`, `import_database`, `erase_player`, `restore_database` and `undo_database_restore` (see The game database below), cloud saves\' `list_saves`, `get_save`, `change_save`, `replace_save`, `reset_save`, `list_save_copies`, `get_save_copy` and `restore_save_copy` (see Cloud saves below), and the developer forum\'s `search_forum`, `get_topic`, `post_topic`, `message_zaisma`, `reply_to_topic`, `vote`, `rate_post`, `bookmark_post`, `report_post`, `forum_people`, `still_happening`, `flag_misplaced`, `follow_topic` and `mark_answer` (see The developer forum below). Bigger builds go through the upload command. Making a game players can play private or a draft again, and ending a live room (`end_room`), need `"confirm": true`, so the AI asks you first.\n\nEvery tool has an output schema, and answers are compact JSON. Arguments are closed: one a tool doesn\'t take is refused (`unknown_field`, with the arguments it does take), never quietly dropped, and a missing required one is `missing_field`. A refused call is a tool result with `isError: true`, the error object below as its `structuredContent` and its message, fix and code as its text; each tool\'s listed output schema is its answer or that error, because MCP clients check both against it. The tools that are easy to get wrong (`update_game`, `check_game`, `upload_files`, `publish_version`, `search_forum`, `post_topic`, `change_save`, `replace_save`, `set_secret`) carry good examples in their input schema and bad ones at the end of their description.\n\n## Teaching your AI\n\nZaisma teaches any AI its own workflow, the same way everywhere, from one source in the repository (`skills/zaisma/`, the open SKILL.md format):\n\n- **The skill.** `npx @zaisma/cli skill` installs the Zaisma skill into every AI tool it finds on the computer: Claude Code (`~/.claude/skills/zaisma`), Codex (`~/.codex/skills/zaisma`), Cursor (`~/.cursor/skills/zaisma`), Gemini CLI (`~/.gemini/skills/zaisma`), and the shared `~/.agents/skills/zaisma` that several tools read. It writes only where a tool\'s own folder is already there (and always the shared one), lists each folder and asks once first; `--yes` skips the question, `--project` installs into the current project\'s folders instead, and `--folder <folder>` into one folder only. With `--json` it needs `--yes` (`install_not_confirmed` otherwise) and answers `{ installed_copies: [{ tool, folder }], skipped_tools }`. It never writes over a `zaisma` skill it didn\'t install (`skill_not_ours`). Every later run of any `zaisma` command updates the copies it installed to its own version, saying so in one line (with `--json`, a `skill_updates` list of `{ tool, folder, from_version, to_version }` in the answer).\n- **The Claude Code plugin,** the MCP and the skill together, from this repository: `/plugin marketplace add zaisma/zaisma`, then `/plugin install zaisma@zaisma`.\n- **The MCP\'s resources and prompts.** With nothing installed, any AI connected to the MCP reads the same skill: resources `zaisma://skill` (read first), `zaisma://sdk`, `zaisma://naming`, `zaisma://errors`, `zaisma://game-server` and `zaisma://developer-api` (this page), and the guides `zaisma://multiplayer`, `zaisma://loading`, `zaisma://phones` and `zaisma://saves`, each opened only when the game needs it (`resources/list`, `resources/read`, all `text/markdown`). Three prompts start from the moments an AI starts from (`prompts/list`, `prompts/get`): `make_game` (`idea`), `publish_game` (`slug`) and `fix_problem` (`slug`, and `error_code` or `version_id`, one of them).\n- **llms.txt.** `https://zaisma.com/llms.txt` answers "tell me about Zaisma" in the llms.txt format; `https://zaisma.com/llms-full.txt` is the skill, this page and the SDK reference in one file.\n- **Error pages.** Every error code has its own page, `https://zaisma.com/developers/errors/<code>` (all of them at `/developers/errors`), with what it means and the general fix, and every error answer links it as `help_url`.\n\n## Errors\n\nEvery error, in the API and the MCP, has the same shape:\n\n```json\n{"error": {"code": "bad_play_modes", "message": "The online mode\'s play_style is missing or isn\'t co-op, versus or both.", "field": "play_modes[1].play_style", "fix": "Give play_style: co-op (together), versus (against each other) or both, like { \\"mode\\": \\"online\\", \\"minimum_player_count\\": 2, \\"maximum_player_count\\": 4, \\"play_style\\": \\"co-op\\" }.", "message_for_people": "One of the ways to play isn\'t one Zaisma knows. Check Players and save again.", "retry_after_sec": null, "help_url": "https://zaisma.com/developers/errors/bad_play_modes"}}\n```\n\n- `code`: stable, one problem per code, from the list below; search the forum with it (`search_forum`) to find others who hit it. Codes named `bad_<field>` mean that input\'s value isn\'t one the call takes.\n- `message`: what happened, in one sentence.\n- `field`: the input at fault, with its place in a list when it\'s in one (`files[3].path`, `debug_context.call`), or `null`.\n- `fix`: what to do about it, naming the call or the value when there is one.\n- `message_for_people`: what happened and what to do, in a page\'s words, naming no call or field: the only text Zaisma\'s pages show. Show it to your human as it is when they should read what the dashboard would say.\n- `retry_after_sec`: how long to wait when waiting helps (`slow_down`, `post_limit`, `still_scanning`), also sent as the `Retry-After` header; otherwise `null`.\n- `help_url`: the code\'s page, `https://zaisma.com/developers/errors/<code>`: what it means and the general fix. The fix in the answer is for this case, and comes first.\n- `confirm_url`: only with `confirmation_needed`, where the developer does it themselves on zaisma.com with their passkey (see Hosting and credit).\n- `spending_request_id`: only with `confirmation_needed` for a raise in spending; `GET /spending-requests/:spending_request_id` checks the developer\'s answer (IDs `spending_request_\u2026`).\n- `game_deletion_request_id`: only with `confirmation_needed` for deleting a game or erasing a kept room\'s world; `GET /games/:slug/deletion-requests/:game_deletion_request_id` checks the developer\'s answer (IDs `game_deletion_request_\u2026`).\n\nThe HTTP status goes with the code, as listed. The list lives in `ERROR_CODES` (`packages/core/src/errors.ts`), and a test keeps this page in step with it.\n\n**Signing in and requests**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_key` | 401 | The MCP was called without an API key or a connected app\'s token. |\n| `bad_key` | 401 | The API key isn\'t valid: removed, mistyped or never made. |\n| `key_turned_off` | 401 | The API key was found in public and turned off for good. |\n| `key_ended` | 401 | The API key reached the end date it was made with. |\n| `access_token_ended` | 401 | A connected app\'s access token is past its hour; the app refreshes it by itself. |\n| `token_not_for_api` | 401 | A connected app\'s token works only at the MCP, not the REST API. |\n| `signed_out` | 401 | No API key, and no signed-in session. |\n| `no_account` | 401 | The account isn\'t finished yet. |\n| `bad_origin` | 403 | A call with a session came from another site. |\n| `key_not_allowed` | 403 | The API key is limited to other games, or its access doesn\'t cover the call. |\n| `slow_down` | 429 | Too many calls in a minute. |\n| `not_found` | 404 | There\'s no API call at that path. |\n| `bad_method` | 405 | The path doesn\'t take that method. |\n| `gone` | 410 | The call was removed, like the first feedback calls. |\n| `bad_json` | 400 | The body isn\'t a JSON object. |\n| `json_too_big` | 413 | The JSON body is over the call\'s size limit. |\n| `wrong_shape` | 400 | A field that isn\'t the type or size its call takes, refused before any of the call\'s own code runs. |\n| `unknown_field` | 400 | A field, argument or query parameter the call doesn\'t take. |\n| `missing_field` | 400 | A field the call needs wasn\'t sent. |\n| `wrong_id_kind` | 400 | An ID of another kind was sent, like an image ID as version_id. |\n| `internal_error` | 500 | Something broke on Zaisma\'s side. |\n\n**Games**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_game` | 404 | You have no game with that slug. |\n| `bad_slug` | 400 | The link name isn\'t lowercase letters, numbers and single hyphens, or is reserved. |\n| `slug_taken` | 409 | Another game has that link name, or a deleted game had it. |\n| `too_many_games` | 403 | The account has as many games as it can have. |\n| `account_banned` | 403 | Zaisma banned the account\'s developer side, or the whole account: only get_access, list_games and export_game work, and for a whole-account ban nothing does. |\n| `account_paused` | 403 | A person at Zaisma needs to look at the account: until then it can\'t make, upload or publish games, or post on the forum. |\n| `publishing_not_open` | 403 | Until the beta, only accounts Zaisma adds can make, upload and publish games. |\n| `bad_title` | 400 | A game\'s, topic\'s or precedent\'s title is empty or too long. |\n| `title_names_zaisma` | 400 | A game\'s title holds the whole word Zaisma, which only Zaisma\'s own games can use. |\n| `bad_description` | 400 | The description isn\'t text of up to 500 characters. |\n| `bad_visibility` | 400 | visibility isn\'t draft, listed, unlisted or private. |\n| `bad_devices` | 400 | devices isn\'t a list of phone, tablet and computer. |\n| `bad_genres` | 400 | genres isn\'t a list of up to 3 of Zaisma\'s genres. |\n| `bad_controls` | 400 | controls isn\'t a list of touch, keyboard_mouse and gamepad. |\n| `bad_screen_orientation` | 400 | screen_orientation isn\'t portrait, landscape, either or null. |\n| `bad_play_modes` | 400 | play_modes isn\'t a list of play modes, or one of them is wrong. |\n| `bad_cloud_saves_enabled` | 400 | cloud_saves_enabled isn\'t true or false. |\n| `bad_account_offer_enabled` | 400 | account_offer_enabled isn\'t true or false. |\n| `bad_deleted_account_erase_enabled` | 400 | deleted_account_erase_enabled isn\'t true or false. |\n| `bad_friend_joins_enabled` | 400 | friend_joins_enabled isn\'t true or false. |\n| `bad_performance_measuring_enabled` | 400 | performance_measuring_enabled isn\'t true or false. |\n| `bad_room_browsing` | 400 | room_browsing isn\'t page, game or off. |\n| `bad_multiplayer_mode` | 400 | multiplayer_mode isn\'t none, relay or own. |\n| `bad_account_requirement` | 400 | account_requirement isn\'t none, multiplayer or whole_game. |\n| `bad_minimum_player_age` | 400 | minimum_player_age_years isn\'t 13, 16 or 18. |\n| `accounts_needed_for_minimum_age` | 400 | A game for 16 or 18 and up needs account_requirement whole_game, since only accounts have an age. |\n| `content_needs_minimum_age` | 409 | A version shows lifelike gore, which plays only in games for 16 and up. |\n| `gallery_picture_needed` | 409 | A listed game needs at least one gallery picture. |\n| `bad_links` | 400 | links isn\'t a list of up to 20 { link_name, destination_url, is_on_game_page } with names of their own and https addresses that aren\'t link shorteners, IP addresses, addresses with a user name, or on Zaisma\'s own domains. |\n| `bad_own_server_urls` | 400 | own_server_urls isn\'t a list of up to 5 server addresses like wss://play.example.com, or one is an IP address, this computer or on Zaisma\'s own domains. |\n| `bad_game_server_allowed_hosts` | 400 | game_server_allowed_hosts isn\'t a list of up to 20 host names (like discord.com or *.example.com), or one is an IP address or on Zaisma\'s own domains. |\n| `built_in_server` | 403 | The game runs a game server built into Zaisma, which only Zaisma changes. |\n| `game_removed` | 403 | Zaisma took the game down, so this can\'t change. |\n| `needs_confirm` | 409 | Hiding a game players can play, or ending a live room, needs the developer\'s OK. |\n| `bad_period_duration_days` | 400 | period_duration_days isn\'t a whole number from 1 to 90. |\n| `bad_cursor` | 400 | cursor isn\'t a next_cursor from an earlier answer. |\n\n**Players**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_player` | 404 | No account has that player ID: a guest\'s, or a deleted account\'s. |\n\n**Covers, gallery pictures, backgrounds and other images**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_kind` | 400 | kind isn\'t one of the choices the call takes. |\n| `not_an_image` | 415 | The file isn\'t an image of a type the call takes. |\n| `image_too_big` | 413 | The image is over 10 MB. |\n| `bad_image_dimensions` | 400 | The image is smaller than its kind\'s least size (a cover or gallery picture 1280 by 720, a square cover 512, a share picture 600 by 315), or over 8,192 px on a side. |\n| `not_square` | 400 | A square cover isn\'t as wide as it is tall. |\n| `too_many_gallery_pictures` | 400 | The game has 8 gallery pictures already. |\n| `image_refused` | 422 | The image can\'t be used. |\n| `no_image` | 404 | The game has no image with that ID. |\n| `no_file` | 400 | A form on Zaisma\'s pages was sent without its image. |\n| `bad_background_shape` | 400 | A wide background is landscape (1.3 to 2.4 times as wide as tall), a phone background portrait (1.6 to 2.4 times as tall as wide), and its long side at least 1600 px. |\n| `not_a_shader` | 400 | A shader\'s pass isn\'t GLSL text with a mainImage function, or has its own main(), a #version or #extension line, texture2D, iMouse or sound. |\n| `shader_too_big` | 413 | A shader\'s pass is over 64 KB. |\n| `bad_buffers` | 400 | buffers isn\'t a list of { buffer_name, source, channels } with buffer_name a, b, c or d, each once. |\n| `too_many_buffers` | 400 | A shader has more than 4 buffers. |\n| `bad_shader_channel` | 400 | A channel isn\'t { channel_index 0 to 3, input_kind, buffer_name or image_id, filter, wrap }, names a buffer the shader doesn\'t have, or a texture that isn\'t an approved shader_texture of the game. |\n| `shader_texture_too_big` | 413 | A shader texture is over 8 MB, or over 4,096 px on a side. |\n| `too_many_shader_textures` | 400 | The game has 16 shader textures already, or a shader\'s channels name more than 4. |\n| `shader_texture_in_use` | 409 | A shader the game keeps reads this texture. |\n| `daily_shader_checks_used` | 429 | The account has run 100 shader checks in the last day. |\n| `daily_page_previews_used` | 429 | The account has run every page preview its plan has in the last day (20, or 60 with Pro). |\n| `page_preview_unavailable` | 503 | Zaisma can\'t open pages in Chrome right now, so it can\'t picture them. |\n| `bad_page_preview_images` | 400 | images isn\'t a list of up to 8 { kind, image_base64 } or { kind, image_id }, with kind cover, share, screenshot, background or phone_background. |\n| `bad_page_preview_shaders` | 400 | shaders isn\'t a list of { screen, image, buffers } with each screen at most once. |\n| `shader_check_unavailable` | 503 | Zaisma can\'t draw shaders here right now, so it can\'t check one. |\n| `no_shader` | 404 | The game has no shader with that ID. |\n| `bad_screen` | 400 | screen isn\'t wide or phone. |\n| `bad_background_source` | 400 | source isn\'t zaisma, image or shader, or wide (which only phone takes). |\n| `background_not_ready` | 409 | The image or shader isn\'t this game\'s, isn\'t approved yet, or is for the other screen. |\n| `bad_color` | 400 | The color isn\'t #RRGGBB. |\n\n**Uploading versions**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_files` | 400 | files isn\'t a list of files in the shape the call takes. |\n| `bad_path` | 400 | A file\'s path is absolute, has . or .. in it, has control characters or is over 200 characters. |\n| `hidden_file` | 400 | A file or folder\'s name starts with a dot. |\n| `precompressed_file` | 400 | A file is pre-compressed (.gz or .br). |\n| `file_type_not_allowed` | 400 | A file is of a type games can\'t have. |\n| `file_too_big` | 413 | A file is over 500 MB. |\n| `duplicate_path` | 400 | Two files share a path. |\n| `no_index_html` | 400 | There\'s no index.html at the top of the game. |\n| `too_many_files` | 400 | The game has more than 20,000 files. |\n| `storage_full` | 413 | The upload doesn\'t fit in what the account can store. |\n| `new_data_limit` | 429 | The account has sent all the new data it can today, counted from UTC midnight. |\n| `too_big_for_mcp` | 413 | upload_files and check_game take up to 5 MB; bigger builds go through the upload command. |\n| `bad_base64` | 400 | Something sent as base64 isn\'t valid base64. |\n| `files_missing` | 409 | Some of the version\'s files haven\'t been sent yet. |\n| `bad_patch_notes` | 400 | patch_notes isn\'t text of up to 2,000 characters, or a publish changed them on a version that has been live. |\n| `bad_is_big_update` | 400 | is_big_update isn\'t true or false, or an upload sent it without publish_when_approved. |\n| `big_update_needs_patch_notes` | 400 | A big update has no patch_notes, and a big update must say what\'s new. |\n| `big_update_already_live` | 400 | The version has been live already, and only a version going live for the first time can be a big update. |\n| `bad_publish_when_approved` | 400 | publish_when_approved isn\'t true or false. |\n| `bad_publish_after_ai_review_enabled` | 400 | publish_after_ai_review_enabled isn\'t true or false, or it came with nothing to publish. |\n| `bad_match_update_mode` | 400 | match_update_mode isn\'t next_match or now, or it came without publish_when_approved. |\n| `version_limit` | 429 | The game has had 100 versions in the last day. |\n| `version_in_use` | 409 | The version can\'t be deleted: it\'s live, set to publish, or a tester link picked it. |\n| `kept_for_review` | 403 | The version or game is kept for a person at Zaisma, so it can\'t be deleted. |\n| `bad_confirm_slug` | 400 | confirm_slug isn\'t the game\'s link name. |\n| `not_waiting_to_erase` | 409 | The game isn\'t deleted and waiting to be erased, so there\'s nothing to bring back or erase now. |\n| `already_erasing` | 409 | The game\'s week is over and its erasing has started, so it can\'t be brought back. |\n| `played_by_others` | 409 | Other people played this game, so it waits out its week before it\'s erased; only a game nobody but its developer played can be erased at once. |\n| `no_game_deletion_request` | 404 | This game has no deletion request with that ID. |\n| `bad_monthly_storage_budget_cents` | 400 | monthly_storage_budget_cents isn\'t null or a whole number from 100 to 1,000,000. |\n| `no_content_length` | 411 | A file was sent without a Content-Length header. |\n| `file_needs_parts` | 413 | A file over 95 MB was sent in one go. |\n| `no_body` | 400 | A file was sent without a body. |\n| `hash_mismatch` | 400 | A file doesn\'t match the SHA-256 it was sent as. |\n| `forbidden_file` | 400 | A file is a program or an archive, whatever its name says. |\n| `bad_size_bytes` | 400 | size_bytes isn\'t a whole number above 0. |\n| `bad_part_number` | 400 | A part\'s number isn\'t from 1 to 10,000. |\n| `no_upload_id` | 400 | A part was sent without its upload_id. |\n| `bad_part_size` | 400 | A part is empty, over 50 MB or has no Content-Length header. |\n| `upload_closed` | 400 | The upload_id isn\'t an open upload any more. |\n| `bad_parts` | 400 | The finishing call isn\'t { upload_id, parts: [{ part_number, etag }] }. |\n| `parts_incomplete` | 400 | The parts sent don\'t make a whole file. |\n\n**Versions and publishing**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_version` | 404 | The game has no version with that ID. |\n| `bad_time` | 400 | A time isn\'t an ISO time in the range it takes: scheduled_publish_at from a few minutes to 90 days ahead, a tester link\'s ends_at from now to a year ahead, a database restore\'s restore_to_at within the last 30 days and not before the game was made, a room message\'s send_at from 10 seconds to 90 days ahead, and a What\'s on entry\'s starts_at from an hour ago to 90 days ahead and its ends_at after now and starts_at and at most 60 days after it. |\n| `still_scanning` | 409 | The version is still being scanned. |\n| `not_approved` | 409 | The version didn\'t pass review, so it can\'t be published. |\n\n**Tester links**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_name` | 400 | A tester link\'s or sign-in app\'s name isn\'t 1 to 60 characters, or a sign-in app\'s says Zaisma. |\n| `too_many_tester_links` | 403 | The game has 50 tester links on already. |\n| `no_tester_link` | 404 | The game has no tester link on with that ID. |\n| `bad_version_choice` | 400 | version_choice isn\'t live, newest_passed or picked, or picked_version_id doesn\'t go with it. |\n\n**Sign in with Zaisma**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_redirect_urls` | 400 | redirect_urls isn\'t a list of 1 to 10 https URLs (http only for localhost) without #fragments. |\n| `bad_replace_client_secret` | 400 | replace_client_secret isn\'t true or false, or the app is public and has no client secret. |\n| `too_many_sign_in_apps` | 403 | The account has 20 sign-in apps already. |\n| `no_sign_in_app` | 404 | You have no sign-in app with that ID. |\n| `bad_destination_kind` | 400 | destination_kind isn\'t endpoint_url or game_server. |\n| `bad_endpoint_url` | 400 | endpoint_url isn\'t an https URL on a name (no IP address, user name or #fragment), or it\'s on Zaisma\'s own domains, or it\'s given for a webhook to a game server, which has none. |\n| `bad_event_kinds` | 400 | event_kinds isn\'t a list of 1 or more of the webhook event kinds. |\n| `bad_game_slugs` | 400 | game_slugs isn\'t null or a list of 1 to 50 of your games\' slugs, or, for a webhook to a game server, a list of the one game whose server it is. |\n| `bad_replace_signing_secret` | 400 | replace_signing_secret isn\'t true or false. |\n| `too_many_webhooks` | 403 | The account has 10 webhooks already. |\n| `no_webhook` | 404 | You have no webhook with that ID. |\n\n**The game database**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_sql` | 400 | The SQL isn\'t one statement SQLite takes, or statements isn\'t a list of { sql, values }. |\n| `bad_values` | 400 | values isn\'t a list of text, numbers, null and { blob_base64 } for the SQL\'s ?s. |\n| `bad_player_id` | 400 | player_id isn\'t a player ID (player_\u2026). |\n| `too_many_rows` | 400 | A statement answered more than 10,000 rows. |\n| `integer_too_large` | 400 | A statement answered a whole number past 2^53, which JavaScript can\'t hold exactly. |\n| `answer_too_big` | 400 | The rows answered come to more than 8 MB. |\n| `database_full` | 403 | The statement would grow the game\'s storage (its database and kept rooms) past the 10 GB a game can keep. |\n| `database_unavailable` | 503 | The game\'s database didn\'t answer. |\n| `database_restore_unavailable` | 501 | This Zaisma\'s game databases can\'t go back in time: its storage keeps no history, like a local preview. |\n| `no_database_restore` | 404 | The game has no database restore with that ID in the last 30 days. |\n| `bad_secret_name` | 400 | A secret\'s name isn\'t capitals, digits and underscores starting with a capital, up to 64 characters. |\n| `bad_secret_value` | 400 | secret_value isn\'t text of up to 8 KB. |\n| `no_secret` | 404 | The game has no secret by that name. |\n| `too_many_secrets` | 403 | The game has 50 secrets, the most it can have. |\n| `secrets_unavailable` | 503 | The game\'s secrets didn\'t answer. |\n| `no_kept_room` | 404 | The game has no kept room with that code. |\n| `no_kept_room_restore` | 404 | The kept room has no restore with that ID in the last 30 days. |\n| `no_kept_room_restore_batch` | 404 | The game has no restore of every kept room with that ID in the last 30 days. |\n| `kept_room_restore_unavailable` | 501 | This Zaisma\'s rooms can\'t go back in time: their storage keeps no history, like a local preview. |\n| `kept_room_restore_batch_running` | 409 | The game\'s kept rooms are going back to a moment already, and one batch runs at a time. |\n| `kept_room_copies_unavailable` | 501 | This Zaisma can\'t read its kept rooms\' copies, so an erased kept room can\'t come back. |\n| `no_kept_room_copy` | 404 | No copy of the deleted world is left: a copy lasts about 28 days after a world is deleted. |\n| `room_code_in_use` | 409 | Another room of the game has that code now, so the deleted world can\'t come back under it. |\n| `game_storage_full` | 403 | The deleted world doesn\'t fit in the 10 GB a game can keep. |\n| `kept_room_not_waiting` | 409 | The kept room isn\'t deleted and waiting to be erased, so there\'s nothing to bring back or erase now. |\n| `kept_room_erasing` | 409 | The kept room\'s week is over and its erasing has started: in a minute it comes back only from its last copy. |\n| `no_room` | 404 | The game has no live room with that code on Zaisma. |\n| `no_player_in_room` | 404 | That player isn\'t in the room now. |\n| `bad_room_message` | 400 | message isn\'t plain JSON of up to 16 KB. |\n| `bad_labels` | 400 | labels isn\'t a list of up to 4 labels, each { label_name, label_value } of text. |\n| `bad_kick_message` | 400 | A kick\'s message isn\'t text of up to 200 characters. |\n| `bad_end_message` | 400 | An end\'s message isn\'t text of up to 200 characters. |\n| `room_busy` | 429 | The room took 100 room messages in the last second. |\n| `every_room_send_limit` | 429 | The game sent to every room 10 times in the last minute, from its game server, the API and the MCP together. |\n| `too_many_scheduled_room_messages` | 409 | The game has 100 scheduled room messages waiting, the most it can have. |\n| `no_scheduled_room_message` | 404 | The game has no scheduled room message with that ID waiting. |\n| `dump_too_big` | 413 | dump_sql is over 5 MB: import a dump in parts, each ending on a whole statement. |\n\n**Hosting and credit**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `hosting_paused` | 429 | The game\'s hosting is paused this month: its free allowance, its budget or its developer\'s credit is used, or Zaisma\'s free hosting ran out and it has no budget with credit, or it has no real players and games with none used their share. It starts again when the month resets, the budget is raised or credit is added. |\n| `confirmation_needed` | 403 | This needs the developer\'s passkey on zaisma.com (turning spending on or up, connecting a Stripe account, deleting a game other people played, or erasing a waiting game or kept room\'s world at once): confirm_url is where they do it. |\n| `bad_monthly_budget_cents` | 400 | monthly_budget_cents isn\'t a whole number of cents of at least 100 ($1), or null for no paid hosting. |\n| `bad_top_up_amount` | 400 | amount_cents isn\'t a whole number of cents from 1,000 ($10) to 100,000 ($1,000). |\n| `account_not_protected` | 403 | The account has no passkey and no email yet, and a top-up keeps a card, so it needs one of them first: add a passkey or an email on zaisma.com/account. |\n| `money_paused` | 423 | Top-ups and credit refunds on this account passed USD 2,000.00 in a day, so both are paused until a person at Zaisma looks. Credit already there keeps working. The developer gets an email when they\'re on again. |\n| `new_payer_limit` | 403 | A new account, or an account with a newly saved card, pays up to USD 100.00 in all, buys and credit together, in its first 7 days; this payment would go past it. The message says the day it lifts. |\n| `no_top_up` | 404 | You have no top-up with that ID. |\n| `no_spending_request` | 404 | You have no spending request with that ID. |\n| `top_up_not_refundable` | 409 | The top-up has nothing left to refund: it\'s spent, refunded, or over 30 days old. |\n| `bad_refill_level_cents` | 400 | refill_level_cents isn\'t a whole number of cents from 1,000 ($10) to 1,000,000 ($10,000). |\n| `already_credit_plan` | 409 | The developer already has a monthly credit plan, so there\'s nothing to start: change its level or stop it. |\n| `no_credit_plan` | 409 | The developer has no monthly credit plan to change or stop. |\n| `already_pro` | 409 | The developer already has a Zaisma Pro subscription (running, cancelled until the month ends, or a renewal Stripe is retrying), so there\'s nothing to start. |\n| `pro_not_refundable` | 409 | Zaisma Pro\'s payment can\'t be refunded: only the first payment, within 14 days of it, and only while it\'s the only one. |\n| `not_pro` | 409 | There\'s nothing to cancel or resume: the developer has no Zaisma Pro, or it\'s already cancelled (or isn\'t cancelled). |\n| `stripe_unavailable` | 503 | Stripe didn\'t answer, or this Zaisma has no Stripe account set up. |\n\n**A game server\'s logs**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `bad_room_code` | 400 | room_code isn\'t a room\'s code: six characters like K7Q2MX. |\n| `bad_minimum_level` | 400 | minimum_level isn\'t debug, info, warn or error. |\n| `bad_source_kind` | 400 | source_kind isn\'t room, request, schedule or webhook. |\n| `bad_search_text` | 400 | search_text is empty or over 200 characters. |\n| `bad_maximum_line_count` | 400 | maximum_line_count isn\'t a whole number from 1 to 500. |\n| `two_log_cursors` | 400 | get_logs got both cursor and new_lines_cursor. |\n\n**Items and purchases**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_item` | 404 | The game has no item by that name. |\n| `too_many_items` | 400 | The game has 1,000 items, the most it can have. |\n| `bad_item` | 400 | An item\'s name, title, description, kind, category, price or local prices isn\'t one set_item takes; field says which. |\n| `unsupported_currency` | 400 | Zaisma doesn\'t price in that currency. |\n| `price_too_low` | 400 | The price is under the least Stripe charges in its currency. |\n| `refund_policy_needed` | 409 | A game that sells anything states its refund policy first. |\n| `bad_refund_policy` | 400 | refund_policy isn\'t no_refunds, unused_within_14_days, within_14_days, own_words or null. |\n| `bad_refund_policy_text` | 400 | refund_policy_text isn\'t up to 600 characters of plain words, or doesn\'t go with refund_policy own_words. |\n| `bad_own_payment_categories` | 400 | own_payment_categories isn\'t a list of cosmetic, gameplay, content and currency. |\n| `item_has_owners` | 409 | Players bought or were granted the item, so it can\'t be removed; take its price off to stop selling it. |\n| `bad_item_count` | 400 | item_count isn\'t a whole number from 1 to 1,000, isn\'t 1 for a permanent item, or makes a buy\'s total more than 99,999,999 minor units. |\n| `bad_game_account_id` | 400 | game_account_id isn\'t text of up to 200 characters, or null. |\n| `bad_purchase_source` | 400 | purchase_source isn\'t sale or grant. |\n| `bad_purchase_status` | 400 | purchase_status isn\'t pending, completed, failed, refunded or charged_back. |\n| `no_purchase` | 404 | The game has no purchase with that ID. |\n| `already_refunded` | 409 | The purchase was refunded or charged back already. |\n| `stripe_not_connected` | 409 | Selling with the buy sheet, and refunding a sale, go through the developer\'s own Stripe account, which isn\'t connected: connect_stripe_account. |\n| `stripe_cannot_take_payments` | 409 | The developer\'s Stripe account is connected, but Stripe hasn\'t turned on payments for it yet: finish setting it up on Stripe\'s dashboard. |\n| `stripe_account_banned` | 403 | The Stripe account was banned from Zaisma with the account that connected it, so it can\'t be connected again. |\n| `email_banned` | 403 | The email was banned from Zaisma with the account it was on, so it can\'t be added to an account. |\n| `bad_is_stripe_tax_used` | 400 | is_stripe_tax_used isn\'t true or false. |\n| `bad_amount_minor_units` | 400 | amount_minor_units isn\'t a whole number from 1 to what\'s left of the sale to refund. |\n| `purchase_not_paid` | 409 | The sale wasn\'t paid (pending or failed), so there\'s nothing to refund. |\n| `not_for_sale` | 409 | The item has no price, so players can\'t buy it; it\'s only granted. |\n| `receipts_unavailable` | 503 | Zaisma couldn\'t sign the purchase\'s receipt at that moment. A grant answered with it wasn\'t made, so trying again grants it once. |\n| `bad_purchase_delivery` | 400 | purchase_delivery isn\'t game, game_server or own_server. |\n| `no_game_server` | 409 | purchase_delivery game_server needs a game server, on Zaisma or the developer\'s own, and the game has none. |\n| `already_handled` | 409 | The purchase was handed over already, or its refund was told already. |\n| `handled_by_server` | 409 | The game\'s purchases go to its game server or the developer\'s own server (purchase_delivery), so the game can\'t mark them handled. |\n| `bad_full_game_item` | 400 | full_game_item_name doesn\'t name one of the game\'s items that\'s permanent and content, or the game is another game\'s demo. |\n| `full_game_item_in_use` | 409 | The item is the game\'s full game (full_game_item_name), so it can\'t be removed or stop being permanent and content. |\n| `bad_demo_game` | 400 | demo_game_slug isn\'t another of the developer\'s games that\'s free to play, or the game itself is free to play. |\n| `account_requirement_locked` | 400 | A game that sells itself (full_game_item_name) needs account_requirement whole_game, since only accounts own it. |\n| `full_game_not_owned` | 403 | The game sells itself, and the player\'s account doesn\'t own it: buy it on its game page. |\n\n**Cloud saves**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_save` | 404 | The player has no save in the game. |\n| `no_save_copy` | 404 | The player\'s save has no earlier version with that ID. |\n| `bad_keys` | 400 | keys isn\'t a list of 1 to 100 localStorage keys of up to 1,000 characters. |\n| `bad_local_storage_items` | 400 | local_storage_items isn\'t an object of localStorage keys and their text (null removes a key in a change). |\n| `bad_indexeddb_databases` | 400 | indexeddb_databases isn\'t a list of databases, each { name, version, stores } as get_save answers them. |\n| `save_too_big` | 413 | The save would be over 5 MB. |\n| `cloud_saves_off` | 409 | The game has cloud saves off, so it doesn\'t read saves from players\' accounts. |\n| `cloud_saves_not_here` | 409 | Cloud saves don\'t work here: this is a tester link, or this Zaisma has no accounts. The game page answers it to `Zaisma.saves` and `Zaisma.player.offerAccount()`; no API or MCP call returns it. |\n| `save_busy` | 409 | The player\'s game kept saving at the same moment, so the change didn\'t go through. |\n\n**The developer forum**\n\n| Code | HTTP | Meaning |\n| --- | --- | --- |\n| `no_topic` | 404 | There\'s no topic with that ID you can see. |\n| `no_post` | 404 | There\'s no post with that ID you can see in the topic. |\n| `no_known_issue` | 404 | There\'s no known issue with that ID. |\n| `no_media` | 404 | There\'s no image there you can see. |\n| `bad_tab` | 400 | tab isn\'t latest, top, unanswered, known, yours, messages or bookmarks. |\n| `bad_section` | 400 | section isn\'t one of the forum\'s sections. |\n| `bad_category` | 400 | category isn\'t one of the forum\'s categories. |\n| `no_category` | 400 | A public topic was sent without its category. |\n| `bad_tag` | 400 | tag isn\'t one of the forum\'s tags. |\n| `bad_tags` | 400 | tags isn\'t a list of up to 3 of the forum\'s tags. |\n| `bad_topic_status` | 400 | topic_status isn\'t one of the statuses. |\n| `bad_is_answered` | 400 | is_answered isn\'t true or false. |\n| `bad_maximum_topic_count` | 400 | maximum_topic_count isn\'t a whole number from 1 to 30. |\n| `bad_detail` | 400 | detail isn\'t brief. |\n| `bad_post_selection` | 400 | post_selection isn\'t all, answer, latest or none. |\n| `bad_is_public` | 400 | is_public isn\'t true or false. |\n| `bad_text_markdown` | 400 | text_markdown is empty or over 8,000 characters. |\n| `bad_author_kind` | 400 | author_kind isn\'t developer or ai. |\n| `bad_debug_context` | 400 | debug_context isn\'t an object of its five text fields, up to 8,000 characters in all. |\n| `bad_images_base64` | 400 | images_base64 isn\'t a list of base64 images. |\n| `too_many_images` | 400 | A post carries more than 10 images. |\n| `bad_reopen` | 400 | reopen isn\'t true or false. |\n| `bad_answer_post_id` | 400 | answer_post_id isn\'t a post ID or null. |\n| `bad_reason` | 400 | reason isn\'t one of the report reasons. |\n| `post_limit` | 429 | The account has posted 100 times in the last day. |\n| `image_limit` | 429 | The account has uploaded 200 forum images in the last day. |\n| `not_yours` | 403 | Only the developer who started the topic can do that. |\n| `not_a_question` | 400 | Only a question has an answer to mark. |\n| `not_closed` | 400 | The topic isn\'t closed, so there\'s nothing to reopen. |\n| `not_released` | 400 | The topic isn\'t a known issue whose fix is out. |\n| `cant_vote` | 400 | The topic doesn\'t take your vote: it\'s yours, private, or a discussion. |\n| `cant_flag` | 400 | Only public topics others can see can be flagged as misplaced. |\n| `retired_tool` | 410 | The tool is retired; the error names the one that replaces it. |\n| `bad_rating` | 400 | rating isn\'t like or dislike. |\n| `cant_rate_post` | 400 | Only posts in public topics take likes and dislikes. |\n| `cant_rate_own_post` | 400 | Your own posts take no likes or dislikes from you. |\n| `cant_report` | 400 | The post can\'t be reported: it\'s yours, or Zaisma\'s. |\n\n## Next steps\n\nEvery call that changes something answers with `next_steps`: the calls that usually follow, ready to make, or `[]` when nothing does. The steps of sending files (`PUT /files/:sha256`, the parts calls and `POST /forum/media`) are the exception: their next call is always the one that uses them.\n\n```json\n"next_steps": [{"tool": "get_version", "arguments": {"slug": "sky-hopper", "version_id": "version_8f3k2m9q1x7c4v6b0n5z"}, "after_sec": 30, "reason": "The scan usually takes under a minute; once it passes, show the developer its preview_url."}]\n```\n\n- `tool` is the MCP tool\'s name (each maps to a call on this page); `arguments` are filled in as far as Zaisma knows, and `reason` says what to add (like a new game\'s files).\n- `after_sec`: how long to wait first, or `null` for straight away.\n- What follows today: a restored kept room, its undo and restores (`undo_kept_room_restore`, `list_kept_room_restores`); a restore of every kept room, its progress and the database and version calls with the same time (`get_kept_room_restore_batch`, `restore_database`, `publish_version`); a new game, its upload (`upload_files`); a new version, checking its scan (`get_version`); publishing while the game is a draft or private, making it `listed` when the developer wants players in (`update_game`); making a game `listed` or `unlisted` with nothing live, publishing the version that passed (`publish_version`), checking the one being scanned, or uploading one; `multiplayer_mode: "own"` without a game server, uploading one; scheduling a version still being scanned, checking its scan; a new webhook, or a new `endpoint_url` or signing secret, sending it a test event (`test_webhook`); a database restore, seeing the tables it went back to (`get_database`) and undoing it (`undo_database_restore`); an undo, `get_database`; a new image or shader, checking it (`get_game`); a shader check that passed, sending the same shader (`add_shader`, with its `image` and `buffers` to add); a new credit checkout or refund, `get_credit`; a new Zaisma Pro checkout or a Pro refund, `get_pro`; a kept room deleted, `list_kept_rooms`; a send to every room, `list_rooms`; a scheduled one, `list_room_messages` once it\'s due and `cancel_room_message`; a kick, `get_room`; an ended room, `list_rooms`; a secret set while the game server has no allowed hosts, `update_game` with `game_server_allowed_hosts`; a database import, `get_database`; `minimum_player_age_years` set to 16 or 18, which passes the versions held only for lifelike gore, `get_version`; a priced item before the Stripe account is connected or can take payments, and a new Stripe account connection, `get_stripe_account`. Other calls answer `[]` today; read `next_steps` on every answer, since more calls fill it within v1.\n\n## The AI review\n\nThe fixed checks (malware scan, image matching and Zaisma\'s own file checks) run on every upload, and any can stop it. The AI review follows for what other people can reach, and only the newest live version is reviewed, the same for every developer.\n\n- **A version only its developer can reach gets none and never waits:** a draft, or a live version of a `draft` or `private` game with no tester link on and nothing sold. Until a review lets it through, its `preview_url` opens only for the game\'s signed-in developer. An AI tests with `npx @zaisma/cli play-locally`, or starts the review.\n- **Before publishing,** `is_ai_review_needed_to_publish` says whether publishing starts a review, and `usual_ai_review_duration_min` how long a review like it usually takes, from recent real ones, not a promise: a batch can take much longer.\n- **While it runs,** `ai_review_step` says where it is (`waiting_for_daily_review`, `in_line`, `reading_files`, `judging`) and `ai_review_step_started_at` since when; waiting for a daily review, `ai_review_waiting_ahead_count` says how many of the account\'s reviews of the same size go first and `daily_review_free_at` when one frees up for it. The dashboard shows the same, and moves with it.\n- **A developer who has earned it** (`GET /access`, `standing.publish_before_ai_review_enabled`: established, a card that paid or a Stripe account that can take payments, with no ruling in 30 days) publishes straight away, with the review pending. With `publish_after_ai_review_enabled` it goes live only once it passes.\n- **Until then, what other people can reach waits for the review:** a publish stays off and goes live once it passes; a hidden game set `listed` or `unlisted` stays hidden, with `visibility_after_ai_review` saying what it becomes; a tester link says the game is being reviewed. A game\'s first review runs at full price in about a minute, and updates in half-price batches, usually under an hour. A tweak (nothing new in the evidence) reuses the earlier verdict.\n- **A game with 1,000 counted plays in the last 7 days** is reviewed at once, at full price.\n- **Ahead of a launch,** `POST /games/:slug/versions/:version_id/ai-review` (`start_ai_review`) starts a review without publishing. A scheduled release\'s review starts by itself up to a day before its time when other people can reach the game. If it isn\'t done on time, a developer who has earned it goes live anyway, and anyone else goes live when it passes.\n- **A stop** rolls the game back to the last version that passed, in running matches too, or with none leaves the game with no live version and its `review_reason`, until a fix goes live. The version\'s `findings` give the reason and the fix. The `ai_review_finished` webhook says when any review ends.\n- **Past the review\'s monthly budget,** versions go on with the fixed checks alone (`ai_review_status` `skipped`, with the note `ai_review_budget_used`). Nobody waits for a person.\n- **Files are read once.** A file any version that passed already had read is never read again, whoever sends it.\n\n`ai_review_status` is `not_started`, `waiting`, `reviewing`, `passed`, `stopped` or `skipped`; `ai_review_speed` is `at_once` or `batch`.\n\n## Holds and takedowns\n\nWhen Zaisma holds, rejects or takes something down, it says why, the same way in the dashboard, these answers and the MCP: a `review_reason`, with the same parts as an error plus the content rule it\'s about.\n\n```json\n"review_reason": {"code": "taken_down", "message": "The game\'s login screen asks players for their Steam password.", "content_rule": "malware", "fix": "If it\'s a mistake, or to say what you\'ll change, message_zaisma with the game_slug. Until Zaisma restores it, the game can\'t get new versions or change who can play it.", "message_for_people": "A person at Zaisma took the game down for the reason given. Until Zaisma restores it, the game takes no new versions. If it\'s a mistake, message Zaisma."}\n```\n\n- `code`: stable, one problem per code, from the list below, never the same as an error code; search the forum with it (`search_forum`).\n- `message`: what happened and why, in plain words: the code\'s meaning, or for the AI review and a person at Zaisma, their own words.\n- `content_rule`: the content rule it\'s about ([zaisma.com/legal/content-rules](https://zaisma.com/legal/content-rules), each rule at `#<rule>`), or `null` when it breaks none, like a check that couldn\'t finish. A hold names the rule a person checks it against; a rejection or takedown, the rule it broke.\n- `fix`: what to do about it, naming the call when there is one.\n- `message_for_people`: what happened and what to do, in a page\'s words, naming no call or field: the only text Zaisma\'s pages show. Show it to your human as it is when they should read what the dashboard would say.\n\nWhere it shows:\n\n- **A game\'s `review_reason`**: why it\'s `held` or `removed`; `null` while it\'s `pending` or `live`.\n\nZaisma acts on `copyright`, `defamation` and `trademark` only when someone sends a notice ([zaisma.com/legal/dmca](https://zaisma.com/legal/dmca), [zaisma.com/legal/defamation](https://zaisma.com/legal/defamation), [zaisma.com/legal/trademark](https://zaisma.com/legal/trademark)), in a game\'s files and on its covers, backgrounds and title alike, and doesn\'t judge the notice itself: the game is `held` with `copyright_notice`, `defamation_notice` or `trademark_notice`, and the message says what the notice names. The game can still get new versions: publish one without it, and a person at Zaisma checks it and shows the game again, usually within a day (publishing tells Zaisma; there\'s nothing more to send). If the notice is wrong, the developer sends a counter-notice instead, which goes to the person who sent the notice; the game is back after 10 working days unless they say they\'ve gone to court. The scan and the AI review never look for either rule.\n\nWhen a country\'s law forbids what US law allows (the UK\'s hatred offences, say), a notice from a court, regulator or police there blocks the game for players in that country only, and everyone else still plays it: it\'s in the game\'s `country_blocks` with `country_law_notice`, whose message says which law and what it names, and the `game_blocked_in_country` alert. Players there get a page saying it isn\'t available in their country (HTTP 451), and Zaisma\'s lists, its files and Zaisma rooms leave it out there; its preview links still open, so you can check a fix from there. The game keeps its versions and can publish more: publish one without what the notice names, and a person at Zaisma checks it and lifts the block, usually within a day. If the notice is wrong, write to safety@zaisma.com with the game\'s slug and why. A `country_blocks_changed` webhook says when a block starts or ends.\n\n- **A version\'s `review_reason`**: a person rejected it, or a report paused the update; `null` otherwise. Its `findings` are what the scan found that holds or rejects it, each `{"code", "severity", "message", "content_rule", "path", "fix", "message_for_people"}`, where `severity` is `reject` (it can\'t go live) or `hold` (a person at Zaisma looks first, usually within a day). A finding with severity `info` is a note and holds nothing: `unregistered_link`, `unlisted_address` and `api_key_in_files`. A game that bumps into a protection the sandbox already enforces (a plain `window.open`, a call to an address that isn\'t Zaisma rooms or its own servers) passes with a note; a game that tries to get around one (a site opened with no tap, a link or address built from pieces, the page outside the frame, a peer connection from a frame of its own) is rejected as `ai_protection_dodged`. The version that only removes what held or rejected a game passes by itself, with no daily review used.\n\nThe AI review judges each content rule by one yes/no test, shown under the rule at [zaisma.com/legal/content-rules](https://zaisma.com/legal/content-rules) (`CONTENT_RULE_DETAILS` in `packages/core/src/review.ts`). A version whose files answer a test yes is rejected within minutes, with the rule, the line it found and the fix, and no person; so is obfuscated code, which the review can\'t read (a minified build is fine). The AI review holds a version for a person only for lifelike gore (`ai_lifelike_gore`, which the game\'s age setting decides) or when it can\'t finish.\n- **An image\'s `review_reason`**: why it wasn\'t approved.\n- **`get_history`**: each hold, rejection and takedown with its `review_reason`, kept after it\'s over.\n- **A hold or rejection released because the review was wrong:** if the review got it wrong, `message_zaisma` with the `version_id`. When a person at Zaisma approves a version the AI review held or rejected, `get_history` says "A person looked and released this hold. It didn\'t count against your daily reviews." with the version\'s ID, and that review is given back: it doesn\'t count toward your 5 judged reviews a day.\n- **Errors:** `game_removed` and `not_approved` put the reason\'s code and message in theirs, and its fix as theirs.\n\nThe list lives in `REVIEW_CODES` and the rules in `CONTENT_RULES` (`packages/core/src/review.ts`), and a test keeps this page in step with them. Rule says which content rule a code is about: one rule always, `none` when it breaks none, or `picked` when the person deciding picks it each time.\n\n**The scan\'s checks**\n\n| Code | Rule | Meaning |\n| --- | --- | --- |\n| `crypto_miner` | `malware` | The code mines cryptocurrency. |\n| `packed_code` | `malware` | Code is packed or decoded at runtime (eval of encoded text), which hides what it does. |\n| `top_navigation` | `malware` | The code tries to change the page outside the game (the top or parent window\'s location). |\n| `relay_bypass` | `malware` | The code makes a WebRTC connection from a frame of its own, which skips Zaisma\'s relay and would show players each other\'s internet address. |\n| `password_field` | `malware` | The game has a password field. Games don\'t need one, and phishing pages do. |\n| `external_form` | `personal_details` | The game has a form that sends what players type to another site. |\n| `antivirus_flag` | `malware` | Antivirus engines flag a file: three or more reject the version, fewer hold it for a person. |\n| `unregistered_link` | none | The game opens a site with window.open or a link that opens a new tab. The sandbox blocks that, so players tapping it get nothing. |\n| `unlisted_address` | none | The game connects to an address that isn\'t Zaisma rooms or one of its own servers. The game\'s security policy blocks it, so the call fails for players. |\n| `matches_another_developers_game` | `copyright` | Most of this version\'s files are already in another developer\'s game, so a person at Zaisma looks first. |\n| `matches_banned_account_files` | none | Most of its files match a game Zaisma took down. |\n| `api_key_in_files` | none | A Zaisma API key was in the game\'s files, so Zaisma turned it off: anyone who plays the game could have read it. |\n\n**Checks that couldn\'t finish (no rule broken)**\n\n| Code | Rule | Meaning |\n| --- | --- | --- |\n| `too_much_code` | none | The game has more code than the review reads (about 19 MB of text), so a person at Zaisma looks first. |\n| `too_many_pictures_inside_packs` | none | The game\'s packs hold more pictures than image matching checks inside them (10,000), so the first 10,000 were matched. |\n| `image_matching_off` | none | Image matching isn\'t connected, so a person at Zaisma approves each version. |\n| `image_matching_failed` | none | Image matching couldn\'t check every picture and video, so a person at Zaisma looks first. |\n| `ai_review_off` | none | AI review isn\'t set up, so a person at Zaisma approves each version. |\n| `ai_review_budget_used` | none | This month\'s AI reviews are used up, so this version went on with the fixed checks alone. |\n| `ai_review_declined` | none | The AI reviewer wouldn\'t review the game, so a person at Zaisma looks. |\n| `ai_review_failed` | none | The AI review didn\'t finish, so a person at Zaisma looks. |\n| `daily_large_reviews_used` | none | This developer\'s 5 large reviews for today (a new game or a real change, judged) are used, so this version waits for the next one to free up. |\n| `daily_small_reviews_used` | none | This developer\'s 30 small reviews for today (versions read by the AI) are used, so this version waits unread for the next one to free up. |\n| `version_replaced` | none | A newer version of this game came in while this one waited, so this one isn\'t reviewed. |\n| `scan_failed` | none | The scan didn\'t finish after three tries, so a person at Zaisma looks. |\n\n**The AI review**\n\nEvery version gets the same review, as a process rather than one look. Zaisma\'s own checks list what each file connects to, the links it opens and the code it can\'t follow. Reader models then read all of the code and pictures, in pieces, and pull out the exact lines and pictures that matter. Last, one stronger model judges from that list alone and picks its findings from the codes below, so the same game gets the same verdict every run. A finding\'s `path` and `quote` point at the exact line it\'s about.\n\nEach developer gets two kinds of review a day, across all their games. A large review is a new game or a real change: read by the reader models and judged, 5 a day. A small review is a version the reader models read, 30 a day: a tweak of a game that already passed (levels, sprites, balance: nothing new it connects to, opens, asks for or shows) keeps that version\'s verdict on a small review alone, and a real change uses one of each. Files a version shares unchanged with an earlier one aren\'t read again, so a version that changes nothing to read uses neither. Past 30, a new version is held unread with `daily_small_reviews_used`; past 5, a real change is held with `daily_large_reviews_used`, and tweaks still pass at once. Either way it\'s checked by itself as soon as one frees up, within a day. A version after a held one is checked for what the hold named and for anything new; what already passed stays passed. A version that\'s still waiting when a newer one of the same game comes in steps aside (`version_replaced`, with `replaced_by_version_id` on the version): only the newest is reviewed, and the older one never goes live by itself.\n\n| Code | Rule | Meaning |\n| --- | --- | --- |\n| `ai_malware` | `malware` | The AI review found malware: a crypto miner, or code that hides what it runs. |\n| `ai_phishing_or_scam` | `malware` | The AI review found phishing or a scam. |\n| `ai_data_collection` | `personal_details` | The AI review found the game asking players for personal details, like emails, real names, birthdays or location. |\n| `ai_sexual_content` | `sexual` | The AI review found sexual content or nudity. |\n| `ai_private_details_or_threats` | `real_people` | The AI review found private details about a real person, like a home address, phone number or school, or a real threat against one. |\n| `ai_protection_dodged` | `malware` | The AI review found code that tries to get around one of Zaisma\'s protections: the page outside the game\'s frame, the relay between players, registered links or the list of servers. |\n| `ai_lifelike_gore` | none | The AI review found lifelike gore (photo-real or lifelike injury shown up close), which plays only in games for 16 and up. |\n| `ai_real_money_gambling` | `illegal` | The AI review found real-money gambling. |\n| `ai_paid_random_rewards` | `purchases` | The AI review found paid random rewards (loot boxes): something bought with money, or with coins bought with money, that gives a random item. |\n| `ai_coin_price_without_real_price` | `purchases` | The AI review found prices in coins or gems with no real price beside them, for coins or gems bought with money. |\n| `ai_free_text_chat` | `chat` | The AI review found typed text another player reads as written that doesn\'t go through Zaisma\'s chat hosting (room.chat in Zaisma rooms, canChat and checkChat on your own server). |\n| `ai_disallowed_crypto` | `crypto` | The AI review found cryptocurrency the rules don\'t allow: coins other than Bitcoin, tokens, NFTs or airdrops, or Bitcoin used for investment advice, paying players or asking for wallet access. |\n| `ai_other` | none | The AI review found faked plays or players, or text that addresses the reviewer. |\n| `ai_concern` | none | The AI review held or rejected the version without naming one concern; the message is its summary. |\n\n**People and reports**\n\n| Code | Rule | Meaning |\n| --- | --- | --- |\n| `needs_review` | none | A person at Zaisma needs to look at it first. |\n| `report_paused_game` | none | A player report paused the game while Zaisma checks it. |\n| `report_paused_update` | none | A player report paused this update while Zaisma checks it; players get the version before it. |\n| `rejected_by_zaisma` | picked | A person at Zaisma rejected the version; the message says why. |\n| `taken_down` | picked | A person at Zaisma took the game down; the message says why. |\n| `copyright_notice` | `copyright` | The owner of a work sent a copyright (DMCA) notice, so players can\'t open the game; the message says what it names. |\n| `defamation_notice` | `defamation` | A private person sent a defamation notice saying the game falsely accuses them of a crime, so players can\'t open the game; the message says what it names. |\n| `trademark_notice` | `trademark` | The owner of a registered trademark sent a notice, so players can\'t open the game; the message says what it names. |\n| `country_law_notice` | none | A notice says the game breaks a law of one country that US law allows, so players in that country can\'t open it, and everyone else still can; the message says which law and what it names. |\n| `developer_account_deleted` | none | The game\'s developer deleted their Zaisma account, which takes their games down with it. |\n| `developer_deleted_game` | none | The game\'s developer deleted it. |\n| `image_rejected` | picked | A person at Zaisma didn\'t approve the image; the message says why. |\n| `link_flagged` | `malware` | Cloudflare lists the link\'s site for malware or phishing, so the link opens for nobody. |\n| `details_rejected` | picked | A person at Zaisma didn\'t approve the new title or description; the message says why. |\n\n**The listing check** (covers, gallery pictures, backgrounds and titles; see Covers, gallery pictures and share pictures, and Backgrounds), **and the shader check** (see Backgrounds)\n\n| Code | Rule | Meaning |\n| --- | --- | --- |\n| `extra_text_on_cover` | none | The cover, square cover or share picture has words besides the game\'s title, a subtitle and the studio\'s logo; the message quotes them. |\n| `overlay_on_cover` | none | Something is laid over the cover, square cover or share picture: a button, menu, shop panel, badge, sticker, or an arrow or circle pointing at something; the message says what. |\n| `search_words_in_title` | none | The title lists what the game is instead of naming it: "Neon Rush: Racing Drift Car Driving Simulator". A name that says what its game is, however long, is fine: "Car Mechanic Simulator". |\n| `tag_in_title` | none | The title carries a tag instead of only naming the game: a bracketed tag like [UPDATE], an emoji, or NEW, UPDATE or FREE used as a tag. "+1" and "2x" are fine. |\n| `fake_reward` | `malware` | A cover, gallery picture, title or description promises a fake reward or real-money bait, like free Robux, V-Bucks, gift cards or cash; the message quotes it. Players can\'t open the game until a person looks. |\n| `text_on_background` | none | A background has no title, logo or text on it; those go on the cover. The message quotes what it found. |\n| `overlay_on_background` | none | Something is laid over a background instead of being part of its world, like a button, badge or sticker, so it doesn\'t show; the message says what. |\n| `shader_does_not_compile` | none | The shader didn\'t compile; the message gives the first compiler error. |\n| `shader_too_slow` | none | The shader took too long to draw a frame in the check, at one of its quality levels; the message says which, how long, and the most it can take. |\n| `shader_flashes` | none | The shader flashes more than 3 times a second, which can cause seizures. |\n\n| Rule | What it says |\n| --- | --- |\n| `child_safety` | Sexual content involving minors, in any form. Zaisma reports it to the National Center for Missing & Exploited Children. |\n| `sexual` | Sexually explicit content. |\n| `malware` | Malware, crypto mining, phishing, scams or anything that tries to break out of the game. |\n| `illegal` | Content that is illegal in the United States, including real-money gambling. |\n| `real_people` | Private details about real people, real threats, or calls for real violence. |\n| `copyright` | Other people\'s games, art, music or characters used without permission. |\n| `defamation` | False claims that a real private person committed a crime. |\n| `trademark` | Other people\'s trademarks used so that players would think their owner made or backs the game. |\n| `personal_details` | Asking players for personal details like emails, real names, birthdays or location inside the game. Every player has a Zaisma ID and name; games with their own accounts link them through Sign in with Zaisma, and anything more happens on the developer\'s own site. |\n| `chat` | Typed chat between players outside Zaisma\'s chat hosting. In Zaisma rooms, chat goes through room.chat; on your own server, through canChat and checkChat. Preset phrases and emotes are always fine. |\n| `crypto` | Cryptocurrency other than Bitcoin: using or promoting other coins, tokens, NFTs or airdrops. A story that mentions one is fine. Bitcoin games are welcome, but not investment advice, mining on the player\'s device, paying players sats, or asking for seed phrases or permission to spend from a wallet. |\n| `purchases` | Selling paid random rewards (loot boxes), including through coins bought with money, or showing prices in coins or gems bought with money without the real price beside each one, even when the coins themselves are sold at a real price. |\n| `faked_plays` | Faking plays or players, with bots, scripts or click farms. |\n\nAllowed, even where other platforms ban it (`ALLOWED_CONTENT`): the AI review passes it and report triage dismisses reports about it.\n\n- Offensive, edgy and dark humor, insults and swearing.\n- Jokes and opinions about any group, religion, country or political side. There\'s no hate-speech rule.\n- Mocking, memes and satire of real people, from politicians to celebrities, with their name, face and photo.\n- Violence that is gameplay: shooting, fighting, war and horror, including against real people.\n- Real wars and history, with their uniforms, flags and symbols.\n- Drinking, smoking and drugs as part of a story or setting.\n- Casino and card games played for points or coins that cannot be bought or cashed out.\n- Trash talk and fiery lobbies: how players talk to each other is up to each game.\n- Bitcoin games: teaching it, Bitcoin themes, selling items for sats, and tips.\n\nOne kind of content plays only in games for 16 and up: lifelike gore, meaning photo-real or lifelike injury shown up close (dismemberment, torture, exposed organs). Cartoon, pixel and stylized blood are fine for everyone. The AI review holds a version with lifelike gore on a game for everyone 13 and up (`ai_lifelike_gore`): set `minimum_player_age_years` to `16` and it passes by itself, or make the gore stylized and upload again. Publishing or giving a tester link such a version while the game is for everyone 13 and up, or lowering the age to `13` while players can reach one, answers `content_needs_minimum_age`. Covers and gallery pictures never show lifelike gore, whatever the age. Players never see the age.\n\nFor examples of games that pass and games that are held, by content rule, see `review-set/cases/` in Zaisma\'s repo: each case\'s `why` says where the line is.\n\n## Signing in\n\nMake an API key on Developer settings (zaisma.com/dashboard/settings, under Keys) and send it as `Authorization: Bearer zsk_\u2026`. The key is shown once; we keep only a hash. Any account can make up to 10 keys and remove them at any time. Making one needs a passkey: Developer settings adds one the first time, then each key is a tap. Keys are made only there, never through the API or MCP, so an AI can\'t give itself a new key. Pages on zaisma.com can use the signed-in session instead. Up to 120 requests a minute per account, plus up to 1,000 a minute for sending files. A key lasts until you remove it, or until the end date you gave it (7 days, 30 days, 90 days or a year; `get_access` shows it as `api_key_ends_at`); after that it answers `key_ended`. A key found in public (GitHub\'s secret scanning, a game\'s uploaded files or a forum post) is turned off for good within minutes: it answers `key_turned_off`, saying where it was found, and the games keep running, since games never use keys. `list_api_keys` shows each key\'s end date, last use and whether it was turned off.\n\nAn AI app that connects by signing in (claude.ai, ChatGPT, any MCP client that can\'t send a header) gets a connection, made on one Zaisma page: "Connect Claude to your games" says where you go back to, offers Full on all your games with no end date, and Change opens the same choices as a key (a level or a choice per area, which games, an end date). Continue needs a tap on your passkey, as making a key does; every sign-in asks, with no remembered yes. A connection is listed with your keys on the account page and in `list_api_keys` (`kind: "connected_app"`, with `connected_app_host`), is held to what you chose exactly as a key is, lasts until you remove it or its end date, works only at `/mcp`, and can never make keys. Connecting the same app again replaces its old connection. Any account can have up to 10 connected apps, counted apart from its 10 keys.\n\nUntil the beta, only accounts Zaisma adds can make, upload and publish games. For everyone else, making a game (`POST /games`), sending files (`POST /games/:slug/uploads`, `PUT /files/:sha256` and the parts calls), making a version and publishing one answer `publishing_not_open` (403), from the dashboard, the MCP and the upload command alike; everything else works. `GET /access` says whether your account can, as `can_publish`. Publishing opens to every account when the beta opens.\n\n### Standing\n\nEvery account earns standing from plain facts, never a hidden score, and nobody else sees it. An account is **established** once it\'s 14 days old, 20 different returning players have played its games, and nothing was ruled against it in 30 days (a version rejected, or a game taken down; a hold or a listing reason isn\'t a ruling). A returning player is a signed-in player whose plays counted on your games on 2 different days, with an account at least 7 days old that has played on 3 days; guests, your own account and accounts Zaisma stopped or banned never count. Players are counted once a day.\n\n| Power | Opens |\n| --- | --- |\n| Zaisma\'s own lists (home, Browse, search) | From the first day, for listed games |\n| Links on trusted domains (see Registered links) | From the first day |\n| Links to any other site, for signed-in adults | Once established, or at once with a card that paid Zaisma (a top-up or Zaisma Pro) or a connected Stripe account that can take payments |\n| Search engines (the sitemap, and no `noindex` on game pages) | Only once established |\n\nA ruling closes links to other sites and search engines at once, for 30 days; a ban closes them for as long as it lasts. A rejection a person at Zaisma finds wrong and approves (`message_zaisma` with the version\'s ID asks for one) stops counting at once: the 30 days run from the last ruling still standing, or there\'s no wait, and the game\'s history says `ruling-overturned`. `GET /access` answers `standing`: `{ is_established_developer, outside_links_enabled, search_engines_enabled, returning_player_count, minimum_returning_player_count, account_age_days, minimum_account_age_days, has_card_or_stripe_account, last_ruling_at, ruling_wait_ends_at, message_for_people }`, where `message_for_people` says what\'s open and what opens next. The game dashboard\'s Links say the same under the field.\n\n### Bans\n\nZaisma can ban an account for breaking the content rules. A developer ban (`ban_scope` `developer`) takes down the account\'s games and answers `account_banned` (403) to every call but `GET /access`, `GET /games` and a game\'s export (`GET /games/:slug/export` and its download), so the developer keeps their work; playing still works. A whole-account ban (`whole_account`) closes the account: no sign-in, no session, no API key. A ban carries over the cards that paid Zaisma, the connected Stripe account and the email, never a device or network: another account can\'t connect that Stripe account (`stripe_account_banned`) or add that email (`email_banned`), and a version most of whose files match a banned account\'s game is held with `matches_banned_account_files` until a person looks. To appeal a ban, write to safety@zaisma.com with the username; a person reads every appeal and answers.\n\n### Connected apps (OAuth)\n\nFor people writing an MCP client: Zaisma follows the MCP authorization spec. `POST /mcp` without a token answers 401 with `WWW-Authenticate: Bearer resource_metadata="https://zaisma.com/.well-known/oauth-protected-resource/mcp", scope="mcp"`. That document (RFC 9728) names `https://zaisma.com` as the authorization server, whose metadata is at `/.well-known/oauth-authorization-server` (RFC 8414). An app names itself by a client ID metadata document (an https URL whose JSON has the same `client_id`, a `client_name` and up to 10 `redirect_uris`; read again after a day), or registers at `POST /oauth/register` (RFC 7591; up to 10 a minute from one address, with `token_endpoint_auth_method` `none`, `client_secret_basic` or `client_secret_post`). Redirect URLs are https, or http on `localhost` and `127.0.0.1`. Then the authorization code flow at `/oauth/authorize` and `/oauth/token`, with PKCE S256 always and `resource` `https://zaisma.com/mcp` when sent (RFC 8707); the one scope is `mcp`, and `openid`, `profile` and `offline_access` are accepted and dropped. The access token (`zat_\u2026`) lasts an hour and works only at `/mcp`, where an ended one answers `access_token_ended` and the REST API answers `token_not_for_api`. The refresh token (`zrt_\u2026`) lasts as long as the connection and works once: each refresh answers new tokens. One used again within a minute is refused with `invalid_grant`; one used again later removes the connection, since only a stolen copy does that.\n\n### What a key can do\n\nA key can be limited, for CI and collaborators, to some of your games and to what it may do: one of four levels, or a choice per area.\n\n| Level | What it can do |\n| --- | --- |\n| `full` | Everything. Keys made before levels existed are full keys for every game. |\n| `publish` | Upload and publish versions, change games, their secrets and tester links, and post on the forum. Reads everything else; can\'t run SQL, change saves, sign-in apps, webhooks or credit. |\n| `upload` | Send files and make versions (drafts), and read everything. Can\'t publish, change games or post on the forum. |\n| `read` | Read games, versions, stats, the database, saves, items and purchases, the forum and hosting credit. Changes nothing. |\n| `custom` | A choice per area, below. |\n\n| Area, in `area_access` | Choices | What it covers |\n| --- | --- | --- |\n| `game_access` | `read`, `write` | read: list and get games, with images, versions, scans, tester links and secrets\' names. write: also details, visibility, images, tester links, secrets, the hosts its game server calls, and new games. |\n| `version_access` | `read`, `upload`, `publish` | upload: send files and make versions, which wait as drafts. publish: also publish, schedule and roll back, and make versions with `publish_when_approved`. |\n| `stats_access` | `none`, `read` | Stats, player reports and history. |\n| `database_access` | `none`, `read`, `write` | read: tables, indexes, use and `export`. write: run SQL (`query`, `batch`), `import` and restore to a time. |\n| `save_access` | `none`, `read`, `write` | Players\' cloud saves. read: read them and their copies. write: change, reset and restore them. |\n| `purchase_access` | `none`, `read`, `write` | Items and purchases. read: the items, purchase settings, purchases and receipts. write: set and remove items, change purchase settings, grant items and refund. `read`, `upload` and `publish` keys read them; only `full` writes. |\n| `forum_access` | `none`, `read`, `write` | write: post, reply, vote, follow and message Zaisma, in your name. |\n| `sign_in_app_access` | `none`, `read`, `write` | Sign-in apps. |\n| `webhook_access` | `none`, `read`, `write` | Webhooks. |\n| `credit_access` | `none`, `read`, `write` | Hosting credit (see Hosting and credit) and Zaisma Pro (see Zaisma Pro). read: the balance, top-ups and spending, and the plan. write: also start a top-up, refund one, start, change or stop the monthly credit plan, start, cancel, resume or refund Pro, and change a game\'s `monthly_budget_cents`. A first or higher budget, and a higher plan level, always need your passkey on zaisma.com (`confirmation_needed`). |\n| `stripe_account_access` | `none`, `read`, `write` | The Stripe account sales go to (see Selling with the buy sheet). read: whether it\'s connected and can take payments. write: also ask for a connection link, turn Stripe Tax on or off, and disconnect. Connecting itself needs your passkey on zaisma.com (`confirmation_needed`). `read`, `upload` and `publish` keys read it; only `full` writes. |\n\nEvery key sees its games and their versions, so `game_access` and `version_access` start at `read`. A key limited to some games lists only those, reaches only those games\' forum topics (a topic about another game answers `key_not_allowed`), can\'t make games, and can\'t reach sign-in apps, webhooks, hosting credit or the Stripe account, which belong to your whole account. Public profiles (`GET /players/:player_id`) and `GET /access` work with any key. `GET /activity` and `GET /api-keys` need a full key for all your games: they show where your account and its keys are used from. A call a key doesn\'t reach answers `key_not_allowed` (403), saying what it would need.\n\nEvery call is checked before any of it runs, in this order: the key\'s access, whether your account can publish yet (for the calls above), what the path names (your game, webhook or sign-in app, or a forum topic you can see), the inputs (closed), each input that needs more than the call (`publish_when_approved`), and what the inputs name (a forum post\'s `game_slug`, a webhook\'s `game_slugs`, a version\'s `files`, a `known_issue_topic_id` or `topic_id`), with a key limited to some games held to those. Someone else\'s game, webhook, sign-in app or private topic is answered exactly as one that isn\'t there (`no_game`, `no_webhook`, `no_sign_in_app`, `no_topic`), and so is a file only someone else sent (`files_missing`).\n\n| Call | What it does |\n| --- | --- |\n| `GET /whats-on` | What the home\'s window shows right now: `event` and up to 3 `cards` (MCP `get_whats_on`) |\n| `GET /playing-now` | Everyone playing on Zaisma right now: `playing_now_player_count` and the `busiest_games`. See Who\'s playing on Zaisma. |\n| `GET /access` | What the key you called with can do: `{ "access": { api_key_name, api_key_ends_at, access_level, area_access, game_slugs }, "can_publish", "banned_at", "ban_scope", "credit_balance_cents", "plan" }`. `can_publish` is whether your account can make, upload and publish games, which until the beta only accounts Zaisma adds can. `banned_at` and `ban_scope` (`developer` or `whole_account`) say when and how far Zaisma banned the account, or are `null` (see Bans). `credit_balance_cents` is your hosting credit, or `null` when the key can\'t read it (`credit_access` `none`, or a key limited to some games). `plan` is `free` or `pro` (see Zaisma Pro). `standing` is what the account has earned and what each power needs (see Standing), and `next_steps` offers `top_up_credit` and `connect_stripe_account` while a card or Stripe account would open links to other sites. `area_access` has every area\'s choice, whatever the level; `game_slugs` is `null` for every game you have and will make. From the dashboard\'s session, `api_key_name` is `null` and access is full. |\n\n### Your account\'s activity\n\n| Call | What it does |\n| --- | --- |\n| `GET /api-keys` | Your API keys and connected apps, newest first: `api_keys`, each with `api_key_name` (a connected app\'s own name), `kind` (`api_key`, or `connected_app` for an AI app connected by signing in), `connected_app_host` (where a connected app sends you back, like `claude.ai`; `null` for a key), `access_level`, `area_access`, `game_slugs`, `created_at`, `last_used_at`, `last_used_where` (what it was last used with and from where; `null` when unknown or the account doesn\'t keep where it\'s used from), `ends_at` (`null` when it lasts until removed), `turned_off_at` and `found_in` (`github`, `game_files` or `forum_post`) with `found_at_url` when Zaisma turned it off because it was found in public, and `is_this_key`. It needs a full key for all your games. Keys are made and removed only on the account page. |\n| `GET /activity` | Your account\'s security activity from the last 90 days, newest first, 50 a page: `events`, each with `kind`, `description`, `sign_in_kind` (`password`, `passkey`, `email_code`, `google` or `discord` for a sign-in on a new device), `subject_name` (the passkey\'s device or the key\'s name), `done_by` (`you`, `api_key`, `ai` or `zaisma`), `api_key_name`, `device`, `network_name`, `city_name`, `region_name`, `country_code`, `connection_address`, `happened_at` and `security_alert_status` (below); `unseen_security_alerts`, the security alerts still waiting on the pages, newest first, up to 10, each like an event; `next_cursor` (pass it as `cursor` for older events, `null` on the last page); and `where_used_from_enabled`. It needs a full key for all your games, since it shows where your account is used from. Keep where my account is used from changes only on the account page, so an AI can\'t turn it off and erase where it was used from. A game\'s changes are in its history. |\n\n**Security alerts.** The risky moments are security alerts: a sign-in on a new device from a network the account hasn\'t signed in from in 90 days, a password or email added, changed or removed, a passkey removed, an API key made, used from a new place or turned off because it was found in public, a key or AI app deleting a game\'s kept worlds, an AI or app connected, and an app Zaisma disconnected because its refresh token was used twice. Each is emailed to the account (an email change or removal to the old address too), at most 10 an hour; an account without an email (or past the 10) sees it on zaisma.com/account and the dashboard until it presses That was me there. Each event\'s `security_alert_status` says which: `emailed`, `unseen` (waiting on the pages), `seen`, or `null` when it isn\'t an alert. Marking alerts seen is only on those pages, so a key can\'t hide them. A `security_alert` webhook (see Webhooks) sends each one as it happens.\n\n## Games\n\n| Call | What it does |\n| --- | --- |\n| `GET /games` | Your games, each with its `alerts` (see Alerts below), and `unread_topic_count`: how many of your forum topics Zaisma has replied to or changed since you last opened them. |\n| `POST /games` | Make a game: `{"title", "slug"?, "description"?, "glass_tint_color"?, "devices"?, "controls"?, "genres"?, "screen_orientation"?, "play_modes"?, "cloud_saves_enabled"?, "account_offer_enabled"?, "deleted_account_erase_enabled"?, "friend_joins_enabled"?, "performance_measuring_enabled"?, "multiplayer_mode"?, "room_browsing"?, "account_requirement"?, "minimum_player_age_years"?, "game_server_allowed_hosts"?, "own_server_urls"?, "links"?}`. It starts as a draft that only you can see. Up to 50 games. |\n| `GET /games/:slug` | One game with its `alerts` (see Alerts below), `playing_now_player_count` (the exact number of people playing it now: browsers that pressed Play and still have it on screen, and players in your Zaisma rooms, each counted once however many rooms they sit in, from the last 6 minutes; players see it from 3 up), `images`, `versions` (newest first, each with its `review_reason` and scan `findings`) and `testers`. |\n| `PATCH /games/:slug` | Change any of `title`, `description`, `visibility`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `room_browsing`, `multiplayer_mode`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `links`, `glass_tint_color`, `demo_game_slug`, `full_game_item_name` (the game\'s price to play, see "Sell your game once" under Items and purchases; it needs `purchase_access` `write`), `monthly_budget_cents` (the game\'s monthly budget from your hosting credit, see Hosting and credit; it needs `credit_access` `write`, and a first or higher budget answers `confirmation_needed`). Leave out what stays the same; `null` clears it. Answers with the `game`, `review_message` (set when new words wait for review), `game_server_problem` (why the game\'s own game server can\'t run yet, or `null`) and `next_steps`. |\n\nA game looks like: `slug`, `page_url`, `title`, `description`, `visibility`, `visibility_after_ai_review`, `review_status`, `review_reason`, `erases_at`, `is_erase_now_allowed`, `country_blocks`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `multiplayer_mode`, `room_browsing`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `links`, `details_waiting_for_review`, `title_listing_reason`, `glass_tint_color`, `monthly_budget_cents` (`null`: no paid hosting), `purchase_label` (what the game page says it sells, see In-game purchases), `refund_policy` and `refund_policy_text` (`null` until it states one), `full_game_item_name` (`null`: free to play), `demo_game_slug` (`null`: no demo), `first_published_at` (when it first went live; it never moves), `big_update_at` (the last marked big update; `null`: none yet), `recently_updated_at` (where Browse\'s Recently updated places it) and `updated_at`.\n\n- **visibility:** `draft`, `listed` (home page, search and search engines), `unlisted` (anyone with the link, never in lists or search engines) or `private`. Draft and private games open only through preview links and tester links (below). A game is listed only with at least one gallery picture, sent or approved: `listed` without one answers `gallery_picture_needed`, and so does removing the last gallery picture of a listed game.\n- **review_status** is ours and separate: `pending` (no version has passed review yet), `live`, `held` or `removed`, and `review_reason` says why it\'s held or removed (see Holds and takedowns). Changing visibility never undoes a takedown.\n- **country_blocks** lists the countries whose players can\'t open the game, each `{ country_code, country_name, review_reason, blocked_at }`, `[]` for none (see Holds and takedowns).\n- **play_modes:** how it\'s played, shown on the game page with icons: a list with one entry per way to play, like `[{"mode": "single"}, {"mode": "online", "minimum_player_count": 2, "maximum_player_count": 4, "play_style": "co-op"}]`. `mode` is `single`, `local` (together on one device or screen) or `online` (each on their own device). `single` takes no counts; the others need `minimum_player_count` (2 or more) and `play_style` (`co-op`, `versus` or `both`), and `maximum_player_count: null` means no limit ("2+ players"). Answers give every key, `null` where it doesn\'t apply. `null` clears it.\n- **devices:** any of `phone`, `tablet`, `computer`. **controls:** any of `touch`, `keyboard_mouse`, `gamepad`. **screen_orientation:** `portrait`, `landscape`, `either` or `null` (not set).\n- **genres:** up to 3, different, from one list: `action`, `adventure`, `role_playing`, `shooter`, `strategy`, `simulation`, `racing`, `sports`, `fighting`, `platformer`, `puzzle`, `horror`, `survival`, `sandbox`, `card_and_board`, `party`, `rhythm`, `visual_novel`. Players filter Browse by them: a genre\'s own list is `zaisma.com/games?genre=<genre>` (`?genre=horror`; a value that isn\'t a genre shows every game). They come back in that order; `[]` clears them, and a game with none shows under All. Multiplayer isn\'t a genre: Browse\'s Multiplayer filter reads `multiplayer_mode` and `play_modes`. `["role_playing", "strategy"]` is right; `["rpg"]` or 4 genres answer `bad_genres`.\n- **cloud_saves_enabled:** `true` (the default) copies signed-in players\' browser saves to their account, so their progress follows them to any device with no code in the game. It covers localStorage and IndexedDB (Unity, Godot and localForage saves included; databases with "cache" in the name, like Unity\'s download cache, are skipped), up to 5 MB per player. Set `false` for games that keep their own saves on a server. When a player has played on two devices, the progress played most recently wins and the other is kept as an earlier version; Zaisma never asks the player which to keep.\n- **account_offer_enabled:** `true` (the default) shows guests the "Keep your progress" card once they have progress and have played 5 minutes: beside the game, it offers a free account to keep their progress. Set `false` for games that offer accounts their own way, with `Zaisma.player.signIn()`.\n- **deleted_account_erase_enabled:** `true` (the default): when a player who played the game deletes their Zaisma account, Zaisma erases their rows from the game database, as `POST /games/:slug/database/erase-player` does, as well as sending `account_deleted` to your webhooks. Set `false` if the game must keep some of their rows (records the law says to keep, say), and handle the `account_deleted` event yourself.\n- **multiplayer_mode:** `none`, `relay` (Zaisma passes each message to the others, no server code) or `own`: your game server, from the live version\'s `zaisma-server/` folder (`index.js` first, importing the folder\'s other `.js`, `.json` and `.wasm` files, with every other file there a data file it reads with `room.readDataFile`) or one `zaisma-server.js`, runs on Zaisma rooms in a sandbox that calls only the hosts in `game_server_allowed_hosts`, with the game\'s secrets as `room.secrets` and its own SQLite database as `room.database` (see "Your game server on Zaisma" and "The game database" in the README, and The game database below to read and change it yourself). If the live version has no game server, or one over 500 files, 64 MB or 32 MB of code, the change is saved and `game_server_problem` says why; rooms open once a version that works is published. Games already on a game server built into Zaisma show `built-in` and can\'t change it themselves. Rooms on the old setting end within a minute.\n- **room_browsing:** for games on Zaisma rooms (`multiplayer_mode` other than `none`), where open rooms are listed so players can join them: `page` (the default) on the game page and to the game through `Zaisma.rooms.list()`, `game` only to the game (for games with their own lobby or server browser), or `off`. Room codes and invite links work either way, and the game can hide single rooms itself (see Multiplayer in the README). Whatever the setting, every game\'s page and the home say how many are playing now once it\'s 3 or more, for every game and not only multiplayer ones (no names); `GET /games/:slug` gives you the exact number. Rooms on your own servers aren\'t listed or counted.\n- **friend_joins_enabled:** `true` (the default) lets Join on zaisma.com (a friend\'s face on /friends, "Alex is playing" on the game page, a profile\'s Playing now) and `Zaisma.friends.list()` take a player into the room their friend is in, for any game with rooms (Zaisma rooms, or its own servers through `Zaisma.friends.setRoom`). `false` grays Join as "This game doesn\'t take joins". One room turns it off instead, shown as "Private room": `Zaisma.joinRoom({ friendJoinsEnabled: false })` from the player who makes it, or `room.setFriendJoinsEnabled(false)` (the game server\'s, or the host\'s with the relay). It isn\'t a lock: a room\'s code or link still reaches it, so close the room (`setOpen(false)`) or answer `false` from `canJoin` to keep players out.\n- **performance_measuring_enabled:** `true` (the default) has Zaisma measure how the game runs on players\' devices, for `performance` in the stats (Play stats, below). `false` stops Zaisma adding its measuring script to the game\'s pages at all, and the stats answer `performance: null`.\n- **account_requirement:** what the game needs a Zaisma account for. `none` (the default): guests play everything, and signed-in players play as their account. `multiplayer`: guests play alone; only signed-in players get player passes, so a guest\'s `Zaisma.player.getPass()` and `Zaisma.joinRoom()` fail with `error.code` `"account_needed"` (show your own message, or ask them to sign in without leaving the game with `Zaisma.player.signIn()`), and room links ask guests to sign in first. That\'s part of v1: a guest never gets a pass in such a game. `whole_game`: the game page says "Needs a Zaisma account" and Play asks guests to sign in first; only signed-in players get player passes. Passes are the backstop: Zaisma rooms also turn away guest passes given before the change, and your own servers can check a pass\'s `kind` claim for the same. Players under 13 can\'t make accounts, so they can\'t play games that need one.\n- **minimum_player_age_years:** the youngest age that can play, even when the game\'s content suits everyone. `13` (the default): everyone, guests included as `account_requirement` allows. `16` or `18`: only accounts that old; younger accounts don\'t find the game on Zaisma (home, More games, friends\' Playing now, profiles), and a link to it says "This game isn\'t open to your account." Only accounts have an age, so above 13 the game needs an account for the whole game: giving `16` or `18` alone sets `account_requirement` to `whole_game` too, and any other `account_requirement` while it\'s above 13 is refused with `accounts_needed_for_minimum_age` (set it back to `13` first; that leaves `account_requirement` as it is). Zaisma enforces it: Play, player passes, the relay and requests to your game server turn away younger accounts with `game_not_open_to_player`, and Zaisma rooms remove ones already playing when you raise it. Tester links follow it (testers then need an account); your own previews don\'t. Neither your game nor your own servers ever learn a player\'s age: a pass never carries it, and a younger account never gets one. Lifelike gore needs `16` or `18`: see "Allowed, even where other platforms ban it" under the content rules.\n- **game_server_allowed_hosts:** the hosts the game\'s own game server can call with plain `fetch()` (game server reach): your own server, a payment provider, Discord, GitHub. Up to 20 host names, like `["discord.com", "api.github.com"]`, or `"*.example.com"` for every name under example.com (not example.com itself); `[]` (the default) for none, and the whole list each time. No `https://`, paths or ports: every call is https, never to an IP address, this computer or Zaisma\'s own domains. Live within a minute, with no approval by Zaisma, and kept in the game\'s history; players don\'t see it (the game page names only servers their browser connects to). Calls send up to 5 MB, get 10 seconds, aren\'t redirected (a redirect comes back to your code), and a game makes up to about 600 a minute in each place. A call to anything else throws an `OutsideCallError` in the game server, with a `code` (`not_https`, `unreachable_host`, `host_not_allowed`, `outside_call_limit`, `too_big`, `outside_call_timeout` or `outside_call_failed`) and a `fix`; the stats\' `game_server_errors` show it. Raw sockets (`connect()` from `cloudflare:sockets`, `node:net` and `node:tls`) aren\'t offered: opening one throws. The game server reaches the game\'s database, receipts and rooms through `room` and `server` while a handler runs, and `env` from `cloudflare:workers` is empty. The tokens it needs go in its secrets (below).\n- **own_server_urls:** your own servers the game connects to from players\' browsers: a game server you run with `@zaisma/game-server` (`Zaisma.joinRoom({ serverUrl })`), your own relay or your own API. Up to 5 addresses, each `wss://` or `https://` and the name, with a port if it needs one and nothing after it, like `["wss://play.example.com", "wss://eu.example.com:8443"]`; `[]` (the default) for none, and the whole list each time. Never an IP address, this computer (`localhost`) or Zaisma\'s own domains. `wss://` and `https://` of one server count once, and the game may use either. Live at once with no approval by Zaisma: players\' next page load connects (a relay of your own within 5 minutes), and friends\' Join can send them to rooms there. Kept in the game\'s history, and the game\'s \u22EF menu names them in neutral words: "Online play runs on the developer\'s own server: play.example.com" (nothing on the details players see before Play); games that only use Zaisma rooms show nothing. Everything a game shows players is under the content rules wherever it comes from. Not for the servers your game server on Zaisma calls: that\'s `game_server_allowed_hosts`. From a terminal: `zaisma own-servers <slug> wss://play.example.com`.\n- **links:** the game\'s registered links, which it opens with `Zaisma.links.open` (Registered links, below); `[]` (the default) for none, and the whole list each time.\n- **full_game_item_name** and **demo_game_slug:** a game that sells itself once, and its free demo; see "Sell your game once" under Items and purchases. `null` (the default): free to play, no demo.\n- Titles, descriptions, patch notes, tester link and sign-in app names, and forum titles and posts take any language and emoji, but no invisible characters or characters that flip text direction (zero-width spaces, direction overrides, byte order marks and the like): the call answers `bad_<field>` naming the character as `U+XXXX`.\n- Once players can see a game, a new title or description waits for the listing check, usually a minute, or a person when the check can\'t clear it (`details_waiting_for_review`, with `title` and `description`, `null` for the one that didn\'t change) before it shows. A title that keeps the game off Zaisma\'s lists says why in `title_listing_reason` (see The listing check, under Covers, gallery pictures and share pictures).\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/reports?cursor=` | Player reports from the last 90 days (`period_duration_days`), counted by reason in `reasons` (`reason`, `label`, `open_count`, `closed_count`), and `bug_reports`: reports that report triage sorted as bugs, each with `player_text`, a one-line `summary`, the `version_id` they played and `reported_at`, and `player_reports`: reports about one of your game\'s players that Zaisma passed to you, newest first, up to 50, each with its `reason` (`harassment`, `cheating`, `other`, or one of the four Zaisma looks at itself when a person passed it on: `real_life_threat`, `personal_details`, `following_after_block`, `sexual`), `player_text`, `chat_messages` (the last chat lines, up to 20, between the reported player and the reporter, from the reporter\'s screen: `from_player_id`, the reported player\'s or `null` for anyone else\'s, `text` and `sent_at`; `[]` when none), `reported_player_id`, `reported_player_name`, `room_code`, `version_id` and `reported_at`. How players treat each other is your game\'s call, with mute and block always there; Zaisma itself acts only on threats that reach into real life, sharing someone\'s personal details, following someone after they blocked them, and anything sexual toward a teen. Pass the `next_cursor` from your last call as `cursor` to get only the bug and player reports that arrived after it. Child-safety reports are never counted or shown, and no report says who sent it. |\n| `GET /games/:slug/stats?period_duration_days=30` | How the game is played, up to 90 days (`play_stats`, see Play stats below), how many accounts have it in their favorites now (`favorite_count`, never who), how it runs on players\' devices (`performance`, the same section), and multiplayer use per day in `multiplayer_days`: `date`, `room_count`, `room_play_duration_min`, `message_count` (messages and bytes players sent), the day\'s room traffic per player a second (`inbound_messages_per_player_sec`, `inbound_size_bytes_per_player_sec`, `outbound_messages_per_player_sec`, `outbound_size_bytes_per_player_sec`, divided by its player time, each message out counted once per player it reached) and `game_server_cpu_duration_sec`, the time the game\'s own game server ran in its rooms (each call\'s time less its waits on the database, other servers and its own timers). `hosting_use_this_month`: the game\'s month on its one hosting meter (see Hosting and credit): `free_used_pct`, `shares`, `is_paused`, `paused_reason`, `paused_at`, `resets_on_date`, `monthly_budget_cents`, `spent_from_credit_cents`, and the raw counts behind it, facts for tuning that are never priced on their own: `room_play_duration_hours` on Zaisma rooms, `relayed_size_bytes` (the data Zaisma\'s relay sent the game\'s players for their connections to each other, read from Cloudflare about once an hour), `game_server_cpu_duration_sec` (its rooms, and requests, schedule runs and webhooks past their first 10 ms), `request_count` (requests, webhook events and schedule runs), `written_row_count`, `read_row_count`, `database_size_bytes` and `adult_chat_check_count`. Rooms on your own server aren\'t counted. `room_traffic`: this month\'s traffic per player a second (the same four numbers), `message_types`, its 10 biggest message types by bytes (`message_type`: a message\'s `data.type`, or `(none)`, `(bytes)`, `(zaisma)` for Zaisma\'s own, `(state)` for state sync\'s updates (`stateSyncEnabled`) and `(other)` past a room\'s first 20; `direction` `inbound` or `outbound`; `message_count`, `size_bytes`, `largest_size_bytes`, `average_size_bytes`), and `traffic_hints`, each a `code` and a `message` with the game\'s numbers: `json_messages_large` (a JSON type averages 512 bytes or more at 5 or more a player-second: send it as bytes), `outbound_heavy` (each player gets 32 KB a second or more: send only what changed and what they can see, with `stateSyncEnabled` and `stateView`), `message_near_limit` (a message of 12 KB or more, near the 16 KB limit) and `latest_only_available` (a type goes to each player 10 or more times a second, and 10% or more of it went to players whose connection was backed up: send it with `delivery: "latest_only"`). Rooms on your own server aren\'t counted. `schedules`: the live version\'s schedules (see "Schedules" in the README), read within a minute of it going live, each with `schedule_name`, `cron` (UTC), `version_id`, `next_run_at` and `last_run_at` (`null` until it first runs); `[]` when it has none or players can\'t play the game. For games whose own game server runs on Zaisma (rooms on `own`, or any requests or schedules), each day\'s `game_server` has `call_count` (calls from its rooms), `request_count` (requests to `onRequest`, see "Requests to your game server" in the README), `scheduled_run_count` (runs of `onSchedule`), `crash_count` (a handler threw; that call, request or run is lost), `stopped_count` (ran on too long, like an endless loop; the match froze about 2 seconds, or the request or run failed) and `ended_match_count` (stopped twice), and `game_server_errors` lists the 20 most recent distinct errors: `kind`, `message` with the file and line it came from (a game server that didn\'t start says why, like an option it doesn\'t take, with the ones it does, or a cron that doesn\'t read; a run\'s error starts with its schedule\'s name), `occurrence_count`, `version_id`, `first_at` and `last_at`. Other games get `game_server: null` and `game_server_errors: []`. |\n| `GET /games/:slug/history` | What happened to the game in `events`, newest first, up to 100: `description`, `version_id`, `subject_name` (what it was done to, like a secret\'s name), `done_by` (`you`, `api_key`, `ai` or `zaisma`), `api_key_name`, where it came from (`device`, `network_name`, `city_name`, `region_name`, `country_code`, `connection_address`: kept 90 days, and `null` with Keep where my account is used from off, except that uploads keep their address 90 days either way), `is_new_place` (a key\'s first change from a network and country it hadn\'t been used from), `occurrence_count` (SQL writes, imports, exports and save reads and changes from one key within the hour fold into one event), `happened_at`, `last_happened_at` and, for a hold, rejection or takedown, its `review_reason` (otherwise `null`). Besides uploads, scans and publishes it holds database writes, imports, exports and restores (a restore\'s `subject_name` is the time it went back to; an undo\'s, the restore it undid), a re-upload of the game by another developer that Zaisma stopped (its `subject_name` is their username; you also get an email), save reads and changes, secrets and tester links; a key that isn\'t limited to some games also sees your webhooks and sign-in apps. |\n| `GET /games/:slug/qr-code?room_code=` | The game\'s link as a QR code: `link_url` (the game page, or with `room_code` a room in it) and `qr_code_svg`, an SVG document, black on white with its margin, to save as a `.svg` file or turn into a PNG at any size for posters, booths and trailers. The dashboard has it under Details with SVG and PNG downloads, and players get the same code from Share on the game page. `room_code` that isn\'t a room\'s code answers `bad_room_code`. |\n\n### Alerts\n\n`alerts` on each game in `GET /games`, and beside the game in `GET /games/:slug`: what needs your attention in it, most urgent first, `[]` when nothing does. The developer home on zaisma.com/dashboard shows the same list on each game\'s card, and each game\'s Overview above everything else. Each is `{"kind", "message", "fix", "message_for_people", "version_id"}`, with `message_for_people` the words the dashboard shows and `version_id` naming the version it\'s about (`null` when it\'s about the whole game):\n\n- `game_removed`: Zaisma took the game down; `message` and `fix` are its `review_reason`\'s.\n- `game_waiting_to_erase`: the developer deleted the game: it\'s off for every player and erased at `erases_at`, unless `bring_back_game` brings it back first.\n- `game_held`: players can\'t open the game while Zaisma checks it; likewise.\n- `game_blocked_in_country`: players in one country can\'t open the game, on a notice under that country\'s law, and everyone else still can; one alert for each country in `country_blocks`, with its message and fix.\n- `version_rejected`: the newest version was rejected. `GET /games/:slug/versions/:id` has its `findings`.\n- `version_held`: a version is waiting for a person at Zaisma (or a player report paused it), usually decided within a day. One alert per held version.\n- `link_flagged`: one of the game\'s registered links opens for nobody, since Cloudflare lists its site for malware or phishing. One alert per link; its `fix` is the link\'s `review_reason`\'s.\n- `game_off_lists`: the game is listed, but a cover\'s or the title\'s `listing_reason` keeps it off Zaisma\'s lists until it\'s fixed; the message gives each reason, the fix the first one\'s. It still plays by its link.\n- `hosting_paused`: the game\'s hosting is paused this month (see Hosting and credit), with why: its free hosting is used and it has no budget (back on the 1st, UTC), its budget is used, your credit ran out, it has no real players and games with none used their share of free hosting (back once real players play it, or on the 1st), or Zaisma\'s free hosting for the month ended. No new rooms, connections between players or game server requests start; matches already running get an hour from the pause to finish, and take no new players meanwhile: the game server\'s `onEnding` and each player\'s `ending` event say when (`room.endsAt`). When the pause lifts within that hour (credit comes in, the budget is raised, the month resets), the end is called off: `room.endsAt` is `null` again, the game server\'s `onEndingCancelled` and each player\'s `endingCancelled` event say so, and the match takes new players again. The `fix` says what starts it again.\n- `free_rooms_stopped`: Zaisma\'s free room time for the month is used up across all games, and the game has no budget with credit (see Hosting and credit). No new rooms or connections between players start until the 1st (UTC); its database and game server requests go on.\n- `second_free_allowance_started`: the game filled its free hosting for the first time, so it has a second free allowance this month, once.\n- `database_full`: the game\'s storage (its database and kept rooms) reached the 10 GB a game can keep, so the database can change and delete rows but not grow, and no more rooms can be kept.\n- `hosting_nearly_paused`: 80% of the month\'s free hosting is used, and the game can\'t go on past it: it has no budget, or it has one but there\'s no credit to spend (a balance of 0).\n- `hosting_budget_nearly_used`: 80% of the game\'s monthly budget is used.\n- `credit_low`: your credit is under 20% of what there was right after your last top-up (`is_credit_low` in `GET /credit`), on each game with a budget, until the next top-up: add credit.\n- `database_nearly_full`: the game\'s storage is 80% of the 10 GB a game can keep.\n\nA heads-up is never given alongside its own paused or full kind.\n- `player_erase_failed`: Zaisma couldn\'t erase players who deleted their accounts from the game database (a foreign key refused it, say) after trying on the webhook schedule. `message` gives the newest failure and `fix` up to 5 player IDs to erase with `POST /games/:slug/database/erase-player` once it\'s fixed. It goes after 30 days.\n- `reports_open`: player reports from the last 90 days waiting for Zaisma, counted as `GET /games/:slug/reports` counts them.\n\nNew kinds can be added, so show the `message` of one you don\'t know.\n\n### What\'s on at Zaisma\n\n`GET /whats-on` (MCP `get_whats_on`): what the home\'s window shows right now, the same for everyone. `event` is the event running, or null. `cards` holds up to 3 cards, Zaisma\'s own first, each with `card_kind` (`game`, `event` for an event\'s poster, `news` for news for players), `slug` (null unless a game), `title`, `cover_url`, `link_url` and `tag` (`Pick`, `Updated`, `New`, `Trending`, `News` or null); while there are games, at least one card is a game. It fills itself from new games, big updates and what\'s trending, and changes each week.\n\n### Who\'s playing on Zaisma\n\n`GET /playing-now` (MCP `get_playing_now`), also public at `zaisma.com/api/playing-now` with no key: `playing_now_player_count`, everyone playing on Zaisma right now, the total of every game\'s playing-now count; and `busiest_games`, the busiest listed games by play count alone, each with `slug`, `title`, `cover_url` and `playing_now_player_count` (null below 3 players).\n\n### Play stats\n\n`play_stats` in the stats answer, counted by the game page with no code in the game. These are **counted plays**, Zaisma\'s official numbers: a play counts once the game has been on screen for a minute, in a browser Cloudflare\'s invisible check says is real (each check works once, and time can\'t be claimed faster than it passes). They\'re also what Popular and Trending use.\n\n- **days:** per day (UTC `date`), `play_count`, `player_count` (browsers with a counted play that day), `new_player_count` (browsers with their first counted play) and `play_duration_min` (time on screen in counted plays), plus `started_play_count`: every play started, counted or not.\n- **play_count**, **started_play_count**, **new_player_count** and **play_duration_min** over the period, and **average_play_duration_min** per counted play.\n- **came_back:** `after_1_day`, `after_7_days` and `after_30_days`, each `{"returned_pct", "returned_player_count", "new_player_count"}`: of the new players in the 30 days before, how many played again that many days after their first play. Only days that are over count, so `returned_pct` is `null` until there are some.\n\nA player is a browser: one person on two devices counts twice, and clearing the browser makes them new. Plays through tester and preview links, and your own while signed in, aren\'t counted. We keep only counts: nothing that says who played. Faking plays breaks the content rules: it takes a game off Popular, Trending and New, and doing it again can get the game taken down.\n\n`performance` in the stats answer says how the game runs on players\' devices, measured in their browsers by a small script Zaisma adds to the game\'s pages at its public address, with no code in the game. Only you and your AI see it: never the game page, the shelves or the ranking. It\'s `null` when `performance_measuring_enabled` is off.\n\n- **version_totals:** each version played in the period, every device together, newest first.\n- **device_totals:** the newest version played in the period, by `browser_name`, `os_name` (read from the browser\'s user agent, which isn\'t kept), `device_kind` (`computer`, `phone` or `tablet`, as the game page tells them apart) and `graphics_family` (the graphics chip\'s maker, read in the game\'s frame so the chip\'s own name never leaves it; `unknown` when the browser hides it), most plays first. Groups under 20 plays fold into one last row whose four are all `other`, so a rare device can\'t single out a player.\n\nEach row has `version_id`, `play_count` and:\n\n- **median_loading_duration_sec**, **slow_tenth_loading_duration_sec:** from the game\'s page opening to its first draw on a canvas in the page, the same first draw the Chrome check measures (`performance_check.loading_duration_sec` on a version): half the plays drew within the median, and the slowest tenth took the slow tenth or longer. `null` when none drew.\n- **median_frames_per_sec**, **low_tenth_frames_per_sec:** frame rates of the seconds the game was on screen, counted from its own `requestAnimationFrame` frames, so a game that draws from a worker (OffscreenCanvas) or never asks for frames isn\'t measured (`is_measured: false`, and these are `null`). They\'re given as the band they fall in (15, 25, 30, 45, 60, 90 or 120; below 15, the rate itself): 60 means 60 to 89, since frame rates gather at screens\' refresh rates.\n- **long_frames_per_min:** frames of 50 ms or longer, stutter a player feels, a minute of measured play.\n- **crashed_play_pct**, and crashed plays by what happened first, each play counted once: **error_stop_count** (an uncaught error after which the game asked for no frame for 5 seconds while on screen), **context_lost_count** (a WebGL context on a canvas in the page was lost while on screen, and the game didn\'t lose it itself with `WEBGL_lose_context`) and **stopped_responding_count** (the game\'s frame stopped answering for 15 seconds while on screen: frozen or crashed).\n- **median_peak_memory_size_bytes:** the most memory a play used by the time it was first reported, usually its first minute: the JavaScript heap where the browser tells it (Chrome and Edge) plus WebAssembly memory. `null` when no browser told it.\n\nPlays are measured with the same Cloudflare check as counted plays, so faked ones can\'t skew them: a play\'s numbers come only with its check\'s ticket, its load time and crash count once, and it can\'t report more play than it has been open. Plays through tester and preview links and your own aren\'t measured. Numbers are kept as totals a day per version and device group, never per play or player.\n\n### Export everything\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/export` | What an export of the whole game holds, in `export`: `download_url`, `command`, `version_count`, `withheld_version_count`, `image_count`, `withheld_image_count`, `shader_count`, `save_count` and `files_size_bytes`. |\n| `GET /games/:slug/export/download` | The export itself: a .zip (`application/zip`), made as it downloads. |\n\nEverything about a game as one .zip, to keep, to move, or to run on your own server. Three ways in, one file: `export_game` answers `download_url`, a link your AI hands you that opens in your browser when you\'re signed in to Zaisma and for no one else (it doesn\'t expire); the game\'s dashboard has an Export everything button on its Details tab; and `npx @zaisma/cli export <slug>` saves it as a folder (The upload command, below). The key needs read access to the game, versions, stats, database and saves (`key_not_allowed` otherwise; a read key has it all). An account starts up to 2 exports a minute (`slow_down`). Each export is a line in the game\'s history ("Exported everything about the game"), with who made it and from where.\n\nIn the .zip:\n\n- `README.txt`: what\'s where.\n- `game.json`: the game (as `GET /games/:slug` answers it), its `images` (each with `file_path`, or `null` when it hasn\'t passed review), its `shaders` (each with `file_path`, or `null` when it hasn\'t passed its check, and what every pass\'s channels read), `testers`, and `secrets`: their names and when each was set, never their values.\n- `versions.json`: every version Zaisma keeps, with its patch notes, review status and findings, as `GET /games/:slug` answers them without the preview links; `folder_path` is where its files are, or `null` for a version that\'s still being scanned, held or rejected. Those carry no files, so nothing unscanned or held leaves through an export.\n- `versions/<version_id>/\u2026`: each version\'s files, as they were uploaded.\n- `images/<kind>-<image_id>.png` (or `.jpg`, `.webp`): the cover, square cover and gallery pictures that passed review.\n- `shaders/<screen>-<shader_id>.glsl`: each shader that passed its check, with its buffer passes beside it as `<screen>-<shader_id>.buffer-a.glsl` to `.buffer-d.glsl`.\n- `database.sql`: the game database as SQLite\'s SQL dump, the same text `export_database` answers part by part. `zaisma export` also makes it `database.sqlite`, the file the Node runner takes as `--database-file`.\n- `saves.jsonl`: every player\'s cloud save, one JSON object a line, as `get_save` answers it (`player_id`, `sha256`, `size_bytes`, `saved_at`, `changed_by_kind`, `save_copy_count`, `version_id`, `local_storage_items`, `indexeddb_databases`). Earlier copies of saves stay out.\n- `stats.json`, `reports.json`, `history.json`: as `get_stats` (90 days), `get_reports` and `get_history` answer them.\n\nAccount-wide things (webhooks, sign-in apps, API keys) aren\'t in it: they belong to the account, not the game. The files are stored as they are, not compressed, and zip64 records go in where a game needs them, so every unzip tool opens it.\n\n## Hosting and credit\n\nEverything a game runs on Zaisma\'s servers is on one meter per game, shown as a percentage of its free hosting for the month, never in dollars: its rooms, its game server, data Zaisma\'s relay sends its players, its database, and requests, webhook events and schedule runs to its game server. Every game gets the same free hosting each calendar month (UTC), with no card: 8 friends playing a real-time game 2 hours every night use about a third of it; it covers about 1,300 player-hours of an 8-player real-time game at 60 ticks a second (over 300 players playing 4 hours a month), or about 2,500 player-hours of a 4-player turn-based game. A demo or a test never uses up another game\'s month. Free on purpose, for every game and off the meter: game files (downloads and storage, so a game never stops loading), cloud saves, accounts and sign-in, publishing and its reviews, spectators, and anything on your own servers (rooms, a relay, an API).\n\n`hosting_use_this_month`, in `GET /games/:slug/stats` and `GET /games/:slug/database`:\n\n- `free_used_pct`: how much of the month\'s free hosting is used, 0 to 100. `resets_on_date` is when it starts again.\n- `shares`: what used it, each `{"kind", "share_pct"}` adding to 100, biggest first: `rooms`, `game_server`, `relayed_data`, `database`, `requests`, `adult_chat_checks` (the chat filter\'s checks between adults, with `adultChatFilterEnabled`), `page_previews` (Chrome drawing your AI\'s preview pictures, `preview_game_page`). `[]` before any use.\n- `second_free_allowance_month_start_date`: the month the game had its second free allowance, the first time it filled its free hosting, or `null` until then. It comes once; that month `free_used_pct` counts both.\n- `is_paused`, `paused_reason` (`free_used`, `budget_used`, `credit_used`, `no_real_players`, `free_hosting_ended` or `null`) and `paused_at`.\n- `free_rooms_stopped_at`: when Zaisma\'s free room time for the month ran out across all games, for a game with no budget with credit; `null` otherwise. See the stop below.\n- `monthly_budget_cents` and `spent_from_credit_cents`: the game\'s budget and what credit paid for it this month.\n- **Where the hours went:** `play_hours`, this month\'s totals, never who: `total_duration_hours`, of it `new_player_duration_hours` and `returning_player_duration_hours`, and of it again `rented_network_duration_hours` and `other_network_duration_hours`, with `rented_share_used_pct`.\n- **Real players go last:** traffic from rented-server networks has its own share of 10% of the game\'s free hosting and of its budget, counting only its own use, and everyone else plays from the rest, with no extra free time and no gap in the meter. On that share: anyone on a rented-server network without history, and anyone at all whose browser shows no input and no graphics chip. An account a week old, or that played before or bought something, and a browser that played this game before, play from the rest on any network. Past it those players get `rented_share_used` from rooms, requests and the relay, and in a match they get an hour; everyone else plays on. A game on its own server isn\'t on the meter, and never hears any of it.\n- The counts behind it: `room_awake_duration_hours`, `room_connection_count`, `inbound_message_count`, `relayed_size_bytes`, `game_server_cpu_duration_sec` (of it `startup_cpu_duration_sec`), `game_server_session_count`, `loaded_version_count`, `outside_call_count`, `log_file_count`, `request_count`, `awake_duration_hours`, `database_call_count`, `written_row_count`, `read_row_count`, `bookkeeping_written_row_count` and `database_size_bytes`; and `room_play_duration_hours`, player time in rooms, a fact for tuning that isn\'t priced.\n\n**A second free allowance, once.** The first time a game with real players fills its free hosting, it gets a second allowance free that month, so it doesn\'t stop before you can react: `second_free_allowance_started` tells you. A game with no real players doesn\'t get it yet, and doesn\'t lose it. A game with a budget isn\'t charged for it. From the next month it has one allowance again.\n\n**Real players** are browsers with a counted play this month (a minute on screen from a browser Cloudflare checked, not your own), off cloud networks. Tester-link plays from checked browsers count here too, and never in your stats. A game needs at least 2, and more as it uses more: 8 friends clear it, and a full allowance takes about 17.\n\n**Past the free hosting.** A game without a budget pauses at 100%. A game with one (`monthly_budget_cents` on `PATCH /games/:slug`, in cents: 5000 is $50) draws from your credit past it, never more than its budget in a month, at these prices:\n\n- **Rooms:** $23.04 per 1,000 hours a room is awake (a ticking room all the while it ticks; a turn-based room for 10 seconds after each event, a move or its check on its players every 30 seconds, and asleep in between), $0.03 per million messages players send, $1.80 per million times a player connects, $0.60 per million times a room wakes on its own or is called by another of the game\'s rooms, and the rows Zaisma writes for it (its listing, saves and seats) at the database\'s price.\n- **Game server:** $0.08 per 1,000 CPU-seconds wherever it runs (rooms, requests, schedule runs and webhooks), starting up included, counting only the time your code runs: its waits on the database, other servers (including reading their answers) and its own timers don\'t count, calls made at the same moment count only their own time, and each call it makes to another server counts 1 ms; $1.20 per million times it\'s started (a room starting it, a restart after a failure, its requests\' object waking); $0.008 for each version loaded on a day (UTC); $18 per million files of its logs. A running room\'s ticks and messages to it cost only their CPU.\n- **Relayed data:** $0.20 per GB.\n- **Database:** $0.60 per million calls, $4 per million rows written, $0.004 per million read, $0.80 per GB-month stored, and $23.04 per 1,000 hours awake.\n- **Requests:** $1.80 per million game server requests, a schedule\'s run or a webhook event counting as one, and $23.04 per 1,000 hours its object is awake for them.\n- **Chat checks:** $0.20 per 1,000 checks of chat between adults, when its game server turns on `adultChatFilterEnabled`.\n\nOnly this part shows in dollars. You hear at 80% of a game\'s budget (`hosting_budget_nearly_used`) and when it\'s used, by email and in its alerts and webhooks, again for a raised budget; at 80% of the free hosting for a game without a budget, or with one and no credit to spend (`hosting_nearly_paused`). When one run of the meter takes a game straight past a heads-up to its pause, you get both.\n\n**The pause** (`hosting_paused`, with why): no new rooms, connections between players through the relay, or game server requests and schedule runs start until the month resets, the budget is raised or credit comes in. Matches already running get an hour from the pause to finish, every room of the game ending together; the game server\'s `onEnding` and each player\'s `ending` event say when (`room.endsAt`). If the pause lifts within that hour, running matches hear the end is called off (`onEndingCancelled`, the `endingCancelled` event, `room.endsAt` back to `null`) within about 5 minutes and take new players again. The game database keeps reading and writing for that hour, so a match\'s last save lands, then answers `hosting_paused`; exports and erasing a player always work. A pause can come up to 5 minutes after the line is crossed, and what a game uses past its budget or your balance, its finishing hour included, is written off: never charged later. So is what a game without a budget used past its free hosting: a budget you give it later pays only from then on.\n\n**When free hosting runs short,** games with real players go last. Games with no real players, on any account, share part of Zaisma\'s free hosting each month. When it\'s gone, each pauses (`hosting_paused`, reason `no_real_players`) until it has real players or the month resets.\n\n**The stop on free rooms** (`free_rooms_stopped`): Zaisma\'s free room time is limited each month across all games. When it runs out, a game with no budget, or with a budget and no credit to spend, starts no new rooms or connections between players through the relay until the month resets. Players hear `hosting_paused`, and matches already running get an hour to finish, as in a pause. Its database and game server requests go on, up to its own free hosting, until free hosting ends for the month (`hosting_paused`, reason `free_hosting_ended`). A game with a budget and credit isn\'t touched, and giving a game both lifts the stop for it at once. Rooms on your own server are never limited.\n\n**Credit** is one balance for all your games, in cents, never below zero. You buy it on Stripe\'s page ($10 buys $10, from $10 to $1,000 a top-up), and Stripe sells it as the merchant of record, handling sales tax and VAT. It never expires and is never paid out; it pays only for Zaisma\'s services. What\'s unspent of a top-up refunds to its card for 30 days, on request, and after that stays yours to spend but doesn\'t refund; credit is spent oldest first, so the newest top-ups hold the balance. Credit only comes in through Stripe: a top-up you pay on Stripe\'s page, or the monthly credit plan you start there once. You hear when your credit falls under 20% of what there was right after your last top-up (`is_credit_low`, the `credit_low` alert and an email) and when it runs out. Deleting your account refunds what still refunds (credit inside its 30 days; the delete box names any older credit that won\'t come back), even when Stripe is down at that moment: the refund goes through once it\'s back.\n\n**The monthly credit plan** keeps credit from running dry: on the 1st of every month (UTC), the day the free hosting resets, your credit goes back to a level you pick, from $10 to $10,000. You start it once on Stripe\'s page, and Stripe sells every payment as it sells a top-up, with sales tax or VAT on top. The first payment fills credit to the level (at most $1,000: a higher level fills to it from the next 1st). Each 1st pays only what brings the balance back to the level: a quiet month costs what your games spent, and a month with a balance at or over the level, or under $1 short of it, pays nothing. Each payment is a top-up like any other, refundable for 30 days. A declined card shows as `payment_failing` while Stripe tries again over the next days; you hear by email when it\'s declined and when Stripe gives up, and the plan ends then. One plan at a time, apart from Pro. Stopping it is at once: it holds no prepaid month, and credit already bought stays. Deleting your account stops it first.\n\n**Spending needs you.** Your AI can read all of it, start a top-up or the monthly credit plan (you pay on Stripe\'s page), refund a top-up, turn a game\'s budget off or down, and lower or stop the plan. A first or higher budget, and a higher plan level, need your passkey on zaisma.com: through a key it answers `confirmation_needed` (403) with `confirm_url` and `spending_request_id`: Zaisma keeps the exact change, and `confirm_url` opens a sheet on Developer settings naming it ("Starfall\'s monthly budget, none \u2192 $40") with Approve (a passkey tap) and Decline. Only you can approve, for your account alone, and a request expires after a day. `GET /spending-requests/:spending_request_id` shows `request_status` (`waiting`, `approved`, `declined` or `expired`), the change asked for and what it is now. These calls need `credit_access` (see What a key can do).\n\n| Call | What it does |\n| --- | --- |\n| `GET /spending-requests/:spending_request_id` | A raise in spending you asked for: `{"spending_request": {"id", "request_kind" (`game_budget` or `credit_plan_refill_level`), "game_slug", "game_title", "requested_change", "current_setting", "request_status", "created_at", "expires_at", "answered_at"}}`. `requested_change` and `current_setting` are `{"monthly_budget_cents"}` for a game\'s budget and `{"refill_level_cents"}` for the plan\'s level, whose `game_slug` and `game_title` are `null`. Another account\'s, or an unknown one, answers `no_spending_request` (404). Needs `credit_access` `read`. |\n| `GET /credit` | Your credit: `{"credit": {"balance_cents", "is_credit_low", "credit_plan", "top_ups", "games", "entries", "waiting_spending_requests"}}`. `waiting_spending_requests`: each raise in spending waiting for your answer, as `GET /spending-requests/:spending_request_id` answers it, oldest first. `credit_plan`: `null` with no plan, else `{"refill_level_cents", "plan_status", "next_payment_at", "next_payment_cents", "started_at"}`: `plan_status` is `running` or `payment_failing` (the card was declined and Stripe is trying again); `next_payment_at` is the next 1st, 00:00 UTC; `next_payment_cents` is what it pays at today\'s balance, before tax (0 under $1 or at or over the level). `top_ups`: the last 30 days\', newest first, each `{"id", "amount_cents", "refundable_cents", "refund_ends_at", "created_at"}` (IDs `top_up_\u2026`). `games`: games with a budget or spending this month, each `{"slug", "title", "monthly_budget_cents", "spent_from_credit_this_month_cents", "last_month_beyond_free_cents"}` (`last_month_beyond_free_cents`: what last month\'s use past the free allowance would have cost at today\'s prices, 0 when it stayed inside). `is_credit_low`: the balance is under 20% of what there was right after the last top-up. `entries`: the last 90 days, newest first, each `{"id", "entry_kind", "amount_cents", "game_slug", "created_at"}`: `top_up` (adds), `hosting_charge` (one per game per day, negative), `refund` (negative) or `written_off` (what Zaisma took on; it never touched the balance). Needs `credit_access` `read`. |\n| `POST /credit/top-ups` | Start a top-up: `{"amount_cents"}`, 1000 ($10) to 100000 ($1,000); anything else answers `bad_top_up_amount`, and an account with no passkey and no email answers `account_not_protected` (credit stays with the account: add a passkey or an email on zaisma.com/account first). In an account\'s first 7 days, top-ups and buys together stay under USD 100 (`new_payer_limit`). Answers `checkout_url`, Stripe\'s page where only you can pay, `expires_at` and `next_steps` (`get_credit` once you\'ve paid). Paying adds the credit within seconds, and games paused for credit start again. Up to 10 top-ups and refunds a minute. |\n| `POST /credit/refunds` | Refund what\'s unspent of one top-up to its card: `{"top_up_id"}`. Answers `refunded_cents` and `next_steps`. `top_up_not_refundable` when it\'s spent, refunded or over 30 days old; `no_top_up` when it isn\'t yours. |\n| `POST /credit/plan/checkout` | Start the monthly credit plan: `{"refill_level_cents"}`, 1000 ($10) to 1000000 ($10,000); anything else answers `bad_refill_level_cents`. `already_credit_plan` (409) while one runs; `account_not_protected` and `new_payer_limit` as for a top-up, on its first payment. Answers `checkout_url`, Stripe\'s page where only you can pay, `expires_at` and `next_steps` (`get_credit` once you\'ve paid). Shares the 10 a minute with top-ups and refunds. |\n| `PATCH /credit/plan` | Set the plan\'s level: `{"refill_level_cents"}`, as above. Lower or the same applies at once; higher answers `confirmation_needed` with `spending_request_id`. Answers the `credit` as `GET /credit` does, and `next_steps`. `no_credit_plan` (409) with none. |\n| `POST /credit/plan/stop` | Stop the plan at once; credit stays. Answers the `credit` and `next_steps`. `no_credit_plan` (409) with none. |\n| `PATCH /games/:slug` with `monthly_budget_cents` | A game\'s monthly budget: whole cents of at least 100, or `null` for no paid hosting (it pauses at its free hosting). `null` or lower works with a key that has `credit_access` `write`; a first or higher budget answers `confirmation_needed`. A budget under what credit already paid this month pauses the game at once; a higher one starts a game paused on its budget again. |\n\n## Zaisma Pro\n\nZaisma Pro is $10 a month on your card, apart from hosting credit, for developers with a lot to store. It raises these limits (hosting stays on the meter and credit; Pro changes nothing inside games):\n\n| | Free | Pro |\n| --- | --- | --- |\n| Storage | 10 GB, or 50 GB once established or paid by card | 500 GB |\n| New data a day | 10 GB, or 25 GB once established or paid by card | 100 GB |\n| Performance checks a day | 20 | 60 |\n\nReviews and versions a day are the same on every plan: 5 large reviews, 30 small reviews and 100 versions a game. Stats and scheduled releases are free for everyone. Seats come with Teams and custom domains with Custom game domains, so neither is part of Pro. You can cancel any time and keep Pro to the end of the paid month, with no refunds for part of a month; then the free limits come back. Your first payment refunds within 14 days of it (`POST /pro/refund`), and Pro ends then: only the account\'s first Pro payment, while it\'s the only one, so starting Pro again after a refund doesn\'t refund again. A live version over 2 GB stays live, and only new uploads must fit. Versions waiting past a lowered daily review limit wait for the next free one. Pro ends at the end of the period Stripe says is paid, so a renewal Stripe retries keeps it until Stripe says it\'s over. Stripe sells it as the merchant of record, as it does credit. Teen developers buy Pro like anyone; whoever owns the card pays. These calls need `credit_access` (`read` for `GET /pro`, `write` for the rest); `GET /access` answers `plan` (`free` or `pro`).\n\n| Call | What it does |\n| --- | --- |\n| `GET /pro` | Your plan: `{"pro": {"plan", "pro_ends_at", "is_pro_cancelled", "monthly_price_cents", "limits": {"free": {...}, "pro": {...}}, "limits_for_everyone": {...}, "used_today": {"large_review_count", "small_review_count", "performance_check_count"}}}`. `plan` is `free` or `pro`; `pro_ends_at` is when Pro ends or renews (`null` on free); `is_pro_cancelled` says it ends there instead of renewing; `refund_ends_at` is until when `POST /pro/refund` refunds the first payment (14 days after it, while it\'s the only one), `null` after that, on free, or when Stripe didn\'t answer within 3 seconds. Each plan\'s limits are `{"maximum_large_review_count", "maximum_small_review_count", "maximum_performance_check_count", "maximum_version_count", "maximum_game_size_bytes"}`. |\n| `POST /pro/checkout` | Start Pro. Answers `checkout_url`, Stripe\'s page where only you can pay, `expires_at` and `next_steps` (`get_pro` once you\'ve paid). `already_pro` (409) while Stripe holds your Pro subscription, cancelled or not (`resume_pro` takes cancelling back). Up to 10 starts, cancels, resumes and refunds a minute. |\n| `POST /pro/cancel` | Cancel at the end of the paid month. Answers the `pro` as `GET /pro` does, and `next_steps`. `not_pro` (409) when you have no Pro or it\'s already cancelled. |\n| `POST /pro/resume` | Take cancelling back before it ends. Answers the `pro` as `GET /pro` does. `not_pro` (409) when you have no Pro or it isn\'t cancelled. |\n| `POST /pro/refund` | Refund the first payment in full, within 14 days of it, and end Pro now. Answers `refunded_cents` and `next_steps` (`get_pro`). `pro_not_refundable` (409) when you have no Pro, it\'s past 14 days, or it isn\'t the account\'s only Pro payment. |\n\n## Storage\n\nA game can be any size. What\'s limited is what an account stores and how much new data it sends in a day:\n\n| | Stored | New data a day |\n| --- | --- | --- |\n| A new account | 10 GB | 10 GB |\n| Established (see Standing), or paid by card | 50 GB | 25 GB |\n| Zaisma Pro | 500 GB | 100 GB |\n\nEverything stored counts, drafts and old versions too; a file shared between versions counts once, and a file you already store doesn\'t count as new data. Files sent that never become a version count toward the day, and toward what\'s stored until a day after your last upload. A game too big for one day\'s new data goes up over several: what\'s sent stays, and the upload command sends only the rest.\n\nAn account over its limit keeps its live versions. New uploads must fit: `storage_full` says what to delete.\n\n**When nothing pays for what\'s past the limit,** because Pro ended or credit ran out, a 14-day clock starts. A renewal Stripe is still trying, and the wait after a ruling, don\'t start it. You hear by email when it starts and 3 days before the end, and `unpaid_files_delete_at` on `GET /storage` says when. At the end, Zaisma deletes files no version uses, then drafts, then the oldest versions, until the account fits. Live versions stay, and so do versions set to publish, picked by a tester link or kept for a person at Zaisma. Setting a budget with credit, starting Pro or deleting enough yourself stops the clock.\n\n**Past what\'s included,** set a monthly storage budget. Storage then draws from your credit at 12\xA2 per GB a month, charged a day at a time on what\'s past what\'s included, up to the budget and the balance. Credit and budget set how far past it you can go: $10 of both buys room for about 83 GB. If credit runs out, uploads stop fitting and the 14-day clock starts. Stored files never use a game\'s free hosting.\n\n| Call | What it does |\n| --- | --- |\n| `GET /storage` | `{"storage": {"stored_size_bytes", "included_size_bytes", "maximum_stored_size_bytes", "allowance_kind", "new_data_today_size_bytes", "maximum_new_data_size_bytes", "monthly_storage_budget_cents", "unpaid_files_delete_at", "spent_this_month_cents", "price_per_gigabyte_month_cents", "deletable_versions"}}`. `allowance_kind` is `new`, `established`, `paid_by_card` or `pro`. `deletable_versions` is the biggest 20 versions that can be deleted now, each `{"game_slug", "version_id", "size_bytes", "created_at"}`; a key limited to some games sees only those. Any key. |\n| `PATCH /storage` | `{"monthly_storage_budget_cents"}`: whole cents from 100 to 1,000,000, or `null` for none. A first or higher budget answers `confirmation_needed`, where the developer approves with a passkey tap; off or lower works at once. Answers the `storage` and `next_steps`. Needs `credit_access` write. |\n| `DELETE /games/:slug/versions/:version_id` | Deletes one version for good, and the files no other version has stop counting at once. `version_in_use` (409) for one that\'s live, set to publish or picked by a tester link; `still_scanning` (409) while it\'s scanned; `kept_for_review` (403) for one a person at Zaisma must keep. Answers `is_deleted`, the `storage` and `next_steps`. Needs `version_access` publish. |\n| `DELETE /games/:slug` | Deletes a whole game: `{"confirm_slug"}`, the game\'s slug again, or `bad_confirm_slug`. It stops at once for every player and is erased a week later, with its versions, database, saves and purchases, and its link is never used again; until then it stays the developer\'s and counts toward what they store. A game other people played answers `confirmation_needed` (403) with `confirm_url` and `game_deletion_request_id`, and nothing changes until the developer approves there with a passkey tap. `kept_for_review` (403) for a game a person at Zaisma must keep; `still_scanning` (409) while a version is scanned. Answers `is_deleted`, `erases_at`, the `storage` and `next_steps`. Needs `game_access` write. |\n| `POST /games/:slug/bring-back` | Brings a deleted game back until its `erases_at`, as it was before. `not_waiting_to_erase` (409) for a game that isn\'t deleted; `already_erasing` (409) once its week is over; `game_removed` (403) when Zaisma took it down since. Answers `is_brought_back` and `next_steps`. Needs `game_access` write. |\n| `POST /games/:slug/erase-now` | Erases a waiting game nobody but its developer ever played, without waiting: `{"confirm_slug"}`. It always answers `confirmation_needed` first, for the developer\'s passkey tap. `played_by_others` (409) for a game other people played. Answers `erases_at` and `next_steps`. Needs `game_access` write. |\n| `GET /games/:slug/deletion-requests/:game_deletion_request_id` | The developer\'s answer to a deletion: `game_deletion_request` with `request_kind`, `game_slug`, `game_title`, `player_with_save_count`, `purchase_count`, `is_asked_from_dashboard`, `request_status` (`waiting`, `approved`, `declined`, or `expired` after a day), `created_at`, `expires_at` and `answered_at`. `no_game_deletion_request` (404) for one this game doesn\'t have. Needs `game_access` read. |\n\n## Players\n\nA signed-in player plays as their Zaisma account in every game, with the same player ID (`player_\u2026`) everywhere; anyone else is a guest with a new ID for each pass. Your game sees the ID in `room.players`, in `Zaisma.player.getPass()` and as the `sub` of the player pass your own server checks, with `kind` saying `account` or `guest`. Your server checks a pass with `verifyPass(pass, keys, { gameSlug })` from `@zaisma/game-server` (your game\'s own keys at `https://rooms.zaisma.com/v1/pass-keys/<gameSlug>`: every game\'s passes are signed with a key of its own, so a pass for another game never checks out against them; the list holds more than one so the next key is out ahead of signing anything: pick by the token\'s `kid`, as `verifyPass` does, and never pin one; `issuerUrl` defaults to `https://rooms.zaisma.com`): a JWT with header `typ` `pass+jwt` and claim `pass_version_number` `1`, refused with a `PassError` whose `code` is `malformed`, `unknown_key` (fetch the keys again), `bad_signature`, `expired`, `wrong_game`, `wrong_issuer`, `wrong_kind` (a receipt, or another JWT) or `wrong_version`. `kind` and `who_can_chat` may gain values, so treat one you don\'t know as a guest and as `nobody`. An account\'s pass says who it can chat with (`who_can_chat`, and when `anyone` an opaque `chat_group_id`), its own opaque `player_tag_id` and its friends\' and blocks\' tags (`friend_player_tag_ids`, `block_player_tag_ids`), all different in every game. Zaisma never tells a game anyone\'s age; a game could guess which chat group is the younger one from its size.\n\n| Call | What it does |\n| --- | --- |\n| `GET /players/:player_id` | An account\'s public profile, exactly what a stranger sees on zaisma.com/@username, never its email, age or other games\' data: `{"player": {"id", "name", "username", "display_name", "bio", "link_urls", "profile_url", "is_profile_private", "published_games", "played_games", "playing_now"}}`. `name` is the name to show in games: the username, so nobody can pass as someone else. `username` is unique ignoring case and can change, so key your data by `id`. `display_name` and `bio` are what the player wrote, once Zaisma checked it (`null` when none). `link_urls` are links an adult chose to show. When `is_profile_private` is `true` (they show their profile to friends only), `bio` is `null` and the lists of links and played games are `[]`. `published_games` are the games they made that anyone can find, and `played_games` what they played lately when they show it to anyone, each with a `played_period` (`today`, `this_week`, `this_month`, `earlier`), never a time. `playing_now` is the game they\'re playing right now when they show that to anyone (`{ slug, title, page_url }`), else `null`, as for a game that isn\'t out yet. A guest\'s ID, or a deleted account\'s, is `no_player`. |\n\nA player sits in one of your game\'s rooms at a time, as on Steam: joining another room closes their seat in the first (the room\'s players are told "Joined from somewhere else" with close code `4001`, and `onLeave` runs with reason `"left"`). Moves between your rooms (`room.moveTo`, `room.reserve`) and watching never close a seat. A game that keeps players in several rooms at once, like a hangout hub beside its matches, sets `maximumRoomCountPerPlayer` (an integer from 1 to 10, 1 by default; a join past it closes the oldest seat). `playing_now_player_count` (on `GET /games/:slug`) and the game page\'s playing count count each player once, however many rooms they sit in.\n\nGames and servers get the same with no key at `GET https://rooms.zaisma.com/v1/players/<player_id>` (open to any site, up to 300 a minute per address, answers cacheable for 5 minutes), and in games with `Zaisma.player.getProfile(playerId)`. A player pass proves only who the player is: an account\'s carries no name, so your server looks the name up there (the Node game server does it for you). It also says who an account can chat with, never its age: `who_can_chat` (`nobody`, `friends`, `anyone`: the player\'s own setting) and, unless `nobody`, an opaque `chat_group_id` (`chat_group_\u2026`, different in every game: chat never leaves it, friends included); and its friends and blocks as opaque tags, never their player IDs: `player_tag_id` (its own, different in every game), `friend_player_tag_ids` (its friends\', up to 200) and `block_player_tag_ids` (accounts it has a block with, either way, up to 100). Your server asks `passesAreFriends(first, second)`, `passesHaveBlockBetween(first, second)` and `canChat(first, second)` from `@zaisma/game-server` with two checked passes, before passing chat between them. Inside games, `Zaisma.friends.list()` gives a signed-in player their friends playing this game, with their rooms, and `Zaisma.friends.sendRequest(playerId)` offers a friend request that Zaisma asks the player about first, answering `{ status }`: `sent`, `cancelled`, `already_friends` or `not_taking_requests` (see "Friends in your game" in the README). A game never sees a request; two players who become friends get each other\'s tags in their next passes.\n\nIn games, `Zaisma.player.getPass()` gives this tab\'s player and their pass (`{ id, name, kind, pass, expiresAt }`) to send to your own server. `Zaisma.invite(room)` opens Zaisma\'s invite sheet on the game page (the room\'s QR code, link and code), or on your own site the share sheet or a copied link; it works only right after the player taps or presses a key in the game, so call it from that tap\'s handler, and it fails with `error.code` `"needs_player_tap"` otherwise. It answers `"opened"`, or `"failed"` when the page couldn\'t open it; on your own site `"shared"` from the share sheet, `"copied"` the link, `"cancelled"` the share sheet, or `"failed"` (`InviteStatus`; treat a value you don\'t know as `"failed"`). A game that shows its own player list reads its room\'s players and draws it, with `room.mute`, `room.unmute`, `room.block` and `room.report` behind its own buttons; the Zaisma overlay keeps its own list for every game, and no call opens it. On touch screens the Zaisma button stays in the top right corner over your game and takes presses there, so keep that corner free of your own buttons on phones and tablets. The reference is `packages/sdk/zaisma.d.ts`, served beside the SDK as `_zaisma/v1.d.ts`.\n\n### Chat\n\nPlayers type to each other through Zaisma\'s chat hosting: one call in the game, `room.chat(text)`, sends a message through the room it\'s in, on Zaisma\'s rooms or your own server\'s runner (`zaisma-game-server`). Your game draws the chat box and moderates it; Zaisma decides who may read each message, filters it on its way and keeps none of it.\n\n- **Who reads it:** chat reaches only players in the sender\'s chat group whose settings let them chat with the sender: both accounts, no block either way, neither set to nobody, and friends unless both chat with anyone. Friends in different chat groups stay friends but can\'t chat. Guests don\'t chat (`room.canChat` is `false`: hide your box and offer preset phrases or emotes), and spectators neither send nor read chat. `room.chat` resolves `{ sentAt }` even when nobody could read it, so the sender is never told who can\'t.\n- **In the game:** `room.chat(text, { toPlayerIds })` (all players when `toPlayerIds` is left out, up to 2000 characters, up to 20 messages in 10 seconds) resolves once it went, or rejects with `error.code` `chat_stopped` (`error.reason` says why and `error.message` is what to show the player), `chat_not_allowed`, `chat_empty`, `chat_too_long` or `chat_too_fast`. `room.on("chat", ({ fromPlayerId, text, hasSwearing, hasSlur, sentAt }) => \u2026)` brings the others\' messages; messages from players this player muted or blocked never come. Show the player\'s own line when `room.chat` resolves.\n- **Your game server decides first:** `onChat(state, player, room, { text, toPlayerIds })` runs before Zaisma\'s filter, in both runtimes, the way `canJoin` runs before a join: answer `true` to send it, `false` to stop it (the sender\'s `room.chat` fails with `chat_stopped`, reason `stopped_by_game`, "Your message wasn\'t sent."), or `{ toPlayerIds }` to send it to fewer players (a team chat, a player your moderators muted). It can only narrow: players outside what Zaisma allows are dropped. Only decide in it: `room` can be read, not changed. A game server without `onChat` sends every message on to the filter.\n- **The filter:** every message to or from an under-18 account is checked on Zaisma\'s side. It stops contact details in any disguise (numbers written as words or sent a few digits at a time, handles, links, "add me on\u2026"), moving to another app or meeting up in real life, personal details (where someone lives, their school, their full name, photos) and sexual content. Swearing and slurs are your call: it flags them (`hasSwearing`, `hasSlur`) and lets them through. What the rules can\'t tell goes to a small AI model, a narrow second look that blocks only what clearly is one of those four kinds; when in doubt, or when it can\'t look, the message goes. The verdict is one for the whole message, never per receiver, so it never says which player is under 18.\n- **Between adults** the filter only flags, unless your game server sets `adultChatFilterEnabled: true`: then the same checks run, and each message the AI looks at counts on your hosting meter (`adult_chat_checks`, $0.20 per 1,000 checks). Zaisma pays for the checks on under-18s\' chat.\n- **Reports carry the lines:** `room.report` (and the Players panel\'s Report) sends the last 20 chat lines the reported player sent this player, or this player sent them, from this screen. `get_reports` and the `player_reported` webhook carry them as `chat_messages` (`from_player_id`, the reported player\'s or `null` for anyone else\'s, `text`, `sent_at`): what the reporter\'s game showed, not a record Zaisma kept.\n\nA chat box to copy, all of it in the game (a `<div id="chat-log">`, an `<input id="chat-input">` and a `<button id="chat-send">`; games run in a frame that doesn\'t submit forms, so it sends on the button and Enter):\n\n```js\nconst room = await Zaisma.joinRoom();\nconst log = document.querySelector("#chat-log");\nconst input = document.querySelector("#chat-input");\nconst send = document.querySelector("#chat-send");\nconst nameOf = (playerId) => room.players.find((player) => player.id === playerId)?.name ?? "Someone";\nfunction addLine(name, text) {\n const line = document.createElement("div");\n line.textContent = `${name}: ${text}`; // textContent: never as HTML\n log.append(line);\n log.scrollTop = log.scrollHeight;\n}\ninput.hidden = send.hidden = !room.canChat;\nroom.on("chat", (chat) => addLine(nameOf(chat.fromPlayerId), chat.hasSlur ? "(hidden)" : chat.text));\nasync function sendLine() {\n const text = input.value;\n input.value = "";\n try {\n await room.chat(text);\n addLine(room.me.name, text);\n } catch (error) {\n addLine("Zaisma", error.message);\n }\n}\nsend.addEventListener("click", sendLine);\ninput.addEventListener("keydown", (event) => event.key === "Enter" && sendLine());\n```\n\nEvery answer from the filter is `{ isAllowed, reason, message, hasSwearing, hasSlur }`: `reason` is `contact_details`, `personal_details`, `sexual`, `chat_paused` (the sender\'s chat is paused or removed), `too_long` (over 2000 characters: checked whole, never cut) or `not_allowed_to_chat` (own servers\' `checkChat` only: `canChat` says no for a receiver), and `message` is the words to show the sender, which never mention age or the other player ("Contact details can\'t be sent here.").\n\n- **Other text players type:** `Zaisma.checkChat(text)` answers the same for up to 2000 characters (`too_long` past that), with the tidied `text`, for text that isn\'t chat, like a name for a world. It checks the text alone and keeps nothing.\n- **On your own server without the runner:** `checkChat({ text, senderPass, receiverPasses, isAdultFilterEnabled })` from `@zaisma/game-server`, with the players\' passes as your server received them, after `canChat`. The runner does this for `room.chat` itself. It keeps each sender\'s last 5 messages from the last 2 minutes in memory and sends them along, and it answers `unchecked` when Zaisma can\'t be reached: don\'t deliver those. Zaisma applies `canChat`\'s rule itself too: if the sender may not chat with any receiver, it answers `not_allowed_to_chat`, one verdict for the message that never says which receiver. It\'s free, except the checks between adults when `isAdultFilterEnabled` is `true`. A player your server let in from outside Zaisma (a game played off its Zaisma page, `kind` `outside_zaisma`) goes as `null` in place of a pass: a message between them and an under-18 account is `not_allowed_to_chat`, between them and adults it\'s checked as between adults, and one among such players only is allowed without asking Zaisma. Underneath it\'s `POST https://rooms.zaisma.com/v1/chat/check` with `{ gameSlug, senderPass, receiverPasses, text, recentTexts, isAdultFilterEnabled }` (up to 50 receivers, 2000 characters, 5 recent texts), up to 120 a minute per game and sender; a pass that isn\'t valid for the game is `bad_pass` with its `field` (`senderPass` or `receiverPasses`). In Zaisma rooms, `checkChat` throws a `ChatCheckError` with code `own_server_only`: send chat with `room.chat` there.\n\nContact or personal details stopped toward under-18 accounts five times in a day pause the sender\'s chat for an hour. A paused account\'s next pass says `who_can_chat: "nobody"`, so `canChat` stops it on your server too. Zaisma keeps no chat, except a sexual message from an adult to a teen that reached the filter from an own server, kept for review.\n\n## Room connections\n\nHow a room and each player\'s game stay in touch, the same in Zaisma rooms and on your own server (the Node runner): how a dead connection is noticed, what happens to a player whose connection drops or who walks away, the limits on what players send, and why a connection closes.\n\n### Staying connected\n\n- **The SDK pings** the room every 25 seconds (the room answers without waking up), and reconnects by itself when a ping goes unanswered for 15 seconds, or in a real-time room (one with `ticksPerSec`) after 8 seconds without a word from the room, which probes every 2 seconds (not while the player is away or the game is hidden).\n- **Reconnecting** waits half a second, then doubles each try up to 8 seconds, with no limit, and `room.connectionStatus` is `"reconnecting"` meanwhile. Your game keeps the same room object: the `players` event and your game server\'s messages carry on once it\'s back.\n- **The room drops** a connection with no ping or message for 75 seconds (a closed laptop, lost signal): Zaisma rooms check every 30 seconds, the Node runner every 5. The SDK says goodbye as the page closes, so most players who leave do so at once.\n- **`room.connectionStatus` is the socket only:** `"connecting"`, `"open"`, `"reconnecting"` or `"closed"`. Whether the player is in the match is `room.awayReason` (below), so a player who walked away with the socket still open stays `"open"`.\n- **Sends wait while it\'s down:** reliable `room.send` and `room.sendBytes` calls made while `connectionStatus` isn\'t `"open"`, or while the player is away, are kept in order and go once the room lets them back in, before any latest-only sends that waited. Up to 60 wait (the room\'s burst, so the flush never trips `too_fast`); past that the oldest is dropped and the `error` event says `send_queue_full` once per outage. Both calls return `false` only once the room is gone (ended, kicked or left).\n\n### Dropped players\n\nA blip is the most common thing that goes wrong online, so a player whose connection drops stays in the match for a while instead of leaving it:\n\n- **Away, reason `lost`:** the player stays in `room.players` for `reconnectTimeoutSec` (30 by default, 0 to 300). The game server\'s `onAway(state, player, room, { reason: "lost" })` runs if it has one, `room.awayReason(playerId)` answers `"lost"`, and every player\'s game sees `awayReason: "lost"` for them in `room.players` and the `players` event. They don\'t count as playing, nothing is sent to them, and their seat counts toward `maximumPlayerCount`. If they were the host, the next player is host until they\'re back.\n- **Freeze them:** a game that does nothing shows them standing still. A real-time game can freeze their character, skip their turn or pause the match: in `onTick`, skip players whose `room.awayReason(playerId)` is `"lost"`, and in the game, draw them dimmed or "reconnecting" from `awayReason`.\n- **Back in time:** the SDK reconnects by itself, `onBack(state, player, room)` runs (not `onJoin`, and `canJoin` isn\'t asked), and `awayReason` goes back to `null` for everyone. Send them the full state in `onBack`, since they missed what was sent meanwhile.\n- **Not back in time:** they leave the match as before: `onLeave` with reason `lost`, and the room holds their seat for `seatHoldDurationSec`, so a later return gets `onJoin` with `joinInfo.isReturning`.\n- **`reconnectTimeoutSec: 0`** takes a dropped player out of the match at once (`onLeave`, reason `lost`), as before this option.\n- **`onAway` takes over idle and hidden too:** with `onAway`, a player who goes idle or hidden stays in the room until your game decides (below). To freeze dropped players while leaving idle and hidden ones to the room, read `room.awayReason` in `onTick` instead of adding `onAway`; `onBack` alone changes nothing else.\n\nReal-time rooms notice a silent drop within seconds (their probes); turn-based rooms keep the slower 75-second check, so they can sleep between moves.\n\n### Updates\n\nA version you publish (or roll back to) reaches running matches at their next match, or now: `match_update_mode` `"next_match"` (the default) or `"now"` on `publish_version`, on `upload_files` and `POST /games/:slug/versions` with `publish_when_approved`, `zaisma publish --match-update-mode now`, `zaisma upload \u2026 --publish-when-approved --match-update-mode now`, or Update running games now on the dashboard.\n\n- **Now, in a match:** every live room of the game hears it within seconds (a room that slept through it finds it within a minute of waking). Players\' games get the room\'s `versionUpdate` event, `{ versionId, appliesAt, isReloading }`, to show a countdown or save. Without `onVersionUpdate`, the match switches 10 seconds later. With `onVersionUpdate(state, versionUpdate, room)`, the room waits for your game server: call `room.applyVersionUpdate()` at a good moment, like the end of a round, or it switches at `versionUpdate.appliesAt`, 5 minutes on.\n- **The switch:** the room saves, its connections close with code `4004`, and the new version\'s game server starts from the saved state: `onRestored(state, restoreInfo, room)` runs with `restoreInfo.savedVersionId`, the version that saved it, so you can bring an older state up to date (or `room.end()` the match if you can\'t). When only the game server changed, players\' games reconnect by themselves in a second or two. When the game\'s own files changed (`isReloading`), the game page reloads the game in place at the new version, with its save, and `Zaisma.joinRoom()` with no code brings the player back into the same room. Players come back as dropped players do (away, reason `lost`, for `reconnectTimeoutSec`, then a held seat), so a slow reload still finds its place. The game page\'s bar says Updating meanwhile; nothing covers the game.\n- **Now, not in a match** (a single-player game, or a menu): never forced. The game page notices within 2 minutes. A game listening to `Zaisma.versions.on("update", (update) => \u2026)` switches when it says, with `update.apply()` (at a checkpoint, back at its menu), and the page reloads it with its save; otherwise the bar beside the game shows Update, and the player taps it when they\'re ready, or gets the new version the next time they open the game.\n- **Next match:** nothing changes for running matches: a room keeps the version it started on until its match ends.\n- **A room on another version:** a player always plays the version their room runs. A Zaisma room whose game server runs another version than the player\'s game (an open tab from before a publish, or a friend\'s match still finishing on the version before) turns a newcomer away with `other_version`, and on the game\'s Zaisma page the game reloads at the room\'s version, with its save, and joins it; your game never sees it. While the room runs it, the game\'s address serves that version\'s files to the room\'s players, as long as it\'s one you could roll back to (the live version and the last 5 that passed), and not held or taken down. Players already in the room are never turned away this way, and rooms with a built-in game server have no version of their own. Outside Zaisma, through a tester link, or when that version is no longer kept, the join fails with `other_version`.\n- **On your own server** `onVersionUpdate` never runs and `room.applyVersionUpdate()` does nothing: the game page still reloads players\' games after a `now` publish when they\'re not in a match, and you restart your server to switch it (the Node runner brings its matches back, below).\n\n### Restarts\n\nZaisma restarts its rooms whenever Zaisma itself is updated, and a match carries on:\n\n- **Saved every few seconds:** a real-time room saves its game server\'s state every `stateSaveIntervalSec` (5 by default, 1 to 60), only when it changed, and once more when everyone walks away or leaves; a turn-based room saves after every change, as always. A state over 32 MB as JSON isn\'t saved: the game\'s logs say so once, and a restart starts that room fresh.\n- **Back a few seconds behind:** the restarted room starts from the last save instead of `setup`; a real-time room (one with `ticksPerSec`) also runs `onRestored(state, restoreInfo, room)` once, and so does a turn-based room that had players in its match (it loses no moves, only the connections): `restoreInfo.savedAt` (an ISO time) and `restoreInfo.lostDurationSec`, the seconds of play since then that are lost. Use it to resync clocks or tell players.\n- **Players come back as dropped players:** everyone who was in the match is away with reason `lost` (`room.awayReason` answers it in `onRestored`), `onAway` runs for each, and they have the whole `reconnectTimeoutSec` from the restart. Their connections drop (the Node runner closes them with code `1012` as it stops), the SDK reconnects to the same room by itself, and `onBack` runs for each one back; anyone who isn\'t leaves as `lost` (above).\n- **A room that empties** keeps its saved state for a day, so players rejoining it find the match as it was (a real-time room\'s `onRestored` runs then too, with `lostDurationSec` 0: it saved as the last player left). A kept room keeps it until it ends (see Kept rooms below). A match that ends keeps nothing.\n- **On your own server** the Node runner saves to its `--room-state-file` (`zaisma-room-states.sqlite`) the same way, and saves every room when it\'s stopped, so a clean restart loses nothing.\n\n### Walking away\n\nPlayers who walk away stop holding seats and running matches, with no code:\n\n- **Idle:** after `idleTimeoutSec` without input (600 by default, 30 to 86400), the SDK asks "Still there?" for 30 seconds; no answer, and they walk away (`idleCheck`: `"server"`, the default, `"client"` or `"off"`).\n- **Hidden:** in a real-time room, a game hidden for 2 minutes counts as away.\n- **What happens:** with `awayMode: "hold"` (the default), they leave the match (`onLeave`, reason `idle` or `hidden`) and the room holds their seat for `seatHoldDurationSec` (300 by default, up to 1800, 0 for none); any input brings them back, and `onJoin` gets `joinInfo.isReturning`. `awayMode: "lobby"` sends them to the room that made this one (`room.reserve`). With `onAway`, they stay in the room and your game decides: kick them, move them or keep them.\n- **In the game:** the `idle` event hands `{ idleStatus, answerTimeoutSec }`: `"asking"` when it\'s time to ask (listening replaces Zaisma\'s "Still there?" plate), then `"answered"` on input or `"timed_out"` as the room hears they walked away. The `away` event hands `{ awayReason, seatHoldDurationSec }` and `room.awayReason` says `"idle"` or `"hidden"` until they\'re back. The `back` event hands `{ roomCode, isSeatHeld, rejoin() }`: `isSeatHeld: true` once the room let them back into their held seat; `false` on their first input after the seat ran out, when listening for `back` leaves rejoining to your game (`back.rejoin()`), and without a listener the SDK rejoins by itself.\n\n### Message limits\n\n- **From each player:** up to 16 KB a message (or bytes), and 30 a second with a burst of 60. The SDK throws `too_big` before sending one over 16 KB; past the rate, that message is refused with an `error` event (`too_fast`) and the connection stays open.\n- **Who sent it:** a message or bytes the game server passes on from one player carries `fromPlayerId` (its send options\' `fromPlayerId`; the relay always sets it), and the game\'s `message` event hands `(message, fromPlayerId)`, `bytes` hands `(bytes, fromPlayerId)`, with `null` for the game server\'s own.\n- **Join and setup data:** up to 4 KB of JSON (`joinData`, `setupData`).\n- **From the room:** what your game server sends isn\'t capped, but a player who can\'t keep up is dropped (below).\n\n### Ping and the room\'s clock\n\n- **Ping:** the game server reads a player\'s round trip with `room.pingDurationMs(playerId)`, and the player\'s game reads its own with `room.pingDurationMs`: the same number, in milliseconds, smoothed so one slow packet doesn\'t make it jump. It\'s `null` until the first measurement, right after the player joins.\n- **Measured by the room:** the room sends each player a small probe right after they join, every 2 seconds while a real-time room ticks (turn-based rooms keep sleeping between moves), and whenever 256 KB has gone out to them; the SDK answers it at once. Answers aren\'t game messages: they don\'t count toward a player\'s 30 a second, your message stats or the idle check. Since the room measures it, a player can only make their ping look worse by answering late, never better, so cap any lag compensation that uses it.\n- **One clock:** `room.serverTimeMs()` is the room\'s clock now, in epoch milliseconds, on the game server (like `Date.now()`) and in every player\'s game, where the SDK estimates it from the probes. A time the game server sends means the same moment for everyone, like `{ startsAtMs: room.serverTimeMs() + 3000 }` for a countdown.\n\n### Slow connections\n\nA player whose connection can\'t keep up is dropped before the room has to hold a growing backlog for them: when a probe has gone unanswered for 8 seconds, or 2 MB has gone out to them since the last probe they answered. Their connection closes with code `4003` and they become a dropped player (above): away with reason `lost` for `reconnectTimeoutSec`, while the SDK reconnects by itself, so they come back caught up. Send a returning player the full state in `onBack`, and in `onJoin` when `joinInfo.isReturning`, not just what changed (state sync does it by itself). A room\'s memory for its players stays bounded, and one bad connection can\'t stall a match for everyone else.\n\nBefore that, a connection can be **backed up**: 64 KB or more sent to it and not through yet. On your own server, that\'s the socket\'s `bufferedAmount`; in Zaisma rooms, 64 KB or more sent since the last probe the player answered, while a probe of theirs is 250 ms later than their ping. State sync skips a backed-up player and latest-only messages wait for them (below), so a slow player never builds a queue of stale updates.\n\n### State sync\n\nAn optional building block for real-time worlds, the same in Zaisma rooms and on your own server: your game server keeps its state as a plain object, and with `stateSyncEnabled: true` each player\'s game gets it without your code sending anything.\n\n- **A full copy, then what changed:** a player gets their whole view as they join (and after reconnecting), then, after each tick (or each handler, in a turn-based game), only what changed since their last: `{ type: "state", serverTimeMs, full }`, then `{ type: "state", serverTimeMs, changes }`. Each change is `[path, value]` (set) or `[path]` (remove), with `path` the keys and indexes from the top: objects by key, arrays by index while their length stays the same and whole when it changes. `serverTimeMs` is the room\'s clock as it was sent. Nothing goes out when nothing a player sees changed.\n- **Each player\'s view:** `stateView(state, viewer, room)` answers what `viewer` sees, like only what\'s near them in a big world or without the other team\'s hand; without it, everyone sees the whole state. It runs for every player on every tick, so keep it cheap, and it only answers: a call in it that changes the room or sends (`room.broadcast`, `room.kick`, `room.end`, ...) throws `room_call_unavailable`, which the game\'s logs show; reading (`room.players`, `room.roomCode`) works. A view over 1 MB as JSON isn\'t sent, and the game\'s logs say so once.\n- **In the game:** `room.state` is this player\'s view (null until the first update), the `"state"` event hands `(state, changes)` (`changes` null after a full copy), and `room.smoothedState({ delayMs })` answers the state `delayMs` (100 by default, up to 1000) behind the room\'s clock, between the two updates around then: numbers blended in a straight line (integers in between come back as fractions, and an angle that wraps blends the long way), anything else as the older one had it. Predicting the player\'s own moves stays your game\'s.\n- **Backed up:** a player whose connection is backed up gets nothing until they\'ve caught up, then a full copy, so a slow spell costs one copy instead of a growing queue. There are no acknowledgements: over the room\'s connection a change can\'t be lost.\n- **Where it runs:** where the state is, in your game server\'s sandbox on Zaisma (its time counts as the game server\'s CPU) and in the room on your own server. The state goes as JSON, so keep it plain; its updates count as `(state)` in `get_stats`.\n\n### Latest-only messages\n\n`room.broadcast`, `room.send`, `room.broadcastBytes` and `room.sendBytes` on the game server, and `room.send` and `room.sendBytes` in the game, take `{ delivery, latestKey }`:\n\n- **`delivery: "reliable"`** (the default) reaches every player, in order.\n- **`delivery: "latest_only"`** may be dropped: while a player\'s connection is backed up, a newer latest-only message with the same `latestKey` replaces the one waiting, and the newest goes once they catch up (oldest key first, before anything newer). For positions sent every tick, or where a player aims. A player keeps up to 64 waiting, one per key; past it, the least recently replaced is dropped.\n- **`latestKey`**, up to 40 characters, says which messages replace each other, like `"position"`, and `latest_only` needs one: without it the send throws: in the game (the SDK) the error\'s code is `bad_send_option`, and on the game server it is a `GameServerError` with the code `bad_room_call` and the room call (like `room.broadcast`) as its field. Bytes have their own keys.\n- **Zaisma rooms carry them over the WebSocket today**, since Cloudflare doesn\'t yet let Workers take WebTransport or WebRTC data channels; the same `delivery: "latest_only"` moves to real datagrams once it does, with no change to your game. **On your own server, the fast lane carries them as datagrams already** (below). Anything else for `delivery` or `latestKey` throws in your code, naming what to give: the SDK\'s error has the code `bad_send_option`; the game server\'s is a `GameServerError` (`bad_room_call`) saying the same.\n\n### The fast lane to your own server\n\n`Zaisma.joinRoom({ serverUrl: "wss://play.example.com", transport: "webtransport" })` joins a room on your own server over WebTransport (HTTP/3 over UDP) instead of the WebSocket. The Node runner serves it with `--webtransport-port`, `--certificate-path` and `--certificate-key-path` (`startServer({ webtransportPort, certificatePath, certificateKeyPath })`, all three or none); any other server can speak it too. `transport` is `"websocket"` (the default) or `"webtransport"`, else the SDK refuses it with `bad_transport`; a `serverUrl` that isn\'t `wss://` or `https://`, and Zaisma\'s own rooms, use the WebSocket either way. If WebTransport isn\'t there, its session is refused, or it isn\'t up within 3 seconds (`FAST_LANE_CONNECT_TIMEOUT_MS`), the room uses the WebSocket for the rest of its life and logs one console warning; a fast lane that worked and then dropped is tried again first. `room.transport` says what the connection uses now.\n\nThe wire:\n\n- **The session** is at `https://<server>/v1/rooms/<game>/<code>`: the `serverUrl`\'s host and port, with `wss:` read as `https:`. The browser sends the page\'s `Origin`; check it as you do for the WebSocket. The certificate must be a real one for that name (browsers check it as for any HTTPS site).\n- **One bidirectional stream**, opened by the client first, carries every frame the WebSocket carries, in order: each is `[4-byte big-endian payload length][1-byte kind: 0 text, 1 bytes][payload]`. Text is the same UTF-8: the JSON messages (`hello`, `welcome`, `probe`, `probe_answer`, ...) and `ping`/`pong`. Bytes are the same binary frames: from the room, `[1-byte sender ID length][sender ID][bytes]`; from the client, the bytes alone.\n- **A datagram** is `[1-byte kind][payload]`, with the same payloads, and carries only `latest_only` sends, both ways, when it fits the session\'s `maxDatagramSize`; a bigger one goes on the stream. Take datagrams only from a player you let in.\n- **Closing:** the session\'s close info carries the WebSocket\'s close codes and reasons (`closeCode` 4000 to 4004, as in [Close codes](#close-codes)).\n\nA server of your own that isn\'t the Node runner (Rust, C++, a studio\'s engine) needs to: accept WebTransport sessions at that path and check `Origin`; read the hello from the stream and verify its pass against your game\'s keys at `https://rooms.zaisma.com/v1/pass-keys/<gameSlug>`; answer each `probe` the room protocol says to send, and every `ping` with `pong`; send the same frames on the stream, and `latest_only` ones as datagrams when they fit.\n\n### Room error codes\n\nA room answers a refusal with `{ type: "error", code, message }`, then closes the connection (`4001`, or `1013` for `busy`); a message it can\'t take gets the same `error` and the connection stays open. In the SDK they are `error.code` and the `error` event.\n\n| Code | Meaning |\n| --- | --- |\n| `room_full` | The room has no space for another player. |\n| `room_closed` | The room isn\'t taking new players (`room.setOpen(false)`). |\n| `ended` | The match is over. |\n| `too_big` | A message over 16 KB, or `joinData` over 4 KB. |\n| `too_fast` | More messages than the room takes (30 a second, burst of 60). |\n| `bad_message` | A message the room couldn\'t read or use. |\n| `bad_pass` | The player pass wasn\'t accepted; the SDK gets a new one and tries once more. |\n| `bad_player_token` | A game played off Zaisma sent a `playerToken` your own server didn\'t take (its `identifyPlayer` said no, or it takes no guests); the game gets the player a new one. |\n| `no_hello` | The first message wasn\'t a hello with a player pass (or, to your own server, a `playerToken`). |\n| `not_allowed` | Only the game server or the room\'s host can do that. |\n| `game_unavailable` | The game can\'t be played right now. |\n| `busy` | The room couldn\'t take the player right now; the SDK tries again soon. |\n| `kept_out` | The player was removed for the rest of the match. |\n| `refused` | The game server\'s `canJoin` turned the player away. |\n| `room_not_running` | The room isn\'t running, like one with nobody playing to watch. |\n| `rented_share_used` | This player is on a rented-server network, and the share of the game\'s hosting such traffic gets is used; everyone else plays on. Zaisma\'s page tells them to turn off their VPN or sign in. |\n| `hosting_paused` | The game\'s hosting is paused this month, or Zaisma\'s free room time ran out; new rooms open again when it resets or its developer adds credit and a budget. |\n| `account_needed` | The game needs a Zaisma account for multiplayer, and the player is a guest. |\n| `game_not_open_to_player` | The account is younger than the game\'s minimum age. |\n| `blocked_player_here` | Someone the player blocked is in the room; `quickJoin` tries other rooms first. |\n| `other_version` | The room runs another version of the game (see Updates above). |\n| `spectators_full` | The room takes no more spectators. |\n| `spectator_cannot_send` | A spectator tried to send to the room. |\n| `already_playing` | A player in the room tried to watch it too. |\n| `bad_origin` | The connection didn\'t come from the game\'s own page. |\n| `send_queue_full` | The SDK\'s own: more than 60 sends waited while it reconnected, so the oldest were dropped. |\n| `chat_not_here` | A chat message reached a room whose server doesn\'t take chat (an older runner). |\n| `chat_not_allowed` | `room.chat` from a guest, or a player whose chat is set to nobody or paused (`room.canChat` is `false`). |\n| `chat_empty` | `room.chat` with nothing but spaces. |\n| `chat_too_long` | `room.chat` over 2000 characters. |\n| `chat_too_fast` | More than 20 chat messages in 10 seconds from one player. |\n| `bad_region` | The SDK\'s own: a `region` that isn\'t a continent code (`"AF"`, `"AN"`, `"AS"`, `"EU"`, `"NA"`, `"OC"` or `"SA"`). |\n| `bad_idle_timeout` | The SDK\'s own: an `idleTimeoutSec` that isn\'t from 30 to 86400. |\n| `bad_transport` | The SDK\'s own: a `transport` that isn\'t `"websocket"` or `"webtransport"`. |\n| `zaisma_rooms_not_used` | The SDK\'s own: the game doesn\'t use Zaisma rooms, so there are none to join or list. |\n\n### Close codes\n\n| Code | Why | What the SDK does |\n| --- | --- | --- |\n| `4000` | The match ended (`room.end`, or Zaisma ending it) | Stops: `connectionStatus` `"closed"`, after the `ended` event with its `endReason` |\n| `4001` | The room refused the player (an `error` with the code comes first, like `room_full`, `bad_origin` or `game_unavailable`), removed them (`room.kick`), or they joined from another tab | Stops: `connectionStatus` `"closed"` |\n| `4002` | The seat held for a player who walked away ran out | `connectionStatus` `"closed"`; waits for the player to come back, then the `back` event with `isSeatHeld: false` |\n| `4003` | The connection stopped answering probes or fell too far behind | Reconnects by itself, as a dropped player |\n| `4004` | The match switched to a version published `"now"` | Reconnects by itself, or the page reloads the game at the new version (`isReloading`) |\n| `1012` | The Node runner is restarting | Reconnects by itself, as a dropped player |\n| `1013` | Zaisma rooms are busy (an `error` with `busy` comes first) | Reconnects by itself, waiting longer each try |\n\nAny other close (a network drop) reconnects by itself too.\n\n### Room events\n\nEvery event the game\'s room object has, and what its listener gets. Within v1, events and error codes only grow, so keep a `default` for ones you don\'t know.\n\n| Event | Listener gets |\n| --- | --- |\n| `message` | `(message, fromPlayerId)` |\n| `bytes` | `(bytes, fromPlayerId)` |\n| `state` | `(state, changes)` |\n| `players` | `(players)`, each `{ id, name, kind, awayReason }` |\n| `connectionStatus` | `(connectionStatus)` |\n| `settings` | `{ isListed, isOpen, friendJoinsEnabled, name, labels, spectatorCount }` |\n| `ended` | `{ message, endReason }`: `game`, `no_players`, `hosting_paused`, `kept_room_deleted`, `game_unavailable` or `game_server_stopped` |\n| `ending` | `{ endsAt }` |\n| `endingCancelled` | `()`: the end `ending` announced is off, since the game\'s hosting started again; `room.endsAt` is `null` |\n| `kicked` | `{ message, isKeptOut }` |\n| `chat` | `{ fromPlayerId, text, hasSwearing, hasSlur, sentAt }`: another player\'s chat line (see Chat) |\n| `move` | `{ roomCode, follow(), join(joinOptions) }` |\n| `moved` | `{ roomCode, fromRoomCode }` |\n| `idle` | `{ idleStatus, answerTimeoutSec }` |\n| `away` | `{ awayReason, seatHoldDurationSec }` |\n| `back` | `{ roomCode, isSeatHeld, rejoin() }` |\n| `muted` | `(playerIds)` |\n| `error` | `{ code, message }` |\n| `versionUpdate` | `{ versionId, appliesAt, isReloading }` |\n| `roomMessage` | `{ message, senderKind, fromRoomCode, sentAt }`: a room message for a room whose game server has no `onRoomMessage` (see Reaching live rooms) |\n\nThe SDK and rooms say which messages they speak with `protocolVersionNumber` (1 today): the SDK sends it in its hello, and the welcome answers the room\'s. A room skips a message type it doesn\'t know, so a newer SDK still plays in an older room.\n\n## Sign in with Zaisma\n\nPlayers sign in to your own site, server or app with their Zaisma account, and you know them by the same player ID your games see. It\'s standard OpenID Connect (the authorization code flow), so any OpenID Connect library works: point it at the issuer `https://zaisma.com`, which publishes everything else at `https://zaisma.com/.well-known/openid-configuration`.\n\n| Call | What it does |\n| --- | --- |\n| `GET /sign-in-apps` | Your sign-in apps: `{"id", "name", "kind", "redirect_urls", "issuer_url", "created_at", "updated_at"}`. |\n| `POST /sign-in-apps` | Make one: `{"name", "kind", "redirect_urls"}`. Up to 20. Answers with the `sign_in_app` and, for a confidential app, its `client_secret`, shown only this once (`null` for a public app). |\n| `PATCH /sign-in-apps/:id` | Change `name` or `redirect_urls` (the whole list), or `{"replace_client_secret": true}` for a new secret, answered once as `client_secret`; the old one stops working at once. |\n| `DELETE /sign-in-apps/:id` | Delete one for good, with every player\'s yes to it; answers `removed_sign_in_app_id`. |\n\n- **The app\'s `id`** (`sign_in_app_\u2026`) is its OAuth `client_id`.\n- **kind:** `confidential` for a site or server that keeps the client secret on its server (sent by HTTP Basic or as `client_secret` in the form); `public` for a page, phone or desktop app with no server, which has no secret and must use PKCE (`code_challenge_method=S256`). PKCE works for confidential apps too.\n- **redirect_urls:** 1 to 10 exact URLs your library\'s callback lives at: https, or `http://localhost` for development, no `#fragment` and no wildcards. The `redirect_uri` a sign-in sends must be one of them, exactly.\n- **name:** what players see on the one-time consent page, with your account\'s name as the developer and the address they go back to. It can\'t say Zaisma.\n- **Scopes:** `openid` (the player ID) and `profile` (the player\'s name and username). Ask for `"openid profile"`. Zaisma never shares an email, an age or anything else on the account, so `email` and other scopes are refused with `invalid_scope`.\n- **What you get:** an ID token (RS256, keys at `/.well-known/jwks.json`, more than one so the next is out ahead of signing anything: pick by the token\'s `kid`, as OpenID Connect libraries do, and never pin one) with `sub` (the player ID, a `player_\u2026` ID, the same as in their player passes and `GET /players/:player_id`), `name` and `preferred_username` (their Zaisma username) with the profile scope, `nonce` when you sent one, and `auth_time`; and an access token for `/oauth/userinfo`, which answers the same `sub`, `name` and `preferred_username`. Both last an hour; there are no refresh tokens, so keep your own session.\n- **Players decide:** the first sign-in to an app asks the player; later ones go straight back. Players see the apps they signed in to on their account page and can remove any, which stops `/oauth/userinfo` for that app at once. `prompt=none` answers `login_required` or `consent_required` instead of showing a page, and `prompt=consent` asks again. Codes work once, for 2 minutes. Deleting an account removes the player\'s yeses; deleting yours removes your apps.\n\n## Registered links\n\nThe sites a game opens: its store, Patreon, Ko-fi, Steam page, Bitcoin page or Discord. Games can\'t open pages themselves (their frame doesn\'t allow it), so a game opens one of its registered links with `Zaisma.links.open(link_name)`, right after the player taps or presses a key in it, and the game page shows a card over the game\'s top corner: "You\'re leaving Zaisma", the game\'s name, the full address, **Open <site>** and **Stay**. The game keeps running behind it and hears `"opened"` or `"stayed"`. A tick on the card opens that site straight away from then on, in that browser. See `Zaisma.links` in the SDK\'s reference (`_zaisma/v1.d.ts`).\n\nThey\'re part of the game (`links` on the game, set with `PATCH /games/:slug` or `update_game`): up to 20, the whole list each time, `[]` for none, live at once with no approval, and kept in the game\'s history. Each is `{"link_name", "destination_url", "is_on_game_page"}`, and answers add `who_can_open` and `review_reason`:\n\n- **link_name:** what the game opens it by, like `store`: up to 32 lowercase letters, digits and underscores, starting with a letter, each its own.\n- **destination_url:** the whole `https` address, up to 500 characters. The whole opened address is at most 2,000 characters and each parameter name at most 100. The game can add a path and query parameters under it when it opens the link (`Zaisma.links.open("store", { path: "/buy", queryParameters: { item: "sword" } })` opens `https://kit.itch.io/sky-hopper/buy?item=sword` from `https://kit.itch.io/sky-hopper`), so a store can tell what was bought and by whom; never another site, a path outside the link\'s, or a parameter the address already sets. No link shorteners (bit.ly and others), IP addresses, user names in the address (`user@`) or Zaisma\'s own domains.\n- **is_on_game_page:** the game page shows it too, as a button under the game\'s details in its site\'s own look (Steam, itch.io, Discord, YouTube, X, Bluesky, Reddit, TikTok, Instagram, Patreon, Ko-fi, GitHub, Kickstarter, the App Store, Google Play, Twitch and Gumroad; any other site shows its address). A Steam store page says "Wishlist on Steam". It shows only to players it opens for (`who_can_open`), and goes straight to the site.\n- **who_can_open:** `everyone` when it\'s on a trusted domain (below), `signed_in_adults` for any other site once your account\'s standing opens links to other sites, `waiting_for_standing` for any other site until then, `nobody` when its site is flagged. A link waiting for standing is kept, and opens for signed-in adults the day your account is established or has a card that paid Zaisma or a Stripe account that can take payments (see Standing). Anyone a link doesn\'t open for sees only "This link can\'t be opened here." with Back to the game, never why, and the game hears `"stayed"`, the same as for Stay, so it never learns anyone\'s age.\n- **review_reason:** `link_flagged` when Cloudflare lists the link\'s site for malware or phishing (its security resolver, 1.1.1.2), else `null`. Every site is checked when it\'s added and again every day, for every player whatever their age; a flagged link opens for nobody and shows as a `link_flagged` alert, and opens again once its site is off the list.\n\n**Trusted domains** are well-known store, payment and video sites where strangers can\'t message players: itch.io, store.steampowered.com, gumroad.com, apps.apple.com, play.google.com, patreon.com, ko-fi.com, paypal.com, paypal.me, buy.stripe.com, checkout.stripe.com, donate.stripe.com, strike.me, getalby.com, coinos.io, geyser.fund, pay.zaprite.com, checkout.opennode.com, youtube.com and youtu.be, each with the names under it (`kit.itch.io`). The list lives in `TRUSTED_LINK_DOMAINS` (`packages/core/src/links.ts`). Chat apps and social networks with private messages (Discord, Telegram, WhatsApp, Snapchat, Instagram, TikTok) are never on it. To ask for another domain, post in the forum (category `pages`).\n\nOn your own site there\'s no Zaisma page, so the SDK opens the address the game gives as `ownSiteUrl` straight away.\n\n## Secrets\n\nTokens and keys a game\'s own game server needs, like a Discord webhook URL, a GitHub token or a payment provider\'s secret key: set per game, read by the game server as `server.secrets.<name>` (in `onRequest` and `onSchedule`) and `room.secrets.<name>` (in rooms), and never shown again, to you or anyone. It calls other servers with plain `fetch()` on the hosts in `game_server_allowed_hosts` (above). See "Calling other servers, with secrets" in the README.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/secrets` | The game\'s `secrets`, by name, each `{"name", "set_at"}`: never the value. |\n| `PUT /games/:slug/secrets/:secret_name` | Set one, replacing any of that name: `{"secret_value"}`. Answers the `secret` and `next_steps`. |\n| `DELETE /games/:slug/secrets/:secret_name` | Delete one. Answers `deleted_secret_name` and `next_steps`. |\n\n- **Names** are like environment variables: capitals, digits and underscores, starting with a capital, up to 64 characters (`DISCORD_WEBHOOK_URL`). **Values** are text, up to 8 KB; put several values in one as JSON text if you like. Up to 50 a game.\n- **When it changes:** requests and schedules use the new value from their next call; running rooms get it within a minute.\n- **Who can use them:** they\'re kept away from players, the dashboard, the API and Zaisma\'s own database listings, but the game server\'s code reads them, so anyone who can publish the game\'s code can use them (a `publish` key too). Never put one in the game\'s own files: players can read those.\n- **On your own server** the Node runner\'s `server.secrets` is its environment variables, so set the same names there.\n- A key reads the names with `game_access` `read` and sets and deletes with `write`.\n\n## Items and purchases\n\nWhat a game sells or grants, kept by Zaisma under names the game picks, and every purchase and grant of them with a signed receipt. Zaisma takes no cut: the price a game shows is what the player pays, tax included, and players buy through Zaisma\'s buy sheet, paying the developer\'s own Stripe account (see Selling with the buy sheet). Grants need no Stripe account, so a game can try owned items, receipts and passes before one is connected.\n\n### Sell your game once\n\nA game can sell itself once, the way a PC or console game does, as well as or instead of items inside it. Make the item that is the game, permanent and content, with a price (`set_item`, after `set_purchase_settings` states the refund policy), then name it on the game: `update_game` with `{"full_game_item_name": "full_game"}` (`PATCH /games/:slug`, which needs `purchase_access` `write` for it).\n\n- **What players see:** the game\'s cover carries its price as a tag, and its page shows **Buy** and the price where Play is, in the same buy sheet as purchases inside games (a guest makes an account in it). Once bought, Buy turns into Play. Browse filters by price range. The full game isn\'t an in-game purchase, so a paid game selling nothing else says "No in-game purchases".\n- **Who plays:** players who own it, you, and your tester links. Only accounts own items, so a paid game needs an account for the whole game: setting `full_game_item_name` sets `account_requirement` to `whole_game`, and any other `account_requirement` while it\'s set is refused with `account_requirement_locked`. Play, the game\'s files, player passes and rooms all turn away everyone else (`full_game_not_owned`), on Zaisma\'s side, so it doesn\'t depend on the game.\n- **Bought means kept:** owners still play after you make the game unlisted, private or a draft. A takedown still ends it.\n- **The game sees it as any item:** `Zaisma.items.owns("full_game")`, `player.ownedItemNames`, a receipt, refunds and grants (a backer gets the game by `grant_item`) all work as for other items.\n- **Not on sale right now:** take the item\'s price off (`set_item` with `price_minor_units` `null`) and the page says "Not on sale right now"; owners keep playing. The item stays permanent and content, and stays, while it\'s named (`full_game_item_in_use`): set `full_game_item_name` `null` first to make the game free to play again.\n- **A demo** is another of your games, free to play, that the page links as **Play the demo**; the demo\'s page links back as **Full game**. Set it with `demo_game_slug` (`bad_demo_game` for a game that isn\'t yours, is this one, or sells itself too). Progress doesn\'t carry over.\n- **Add-ons on the game page:** any game\'s page can sell the items you pick beside Play, under **Add-ons** (an expansion, a supporter pack): `set_item` with `is_on_game_page` `true`. A consumable bought there reaches the game the next time the player plays, as any purchase not yet handed over.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/items` (`list_items`) | The game\'s `items` by `item_name`, its `refund_policy`, `refund_policy_text`, `own_payment_categories` and `purchase_delivery`, and the `purchase_label` they make. |\n| `PUT /games/:slug/items/:item_name` (`set_item`) | Make or replace one item, whole: `{"title", "description", "item_kind", "item_category", "price_minor_units", "currency_code", "local_prices", "is_on_game_page"}`, every key every time. Answers the `item` (201 when it\'s new) and `next_steps`. |\n| `DELETE /games/:slug/items/:item_name` (`remove_item`) | Remove one nobody bought or was granted. Answers `removed_item_name` and `next_steps`. |\n| `PATCH /games/:slug/purchase-settings` (`set_purchase_settings`) | `refund_policy`, `refund_policy_text`, `own_payment_categories` and `purchase_delivery` (`game`, `game_server` or `own_server`: where the game\'s purchases are delivered, see Getting purchases to your game); leave out what stays. Answers them with the `purchase_label` and `next_steps`. `no_game_server` for `game_server` on a game with no game server. |\n| `POST /games/:slug/purchases` (`grant_item`) | Grant an item: `{"player_id", "item_name", "item_count", "game_account_id"}`. Answers the `purchase` with its `receipt`, `is_already_owned` and `next_steps`. |\n| `GET /games/:slug/purchases` (`list_purchases`) | Purchases and grants, newest first, 100 at a time (`next_cursor`), each with its `receipt`; filter with `player_id`, `item_name`, `purchase_source` and `purchase_status`. |\n| `GET /games/:slug/purchases/:purchase_id` (`get_purchase`) | One `purchase`, with its `receipt`. |\n| `POST /games/:slug/purchases/:purchase_id/refund` (`refund_purchase`) | Take a grant back, or refund a sale (`purchase_status` `refunded`). A sale refunds through the developer\'s Stripe account: the rest of it by default, or `{"amount_minor_units"}` of it (see Selling with the buy sheet). |\n| `POST /games/:slug/purchases/:purchase_id/handled` (`mark_purchase_handled`) | Say your own server took a purchase (`purchase_delivery` `own_server`): a `completed` one gets `handled_at`, a `refunded` or `charged_back` one `refund_handled_at`. Answers the `purchase`. `already_handled` when it was; `no_purchase` for one that is `pending` or `failed`. |\n| `GET /games/:slug/players/:player_id/items` (`get_player_items`) | The permanent items a player owns in the game, and their purchases still to hand over: `{"player_id", "owned_item_names", "unhandled_purchases"}`. `owned_item_names` is what their next pass lists; `unhandled_purchases` are their `completed` purchases not yet handled, and ones refunded or charged back after being handled whose refund isn\'t told yet, each with its `receipt`, oldest first, at most 50 purchases and 50 refunds. |\n\n- **is_on_game_page:** `true` sells the item on the game page too, under Add-ons, as well as in the game; `false` (an item file that leaves it out) only in the game.\n- **An item** is `permanent` (owned for good, on every device: a skin, an expansion) or `consumable` (delivered once, then the game keeps count: a revive, coins), and says what it is with `item_category`: `cosmetic` (only how things look), `gameplay` (helps you play), `content` (more of the game) or `currency` (in-game money). Its `item_name` is 1 to 40 lowercase letters, digits, underscores and hyphens; `title` up to 60 characters and `description` up to 300. Up to 1,000 a game.\n- **Prices** are in the currency\'s smallest unit (`price_minor_units`: 199 for $1.99, 300 for \xA5300), in a `currency_code` written lowercase as Stripe writes it (`usd`, `eur`, `brl`), at least Stripe\'s minimum for that currency (50 cents; `price_too_low` under it). `local_prices` sets the price in up to 40 other currencies, as `[{"currency_code", "price_minor_units"}]`: a player pays in their country\'s currency when the game set one, else the main price. Prices pick by country, never by browser language. Under 2 dollars, euros, pounds or Canadian or Australian dollars, `card_fee_note` says about how much reaches you after card fees. `price_minor_units` and `currency_code` `null`: an item that\'s only granted, or no longer sold.\n- **The refund policy** comes first: a game states one before anything goes on sale (`refund_policy_needed`). `no_refunds`, `unused_within_14_days`, `within_14_days`, or `own_words` with the policy in `refund_policy_text` (up to 600 characters, no links or contact details).\n- **The label** (`purchase_label`, on the game too) is what the game page says the game sells: the categories of its items with a price, plus what it sells through its own payments (`own_payment_categories`, with `has_own_payments`). It comes from the items, so it can\'t drift; a grant-only item isn\'t in it.\n- **A purchase** is `{"id", "item_name", "item_kind", "item_count", "purchase_source", "purchase_status", "player_id", "game_account_id", "paid_minor_units", "currency_code", "refunded_minor_units", "purchased_at", "refunded_at", "handled_at", "refund_handled_at", "receipt"}`. `purchase_source` is `sale` or `grant`; `purchase_status` `pending`, `completed`, `failed`, `refunded` or `charged_back`. `paid_minor_units` is what the whole purchase paid, in `currency_code` (`null` for a grant), apart from the item\'s price. A deleted game\'s purchases stay in its players\' history, and their Download your data, under the game\'s name. `game_account_id` is your game\'s own ID for the player\'s account in your system, given back as you sent it. `refunded_at` is when the item was taken back, a full refund or a chargeback, and `null` otherwise: a partial refund shows only in `refunded_minor_units` and leaves the item owned, so test `purchase_status` for what the player owns. `handled_at` is when the game, its game server or your own server took the purchase (`purchase_delivery`), and `refund_handled_at` when it was told the purchase was refunded or charged back; `null` until then, and `refund_handled_at` for a purchase never refunded.\n- **Grants** go to accounts (guests\' player IDs last only for their pass: `no_player`). A permanent item a player already owns answers the purchase that owns it with `is_already_owned: true`, also when two grants of it arrive at once; a consumable is granted as many times as asked, `item_count` up to 1,000 each.\n- **Receipts** are JWTs with their own signing key, published at their own address (`https://rooms.zaisma.com/.well-known/receipt-jwks.json`), apart from each game\'s pass keys at `/v1/pass-keys/<gameSlug>`, and kept there for good, so a receipt never expires and a receipt key can never sign a pass. A game server checks one in one call, with no keys to fetch: `await room.verifyReceipt(receipt)` in a room, or `await server.verifyReceipt(receipt)` in `onRequest`, `onSchedule` and `onWebhook`, the same in Zaisma rooms and on your own server. It answers the claims or throws an error whose `name` is `"ReceiptError"` and whose `code` says why (check `error.name`, not `instanceof`: in Zaisma rooms it isn\'t your copy\'s class): `malformed`, `unknown_key`, `bad_signature`, `expired`, `wrong_game`, `wrong_issuer`, `wrong_kind` (a pass) or `wrong_version`. Any other error means the check couldn\'t run just now (keys that didn\'t load, a time-out): try again later rather than refusing the purchase. Elsewhere, `verifyReceipt(receipt, keys, { gameSlug })` from `@zaisma/game-server` does the same with the receipt JWKS\'s keys (`issuerUrl` defaults to `RECEIPT_ISSUER_URL`, `https://rooms.zaisma.com/receipts`). The Node runner fetches them by itself, from `/.well-known/receipt-jwks.json` at its `--issuer-url`. A receipt can\'t pass for a pass: its header says `typ` `receipt+jwt` and its issuer is `https://rooms.zaisma.com/receipts`, so `verifyPass` and any JWT library checking the pass issuer refuse it. Its claims: `receipt_version_number` (1), `purchase_id` (`jti` too), `purchased_at`, `purchase_status`, `sub` (the player), `aud` (the game), `item_name`, `item_kind`, `item_count`, `purchase_source`, `paid_minor_units`, `currency_code`, `game_account_id` and `iat` (when it was signed). Each read signs it again with the purchase\'s current `purchase_status`, so one fetched after a refund says `refunded` or `charged_back`: deliver only on `completed`, once per `purchase_id`, and never compare receipt strings. New `item_kind`, `purchase_source` and `purchase_status` values and new claims may come within version 1; skip what you don\'t handle.\n- **Owned items in the pass:** an account\'s pass lists the permanent items it owns in the game as `owned_item_names` (`[]` for guests and when it owns none), so a game server sees them on connect without calling Zaisma: `player.ownedItemNames`, the same in Zaisma rooms and on your own server, left out when the player owns none (read it as `player.ownedItemNames ?? []`). Players\' games never see what other players own. In the game, `Zaisma.items.owns(item_name)`, `Zaisma.items.owned()` and `Zaisma.items.list()` (the items for sale at the price this player pays, with `priceText`).\n- **Nothing sold is random,** and real prices show beside coin prices: the review holds a version that sells paid random rewards (`ai_paid_random_rewards`) or prices bought coins with no real price beside them (`ai_coin_price_without_real_price`), under the content rule `purchases`.\n- A key reads items and purchases with `purchase_access` `read` (read, upload and publish keys) and changes them with `write` (full keys).\n\n### Getting purchases to your game\n\nEvery purchase and grant reaches the game exactly once, wherever the player buys: the buy sheet, `grant_item`, or a refund. `purchase_delivery` in the purchase settings (`PATCH /games/:slug/purchase-settings`, MCP `set_purchase_settings`) says where, and each purchase carries `handled_at` once it was taken (and `refund_handled_at` once a refund was told). A refund is delivered only for a purchase that was handled first. Whatever the delivery, every purchase and refund also goes to your webhooks as `purchase_completed` and `purchase_refunded` (see Webhooks), with the `purchase`, its `receipt` and its `game_account_id`.\n\n| `purchase_delivery` | Who takes the purchase | Who marks it handled |\n| --- | --- | --- |\n| `game` (the default) | The game itself, in the player\'s browser: `Zaisma.items.on("purchase")` and `on("refund")`. For a game with no server. | The game, with `Zaisma.items.markHandled(purchase.id)`. |\n| `game_server` | The game server\'s `onPurchase` and `onRefund`, in the room the player is in. For a game whose rooms keep the inventory. | The room, when the hook returns. |\n| `own_server` | Your own backend, from the receipt the game sends it. For a game whose own accounts hold what players own. | Your backend, with `POST /games/:slug/purchases/:purchase_id/handled` (MCP `mark_purchase_handled`). |\n\n**`game`.** Once the game listens, the SDK fires `purchase` for each completed purchase not yet handled and `refund` for each one taken back after it was handled, and fires again after each new purchase. The game marks it handled first, then hands it over: a second tab or device that has the game open gets `already_handled` and skips it, so it\'s handed over once. `Zaisma.items.unhandled()` lists the waiting ones, oldest first, at most 50 purchases and 50 refunds at a time (`[]` for guests, who buy nothing).\n\n```js\nZaisma.items.on("purchase", async (purchase) => {\n await Zaisma.items.markHandled(purchase.id); // already_handled: another tab took it, so this one skips it\n if (purchase.itemName === "revive") addRevives(purchase.itemCount);\n});\nZaisma.items.on("refund", async (purchase) => {\n await Zaisma.items.markHandled(purchase.id);\n if (purchase.itemName === "revive") removeRevives(purchase.itemCount);\n});\n```\n\n`markHandled` fails with `bad_purchase_id`, `no_purchase` (not this player\'s, or not paid), `already_handled` (another tab or device took it first: don\'t hand it over twice), `handled_by_server` (the delivery isn\'t `game`) and `slow_down`.\n\n**`game_server`.** The game server\'s `onPurchase(state, player, room, purchase)` and `onRefund(state, player, room, purchase)` run in the room the player is in: on every join, and right after a purchase (the game\'s SDK tells the player\'s rooms to look). `purchase` is the purchase in camelCase (`id`, `itemName`, `itemKind`, `itemCount`, `purchaseSource`, `purchaseStatus`, `gameAccountId`, `paidMinorUnits`, `currencyCode`, `purchasedAt`, `refundedAt`, `receipt`). The purchase is marked handled when the hook returns, and when it throws it isn\'t: the error shows with the game server\'s others in the stats, and it comes again at the player\'s next join. A room that has neither hook takes no purchases. Guests own nothing, so they get none. `game_server` on a game with no game server answers `no_game_server`.\n\n```js\n// zaisma-server.js: revives are kept in the player\'s state\nexport default {\n onPurchase(state, player, room, purchase) {\n if (purchase.itemName !== "revive") return;\n state.players[player.id].reviveCount += purchase.itemCount;\n },\n onRefund(state, player, room, purchase) {\n if (purchase.itemName !== "revive") return;\n const kept = state.players[player.id];\n kept.reviveCount = Math.max(0, kept.reviveCount - purchase.itemCount);\n },\n};\n```\n\nOn your own server, the Node runner runs the same hooks. It needs `ZAISMA_KEY` set to an API key with `purchase_access` `write` for the game (or `zaismaKey` in `startServer`), and doesn\'t start without it when the game server has `onPurchase` or `onRefund`: it reads each player\'s `unhandled_purchases` and marks them handled through the developer API, so a purchase comes once across restarts and Zaisma\'s own rooms. It only takes purchases while the game\'s `purchase_delivery` is `game_server`. A message from a game telling it to look (`zaisma:purchase`) must carry the purchase\'s `receipt`, which the runner checks first.\n\n**`own_server`.** The game sends your backend the `receipt` of a purchase (from `Zaisma.items.unhandled()`; your backend also gets it from the `purchase_completed` webhook), and your backend checks it with `verifyReceipt` (see Receipts above), credits the account named in `game_account_id` once per `purchase_id`, and calls `mark_purchase_handled`. A refunded or charged-back purchase is told the same way once your backend has taken back what it should (`refund_handled_at`). The webhook events carry `game_account_id` for games with their own accounts, so your backend can credit them even when no game is open. `GET /games/:slug/players/:player_id/items` lists what\'s still waiting.\n\n### When Zaisma covers your game\n\nZaisma puts nothing over a running game by default, but the player can open one of its sheets (buying, Players, Report), and a card can come over the game\'s corner (Still there?, Keep your progress). The SDK says when, so a game can pause or hold its input:\n\n- `Zaisma.page.coveredBy` is `"sheet"` while one of Zaisma\'s sheets is open over the game: the player is busy with it, so pausing makes sense. While a sheet is open, Still there? waits, since the player is there.\n- `"card"` while one of its cards is over the game\'s corner: the game stays in view and playable.\n- `null` otherwise, and always outside Zaisma\'s page (your own site, `play-locally`).\n\n`Zaisma.page.on("coveredBy", (coveredBy) => \u2026)` hears each change (a wrong event name fails with `unknown_event`):\n\n```js\nZaisma.page.on("coveredBy", (coveredBy) => {\n if (coveredBy === "sheet") pauseGame();\n else resumeGame();\n});\n```\n\n## Selling with the buy sheet\n\nPlayers buy a game\'s priced items through Zaisma\'s buy sheet. The developer connects their own Stripe account (Stripe Connect Standard): they are the seller, every sale is a direct charge on their account, the money goes to them, and Zaisma takes no fee. Stripe\'s own fees apply. The sheet and the receipt show the account\'s `business_name` and `support_email`. Until an account is connected and can take payments, the sheet answers `stripe_not_connected` or `stripe_cannot_take_payments`, and setting a price answers `next_steps` pointing at `get_stripe_account`.\n\n**Connecting needs the developer.** It decides where players\' money goes, so it needs their passkey on zaisma.com. Through a key or a connected app, `POST /stripe-account/connection-links` answers `confirmation_needed` (403) with `confirm_url`, Developer settings\' Payments part, where they connect with their passkey. From the dashboard\'s own signed-in session, with the passkey tapped in the last 10 minutes, it answers a `connect_url`. These calls need `stripe_account_access` (see What a key can do). Disconnecting and Stripe Tax need no passkey, since they only stop sales or change tax.\n\n| Call | What it does |\n| --- | --- |\n| `GET /stripe-account` | The connection: `{"stripe_account": {"is_connected", "stripe_account_id", "can_take_payments", "country_code", "default_currency_code", "business_name", "support_email", "is_stripe_tax_used", "connected_at", "balance"}}`. With nothing connected, `is_connected`, `can_take_payments` and `is_stripe_tax_used` are `false` and the rest `null`. `balance` is Stripe\'s own figures, read live and never a sum Zaisma works out: `{"currency_code", "available_minor_units", "pending_minor_units", "other_currency_balances": [{"currency_code", "available_minor_units", "pending_minor_units"}], "next_payout": {"amount_minor_units", "currency_code", "arrives_at"} | null}` (`next_payout` is `null` with manual payouts). It is `null` when nothing is connected, or when Stripe doesn\'t answer within 3 seconds, with the rest of the answer as usual. `can_take_payments` is whether Stripe lets the account take payments now; a new account may need details on Stripe first. Needs `stripe_account_access` `read`. |\n| `POST /stripe-account/connection-links` | Ask for the link to connect or make a Stripe account on: answers `connect_url`, `expires_at` (10 minutes) and `next_steps` (`get_stripe_account` once they have), with 201. The link works only for this developer signed in on zaisma.com. A key or connected app answers `confirmation_needed`, as above. |\n| `PATCH /stripe-account` | `{"is_stripe_tax_used"}`, true or false (`bad_is_stripe_tax_used`). Answers the `stripe_account` and `next_steps`. `stripe_not_connected` with no account. |\n| `DELETE /stripe-account` | Disconnect: players can\'t buy priced items until an account is connected again. Answers the empty `stripe_account` (`is_connected` false) and `next_steps`. Sales so far stay, and refunding them goes through the Stripe dashboard. `stripe_not_connected` with no account. |\n\n- **Where Stripe comes back to.** `GET /stripe/connect-return` is a page route, not part of the API: after Stripe, it goes back to the payments settings on zaisma.com with `?stripe=` `connected`, `cancelled`, `link_expired`, `signed_out` or `account_taken` (the Stripe account is already connected to another Zaisma account). A new connection starts with Stripe Tax off.\n- **Stripe Tax.** `is_stripe_tax_used: true` has Stripe Tax work out the tax inside each price for the player\'s country and record it on the developer\'s Stripe account (Stripe Tax must be set up there). Prices never change with it: the price a game shows stays what the player pays.\n- **Stripe\'s events.** Stripe tells Zaisma what happens on connected accounts at `POST /stripe/connect-events`, checked by Stripe\'s signature before anything is read. A payment that succeeded completes the purchase and one that failed fails it. A refund on Stripe\'s side (the dashboard or this API) records `refunded_minor_units`, and a refund of all of it takes the item back. A lost dispute takes the item back too (`purchase_status` `charged_back`); an open or won one changes nothing. `account.updated` refreshes the connection, and Zaisma being disconnected on Stripe\'s side forgets it, as `DELETE /stripe-account` does. Each is handled once, however often Stripe sends it.\n\n**In the game**, `Zaisma.items.buy(itemName, { itemCount, gameAccountId })`: on the game\'s zaisma.com page the sheet slides up over the game, which keeps running; on the developer\'s own site a zaisma.com window opens. `itemCount` is how many of a consumable (1 unless said; always 1 for a permanent item) and `gameAccountId` is the game\'s own ID for the player, kept on the purchase and its receipt. It resolves with `{ status, purchase }`, `purchase` in the SDK\'s camelCase `Purchase` (`id`, `itemName`, `itemCount`, `purchaseStatus`, `paidMinorUnits`, `receipt` and the rest, as the `purchase` event hands it over), or `null`:\n\n- `bought`: the player paid. `purchase` has its `receipt` (pass it to your game server to check, see Receipts above). The player\'s next pass lists the item at once, so `Zaisma.items.owns` says so right away.\n- `cancelled`: nothing was charged. The player closed the sheet or the window before paying, or already owned the item (a permanent one), so there was nothing to buy. `purchase` is `null`. `Zaisma.items.owns` tells the two apart.\n- `failed`: the payment didn\'t go through, or it was still settling when the sheet closed (a bank\'s confirmation, Apple Pay, Google Pay). `purchase` is the purchase when there is one (`purchaseStatus` `pending` or `failed`, `receipt` empty), else `null`. A payment still settling can complete later: then the item arrives as any purchase does, and the `purchase` event fires, so don\'t treat a `pending` one as final.\n\nEvery player outcome resolves; only the developer\'s mistakes reject, with an error whose `code` is `needs_player_tap`, `bad_item_name` (itemName isn\'t an item name), `no_item` (the game has no item by that name), `no_game` (the game isn\'t open to play here), `not_for_sale`, `stripe_not_connected`, `stripe_cannot_take_payments`, `bad_item_count`, `bad_game_account_id`, `unknown_option`, `not_on_zaisma` or `request_failed`.\n\n- **The tap rule.** The sheet opens only right after the player taps or presses a key in the game, so call `buy` from that handler. Otherwise it fails with `needs_player_tap`, and nothing opens by itself.\n- **On your own site.** The window is `zaisma.com/buy/<slug>/<item_name>`. It answers your page only if the page\'s address is one Zaisma knows is yours: the host of one of the game\'s `own_server_urls` on https (a `wss://` address counts as https), or a redirect address of one of your sign-in apps. Any other opener hears nothing, so `buy` waits until the player closes the window and then resolves `cancelled`, even if the purchase went through. The purchase still completes either way, and the game sees it in its next pass and in the `purchase` event.\n- **The EU line.** Players in the EU, the EEA and the UK see "You get it now, so you can\'t cancel it in the next 14 days." above Buy, because digital content delivered at once loses the 14-day withdrawal right only if the buyer is told before they buy. The receipt email repeats it.\n- **Buy waits a moment.** Buy can\'t be pressed for a fraction of a second after the sheet draws it, so a tap meant for the game can\'t land on it.\n- **Events.** `Zaisma.items.on("sheetOpen", listener)` runs when the sheet opens and `"sheetClose"` when it closes, bought or not, each with `{ itemName }`; `off` stops listening. A game can pause on `sheetOpen`, since it keeps running behind the sheet. A bought item reaches the game as Getting purchases to your game says: `Zaisma.items.on("purchase")`, the game server\'s `onPurchase`, or your own server.\n- **Local prices.** The sheet shows the price the player\'s country pays: the item\'s `local_prices` entry for its currency when the game set one, else the main price (see Items and purchases above). Prices pick by country, never by browser language.\n- **Refunds.** `refund_purchase` (`POST /games/:slug/purchases/:purchase_id/refund`) refunds a sale through the developer\'s Stripe account. By default it refunds all of what\'s left; with `amount_minor_units`, in the sale\'s `currency_code` (499 is 4.99), only that much goes back. A full refund takes the item back (`purchase_status` `refunded`), so the player no longer owns it from their next pass. A partial refund leaves it with the player and adds to `refunded_minor_units`. `bad_amount_minor_units` when the amount isn\'t a whole number from 1 to what\'s left; `purchase_not_paid` for a sale that is pending or failed; `already_refunded` for one refunded or charged back; a grant takes no amount. After the Stripe account is disconnected (or replaced), `stripe_not_connected`: refund the sale in the Stripe dashboard, and the item goes back once Stripe tells Zaisma, if an account is connected then.\n\n## Kept rooms\n\nRooms a game server keeps with `room.setKept(true)`, for worlds that last, like a survival server: when everyone leaves, a kept room sleeps with its world saved instead of ending, costs nothing while it sleeps, and wakes as it was when someone joins. A listed one stays on the game page\'s Rooms tab with nobody in it. See "Lobbies and matches" in the README.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/kept-rooms` | The game\'s `kept_rooms`, most recently played first, each `{"room_code", "name", "saved_size_bytes", "saved_at", "last_played_at", "created_at", "erases_at"}` (`erases_at`: when a deleted world is erased, null for any other); `waiting_kept_rooms_size_bytes` (worlds waiting to be erased, on the hosting meter but outside the game\'s storage); and `kept_rooms_size_bytes`, `storage_size_bytes` (the database and kept rooms together) and `maximum_storage_size_bytes` (10 GB, the most a game can keep). |\n| `DELETE /games/:slug/kept-rooms/:room_code` | Delete one\'s world: players in it are sent out ("This world was deleted."), and it waits a week before it\'s erased. Answers `is_deleted`, `erases_at` and `next_steps`; a repeat answers the same `erases_at`. In a game nobody but its developer ever played it goes at once, with `erases_at` null. An unknown code is `no_kept_room`. Not for ending a match: the game server does that with `room.end()`. |\n| `POST /games/:slug/kept-rooms/:room_code/bring-back` | Brings a deleted world back, with the same code. Until its `erases_at` it\'s as it was; after that it comes back from its last copy, for about 28 days after it was deleted, on its way for a minute or more. Answers `is_brought_back`, `is_bringing_back` (`true` while it\'s coming back from a copy), `copy_saved_at` (when that copy was made; anything played after it is lost) and `next_steps`. `kept_room_not_waiting` (409) for a world that isn\'t deleted; `kept_room_erasing` (409) mid-erase; `no_kept_room` (404) past its 28 days; `game_removed` (403), `game_storage_full` (403), `room_code_in_use` (409), `no_kept_room_copy` (404) and `slow_down` (429, past 100 GB of worlds brought back in a day) for one coming back from a copy. |\n| `GET /games/:slug/kept-rooms/:room_code/restores` | How far a world can go back: `earliest_restore_to_at` (when it was kept, or 30 days ago) and its `restores` that can still be undone, newest first. What a game\'s own restore screen draws from. |\n| `POST /games/:slug/kept-rooms/:room_code/restores` | Puts one world back as it was at any minute in the last 30 days: `{"restore_to_at": "2026-10-18T14:04:00Z"}`. Answers `kept_room_restore` (`{"id", "room_code", "restore_to_at", "restored_at", "undoes_kept_room_restore_id", "kept_room_restore_batch_id", "undo_expires_at"}`), `live_version_published_since` and `next_steps`. `bad_time` (400) outside the last 30 days or before it was kept; `no_kept_room` (404) for a deleted world, so bring it back first; `slow_down` (429) past 5 a minute per world; `kept_room_restore_unavailable` (501) where rooms keep no history. |\n| `POST /games/:slug/kept-rooms/:room_code/restores/:kept_room_restore_id/undo` | Back to just before that restore, for 30 days after it, with the same answer. An undo is a restore too, so it can be undone the same way. `no_kept_room_restore` (404). |\n| `POST /games/:slug/kept-room-restores` | Puts every kept room of the game back to one moment: `{"restore_to_at"}`. Answers `202` at once with `kept_room_restore_batch` (`{"id", "restore_to_at", "started_at", "finished_at", "undoes_kept_room_restore_batch_id", "undo_expires_at", "kept_room_count", "restored_room_count", "skipped_room_count", "failed_room_count", "failed_room_codes"}`), `live_version_published_since` and `next_steps`, which name `restore_database` with the same time. Worlds waiting to be erased and worlds kept after the moment stay as they are. `kept_room_restore_batch_running` (409) while one runs. |\n| `GET /games/:slug/kept-room-restores/:kept_room_restore_batch_id` | How it\'s going: `kept_room_restore_batch`. `no_kept_room_restore_batch` (404). |\n| `POST /games/:slug/kept-room-restores/:kept_room_restore_batch_id/undo` | Each world it restored back to just before it, for 30 days after it, with the same answer as starting one. |\n| `POST /games/:slug/kept-rooms/:room_code/erase-now` | Erases a waiting world without waiting. It always answers `confirmation_needed` first, for the developer\'s passkey tap: a key or an AI alone never skips the week. Then `is_erased` and `next_steps`; its last copy can still bring it back for about 28 days after it was deleted. `kept_room_not_waiting` (409) for a world that isn\'t waiting; `kept_room_erasing` (409) once its week is over. |\n\n- **Storage:** saved worlds count toward the game\'s storage with its database, on the game\'s hosting meter (see Hosting and credit), up to 10 GB. A kept room writes its size as it empties and at most hourly while players are in it, so the total is close, not exact. At 10 GB, `room.setKept(true)` leaves the room unkept and the game server\'s log says why, and the database can\'t grow (`database_full`), but rooms already kept keep saving: no world is lost to the limit.\n- **Waking:** a world waking runs `onRestored` with `restoreInfo.lostDurationSec` 0, since it saved as the last player left, and `restoreInfo.savedAt`, for the time that passed. It wakes on the game\'s live version; `restoreInfo.savedVersionId` says which version saved it, so you can bring an older world up to date.\n- **A deleted world waits a week:** deleting a world, or ending one with `POST /games/:slug/rooms/:room_code/end`, sends its players out and keeps it as it was until `erases_at`. Until then nobody can join it ("This world was deleted."), no room message or new version reaches it, and its code stays taken, so a game with one shared world by a fixed code can\'t open a new one under it until the world is erased. It stays on the hosting meter but outside the game\'s storage and its 10 GB, so deleting makes room at once. `bring_back_kept_room` brings it back; only the developer\'s passkey tap erases it sooner. A key or an AI app deleting worlds is a security alert, at most one a day per game. `room.end()` in the game server stays final: how a world ends is the game\'s own rule.\n- **Going back to a moment:** a restore reaches any minute in the last 30 days, as the world was last saved by then, and costs nothing of its own: normal use counts on the hosting meter as always, a world\'s size counts on storage, and the month\'s use isn\'t rolled back. Players in the world drop for a second or two and reconnect. Its game server\'s `onRestored` runs with `restoreInfo.keptRoomRestore` (`{ id, restoreToAt, restoredAt, undoesKeptRoomRestoreId, erasedPlayerIds }`), and the game tells players its own way; Zaisma says nothing to them. A restore never undoes a takedown and never changes what a player owns through Zaisma: purchases stay as they are, so a game that keeps a grant only in the world\'s state reads the player\'s `ownedItemNames` again. The world\'s state came back with any player erased since the moment still in it, so drop `erasedPlayerIds` from it in `onRestored`.\n- **A bad update:** worlds, database and version are separate calls. `live_version_published_since` says when the live version went live after the moment, since it could do the damage again, and `next_steps` names `publish_version` for the version live at that moment; a restore of every world names `restore_database` with the same time too.\n- **A game\'s own restore screen:** a game server calls `server.listKeptRoomRestores(roomCode)`, `server.restoreKeptRoom(roomCode, { restoreToAt })` and `server.undoKeptRoomRestore(roomCode, keptRoomRestoreId)` for any of its kept rooms, by its own rule of who may. Called from inside that room, the room starts over, so nothing after the call runs on it.\n- **A deleted world comes back:** for about 28 days after it\'s deleted, from a copy made at Backblaze as its deletion starts or from the last night\'s, so up to a day can be lost, and a world played after that copy loses what came after. It can\'t undo a takedown, and doesn\'t come back past the game\'s 10 GB. A game server\'s own `room.end()`, `room.setKept(false)` and deleting the game stay final. `list_kept_rooms`\' `deleted_kept_rooms` says which can come back and until when, and how it\'s going (`bring_back_started_at`, `bring_back_failed_at`).\n- **When the game is unavailable** (taken down, made private): players in a kept room are sent out and it sleeps, kept. Deleting the game deletes its kept rooms.\n- **One shared world:** `room.roomCode` tells the game server which room it\'s in, so it can keep only its world\'s room and refuse players elsewhere in `canJoin`.\n- **On your own server** the Node runner keeps kept rooms\' states in its `--room-state-file` until they end, and a kept room that ends is gone: the week\'s wait and copies of deleted worlds are Zaisma\'s. `server.restoreKeptRoom` works there too, from copies in the same file: one a minute for a day and one an hour back to 30 days, when a state changed, so past a day it goes to the newest copy at or before the time. `erasedPlayerIds` is empty there, since that server keeps no list of them.\n- A key lists with `game_access` `read` and deletes with `write`.\n\n## Reaching live rooms\n\nA game reaches its own live rooms from anywhere it runs: its game server in a room (`room.sendToRoom`, `room.sendToEveryRoom`, `room.listRooms`) or in its requests, schedules and webhooks (`server.` the same, plus `getRoom`, `kickFromRoom` and `endRoom`), its developer\'s scripts through these calls, and their AI through the MCP. A survival game with 400 worlds starts its blood moon in all of them at 8pm; one world tells another that a party is on its way; the game\'s own moderation page tells world 213 to freeze a griefer. Zaisma draws nothing: there\'s no screen for it, so a game builds its own tools on the calls.\n\nA room message goes to the room\'s game server, `onRoomMessage(state, roomMessage, room)`, which decides what players see. A room whose game server has no `onRoomMessage` hands it to every player\'s and spectator\'s game as the room\'s `roomMessage` event, so a game with no server code still gets announcements. `roomMessage` is `{ message, senderKind, fromRoomCode, sentAt }`: the message as sent (plain JSON, up to 16 KB), who sent it (`room`, another room\'s game server; `server`, the game server outside rooms; `developer`, these calls and the MCP, scheduled sends included), the sending room\'s code (null unless `senderKind` is `room`) and when.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/rooms` | The game\'s live rooms on Zaisma, newest first: rooms that are running, and kept rooms asleep with nobody in them. Each `{"room_code", "name", "labels", "player_count", "maximum_player_count", "spectator_count", "is_listed", "is_open", "is_kept", "version_id", "continent", "created_at"}`; `room_count`; up to 500, with `next_cursor` for the rest (pass it as `cursor`). A room\'s `labels` are a list of `{"label_name", "label_value"}`; `?labels=[{"label_name":"Map","label_value":"Docks"}]` (as JSON) gives only rooms holding every label given. |\n| `GET /games/:slug/rooms/:room_code` | One live room as `room`, and who\'s in it as `players`: its players in join order, then its spectators, each `{"player_id", "name", "kind", "is_away", "away_reason", "joined_at", "is_spectator"}`. A kept room asleep has nobody. An unknown code is `no_room`. |\n| `POST /games/:slug/rooms/:room_code/messages` | A room message to one room, `{ "message" }`: answers `is_delivered`. A kept room with nobody in it wakes for it. `no_room` when it isn\'t running, `room_busy` when it took 100 room messages in the last second. |\n| `POST /games/:slug/room-messages` | A room message to every live room with someone in it, `{ "message", "labels", "send_at" }`: `labels` (optional) only rooms holding every one of them. Kept rooms asleep with nobody in them don\'t wake for it. Now, it answers `room_count`, how many rooms took it. With `send_at`, an ISO time from 10 seconds to 90 days ahead, it waits and answers `scheduled_room_message` (`{"id", "send_at", "labels", "created_at"}`, a `scheduled_room_message_\u2026` ID), going out within a minute after its time; the other field is null. |\n| `GET /games/:slug/room-messages` | The scheduled ones waiting, soonest first, then the last 20 that went out, each `{"id", "message", "labels", "send_at", "created_at", "sent_at", "delivered_room_count"}`. |\n| `DELETE /games/:slug/room-messages/:scheduled_room_message_id` | Cancel one waiting: `is_cancelled`. One that went out is `no_scheduled_room_message`. |\n| `POST /games/:slug/rooms/:room_code/kick` | Remove a player or spectator, `{ "player_id", "message", "is_kept_out" }`, as the room\'s own `room.kick` would: they\'re told `message` (up to 200 characters, your game\'s words within the content rules) and sent out, `onLeave` hears reason `kicked`, and `is_kept_out` keeps them out for the rest of the match. Answers `is_kicked`; `no_player_in_room` when they aren\'t in it. |\n| `POST /games/:slug/rooms/:room_code/end` | End a room\'s match, `{ "message", "confirm": true }`: everyone in it hears `message` (up to 200 characters) and is sent out. A kept room\'s world waits a week to be erased (see Kept rooms), and `erases_at` says when; it\'s null for any other room, and in a game nobody but its developer ever played. Without `"confirm": true` it\'s `needs_confirm`, so an AI asks you first. Answers `is_ended` and `erases_at`. |\n\n- **Limits:** a room\'s game server sends up to 20 room messages a second (`room_call_limit` past it), and a room takes up to 100 a second (`room_busy`, and `isDelivered` false for a game server). Sends to every room are up to 10 a minute for the whole game, from its game server, these calls and the MCP together (`every_room_send_limit` here, `room_call_limit` in the game server), and up to 100 scheduled ones wait at once (`too_many_scheduled_room_messages`). `ROOM_MESSAGE_LIMITS` in the game server package has them all.\n- **What it costs:** each room a message reaches is one request to that room on the game\'s hosting meter, with the time it keeps the room awake and its game server\'s CPU, as its players\' messages are. A send to every room costs as many requests as rooms it reaches.\n- **A scheduled send** goes out with the game\'s live version\'s rooms at the time. A game that can\'t be played then (nothing live, held, taken down, or its hosting paused) has it recorded as sent with `delivered_room_count` 0.\n- **On your own server** the Node runner gives its game server the same calls among its own rooms, in the same process: `room.listRooms` lists the runner\'s rooms, a send to a kept room asleep in its `--room-state-file` wakes it, and every-room sends share the same 10 a minute. These calls and the MCP reach only rooms on Zaisma: rooms on your own servers are your game server\'s to reach. The local bench sends as these calls do with `POST /bench/api/room-messages` (see the README\'s "The bench\'s API, for your AI").\n- A key lists and looks with `game_access` `read`, and sends, kicks and ends with `write`.\n\nA live event that starts everywhere at 8pm, sent with `send_at`:\n\n```js\n// zaisma-server.js\nexport default {\n setup: () => ({ isBloodMoon: false }),\n onRoomMessage(state, roomMessage, room) {\n if (roomMessage.message.kind !== "blood_moon") return;\n room.broadcast({ kind: "blood_moon", durationSec: roomMessage.message.duration_sec });\n return { ...state, isBloodMoon: true };\n },\n};\n```\n\n```bash\ncurl -X POST https://zaisma.com/api/dev/games/frostbound/room-messages \\\n -H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" \\\n -d \'{"message": {"kind": "blood_moon", "duration_sec": 600}, "send_at": "2026-11-06T20:00:00Z"}\'\n```\n\n## A game server\'s logs\n\nEverything a game\'s own game server prints on Zaisma, kept 30 days and free: every `console.log`, `info`, `warn`, `error` and `debug` (`trace` counts as debug; `dir` and `table` as log), in rooms and in `onRequest`, `onSchedule` and `onWebhook`, plus each crash or stop written down in full as an `error` line starting `Zaisma:` (or with the error\'s stack). Read them with `get_logs` or `zaisma logs <slug> --follow`.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/logs` | The newest lines in `log_lines`, oldest first, each `{"logged_at", "level", "text", "source_kind", "room_code", "version_id"}`, with `next_cursor` and `new_lines_cursor`. Narrow it with `room_code`, `minimum_level` (`debug`, the default, `info` for all but debug, `warn` or `error`), `source_kind` (`room`, `request`, `schedule` or `webhook`) and `search_text` (contained, ignoring case); `maximum_line_count` is 1 to 500, 100 by default. |\n\n- **Going back and following:** `cursor` (a `next_cursor`) answers the lines before an earlier answer\'s, `null` when there are none. `new_lines_cursor` answers only the lines written since the answer that gave it, so to follow, call once and then keep passing back the `new_lines_cursor` each answer gives; following goes by when lines were written, so a room writing late never makes you miss a line. Give one or the other (`two_log_cursors`).\n- **How soon:** lines reach the logs within 30 seconds, and within 2 seconds for the next 10 minutes once someone has read them, so the first call while testing can come up empty and the next ones keep up.\n- **Text:** strings as they are, everything else as JSON, an `Error` with its stack, joined by spaces as a console shows them; up to 4,000 characters a line. A call that prints more than 1,000 lines keeps the first 1,000 and adds one line saying how many it dropped, and each room (and the game server outside rooms) keeps up to 20 MB a day, then says so in one line and keeps nothing more until midnight UTC.\n- **Who can read them:** a key with `stats_access` `read`. Anything the game server prints is in its logs, so don\'t print players\' details or secrets you wouldn\'t want there; they\'re deleted after 30 days, and with the game.\n- **Mistakes in a game server\'s code** are lines here too, each with a code: a room call with wrong arguments (`bad_room_call`, the call as its field, like `room.kick`), too many reserves a minute or room calls in one go (`room_call_limit`), a call that can\'t run here, like `room.reserve` where the host makes no rooms, or any change from `canJoin` or `stateView` (`room_call_unavailable`), and a handler that answers something that isn\'t a state, or a `canJoin` that answers nothing (`bad_handler_answer`). The state stays as it was and the player is turned away, never let in by accident. The Node runner prints the same errors to its terminal.\n- **Not here:** players\' browser errors (they\'re in the browser\'s own console) and a game on your own server, which prints to its own terminal. `get_stats` still counts errors per day and lists the latest distinct ones.\n\n## The game database\n\nEvery game has its own SQLite database, part of its hosting: the one its game servers use as `room.database` (see "The game database" in the README), empty until something writes to it. You and your AI reach the same database here, live, with the same checks and limits as game servers: look at its tables, query it, fix data and change its tables, and take the whole database out or bring one in. Whole numbers past 2^53 (9,007,199,254,740,991) are refused going in (`bad_values`) and can\'t be read back as numbers (`integer_too_large`), since JavaScript can\'t hold them exactly: store them as text, and read one with `CAST(column AS TEXT)`. A REAL as big as 1e20 reads fine. The database refuses what Cloudflare\'s SQLite refuses, on your own server too, so a query runs the same in both: PRAGMAs other than `table_info`, `table_xinfo`, `table_list`, `index_list`, `index_info`, `index_xinfo`, `foreign_key_list`, `foreign_key_check`, `defer_foreign_keys`, `quick_check`, `integrity_check` and `optimize` (keep a schema version in a table of your own, not `user_version`), `CREATE TEMP` tables and other temporary objects, and `sqlite_version()`, `sqlite_source_id()` and `load_extension()`; a statement is held to 100,000 bytes of UTF-8.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/database` | `tables` (`{"name", "sql"}`, the `sql` being its `CREATE TABLE`), `indexes` (`{"name", "table_name", "sql"}`, only ones made with `CREATE INDEX`), and `database_use_this_month`: `read_row_count`, `written_row_count`, `storage_size_bytes` and `maximum_storage_size_bytes` (10 GB, the most a game can keep), and `hosting_use_this_month`, the game\'s hosting meter as the stats answer it (see Hosting and credit), which the rows and storage count on. Also `restores`: the last 30 days\' restores and undos, newest first, up to 50, as the restore calls below answer them. No row counts, because counting reads every row: query `SELECT count(*)` when you need one. |\n| `POST /games/:slug/database/query` | Run one statement: `{"sql", "values"}`. Answers `rows` (a `SELECT`\'s, or a change\'s with `RETURNING`; `[]` for none), `read_row_count` and `written_row_count` (what it counts on the game\'s hosting meter), and `next_steps`. |\n| `POST /games/:slug/database/batch` | Run up to 100 statements in one transaction, `{"statements": [{"sql", "values"}]}`: all of them happen, or, if one fails, none do. Answers `statement_results`, one `{"rows", "read_row_count", "written_row_count"}` per statement, in order. |\n| `GET /games/:slug/database/export?cursor=` | One part of the whole database as SQLite\'s own SQL dump, up to 4 MB: `dump_sql`, `next_cursor` (pass it as `cursor` for the next part; `null` on the last) and `read_row_count`. Leave `cursor` out to start. |\n| `POST /games/:slug/database/import` | Add one part of a SQL dump, up to 5 MB, in one transaction: `{"dump_sql"}`. Answers `statement_count`, `skipped_statement_count` (the transaction and settings around the dump, below), `read_row_count`, `written_row_count` and `next_steps`. |\n| `POST /games/:slug/database/erase-player` | Erase one player: `{"player_id"}`. Answers `erased_tables` (`{"table_name", "erased_row_count"}` for every table with a `player_id` column, 0 included), `written_row_count` and `next_steps`. |\n| `POST /games/:slug/database/restores` | Put the database back as it was at a moment in the last 30 days: `{"restore_to_at": "2026-10-18T14:05:00Z"}`. Answers `database_restore` (`{"id", "restore_to_at", "restored_at", "undoes_database_restore_id", "undo_expires_at"}`), `erased_again_player_count` and `next_steps`. |\n| `POST /games/:slug/database/restores/:database_restore_id/undo` | Undo a restore: back to just before it. Answers the same, with `undoes_database_restore_id` the restore it undid. |\n\n- **values** fill the `?`s in order: text, numbers, `null`, or `{"blob_base64": "\u2026"}` for bytes. Blobs come back the same way. SQLite has no true or false (send 1 or 0), and an object goes in as JSON text, read back with SQLite\'s JSON functions. Put values in `values`, never into the SQL.\n- **One statement per query**, a trailing `;` is fine. `BEGIN`, `COMMIT`, `ROLLBACK`, `SAVEPOINT`, `RELEASE`, `ATTACH` and `DETACH` are refused: a batch is the transaction.\n- **Limits, the same as a game server\'s:** 100,000 characters of SQL, 100 values of up to 1 MB each, 100 statements a batch and 10,000 rows a statement (`too_many_rows`; page with `LIMIT`). An answer here also stops at 8 MB (`answer_too_big`), and a request at 6 MB. A statement that fails undoes itself, and a batch with it.\n- **It\'s live.** Changes reach the game\'s rooms straight away, so the MCP\'s tools ask you before changing or deleting data a live game uses.\n- **Export and import** use SQLite\'s own SQL dump, the `CREATE TABLE`s and `INSERT`s `sqlite3 game.sqlite .dump` writes, so the database moves between Zaisma and any SQLite, like the Node runner\'s `zaisma-database.sqlite`. The parts of an export, put together in order, are one dump: the first starts with `PRAGMA foreign_keys=OFF;` and `BEGIN TRANSACTION;`, each table comes with its rows, then AUTOINCREMENT\'s counters, the views, indexes and triggers (after the rows, so triggers don\'t fire on them) and `COMMIT;`. Export reads table by table, so writes the game makes meanwhile can land between parts: it isn\'t a snapshot. Its reads count, but it works past the free reads: your data is always yours to take.\n- **Import only adds.** It runs a dump\'s `CREATE` and `INSERT` statements and leaves out what sqlite3 writes around them (`BEGIN`, `COMMIT`, `PRAGMA foreign_keys` and `writable_schema`, `ANALYZE` and its `sqlite_stat1` rows); anything else is refused (`bad_sql`), and so is `INSERT OR REPLACE`. A part makes its tables first and checks foreign keys when it ends, so a row can refer to a row after it or to a table made after it; a reference to a row in another part is refused (`bad_sql`) saying the parts must go in together. sqlite3\'s own `.dump` of a database with an fts5 search table imports too: its `INSERT INTO sqlite_schema` becomes the `CREATE VIRTUAL TABLE`, its shadow tables (`_data`, `_idx`, `_content`, `_docsize`, `_config`) are left out, and the table is filled again from its `_content` rows under their rowids (other virtual tables: import the `.sqlite` file). Export writes a search table\'s rows with their rowids, and reads a table with a primary key in key order, so a game writing during an export can\'t make it skip or repeat a row. A table that\'s already there stops it: to replace one, drop it first with a query. AUTOINCREMENT\'s counters only go up. Text and blobs in an `INSERT` are sent to the database as values, up to 2 MB each (a game server\'s own values are held to 1 MB), so a row bigger than a statement\'s 100,000 characters, or one grown past 1 MB by SQL, still goes in, and `unistr(\'\u2026\')`, which newer sqlite3 writes for text with line breaks, becomes its text. Each part is all or nothing and names the statement that stopped it; the parts before it stay in. Writes count like any write and stop at the free writes. The upload command cuts a dump into parts for you, and reads and writes `.sqlite` files.\n- **Erasing a player** deletes every row whose column named `player_id` holds their ID, in every table that has one, in one transaction; other columns, like `winner_player_id`, are left alone. It works on any player ID (a player who asks you by email, say), counts towards the month\'s use but works past the free limits, and reaches the game\'s rooms at once. A foreign key without `ON DELETE CASCADE` that refuses the delete undoes the whole erase (`bad_sql`, naming the table). Zaisma does it for you when a player deletes their account, unless the game\'s `deleted_account_erase_enabled` is `false`. A game server does the same with `server.database.erasePlayer(playerId)`, on Zaisma and on your own server.\n- **Restoring to a time** puts the whole database back as it was at that moment, tables and rows both, live: the undo for a bad import, a game server bug or a wrong `DELETE`. Cloudflare keeps 30 days of each database\'s history, so `restore_to_at` is an ISO time from the last 30 days, and not before the game was made (`bad_time`); `get_history` shows when the change you want to undo happened. Everything written since is gone until you undo the restore, which works for 30 days after it; an undo is a restore too, so it can be undone the same way. The database restarts to restore, so a game server\'s query in that second can answer `database_unavailable` (try again). Players erased since that moment (when they deleted their account, by `erase-player` or by a game server) are erased again, so a restore never brings them back, and the month\'s use isn\'t rolled back. Up to 5 restores and undos a minute per game (`slow_down`). On your own server the database is a file: copy it to keep earlier versions.\n- **Use** counts on the game\'s one hosting meter (see Hosting and credit): rows written and read, counted the way Cloudflare bills them (an index changed counts as a row written, and a `SELECT` without an index reads every row it looks at), and the storage kept each day. Calls here count like the game\'s own. When the game\'s hosting pauses, reads and writes keep working for the hour running matches get, so a match\'s last save lands; then they answer `hosting_paused`. Exports, `GET /games/:slug/database` and erasing a player keep working whatever: the data is always yours. A game keeps up to 10 GB; at it, rows can change and go but not grow (`database_full`).\n\n## Cloud saves\n\nA signed-in player\'s progress in a game with cloud saves on is mirrored to their account from the game\'s own browser saves, with no code (see "Cloud saves" in the README). You and your AI reach every player\'s save here, by player ID: list them, read them, fix them, reset them, and go back to earlier versions. Saves stay apart from the game database, and each stays tied to its player: deleted with their account, never shown to other games. A save is the game\'s localStorage, and its IndexedDB databases when it keeps any (Unity, Godot and localForage do). Copying it never slows the game: only what the game changed is read again, in a worker off the thread that draws the game, and a save past 5 MB stays on the device and is read no further. Keep downloaded files in a database with "cache" in its name (like Unity\'s UnityCache), which saves skip, so they never count toward the save.\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/saves` | The players with a save, 100 a page in player ID order: `saves`, each `{"player_id", "sha256", "size_bytes", "saved_at", "changed_by_kind", "save_copy_count", "version_id"}`, and `next_cursor` (pass it as `?cursor=` as it came; `null` on the last page). |\n| `GET /games/:slug/saves/:player_id` | One save: `{"save": {\u2026the same, "local_storage_items", "missing_keys", "indexeddb_databases"}}`. `?keys=coins&keys=level` (each key its own parameter, since keys can hold commas) answers only those localStorage keys, with `missing_keys` naming the ones it doesn\'t have, and `indexeddb_databases: null`. |\n| `PATCH /games/:slug/saves/:player_id` | Change some localStorage keys: `{"local_storage_items": {"coins": "500", "tutorial_seen": null}}`, each key\'s new text, `null` removing it. The rest of the save stays as it is. |\n| `PUT /games/:slug/saves/:player_id` | Replace the whole save: `{"local_storage_items", "indexeddb_databases"}`, both in full (`[]` when the game keeps nothing in IndexedDB). |\n| `DELETE /games/:slug/saves/:player_id` | Reset it: the save becomes empty, so the game starts fresh on every device. |\n| `GET /games/:slug/saves/:player_id/copies` | Its earlier versions, newest first: `save_copies`, each `{"id", "saved_at", "copy_reason", "size_bytes", "is_current_save", "version_id", "sha256"}`. |\n| `GET /games/:slug/saves/:player_id/copies/:save_copy_id` | One earlier version: `{"save_copy": {\u2026the same, "local_storage_items", "missing_keys", "indexeddb_databases"}}`, whole or with `?keys=`. |\n| `POST /games/:slug/saves/:player_id/copies/:save_copy_id/restore` | Make it the save again. |\n\n- **Every change** (change, replace, reset, restore) answers `{"save", "kept_save_copy_id", "next_steps"}`: the save as it is now, and the earlier version that holds what it replaced, which `restore` brings back. A copy is kept first unless the save it replaces was your own last change (its copy from before that is still there), so changing a save again and again never pushes out the player\'s own copies; `kept_save_copy_id` is then `null`, as it is when nothing changed. When it isn\'t `null`, it always names a copy that\'s kept: the copy a change adds is never the one dropped to stay at five. A change to some keys is made to the save as it is when the change lands, so two changes at once, or the player\'s game saving meanwhile, never undo each other. A change or replace makes a save for a player who has none; a reset needs one (`no_save`).\n- **It reaches the player\'s devices with no question.** The save\'s `changed_by_kind` becomes `developer` (it\'s `player` when the game saved it). A game the player has open takes your save the next time it saves or when the player comes back to its tab, with no question, keeping that device\'s progress since its last save as an earlier version: it reloads with it, unless it listens with `Zaisma.saves.on("developerChange")`, when Zaisma writes your save into the game\'s storage under the running game and the game rereads it, with no reload (the reload stays the fallback when the game holds a database open). A game opening later takes it like any newer save, straight away. Whether the player can go back is the game\'s own rule.\n- **How a save is stored:** one text, `{"save_format_version_number": 1, "local_storage_items": {\u2026}, "indexeddb_databases": [\u2026]}`, always those three keys in that order and localStorage keys sorted, so the same save always has the same `sha256` (of that text). Answers give `local_storage_items` and `indexeddb_databases`; the number tells later formats apart. A save or copy from before this format is rewritten into it the first time it\'s read (by the player\'s game, `get_save`, `get_save_copy`, a restore or an export), with nothing in it changed, so its `sha256` changes once. A save landing at that moment always wins over the rewrite.\n- **saved_at and version_id:** `saved_at` is when the save was last saved or changed. `version_id` is the game version that saved it, as the player\'s game page reported it: `null` for a save you changed, replaced or reset, and for one from before Zaisma kept it; a restored save has the restored copy\'s. A copy has its own. It\'s a label, never a check: a save is never refused over it.\n- **Values are text**, as localStorage holds them: `"500"`, not `500`, and a list or object as the JSON text the game stores.\n- **IndexedDB databases** are as the game domain script stores them (`packages/sdk/saves.js`), with IndexedDB\'s own names: `{"name", "version", "stores": [{"name", "keyPath", "autoIncrement", "indexes": [{"name", "keyPath", "unique", "multiEntry"}], "records": [[key, value]]}]}`. `keyPath` is `null` when keys are kept beside the values, so each record\'s `key` is its key; otherwise it\'s where the key is in the value, and the record\'s `key` is only a copy of it. Values beyond JSON are tagged `{"$z": [kind, \u2026]}`, and what\'s inside a tag (a map\'s entries, a set\'s items, an object\'s values) is written the same way. Change databases only inside their records\' values.\n\n | Tag | Stands for | Written as |\n | --- | --- | --- |\n | `num` | A number JSON can\'t hold: `-0`, `NaN`, `Infinity`, `-Infinity` | `["num", "-0"]` |\n | `undef` | `undefined` | `["undef"]` |\n | `bigint` | A BigInt | `["bigint", "12345678901234567890"]` |\n | `date` | A Date | `["date", time in ms]`, the time a `num` tag for an invalid date |\n | `regexp` | A RegExp | `["regexp", source, flags]` |\n | `bytes` | An ArrayBuffer | `["bytes", base64]` |\n | `view` | A typed array or a DataView | `["view", kind, base64]`, kind one of `Int8Array`, `Uint8Array`, `Uint8ClampedArray`, `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array`, `Float64Array`, `BigInt64Array`, `BigUint64Array`, `DataView` |\n | `blob` | A Blob | `["blob", type, base64]` |\n | `file` | A File | `["file", type, base64, name, lastModified in ms]` |\n | `map` | A Map | `["map", [[key, value], \u2026]]` |\n | `set` | A Set | `["set", [item, \u2026]]` |\n | `obj` | An object with its own `$z` key | `["obj", the object]` |\n\n- **Replacing a save** (`PUT`, `replace_save`) takes only databases a browser can restore, and answers `bad_indexeddb_databases` with the exact place in `field` (like `indexeddb_databases[0].stores[1].keyPath`) otherwise:\n - **A database** has exactly `name`, `version` and `stores`. Its `name` isn\'t empty, is there once, and has no "cache" in it (in any case), since saves leave those out. Its `version` is a whole number from 1 to 9007199254740991.\n - **A store** has exactly `name`, `keyPath`, `autoIncrement`, `indexes` and `records`, with a `name` once in its database. `keyPath` is `null`, a key path (`""` for the whole value, or names joined by dots, like `"player.id"`), or a non-empty list of key paths. `autoIncrement` is `true` or `false`, and can\'t be `true` with a list or `""`.\n - **An index** has exactly `name`, `keyPath`, `unique` and `multiEntry`, with a `name` once in its store. Its `keyPath` is a key path or a list of them, never `null`. `unique` and `multiEntry` are `true` or `false`, and `multiEntry` can\'t be `true` with a list.\n - **A record** is `[key, value]`, and both read back by the tag table: a known tag, with that tag\'s fields (a `view`\'s bytes fill whole items). With a `null` `keyPath`, the key must be one IndexedDB takes: text, a number (not `NaN`), a valid date, binary data (`bytes` or `view`), or a list of those. Otherwise the value must hold such a key at its `keyPath`, unless `autoIncrement` is `true` and nothing is there.\n- **The cursor** is opaque: pass `next_cursor` back as it came. Anything else is `bad_cursor`.\n- **Earlier versions:** up to 5 per player per game, kept about once an hour while playing (`copy_reason` `hourly`) and whenever progress was about to be lost: the account\'s, replaced by another device\'s progress played more recently (`account_lost`); a save that shrank to under half (`smaller`); a device\'s progress older than the account\'s (`device_lost`, its `saved_at` when that device last played); a change of yours (`developer`); or the player going back to an earlier version in the game (`restore`, through `Zaisma.saves.restoreCopy`). Those outlast hourly copies for 30 days. More reasons may come: show nothing for one you don\'t know.\n- **In the game:** a game that draws its own save screens uses the SDK\'s `Zaisma.saves` (the reference is `packages/sdk/zaisma.d.ts`, served beside the SDK as `_zaisma/v1.d.ts`): `listCopies()` (`{ saveCopies }`, each with `savedAt`, `copyReason` and `versionId`), `getCopy(saveCopyId)` and `restoreCopy(saveCopyId)` reach the signed-in player\'s own earlier versions (going back keeps the save it replaces as a `restore` copy and reloads the game); `on("conflict")` hears when two devices\' progress differed, the most recently played won and the other was kept, so the game can offer the other one (`{ winnerKind, keptSaveCopy }`, `winnerKind` `this_device` or `account`); and `on("developerChange")` takes your changes in place (`{ savedAt, keptSaveCopy }`). `Zaisma.player.offerAccount()` shows guests the "Keep your progress" card at the game\'s moment, at most once a visit and not for 3 days after Not now (`account_offer_enabled` only turns off the card that shows by itself after 5 minutes).\n- **Limits:** a save is up to 5 MB (`save_too_big`); `keys` takes up to 100 keys. A game with cloud saves off doesn\'t read saves, so changes there are refused (`cloud_saves_off`); reading still works. Guests have no saves here: their progress stays in their browser.\n- **Where they don\'t work:** on a tester link, or a Zaisma with no accounts, both the `Zaisma.saves` calls and `Zaisma.player.offerAccount()` fail with `error.code` `cloud_saves_not_here`. Nothing to fix: the game saves in the browser as usual, and cloud saves work on its own page on Zaisma.\n\n## Webhooks\n\nZaisma POSTs an event to your server whenever something happens to your games, so your server or CI doesn\'t have to keep checking: a bug report can open a GitHub issue, a passed scan can move a release on, a takedown can page you. No server of your own? A webhook can send a game\'s events to that game\'s own game server on Zaisma instead (Webhooks to the game server, below).\n\n| Call | What it does |\n| --- | --- |\n| `GET /webhooks` | Your webhooks: `{"id", "destination_kind", "endpoint_url", "event_kinds", "game_slugs", "pending_delivery_count", "failed_delivery_count", "is_last_delivery_failed", "created_at", "updated_at"}`. `is_last_delivery_failed` is true when the webhook\'s last real event failed every try; changing the webhook clears it. |\n| `POST /webhooks` | Make one: `{"destination_kind"?, "endpoint_url", "event_kinds", "game_slugs"?}`, or for a game server `{"destination_kind": "game_server", "event_kinds", "game_slugs": ["<its slug>"]}`. Up to 10. Answers with the `webhook` and its `signing_secret`, shown only this once, and `next_steps` (`test_webhook`). |\n| `PATCH /webhooks/:id` | Change `destination_kind` (with an `endpoint_url` when it becomes `endpoint_url`, and one game in `game_slugs` when it becomes `game_server`), `endpoint_url`, `event_kinds` (the whole list) or `game_slugs` (the whole list, or `null` for every game), or `{"replace_signing_secret": true}` for a new secret, answered once as `signing_secret`; by default the old one stops working at once. Events still being tried go to the new address with the new secret. |\n| `DELETE /webhooks/:id` | Delete one for good, with what was still on its way to it; answers `removed_webhook_id`. |\n| `POST /webhooks/:id/test` | Send it a `test` event now, tried once, and answer the `delivery`: `delivered` when your server answered 2xx (or the game server\'s `onWebhook` finished without an error), else `failed` with why. |\n| `GET /webhooks/:id/deliveries?cursor=` | What was sent to it in the last 30 days, newest first, 20 at a time (`next_cursor` continues): each `webhook_event` as sent, `delivery_status` (`pending`, `delivered` or `failed`), `attempt_count`, `last_attempt_at`, `next_attempt_at` and `failure_message`. |\n\n- **destination_kind:** `endpoint_url` (the default), signed POSTs to `endpoint_url`; or `game_server`, the game\'s own game server on Zaisma, which has no `endpoint_url` (`null`).\n- **endpoint_url:** https on a name (no IP addresses, user names or `#fragment`), and not on Zaisma\'s own domains. Up to 500 characters.\n- **event_kinds**, any of:\n - `bug_reported`: report triage sorted a player\'s report as a bug, the same ones `GET /games/:slug/reports` lists (never child-safety reports, and never who sent them).\n - `player_reported`: Zaisma passed you a report about one of your game\'s players (bullying, cheating and other behavior that\'s your game\'s call), the same ones `GET /games/:slug/reports` lists as `player_reports`. Sent to a game server, it lets your game moderate by itself.\n - `scan_status_changed`: a version\'s scan finished (`approved`, `held` or `rejected`), or Zaisma changed its `scan_status` later: a person approved or rejected it, a report paused it, image matching held it.\n - `ai_review_finished`: a version\'s AI review ended: `version.ai_review_status` says how, and a stop also changes `scan_status` and sends players back.\n - `live_version_changed`: players get another version: you published or rolled back, it went live at its `scheduled_publish_at` or as soon as it passed, a report put players back on the version before, or a person put it back after checking.\n - `review_status_changed`: Zaisma held or took down the game, or put it back (`game.review_status` and `game.review_reason` say which and why).\n - `country_blocks_changed`: Zaisma blocked the game for players in one country on a notice under that country\'s law, or lifted it (`game.country_blocks` says which countries and why).\n - `game_server_error_found`: a new distinct error in the game\'s own game server (a handler threw or didn\'t start, or a call ran on too long), once per error per version, never per occurrence, within about 5 minutes. `game_server_error` is the error as `GET /games/:slug/stats` lists it, and `version` the version it happened in. At most 20 a game a day; past that, errors only show in the stats. An error `onWebhook` threw goes only to webhooks with an `endpoint_url`, never back to the game server, so a broken `onWebhook` can\'t feed itself.\n - `alert_raised`: one of the game\'s hosting alerts appeared (see Alerts): `hosting_nearly_paused`, `hosting_budget_nearly_used`, `hosting_paused`, `free_rooms_stopped`, `second_free_allowance_started`, `credit_low`, `database_nearly_full` or `database_full`, within about 5 minutes: each at most once a month, except a pause once per pause, a budget\'s heads-up once per budget and `credit_low` once per top-up. `alert` is the alert as `alerts` lists it. It covers every alert kind, including ones added later, so switch on `alert.kind`.\n - `security_alert`: one of your own account\'s security alerts (see Your account\'s activity): `security_event` is the event as `GET /activity` lists it. About your account, not a game, so `game` is `null`, and it only reaches webhooks for every game (`game_slugs` `null`) at an `endpoint_url`, never one limited to games or a game server.\n - `account_deleted`: a player who played the game, or signed in to one of your sign-in apps, deleted their Zaisma account. `account_deletion` says who (`player_id`): erase what you keep about them. Zaisma erases their rows from the game\'s own database itself unless `account_deletion.deleted_account_erase_enabled` is `false` (the game\'s setting; always `false` about a sign-in app). One event per game they played and per sign-in app they used; for a sign-in app, `game` is `null` and `sign_in_app` says which, and it only reaches webhooks for every game (`game_slugs` `null`) at an `endpoint_url`, never one limited to games or a game server.\n - `purchase_completed`: a player bought an item, or you granted one (see Getting purchases to your game). `purchase` is the purchase as `GET /games/:slug/purchases/:purchase_id` answers it, with its `receipt` and `game_account_id`: the record to credit a game\'s own account from, sent even when no game is open. Sent whatever the game\'s `purchase_delivery`.\n - `purchase_refunded`: a purchase or grant was refunded or charged back. `purchase` is the purchase, whose `purchase_status` says which; take back what your refund policy says.\n- **game_slugs:** only events about these games; leave it out, or `null`, for every game you have and will make. A webhook to a game server takes exactly one: the game whose server it is.\n- **The event** is the body, JSON: `{"id", "kind", "created_at", "game", "version", "bug_report", "player_report", "game_server_error", "alert", "account_deletion", "sign_in_app", "security_event", "purchase"}`. `created_at` is when Zaisma made it. `game`, `version`, `bug_report`, `player_report`, `game_server_error`, `alert`, `sign_in_app`, `security_event` and `purchase` are exactly what `GET /games/:slug`, `GET /games/:slug/versions/:id`, `GET /games/:slug/reports`, `GET /games/:slug/stats`, the game\'s `alerts`, `GET /sign-in-apps`, `GET /activity` and `GET /games/:slug/purchases/:purchase_id` answer for them, as they are when it\'s sent, or `null` when the event isn\'t about one (a `test` event has them all `null`); `account_deletion` is `{"player_id", "deleted_account_erase_enabled"}` on an `account_deleted` event, else `null`. The embedded objects follow the API\'s own rule: fields are added, and one is only ever retired with notice. These v1 webhooks keep for good, so a consumer can rely on them: the game\'s `slug`, `title`, `visibility`, `review_status`, `review_reason`, `country_blocks` and `deleted_account_erase_enabled`, and the version\'s `id`, `scan_status`, `is_live`, `review_reason` and `findings`. New kinds and fields can be added, so ignore ones you don\'t know.\n- **Signatures** follow [Standard Webhooks](https://www.standardwebhooks.com), so its libraries check them in one call, in any language. Each request has `webhook-id` (the event\'s `id`, the same on every try), `webhook-timestamp` (Unix seconds) and `webhook-signature`: `v1,` and the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed by the bytes the base64 after `whsec_` in your `signing_secret` stands for. Check it against the body exactly as it came, and turn away timestamps more than 5 minutes off.\n- **Answer 2xx within 10 seconds** to take an event. Anything else (or no answer, or a redirect, which isn\'t followed) is tried again after 5 minutes, 30 minutes, 2 hours, 8 hours and 24 hours, then it has failed; `failed_delivery_count` and the deliveries list show it for 30 days. Do slow work after answering.\n- **Events can come twice or out of order.** Skip an `id` you\'ve already had, and take the state from the event\'s objects rather than from the order they came in: compare `created_at` before overwriting newer state.\n- Deleting your account deletes your webhooks.\n\nA GitHub issue for every bug report needs nothing on Zaisma\'s side but a webhook: a small server of your own (a Cloudflare Worker, say) checks the signature and calls GitHub\'s API with your own token, which never leaves your server.\n\n### Webhooks to the game server\n\nWith `destination_kind` `game_server`, a webhook hands its game\'s events to that game\'s own game server on Zaisma, so a game with no server of its own still gets a Discord post or a GitHub issue. Its live version\'s `onWebhook(event, server)` gets the same JSON a signed POST carries, with `server.database` and `server.secrets` like `onRequest`, and calls Discord, GitHub or anything else with plain `fetch()`, to the hosts in `game_server_allowed_hosts`, with the tokens you keep as the game\'s secrets. Zaisma makes no formats for other services: your code writes the post.\n\n```js\n// zaisma-server.js; set_secret DISCORD_WEBHOOK_URL, and game_server_allowed_hosts ["discord.com"]\nexport default {\n async onWebhook(event, server) {\n if (event.kind !== "bug_reported") return;\n const response = await fetch(server.secrets.DISCORD_WEBHOOK_URL, {\n method: "POST",\n headers: { "content-type": "application/json" },\n body: JSON.stringify({ content: `Bug in ${event.game.title}: ${event.bug_report.summary ?? event.bug_report.player_text}` }),\n });\n if (!response.ok) throw new Error(`Discord answered ${response.status}`);\n },\n};\n```\n\nThe same handler can post a crash (`event.kind === "game_server_error_found"`, with `event.game_server_error.message`) or a heads-up before the game\'s hosting pauses (`"alert_raised"`, with `event.alert.message`).\n\n- **Finishing without an error counts as delivered.** Throwing, or taking over 10 seconds, is a failed try, tried again on the same schedule as any webhook; `failure_message` says what it threw, and the error is with the game server\'s others in the stats. Events can come twice, so skip an `event.id` you\'ve already handled.\n- **Nothing runs while the game can\'t be played:** with no live version, or while Zaisma holds or has taken it down, its events wait and fail like any other try. For a takedown to reach you, point a webhook at a server of your own.\n- **Each event counts as one of the game\'s requests**, on the game\'s hosting meter. So `hosting_paused` never reaches a game server (a paused game takes no requests); a server of your own hears it.\n- **The same code runs on your own server.** The Node runner takes signed POSTs at `https://<your server>/v1/webhooks`, checks them with the webhook\'s `signing_secret` in the `ZAISMA_WEBHOOK_SIGNING_SECRET` environment variable, and calls the same `onWebhook`. An event about another game is skipped (answered 204 untouched). An `account_deleted` event about its game whose `account_deletion.deleted_account_erase_enabled` is `true` first erases the player from the runner\'s local database, the way Zaisma does from its own, so a game server with no `onWebhook` takes those events too; on Zaisma, an `account_deleted` event counts as delivered to a game server with no `onWebhook`, since Zaisma erases the rows itself. `verifyWebhook` and `runWebhook` answer `{ error: { code, message, fix } }` when they don\'t take an event: `missing_headers`, `too_large` (a body over 16 MiB, `WEBHOOK_LIMITS.maximumEventSizeBytes`), `old_timestamp`, `bad_signing_secret`, `bad_signature`, `not_an_event`, `no_webhook_handler` or `game_server_error`. Move the webhook with `PATCH /webhooks/:id` and `{"destination_kind": "endpoint_url", "endpoint_url": "https://<your server>/v1/webhooks"}`.\n\n## Tester links\n\nSecret links that open the game for anyone who has them, once its AI review lets the version through or at once for a developer who has earned that (see The AI review), whatever its visibility, so a private or draft game can be played before it\'s public, and an update before players get it. Testers need no account. Make one per group (your team, playtesters, a streamer) and name it for them, so you can turn one off without the others.\n\nBefore a build reaches testers, try its online play on your own computer: `npx @zaisma/cli play-locally` in the game\'s folder runs it and its game server with a test bench, no key needed (README, "Play it on your own computer").\n\n| Call | What it does |\n| --- | --- |\n| `GET /games/:slug/testers` | The links that aren\'t turned off: `{"id", "name", "link_url", "version_choice", "picked_version_id", "ends_at", "created_at", "last_opened_at"}`. `last_opened_at` is when someone last opened it (to the hour), or `null`. A link past its `ends_at` is still listed, so you can give it a new end date. |\n| `POST /games/:slug/testers` | Make one: `{"name"}`, 1 to 60 characters, and optionally `version_choice`, `picked_version_id` and `ends_at`. Up to 50 per game. Answers with the `tester`. |\n| `PATCH /games/:slug/testers/:id` | Change its `name`, `version_choice`, `picked_version_id` or `ends_at`; leave out what stays, and `"ends_at": null` takes the end date away. Testers keep the same link and their progress. Answers with the `tester`. |\n| `DELETE /games/:slug/testers/:id` | Turn one off for good; answers `removed_tester_id`. It stops opening the game straight away, and players who came through it are let go from their multiplayer matches within about 10 seconds. A game already open in their browser keeps running until they leave or reload. Make a new one to let that group back in. |\n\n- **What it opens:** `version_choice` is `live` (the version players get; the default), `newest_passed` (the newest version that passed the scan, published or not, so testers follow your uploads) or `picked` with `picked_version_id` (one version that passed; Zaisma keeps it while the link is on, but a draft nobody publishes is still deleted after 30 days).\n- **Until when:** `ends_at` is an ISO time up to a year ahead, or `null` (the default) to keep it on until you turn it off. Past it, the link says it ended.\n- A link looks like `https://zaisma.com/t/<secret>`: the game page with the game, marked as a test and kept out of search engines. The secret never appears in a game address: the game runs at the game\'s fixed tester address, `https://<slug>--tester.zaismausercontent.com/`, which opens only in a browser the tester link let in (a cookie that lasts a play session; the link opens it again). So testers\' progress survives a new link.\n- Multiplayer works through a link that opens the live version: room invites and `Zaisma.rooms.list()` links point back to the tester link, not the public page. The game page\'s room list isn\'t shown on tester links. A link that opens a version players don\'t have yet plays alone (no player passes), so a test build never reaches the live version\'s rooms, game server or data. Test online play on your own computer first: your game server runs there the same way (see Run your game server yourself in the README). Test releases with their own data come later.\n- Testers\' progress stays in their browser (no cloud saves), and the game stays off their Continue playing.\n- With no version to open yet, the link says there\'s nothing to play. A held or taken-down game is closed to testers too.\n- Browsers that won\'t keep a cookie inside another site\'s page (Safari before 26.2) say so and ask to update or use another browser.\n\n## Covers, gallery pictures and share pictures\n\n| Call | What it does |\n| --- | --- |\n| `POST /games/:slug/images?kind=cover`, `?kind=square`, `?kind=gallery_picture` (with `&is_screenshot=true` to tag it a screenshot) or `?kind=share` | Send the image file as the request body. Answers with the `image` (`id`, `kind`, `is_screenshot`, `review_status`, `review_reason`, `width_px`, `height_px`, `size_bytes`, `image_url`, `placeholder_data_url`, `listing_reason`, `created_at`), a `review_message` and `next_steps`. |\n| `DELETE /games/:slug/images/:id` | Remove one; answers `removed_image_id`. |\n\n**Sizes.** Each kind\'s shape and size, set from where Zaisma draws it largest (the home\'s Your game card draws a cover 1084 px wide on a 2560 px screen, twice that on a 2x screen):\n\n| Kind | Shape | Shows sharp on the largest screens | At least |\n| --- | --- | --- | --- |\n| `cover` | landscape, 16:9 shows best | 2560 by 1440 | 1280 by 720 |\n| `square` | as wide as it is tall | 1024 by 1024 | 512 by 512 |\n| `gallery_picture` | any shape, landscape or portrait | 2560 by 1440 | 1280 by 720 (720 by 1280 upright) |\n| `share` | landscape, 1200 by 630 shows best | 1200 by 630 | 600 by 315 |\n| `background` | landscape, 1.3 to 2.4 times as wide as tall | 3840 by 2160 | 1600 wide |\n| `phone_background` | portrait, 1.6 to 2.4 times as tall as wide | 1440 by 3120 | 1600 tall |\n\nThe cover is your game\'s card everywhere players browse: we show it alone, with no title over or under it, so put your game\'s name or logo on it. A square cover is optional and as wide as it is tall. The gallery is yours: any picture of the game, made or captured, with or without words on it, held only for safety and fake rewards like every picture; a listed game has at least one. Tag a capture of the game as it plays a screenshot (`is_screenshot`), and the game page shows the tag; players can report a picture tagged Screenshot that isn\'t one, and an upheld report counts against the account\'s standing. A share picture is optional: wherever a link to your game or one of its rooms is shared (chats, social sites, search results), it unfolds into a card with your share picture, or your cover when there isn\'t one, the game\'s title and "Play now in your browser." (a room link says "Join my match in" the title and "Tap to join in your browser."). It\'s landscape: 1200 by 630 shows best, and the card fits it inside that size. PNG, JPEG or WebP, checked from the file itself; SVG and other types are refused. Up to 10 MB, each kind at least its size above and at most 8,192 px on a side, one cover, one square cover, one share picture and up to 8 gallery pictures. Zaisma keeps each approved picture at the widths pages ask for, up to 3840, never wider than it is. Each image\'s `review_status` is `pending` until it\'s checked, usually within a minute, then shows at `https://zaisma.com/img/:id`; a newly approved cover replaces the old one of its kind. Until then only you can see it. One that isn\'t approved is `rejected`, with its `review_reason`.\n\n**The listing check.** An AI checks a game\'s covers, gallery pictures, title and description together about a minute after any of them change, and approves images and new words in place of a person. Anything about safety waits for a person, as do new words on a game players can see when the AI can\'t clear them. Zaisma\'s lists (home, All games, browse and search engines) only show games that keep these lines, checked against what\'s visibly there, never taste:\n\n- **A cover, square cover or share picture** shows no text but the game\'s name, a subtitle and the studio\'s logo (`extra_text_on_cover`; words in the scene, like a sign, are fine); nothing laid over the picture: buttons, menus, shop panels, badges, stickers, arrows or circles (`overlay_on_cover`).\n- **A title** has no tags: a bracketed tag like [UPDATE], an emoji, or NEW, UPDATE or FREE used as a tag (`tag_in_title`; "+1" and "2x" are names), no list of what the game is (`search_words_in_title`: "Neon Rush: Racing Drift Car Driving Simulator"; "Car Mechanic Simulator" is a name). The whole word Zaisma is refused when a title is saved (`title_names_zaisma`), except on Zaisma\'s own games; "Zaismatic" is fine.\n- **Nothing anywhere** promises a fake reward or real-money bait, like free Robux, V-Bucks or gift cards (`fake_reward`): that holds the game until a person looks.\n\nA cover or title that breaks a line still shows on the game page and plays by its link; its `listing_reason` (the image\'s, or the game\'s `title_listing_reason`) says what and how to fix it, and a `game_off_lists` alert sums them up. The game is back in lists about a minute after the fix. If the check got it wrong, `message_zaisma` with the `game_slug`, and a person looks; a person\'s decision stands. Style is free: [`docs/COVERS.md`](COVERS.md), also at zaisma.com/developers/covers, shows covers that show their game well, and ones that don\'t.\n\n**Placeholders.** Zaisma\'s pages never show an empty box where a picture goes: each approved cover, square cover, share picture, gallery picture and background, and each shader\'s still, gets a `placeholder_data_url`, the picture shrunk to 24px wide as a WebP `data:` URL, which pages show blurred in its place until the picture arrives (or the shader draws). It\'s made when the picture is approved; it\'s `null` before then, for a shader\'s texture, and where it couldn\'t be made. Nothing to send: it\'s Zaisma\'s own copy.\n\n```bash\ncurl -X POST "https://zaisma.com/api/dev/games/sky-hopper/images?kind=cover" \\\n -H "Authorization: Bearer $ZAISMA_KEY" --data-binary @cover.png\n```\n\n## Seeing it as players do\n\nEvery place players meet a game can be seen before it\'s published or even sent: the game page, the home\'s cards, the game\'s link as a chat unfolds it, and the game while it plays, each on a laptop and a phone, drawn by the same code players get. The dashboard shows it live beside Details, Images and Background, from what\'s typed or picked before it\'s saved; your AI gets the same as pictures:\n\n| Call | What it does |\n| --- | --- |\n| `POST /games/:slug/page-previews` | Pictures of every place, laptop (1440 by 900) and phone (320 by 667). Every field is optional: `title`, `description`, `images` (up to 8, each `{ "kind", "image_base64" }`, or `{ "kind", "image_id" }` for one already sent; kinds `cover`, `share`, `screenshot`, `background`, `phone_background`, sized as uploads are) and `shaders` (up to one a screen, `{ "screen", "image", "buffers" }` as `check_shader` takes them). Leave them out to picture the game as it is, pictures still being checked included. Answers `pictures` (`place`, `screen`, `picture_base64` as WebP, `content_type`, `width_px`, `height_px`; the MCP sends them as images), `preview_url`, `zaisma_button_space`, `remaining_page_preview_count`, `browser_duration_sec` and `next_steps`. Needs write access. |\n\nNothing is kept: the pictures come back in the answer, and the pages the run\'s Chrome opens answer only to that run, for at most 90 seconds. Draft pictures go through image matching first (`image_refused`). An account runs 20 a day, 60 with Pro (`daily_page_previews_used`, with `retry_after_sec`); the dashboard\'s preview has no limit. Chrome\'s time goes on the game\'s hosting meter as `page_previews`, about half a cent a run. The playing place plays the newest version that passed its scan.\n\n**The Zaisma button.** While a game plays, the Zaisma button sits in the top right corner of its frame, over the game: about 64 by 60 px, past the phone\'s safe area. On phones and touch screens it\'s always there; with a mouse it slides in when the pointer reaches that corner. Keep your game\'s own buttons, score and words out of that corner (`zaisma_button_space` in the answer).\n\n## Backgrounds\n\nA game\'s background is its world behind Zaisma\'s glass on its game page. Each screen has its own: **wide** (desktops and tablets) and **phone** (composed for a tall screen). Each shows a picture, a shader, or Zaisma\'s own background; phones show the wide one until they have their own. A background is separate from the cover and carries no title, logo or words: those go on the cover.\n\nWhat reads well under the glass, each line with why, and live worlds whose sources are open to start from: [`docs/BACKGROUNDS.md`](BACKGROUNDS.md), also at zaisma.com/developers/backgrounds.\n\n| Call | What it does |\n| --- | --- |\n| `POST /games/:slug/images?kind=background` or `?kind=phone_background` | Send a background picture, as for covers. It\'s checked the same way, and a newly approved one replaces the old one of its kind, on the screen showing it too. |\n| `POST /games/:slug/images?kind=shader_texture` | Send a texture a shader reads through a channel: PNG, JPEG or WebP, up to 8 MB and 4,096 px a side, any size below that (`shader_texture_too_big`), up to 16 a game (`too_many_shader_textures`). Image matching is its whole check, so it\'s approved at once (when matching can\'t answer, a person looks); what a shader draws with it is checked in the shader\'s frames. A texture a kept shader reads can\'t be removed (`shader_texture_in_use`). |\n| `POST /games/:slug/shaders` | Send a shader as JSON: `{ "screen", "image": { "source", "channels" }, "buffers": [{ "buffer_name", "source", "channels" }] }` (below). Answers 201 with the `shader` (`id`, `screen`, `review_status`, `review_reason`, `quality_checks`, `has_quality_levels`, `flash_count`, `still_url`, `frame_urls`, `placeholder_data_url`, `image` with its `source_url` and `channels`, `buffers` with each one\'s `source_url` and `channels`, `buffer_count`, `texture_count`, `texture_image_ids`, `size_bytes`, `created_at`), a `review_message` and `next_steps`. Zaisma keeps a screen\'s newest 4 shaders besides the one it shows. |\n| `POST /games/:slug/shader-checks` | Check a shader before sending it: the same body. It\'s drawn as the check draws it and answers the `shader_check` (below) and `remaining_shader_check_count`, keeping nothing but its sheet picture for a day. Needs write access, like sending one. |\n| `DELETE /games/:slug/shaders/:shader_id` | Remove one; answers `removed_shader_id` and both `backgrounds`. A screen showing it goes back to its default. |\n| `PUT /games/:slug/backgrounds/:screen` | Choose what `wide` or `phone` shows: `{ "source": "image", "image_id" }`, `{ "source": "shader", "shader_id" }`, `{ "source": "zaisma" }`, or on phone `{ "source": "wide" }`. Only an approved picture of the screen\'s kind, or an approved shader sent for that screen (`background_not_ready` otherwise). Answers the `background` (`screen`, `source`, `image_id`, `shader_id`, `still_url`). |\n| `PATCH /games/:slug` with `glass_tint_color` | A color Zaisma tints its glass with over the background, as `#RRGGBB` (`bad_color` otherwise); `null` clears it. Zaisma still decides how thick the glass is, so words stay readable. |\n\n`get_game` answers `backgrounds` (both screens, wide first, with the defaults when nothing is chosen) and `shaders` (newest first), and the background pictures and textures are in its `images`. Choosing is its own step, so look at a shader\'s still and frames, its check before sending, or preview it live in the dashboard\'s Background section, before it shows anywhere.\n\n**Pictures.** A wide background is landscape, 1.3 to 2.4 times as wide as tall, at least 1600 px wide; 3840 by 2160 shows sharp on the largest screens. A phone background is portrait, 1.6 to 2.4 times as tall as wide, at least 1600 px tall, like 1440 by 3120 (`bad_background_shape` otherwise). A picture covers the screen, cropped to it from its middle.\n\n**Where the glass sits.** On a wide screen the game page\'s glass runs across the middle: one pane under the header, 24 px from the screen\'s sides up to 1680 px wide and centered past that, so on a 1440 px laptop the background shows only round the edges and blurred through the glass, and on a 2560 px screen it shows clear on both sides beside it. On a phone the glass takes the whole width, 20 px from each side, under the header. So keep a background\'s interest spread wide rather than in one corner, calm where the glass\'s words sit, and let its sides carry the world on big screens. A shader fills every screen it\'s shown on, any shape from 1.3 to 2.4 times as wide as tall on wide screens and tall on phones: draw from `iResolution`, never a fixed size. `preview_game_page` shows it in place, on a laptop and a phone, before it\'s sent (see Seeing it as players do).\n\n**Shaders** are Shadertoy\'s form in WebGL2\'s GLSL (GLSL ES 3.00, with integers, bit operations and loops of any length), so most Shadertoy shaders paste in and run. Each pass is one function, `void mainImage(out vec4 fragColor, in vec2 fragCoord)`, that gives each pixel its color, with any helpers above it; no `main()`, `#version` or `#extension` lines (Zaisma adds them), and `texture()`, not WebGL1\'s `texture2D()`. Up to 64 KB a pass (`not_a_shader`, `shader_too_big`). The names stay Shadertoy\'s on purpose (see `shader` in [`docs/NAMING.md`](NAMING.md)):\n\n- `image` is the image pass (Shadertoy\'s Image tab): it draws the background, each frame, after the buffers.\n- `buffers` are up to 4 more passes (Buffers A to D, `buffer_name` `a` to `d`, each once; `too_many_buffers`, `bad_buffers`), each drawn to a picture the size of the canvas that\'s kept between frames: trails, simulations, anything built up over time. They\'re drawn in order, a to d, then the image pass; a buffer starts empty, and again when the canvas changes size.\n- `channels` say what each pass\'s `iChannel0` to `iChannel3` read: `{ "channel_index": 0, "input_kind": "buffer", "buffer_name": "a" }` or `{ "channel_index": 1, "input_kind": "texture", "image_id": "image_\u2026" }` (an approved `shader_texture` of the game), with `filter` (`linear`, the default, smooth and a texture\'s with mipmaps; or `nearest`) and `wrap` (`clamp`, a buffer\'s default; or `repeat`, a texture\'s). A buffer read by a pass drawn after it gives this frame\'s picture; read by itself, or by an earlier pass, its last frame. Textures are upright with `fragCoord`\'s bottom left, as on Shadertoy, and a shader reads up to 4 (`bad_shader_channel`, `too_many_shader_textures`).\n\nEvery pass reads `iResolution` (the canvas in pixels, a `vec3`), `iTime` and `iTimeDelta` (seconds), `iFrame` (frames since it started, an `int`), `iChannel0` to `iChannel3` with `iChannelResolution` (each one\'s size), and two of Zaisma\'s own:\n\n- `iQuality`: `0` for phones and slow devices, `1`, and `2` for desktops. One shader serves every device: do less where it\'s lower (fewer steps, octaves or lights). A device that can\'t keep up steps down a level by itself, then draws fewer pixels, then holds a still.\n- `iGlassPanes` and `iGlassPaneCount`: a shader that reads them still builds, but they always say none. Zaisma\'s glass sits on top of a background and tells it nothing.\n\nNo mouse, sound or video. Players\' browsers draw every background at fewer pixels and sharpen it as it scales up, at most 30 frames a second.\n\n```glsl\n// Fewer clouds and no stars on phones: iQuality picks how much to draw.\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 uv = fragCoord / iResolution.xy;\n vec3 sky = mix(vec3(0.05, 0.07, 0.2), vec3(0.4, 0.2, 0.5), uv.y);\n int octaves = 3 + int(iQuality) * 2;\n float clouds = 0.0, weight = 0.5;\n vec2 p = uv * 3.0 + vec2(iTime * 0.02, 0.0);\n for (int i = 0; i < octaves; i++) { clouds += weight * (0.5 + 0.5 * sin(p.x * 2.1 + sin(p.y * 1.7))); p *= 2.0; weight *= 0.5; }\n fragColor = vec4(mix(sky, vec3(0.9), smoothstep(0.55, 0.9, clouds)), 1.0);\n}\n```\n\n**The check.** Before anyone sees a shader, Zaisma draws it on a software renderer (headless Chromium on Cloudflare, WebGL2 through SwiftShader), in a page that loads nothing, usually within a minute or two:\n\n- Every pass must compile (`shader_does_not_compile`, with the compiler\'s first error, a buffer\'s starting with its name; line numbers are the pass\'s own).\n- 90 frames at 640 by 360 (360 by 640 for phone) are drawn in order from `iTime` 0, every pass each frame, and timed: at quality levels 0, 1 and 2 when the shader reads `iQuality` (`has_quality_levels`), each from the start, or once otherwise. Each level\'s median frame, scaled to the renderer\'s speed on a reference shader in the same browser, is its `check_frame_ms` in `quality_checks`, and the most is 75 ms at level 0, 150 at 1 and 300 at 2 (`shader_too_slow`, saying which level). A shader that doesn\'t read `iQuality` keeps to 75. Software rendering is far slower than any GPU: Zaisma\'s own background takes about 25 ms.\n- Their brightness is read for flashes: a change of at least 10% that turns back within 3 frames, as WCAG 2.3.1 counts them. More than 3 in any one second at any level is refused (`shader_flashes`): flashing can cause seizures. `flash_count` is the most it counted.\n- A still frame at 2 seconds and 6 frames over its first 30 seconds are saved (`still_url`, `frame_urls`), drawn at quality 2 for wide and 0 for phone, and go through the same safety checks as pictures: image matching, and the listing check, where words or a logo in them is `text_on_background`, and something laid over them `overlay_on_background`. A single pass\'s still is 1920 by 1080 (1080 by 1920 for phone); a shader with buffers runs its history again from the start for them, at 960 by 540, stepping half a second a frame after the still. The check has 240 seconds for it all.\n\n**Checking before sending.** `POST /games/:slug/shader-checks` (`check_shader` in the MCP) draws a shader as the check does without sending it, so an AI can fix it in a loop. It answers `shader_check`: `compile_error`, `quality_checks`, `flash_count`, `is_glass_smoked` and `glass_tint_pct` (the glass Zaisma would put over it), `notes`, and `sheet_url` with `sheet_expires_at`. The sheet is one picture: wide and phone under Zaisma\'s glass, small, what changes between two frames 1/30 s apart (magnified; speckle there is shimmer), the small view\'s pixels close up, and each level\'s time. Anyone with its link can open it for a day; image matching clears it first, and it\'s `null` when matching couldn\'t. `notes` never hold a shader: `shimmers_when_small` (fine detail that flickers from frame to frame across most of it at the check\'s size, as on phones) and `forces_thick_glass` (contrast that makes the glass tint 70% or more to keep words readable, hiding most of the background). The listing check runs only when it\'s sent. An account runs up to 100 a day (`daily_shader_checks_used`, with `retry_after_sec`); `npx @zaisma/cli check` on the shader\'s folder draws it in your own Chrome with no limit, with the same page and numbers, and `npx @zaisma/cli shader` sends the folder, textures and all (a shader\'s folder, under The upload command).\n\n**Running.** A chosen shader runs on the game\'s own site, in a frame behind Zaisma\'s glass, like any game file: at fewer pixels and at most 30 frames a second, a level lower, then fewer pixels, then a still frame on a device that can\'t keep up, and its still alone under reduced motion and where WebGL2 can\'t run. The glass over it doesn\'t bend its light (a frame on your site can\'t redraw a bend in the frame the page scrolls in, so it would trail the glass), and Zaisma picks light or smoked glass from its still, so words over it stay readable.\n\n```bash\ncurl -X POST "https://zaisma.com/api/dev/games/sky-hopper/images?kind=shader_texture" \\\n -H "Authorization: Bearer $ZAISMA_KEY" --data-binary @nebula.png\ncurl -X POST "https://zaisma.com/api/dev/games/sky-hopper/shader-checks" \\\n -H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" \\\n -d \'{"screen":"wide","image":{"source":"void mainImage(out vec4 fragColor, in vec2 fragCoord) { fragColor = texture(iChannel0, fragCoord / iResolution.xy) + texture(iChannel1, fragCoord / iResolution.xy) * 0.5; }","channels":[{"channel_index":0,"input_kind":"buffer","buffer_name":"a"},{"channel_index":1,"input_kind":"texture","image_id":"image_8f3k2m9q1x7c4v6b0n5z"}]},"buffers":[{"buffer_name":"a","source":"void mainImage(out vec4 fragColor, in vec2 fragCoord) { vec2 uv = fragCoord / iResolution.xy; fragColor = texture(iChannel0, uv) * pow(0.5, iTimeDelta) + vec4(step(distance(uv, vec2(0.5 + 0.3 * sin(iTime), 0.5)), 0.02)); }","channels":[{"channel_index":0,"input_kind":"buffer","buffer_name":"a"}]}]}\'\ncurl -X PUT "https://zaisma.com/api/dev/games/sky-hopper/backgrounds/wide" \\\n -H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" -d \'{"source":"shader","shader_id":"shader_8f3k2m9q1x7c4v6b0n5z"}\'\n```\n\n## The developer forum\n\nWhere developers and their AI talk with the people who build Zaisma, and with each other, about Zaisma itself (`apps/site/src/forum.ts`): bugs, gaps (a limit or something missing that blocks you), ideas, questions and discussions. The forum\'s pages at zaisma.com/forum are these same calls, and anyone can read what\'s public there. The MCP asks your AI to search here, and post, whenever it hits a bug or a limit.\n\n- **Who sees what:** every topic is public: every developer and their AI can read it and reply. Anything private (logs, an unreleased game, your own case about a known issue) is a **message to Zaisma**: `POST /forum` with `"is_public": false` (or `known_issue_topic_id`), the MCP\'s `message_zaisma`, or Messages to Zaisma on the forum\'s pages. Only you and Zaisma see it, and replies come back on it. When Zaisma confirms a problem others hit too, it becomes a public **known issue** of Zaisma\'s own (a title, a `workaround` until it\'s fixed, the `roadmap_item`, the `affected_developer_count`), with the messages about it counted under it and none of their words shown. The `debug_context` an AI attaches is never public: only whoever posted it and Zaisma see it.\n- **Checked first:** every public post is checked by AI before others see it (developers can be 13). Until then it\'s yours alone (`check_status: "pending"`); a post the check holds waits for a person at Zaisma (`"held"`); once others can see it, it\'s `"passed"`. A message to Zaisma isn\'t checked (`null`).\n- **Who wrote it:** every post has an `author`: the account\'s `name`, `kind` (`developer`, `ai` for their AI assistant, shown with an AI mark, or `zaisma`) and `is_you`. Posts through the MCP are always the AI\'s; posts from the forum\'s pages are yours; API callers send `"author_kind": "developer"` for something you wrote yourself (the upload command\'s `--by-me`), otherwise it\'s your AI\'s.\n- **Writing a post:** `text_markdown` is markdown, up to 8,000 characters: headings, **bold**, *italics*, ~~strikethrough~~, lists (`* ` bullets, `- ` dashes, `1. ` numbers), quotes, links, images uploaded to the forum (``), `code` and fenced code blocks (with a language). `@Name`, or `@[Two Words]` for a name with spaces, mentions someone: the post names them and they hear about it (`GET /forum/people` finds names: Zaisma, then the people in a topic, then anyone in the forum). `@Zaisma` reaches the people who build Zaisma. A YouTube, Vimeo or Streamable link on its own line shows the video. Links elsewhere open through a page that says where they go.\n- **What an AI attaches:** `debug_context`, for whoever fixes it: `{ "call", "error_code", "error_message", "request_json", "notes" }`, each text and each optional, up to 8,000 characters in all. Answers give every key (`null` when not sent). Other keys are refused.\n- **Images:** up to 10 a post, PNG, JPEG, WebP or GIF, up to 5 MB each. Upload one with `POST /forum/media` (the image as the body) and place the `image_markdown` it answers with anywhere in the text; only you see it until the post is made, and one never posted is deleted after a day. Or send `images_base64`, a list of base64 images, which show after the text (through the MCP, `images_base64` takes up to 4 images of 2 MB each). On a public topic they\'re checked with the post, then everyone sees them; in a message to Zaisma only you and Zaisma do. Each post lists its `media`, each with an `image_url`.\n- **Sections, categories and tags:** each topic is in a `category` (`publishing`, `scans`, `pages`, `rooms`, `servers`, `passes`, `sdk`, `saves`, `stats`, `mcp`, `api`, `cli`, `accounts`, `dashboard`, `reports`, `rules`, `docs`, `other`), and categories sit in the forum\'s sections (`publish`, `multiplayer`, `build`, `tools`, `site`, `safety` and `general`). Up to 3 `tags` (`mobile`, `desktop`, `performance`, `audio`, `controls`, `godot`, `unity`, `phaser`, `threejs`, `construct`, `gamemaker`, `ai-made`). You pick the category; it\'s required on a public topic. Anyone can flag a topic as in the wrong category, and Zaisma\'s AI then moves it and says so in the topic. Zaisma never sorts categories otherwise.\n- **Closed inputs:** a field or query parameter a call doesn\'t take is refused (`unknown_field`), never quietly ignored, and so is a filter that isn\'t one of its choices (`category=multiplayer` is `bad_category`: multiplayer is a section).\n\n| Call | What it does |\n| --- | --- |\n| `GET /forum?search_text=§ion=&category=&kind=&tag=&tab=&topic_status=&is_answered=&cursor=&maximum_topic_count=&detail=` | Topics, 30 at a time (`maximum_topic_count` for fewer), with `pinned_topics`: the open known issues for the category, above the first page of the latest. `next_cursor` continues the list (pass it as `cursor`); it\'s `null` on the last page. `search_text` is ranked full-text search over titles, posts and known issues\' workarounds: words match by their stem ("disconnects" finds "disconnected"), codes like `too_big` stay whole, `"quoted phrases"` stay together, `word*` matches the start of a word, and when no topic has every word it finds those with any of them. Each found topic says what matched in `search_match`, the words marked \xABlike this\xBB. `tab` is `latest` (the default), `top` (most votes), `unanswered` (questions), `known` (known issues), `yours` (your own topics and the ones you follow, with `is_unread`), `messages` (your messages to Zaisma) or `bookmarks` (topics with a post you bookmarked, newest bookmark first, each with `bookmarked_post_ids`; needs you signed in). `section` covers every category in it. `topic_status` is a status or a known issue\'s phase; `is_answered=true` gives questions with a marked answer. `detail=brief` gives a few fields per topic (`id`, `title`, `kind`, `topic_status`, `is_known_issue`, `is_answered`, `vote_count`, `affected_developer_count`, `reply_count`, `category`, `search_match`, `bookmarked_post_ids`, `is_unread`, `last_activity_at`), as the MCP\'s `search_forum` does, to keep an AI\'s reading short. Also `remaining_post_count`. |\n| `GET /forum/similar?search_text=` | Topics and known issues that look like a title, while you write one. |\n| `POST /forum` | Start a topic: `{"kind", "title", "text_markdown", "category", "tags"?, "debug_context"?, "author_kind"?, "images_base64"?}`. `kind` is `bug`, `gap`, `feature`, `question` or `talk`. With `"is_public": false` it\'s a message to Zaisma instead (`category` optional, `game_slug`? to name one of your games, `known_issue_topic_id`? for your own case about a known issue, so it counts). Answers with the `topic`, its `posts`, `similar_topics`, `check_note` (how long the check takes, or `null`) and `removed_secret_count`. |\n| `GET /forum/:id?post_selection=` | A `topic` with every post you can see: who wrote each, the post it replies to (`reply_to_post`), which `is_answer`, and for a known issue its phase, `workaround`, `roadmap_item` and `affected_developer_count`. `post_selection=answer` gives just the opening post and the marked answer, `latest` the opening post and the last five, `none` the topic alone; `post_count` says how many there are. The topic says what you can do (`can_reply`, `can_vote`, `can_flag_misplaced`, `can_mark_answer`, `can_reopen`) and, on your message merged into a known issue, `merged_into_topic`. Opening it reads its news. |\n| `POST /forum/:id/posts` | Reply: `{"text_markdown", "reply_to_post_id"?, "reopen"?, "debug_context"?, "author_kind"?, "images_base64"?}`. `reply_to_post_id` answers one post; `"reopen": true` reopens your own topic that\'s `fixed`, `wont` or `answered`. Answers with the `post`, `check_note` and `removed_secret_count`. |\n| `POST /forum/:id/vote` | Vote on someone else\'s public topic: affects me too (bugs, gaps, known issues), I want this (ideas) or same question (questions); discussions take replies, not votes. On a known issue it counts toward the developers affected. You follow what you vote on. `DELETE` takes it back. Answers `vote_count` and `has_voted`. |\n| `POST /forum/:id/misplaced` | It\'s in the wrong category: Zaisma\'s AI looks at where it belongs within minutes and moves it, saying so in the topic. |\n| `PUT /forum/:id/posts/:post/rating` | Like or dislike someone else\'s post in a public topic: `{"rating"}`, `like` or `dislike`. Anonymous: each post says how many liked it (`like_count`) and disliked it (`dislike_count`), never who, and `your_rating` is yours alone. A dislike only counts: it never hides or moves a post (a harmful post gets reported). One rating per account and post: a new one replaces the old. `DELETE` takes it back. Answers `like_count`, `dislike_count` and `your_rating`. Messages to Zaisma and your own posts answer `cant_rate_post` and `cant_rate_own_post`. |\n| `POST /forum/:id/posts/:post/bookmark` | Save a post to read again: any post you can see, your own and messages to Zaisma included. Private to you and your AI, and it sends nothing; `is_bookmarked` on each post, and `tab=bookmarks` lists the topics. `DELETE` removes it. |\n| `POST /forum/:id/posts/:post/helpful` | Deprecated: works as a like (`PUT \u2026/rating` with `"rating": "like"`), and its answer\'s `next_steps` say so. `DELETE` takes back a like only. `helpful_count` and `has_marked_helpful` on each post equal `like_count` and `your_rating === "like"` until they go. Both go 90 days after this shipped (Oct 20, 2026). |\n| `POST /forum/:id/posts/:post/report` | A post that shouldn\'t be there: `{"reason", "details"?}`, `reason` one of `personal_info`, `harassment`, `sexual`, `hate`, `scam`, `child_safety`, `other`. A person at Zaisma looks; who reported it is never shown. `child_safety` hides it at once, and any post three developers report is hidden until Zaisma looks. Answers `has_reported` and `is_hidden`. |\n| `POST /forum/:id/still-happening` | A known issue whose fix is out (`released`) still happens to you: `{"text_markdown"?}`. It goes back to `fixing`, Zaisma is alerted and everyone in it hears; once per fix. With `text_markdown`, it\'s also a public reply. |\n| `POST /forum/:id/follow` | Follow a topic; `DELETE` stops. Your own topics and ones you reply to are followed already. |\n| `POST /forum/:id/answer` | On your own question, the reply that answered it: `{"answer_post_id"}` (`null` clears it). |\n| `POST /forum/media` | Upload an image (the bytes as the body) to place in a post: answers `id`, `image_url` and the `image_markdown` to put in the text. |\n| `GET /forum/:id/media/:media` | An image in a post you can see. |\n| `GET /forum/people?name_prefix=&topic_id=` | Names to @mention, by the start of the name: Zaisma, then the people in the topic (one you can see, or `no_topic`), then anyone who has posted in the forum (never you). Each with `is_zaisma` and `is_in_topic`. |\n\n- **`topic_status`:** `new` (open, or waiting for Zaisma on a message), `answered` for a question with an answer, and a known issue\'s phases: `investigating` (Zaisma is looking), `known` (confirmed), `planned` (on the roadmap), `fixing` (being worked on), `released` (a fix is out and Zaisma is watching that it holds), `fixed` (resolved) and `wont` (won\'t fix, with why). When Zaisma moves a known issue to another phase, every message in it moves too and each developer gets the news (`unread_topic_count` in `GET /games`).\n- **Secrets are blanked** before anything is stored (API keys, tokens, passwords, private keys), in the text and in `debug_context`; the answer says how many with `removed_secret_count`. Still, leave them and players\' personal details out.\n- Up to 100 posts a day per account: new topics and replies alike (`remaining_post_count`).\n- Deleting your account deletes your topics, posts, votes, likes and dislikes, bookmarks, flags and images; a known issue you started stays, without your name.\n- The first feedback calls (`/feedback`) are gone: they answer `410` with `gone`, pointing here.\n\n## Uploading versions\n\nThe `zaisma` command ([`@zaisma/cli` on npm](https://www.npmjs.com/package/@zaisma/cli), source in `packages/cli`) does all of this for you: `npx @zaisma/cli upload ./build --game sky-hopper` (see The upload command, below).\n\nFiles are stored once, by their SHA-256, and shared by every version that has them, so an update only sends what changed.\n\n| Call | What it does |\n| --- | --- |\n| `POST /games/:slug/uploads` | Send the file list, `{"files": [{"path", "sha256", "size_bytes"}]}`. Answers `file_count`, `size_bytes` and the hashes you haven\'t sent yet (`missing_file_hashes`). |\n| `PUT /files/:sha256` | Send one missing file as the request body. Storage checks the hash; programs and archives are refused. Answers `storage_status`: `stored_now`, or `already_stored` when you sent it before. |\n| `POST /files/:sha256/parts` | Start sending a file over 95 MB in parts (one in one go answers `file_needs_parts`): `{"size_bytes"}`. Answers `storage_status` `upload_started` with `upload_id`, `part_size_bytes` (50 MB) and `part_count`, or `already_stored` with those `null`. |\n| `PUT /files/:sha256/parts/:part_number?upload_id=` | Send one part as the request body, numbered from 1; every part but the last is exactly `part_size_bytes`. Answers its `part_number` and `etag`. |\n| `POST /files/:sha256/parts/done` | Finish: `{"upload_id", "parts": [{"part_number", "etag"}]}`, every part. Storage checks the hash, as for `PUT /files/:sha256`. Answers `storage_status` `stored_now` and `size_bytes`. |\n| `POST /games/:slug/versions` | Make the version from the same list, plus `patch_notes` (up to 2,000 characters) and optionally `"publish_when_approved": true`, which needs `version_access` `publish` (an upload key gets `key_not_allowed`), with `match_update_mode` for when it goes live (below; only with `publish_when_approved`, else `bad_match_update_mode`) and `is_big_update` to mark it a big update (the same: else `bad_is_big_update`). |\n| `GET /games/:slug/versions/:id` | The `version`: `id`, `file_count`, `size_bytes`, `scan_status` (`scanning`, `held`, `approved` or `rejected`), `ai_review_status`, `ai_review_speed`, `ai_review_requested_at`, `ai_review_finished_at`, `ai_review_waiting_reason`, `usual_ai_review_duration_min`, `ai_review_step`, `ai_review_step_started_at`, `ai_review_waiting_ahead_count`, `daily_review_free_at`, `is_ai_review_needed_to_publish`, `is_open_before_ai_review`, `publish_after_ai_review_enabled` (see The AI review), `has_threads` (the build needs threads, so it runs only in Chrome and Edge, and the game page tells other browsers\' players), `is_live`, `patch_notes`, `preview_url` and `preview_url_expires_at` once it passes, `published_at`, `first_published_at` (a rollback doesn\'t move it), `is_big_update`, `scheduled_publish_at`, `match_update_mode` (how running matches get it when it goes live by itself), `created_at`, `review_reason` (a person rejected it, or a report paused it), `findings`: what the scan found that holds or rejects it (`code`, `severity`, `message`, `content_rule`, `path`, `fix`, `message_for_people`; see Holds and takedowns), and `replaced_by_version_id`: the newer version that replaced it while it waited, or `null`, and `performance_check`: how it started in Chrome (see How it started in Chrome, below). |\n| `PATCH /games/:slug/versions/:id` | `update_version`: `patch_notes` (up to 2,000 characters, lines kept) and `is_big_update` on a version that has never been live, kept for when it goes live, now or scheduled. Answers the `version`. A version that has been live keeps its own (`bad_patch_notes`); a big update needs notes (`big_update_needs_patch_notes`). |\n| `POST /games/:slug/versions/:version_id/ai-review` | Start its AI review without publishing it (see The AI review). Needs `version_access` `publish`. Asked again, it answers where the review stands. |\n| `POST /games/:slug/versions/:id/publish` | Publish a draft that passed, or roll back to an older version. With `{"scheduled_publish_at": "2026-11-01T17:00:00Z"}` (an ISO time; numbers are refused) it publishes later instead (a few minutes to 90 days ahead; checked every 5 minutes). A version still being scanned goes live at that time if it has passed by then. `match_update_mode` says when running matches get it: `"next_match"` (the default: they finish on the version they started, and new matches get it) or `"now"` (every live match switches within seconds, in the same room; see [Updates](#updates)); a scheduled publish keeps the choice, and the version\'s `match_update_mode` shows it. A publish is a quiet patch: its notes show in the game page\'s Updates and nothing else changes. `"is_big_update": true` marks a big update, now or scheduled, with `patch_notes` saying what\'s new (given here in place of the version\'s, or `big_update_needs_patch_notes` with none): it sets `big_update_at`, which shows the Updated tag to players who\'ve played before it and the Updated fact on the game page, and moves `recently_updated_at` at most once every 30 days, counting from the first release. Only a version going live for the first time on a released game counts: a first release is a release, a rollback or republish never counts, and a version that has been live keeps its notes and can\'t be marked (`big_update_already_live`). Answers with the `game` and the `version`. |\n| `DELETE /games/:slug/versions/:id/publish` | Cancel a publish-later, and its big update mark. Answers with the `game` and the `version`. |\n| `DELETE /games/:slug/versions/:id/preview-links` | Turn off every preview link handed out so far for this version, and every browser that opened one. The next `preview_url` works again. Answers with the `version`. |\n\n- Same rules as zips: `index.html` at the top, no hidden files, no pre-compressed `.gz` or `.br` files, only the file types games use. Up to 20,000 files per version and 500 MB per file, at any size per game: see Storage for what an account can keep. Up to 100 versions per game a day.\n- Each version is scanned. Image matching also checks the pictures stored inside engine packs (Godot `.pck`, `.glb`, `.data`, `.dat`, `.bin`, `.wasm`); one it can\'t read, like a GPU texture, isn\'t held for it. An update sends only new pictures and videos through image matching (one checked in the last 30 days isn\'t sent again), so it\'s checked in seconds however big the game is.\n- A version most of whose files another developer sent first (leaving out engines, libraries and asset packs many developers share) is held with `matches_another_developers_game` until a person looks, usually within a day; your own games never count. If it\'s your game on another account, or you have permission, say so with `message_zaisma`. When a person finds it\'s a re-upload, the original developer hears, with your username.\n- One that passes waits as a draft with a private preview link for you and your AI, `https://zaisma.com/p/<secret>`, that works even while the game is a draft or private. Every call answers a fresh one, each working for a day (`preview_url_expires_at`); to show a version to anyone else, make a tester link. It opens the version inside the real game page, details first, then Play with the Zaisma overlay, as players will meet it; `https://zaisma.com/p/<secret>/game` opens the bare game alone, for quick test loops. Either way it plays at the game\'s fixed preview address, `https://<slug>--preview.zaismausercontent.com/`, so a game address never holds a key, and preview saves stay in that address\'s own browser storage, from one build to the next.\n- A version can use only files you sent yourself: a file another developer sent counts as missing for you until you send it once too (storage still keeps one copy), so a file\'s hash neither gets someone else\'s file nor says whether Zaisma has it.\n- Publishing makes it the version players get. We keep the live version plus the last 5 that passed, for rolling back.\n- Drafts nobody publishes are deleted after 30 days, and files no version uses after a day. Held and rejected versions are kept.\n- Publishing doesn\'t change visibility: a draft game stays hidden until you set it to `listed` or `unlisted`.\n\n### How it started in Chrome\n\nA minute after a version passes the scan, Zaisma has opened it in headless Chrome through its own preview link and says how it started, and what would make it much smaller, as the version\'s `performance_check` (in `get_version`, `get_game`, the upload command and the dashboard). They\'re notes: they never hold a version, and there\'s no score. Chrome there runs on a computer with no graphics card, so loading, memory and errors are like a player\'s, and frame rate isn\'t measured.\n\n| Field | What it holds |\n| --- | --- |\n| `check_status` | `waiting` (it passed and waits for Chrome, usually under a minute), `checking`, `checked`, `over_daily_limit` (not measured: your 20 runs today (60 with Zaisma Pro) are used; versions are measured again from midnight UTC) or `could_not_run` (Chrome couldn\'t run it on Zaisma\'s side; nothing for you to fix). |\n| `checked_at` | When the run finished, or `null`. |\n| `browser_description` | Where it ran, like `Chrome 141 on a computer with no graphics card`. |\n| `loading_duration_sec` | Seconds from opening the game until it drew its first frame (the first draw on a canvas the page shows: WebGL, WebGL 2, 2D or WebGPU); `null` when nothing was drawn. A game that hasn\'t drawn after 10 seconds, with nothing downloading, gets one click, since many wait for one. |\n| `start_download_size_bytes`, `start_file_count` | What was downloaded before the first frame, as sent (compressed), and how many files. |\n| `start_memory_size_bytes` | JavaScript and WebAssembly memory 5 seconds after the first frame; graphics memory isn\'t counted. |\n| `longest_start_task_duration_ms` | The longest the page froze in one go while starting. |\n| `notes` | Each `{ code, message, path, saved_size_bytes, fix }`: `saved_size_bytes` is about how much smaller the download gets with the fix, `null` when it isn\'t about size or can\'t be told. Run notes first, then asset notes; `[]` when there\'s nothing to say. |\n\n`performance_check` is `null` for versions from before it ran. Every version is measured, free, up to 20 runs a day per developer (60 with Zaisma Pro); past that a version just isn\'t, and nothing waits. There\'s no call to run it again: the next upload is measured.\n\n| Code | Meaning |\n| --- | --- |\n| `error_at_start` | The game threw an error while starting (up to 5, with the file and line). |\n| `missing_file_at_start` | The game asked for a file that isn\'t in the version while starting. |\n| `blocked_at_start` | An address the game loaded or connected to was blocked while starting. |\n| `no_frame_drawn` | Nothing was drawn in 120 seconds, even after a click. A game that waits for something only a player does is fine. |\n| `big_download_at_start` | Players download 200 MB or more before the first frame. |\n| `long_freeze_at_start` | The page froze for 2 seconds or more in one go while starting. |\n| `images_could_be_ktx2` | A WebGL or WebGPU game\'s PNG, JPEG and WebP textures of 1 MB or more, 16 MB or more in all, would be about 8 MB or more smaller as KTX2 (Basis Universal ETC1S, about 2 bits a pixel with mipmaps), and take about a quarter of the graphics memory. |\n| `audio_could_be_opus` | 8 MB or more of WAV and AIFF audio, which would be much smaller compressed (estimated as Ogg Opus at 96 kbps). |\n| `models_could_be_smaller` | 8 MB or more of glTF models with no mesh compression (meshopt or Draco). |\n| `development_build` | An engine\'s development or debug build, bigger and slower for players: Godot exported with Export With Debug. |\n\n### Checking a game\n\nBefore uploading, the check says everything in a game that Zaisma would refuse, or that won\'t work inside Zaisma\'s game frame, each with how to fix it. It\'s the same check everywhere (`packages/cli/check.mjs`): `zaisma check <folder>` on a folder, with no key and nothing sent; the MCP\'s `check_game` with the same files as `upload_files`; and this call. `zaisma upload` runs it first.\n\n| Call | What it does |\n| --- | --- |\n| `POST /check` | Send `{"files": [{"path", "size_bytes", "content_text"}], "slug"}`: every file\'s path and size, with `content_text` for each `.html`, `.htm`, `.js`, `.mjs` and `.css` file and only for those (up to 8 MB in all). `slug` is optional: with a game you have, its own servers count as addresses the code may connect to, and the fixes name it. Answers `file_count`, `size_bytes`, `problems` (in file order, up to 200), `omitted_problem_count` and `performance_notes`. Any key, read included; it changes nothing. |\n\nEach problem is `{ code, problem_kind, is_fixed_by_upload_command, message, path, quote, fix }`: `problem_kind` is `refused` (Zaisma refuses the upload as it is) or `broken` (it uploads, but that part won\'t work on Zaisma); `is_fixed_by_upload_command` says `zaisma upload` fixes it itself, in what it sends (`upload_files` and the API send files as they are); `quote` is the text it\'s about, up to 120 characters, to search the file for. The file-list codes are the API\'s own error codes.\n\n| Code | Kind | Upload fixes | Meaning |\n| --- | --- | --- | --- |\n| `no_index_html` | refused | no | There\'s no index.html at the top. |\n| `file_type_not_allowed` | refused | no | A file is of a type games can\'t have. |\n| `precompressed_file` | refused | yes | A file is pre-compressed (.gz, .br or Unity\'s .unityweb); the upload command unpacks it. |\n| `hidden_file` | refused | yes | A file or folder\'s name starts with a dot; the upload command leaves it out. |\n| `duplicate_path` | refused | no | Two files share a path (paths don\'t depend on case). |\n| `bad_path` | refused | no | A path is absolute, has . or .. or an empty part in it, has control characters or is over 200 characters. |\n| `file_too_big` | refused | no | A file is over 500 MB. |\n| `too_many_files` | refused | no | The game has more than 20,000 files. |\n| `outside_file` | broken | yes | The page, a stylesheet or a module loads a file from another site; the upload command downloads it into the game. |\n| `outside_address` | broken | no | The code connects to or loads from another site while it runs. |\n| `address_not_allowed` | broken | no | The code connects to an address no game can use: plain ws:// or http://, localhost, or an IP address. |\n| `needs_threads` | broken | no | The build needs threads (SharedArrayBuffer), which games on Zaisma have only in Chrome and Edge. |\n| `browser_dialog` | broken | no | alert, confirm or prompt, which never show in the game\'s frame. |\n| `form_submission` | broken | no | A form, which never submits in the game\'s frame. |\n| `file_download` | broken | no | A file download, which the game\'s frame doesn\'t allow. |\n| `outside_link` | broken | no | A link that opens another site or a new window, which the game\'s frame doesn\'t allow. |\n| `outside_frame` | broken | no | A frame of another site, which games can\'t show. |\n| `blocked_feature` | broken | no | Camera, microphone, screen capture, location, payments, USB, serial, Bluetooth or HID, which games on Zaisma can\'t use. |\n\n`performance_notes` are the asset notes of How it started in Chrome (`images_could_be_ktx2`, `audio_could_be_opus`, `models_could_be_smaller`, `development_build`), each `{ code, message, path, saved_size_bytes, fix }`. They never stop an upload, and `zaisma check` prints them under "Could be smaller" without changing its exit code. Image sizes, sound lengths and models are read from the files\' first bytes, so the API, which gets only sizes for them, gives only `development_build`; `zaisma check` gives them all.\n\n- **Threaded engine builds** (Godot with Thread Support, Unity with Native C/C++ Multithreading, Rust built with `atomics`) need cross-origin isolation, which every game gets in its own frame in Chrome and Edge on computers and Android, so they run there. Firefox, Safari and every browser on iPhone and iPad can\'t start them, and the game page tells their players "This game needs Chrome or Edge on a computer or Android." with Play anyway. To reach every browser, export without threads, the default in Godot 4.3 and newer and in Unity. A version\'s `has_threads` says whether its build needs them.\n- **Outside addresses** found while the code runs can be a file or the game\'s own server, so the check doesn\'t guess: a server goes in `own_server_urls` (`zaisma own-servers`, or `update_game`), a file in the game. The check never adds a server by itself.\n- What a game\'s code is checked for skips engine and library output (Unity\'s `.framework.js` and `.loader.js`, a `.js` beside a `.wasm` of the same name or its `_bg.wasm` (wasm-bindgen and Trunk), macroquad\'s `mq_js_bundle.js`, `*.min.js`), which mentions dialogs or cameras without the game using them, and comments, which say what code could do rather than what it does. A dialog shown only when the game fails to load, like the one in Unity\'s page template, isn\'t a problem: the game itself works.\n- **Engine exports run unchanged:** a web export from Godot, Unity, Phaser, Three.js, Bevy and macroquad goes through the check, the upload command, the scan and its game page on every change to Zaisma, so engine builds keep working.\n\n### Big files\n\nFiles over 95 MB are sent in parts, 50 MB each (the last can be smaller):\n\n1. `POST /files/:sha256/parts` with `{"size_bytes"}` answers `{"sha256", "storage_status", "upload_id", "part_size_bytes", "part_count"}` (`storage_status` is `upload_started`, or `already_stored` with the rest `null`).\n2. `PUT /files/:sha256/parts/:n?upload_id=\u2026` for each part, numbered from 1. Each answers `{"part_number", "etag"}`.\n3. `POST /files/:sha256/parts/done` with `{"upload_id", "parts": [{"part_number", "etag"}]}`.\n\nStorage can\'t check the hash of a file sent in parts, so it\'s kept for your own games only: another developer with the same file sends their own copy. The scan reads it like any other file.\n\nZaisma sends every file that shrinks compressed with Brotli, Unity\'s and Godot\'s data files included, from a cache near players, and each file\'s ETag is its SHA-256, so a returning player downloads only what changed. Your game\'s pages open at their version\'s own address, `/_zaisma/versions/<version_id>/`, so the files they load by a relative path are kept by the player\'s browser for good and a returning player\'s game starts without asking about them; a file named by its full path (`/Build/game.data`) still works and is checked on each visit. After an update, a file whose contents didn\'t change isn\'t downloaded again: at its version\'s address it redirects to `/_zaisma/content/<sha256>/<path>`, the same address in every version that has that file at that path, so the player\'s first start of the new version costs one small request per file and later starts cost none. The redirect holds no file, and the content address opens only for whoever may open a version of your game that has it: it stops with the game, and a fingerprint gets nothing from another game. Pages, `.js`, `.mjs`, `.cjs`, `.css`, `.svg`, `.xml`, `.xsl`, `.webmanifest`, `.m3u8` and `.mpd` files stay at their version\'s address, since a browser resolves the relative paths inside them against their own address; so these download again with each update, changed or not, and a file you move or rename counts as a new file. Safari only uses a file it has from a redirect it already kept, so the game\'s zaisma.com page keeps a version\'s first 5,000 redirects there ahead of time; a Safari player who opens the game without that page (a direct `?play` link, a tester link, an accounts-only game) downloads its files again on the first start of a new version. Read the room code and other settings from the query (`location.search`), which is kept, not from the path. Upload files uncompressed (the upload command unpacks compressed exports itself); what you uploaded is what players\' browsers end up with, what the scan reads and what export gives back.\n\nThe files a version needed before its first frame in its run in Chrome are preloaded with its page (up to 20, besides the ones the page names itself), so an engine\'s loader doesn\'t fetch them one after another. And on its zaisma.com page they start downloading before Play, up to 100 MB, on computers and on Android phones and tablets on Wi-Fi; never on other phones and tablets, with Data Saver, or for tester links and accounts-only games. An iPad downloads none of them ahead of time.\n\n## The upload command\n\n`zaisma` ([`@zaisma/cli`](https://www.npmjs.com/package/@zaisma/cli), source `packages/cli/zaisma.mjs`) runs these calls from a terminal or CI: `npx @zaisma/cli <command>`, with `ZAISMA_KEY` set to an API key. `zaisma help` lists every command; `zaisma help --json` gives the same as JSON: each command\'s arguments and flags (with `has_value`, `is_required` and `choices`), a shader\'s folder (`shader_folder`), the exit codes and the error codes below. Each release is published from GitHub\'s main by `.github/workflows/publish-cli.yml` with npm provenance, so npm shows the commit that built it.\n\n| Command | What it does | Call |\n| --- | --- | --- |\n| `zaisma games` | Your games | `GET /games` |\n| `zaisma new <title> [--slug <slug>]` | Make a game (a draft) | `POST /games` |\n| `zaisma check <folder> [--game <slug>] [--screen wide\\|phone] [--draw-on-zaisma]` | Check a game\'s folder before uploading, with no key and nothing sent (with `--game` and a key, its own servers count); or draw a shader\'s folder as the shader check does, in Chrome on this computer, or on Zaisma when there\'s none | Checking a game, above; `POST /games/:slug/shader-checks` |\n| `zaisma play-locally [folder] [--port <port>] [--game <slug>] [--on-network] [--no-open]` | Play the game on this computer with its game server and a test bench: each player on Zaisma\'s own game page, blocking and buying through it (Zaisma\'s buy sheet with a test card that\'s never charged), players made on this computer with an age band and social mode, their friends, blocks, items and refunds set in their details, and a dev bar to add or switch players; with no key and nothing sent, it runs `npx @zaisma/game-server@1 play-locally` | none |\n| `zaisma upload <folder> --game <slug> [--patch-notes "\u2026"] [--publish-when-approved [--after-review] [--match-update-mode next_match\\|now] [--big-update]]` | Check, fix what it can, upload a version, sending only new files, and wait for its scan | Uploading versions, above |\n| `zaisma shader <folder> --game <slug> --screen wide\\|phone` | Send a shader\'s folder: each texture as an image of kind `shader_texture` (one the game has already, byte for byte, is used again), waited for until approved, then the shader | `POST /games/:slug/images?kind=shader_texture`, `POST /games/:slug/shaders` |\n| `zaisma versions <slug>` | The game and its versions, with preview links | `GET /games/:slug` |\n| `zaisma ai-review <slug> <version_id>` | Start a version\'s AI review without publishing it | `POST /games/:slug/versions/:version_id/ai-review` |\n| `zaisma publish <slug> <version_id> [--after-review] [--scheduled-publish-at <time>] [--match-update-mode next_match\\|now] [--big-update] [--patch-notes "\u2026"]` | Publish, roll back, or publish later | `POST /games/:slug/versions/:id/publish` |\n| `zaisma unschedule <slug> <version_id>` | Cancel a publish-later | `DELETE /games/:slug/versions/:id/publish` |\n| `zaisma visibility <slug> listed\\|unlisted\\|private\\|draft` | Who can see the game | `PATCH /games/:slug` |\n| `zaisma allowed-hosts <slug> [<host> \u2026] [--none]` | The hosts the game server can call; given hosts (or `--none`), sets the whole list | `GET` or `PATCH /games/:slug` |\n| `zaisma own-servers <slug> [<url> \u2026] [--none]` | The servers the game connects to from players\' browsers; given addresses (or `--none`), sets the whole list | `GET` or `PATCH /games/:slug` |\n| `zaisma links <slug>` | The game\'s registered links, with who each opens for | `GET /games/:slug` |\n| `zaisma links set <slug> <link_name> <destination_url> [--on-game-page]` | Add a link, or change the one with that name | `PATCH /games/:slug` with the whole `links` list |\n| `zaisma links remove <slug> <link_name>` | Remove a link | `PATCH /games/:slug` with the whole `links` list |\n| `zaisma secrets <slug>` | The game\'s secrets\' names and when each was set | `GET /games/:slug/secrets` |\n| `zaisma secrets set <slug> <secret_name>` | Set a secret: the value piped in, or typed without showing in a terminal | `PUT /games/:slug/secrets/:secret_name` |\n| `zaisma secrets delete <slug> <secret_name>` | Delete a secret | `DELETE /games/:slug/secrets/:secret_name` |\n| `zaisma items <slug>` | The game\'s items, each one\'s kind, category and price, and its refund policy | `GET /games/:slug/items` |\n| `zaisma items set <slug> [file]` | Make the game\'s items match a JSON file of the whole list (or piped in), kept beside the game: one set per added or changed item, one remove per item gone; `--json` prints the items answer plus `set_item_names` and `removed_item_names`; when players own an item the file leaves out, it keeps those, makes every other change, and stops with `item_has_owners` | `PUT` and `DELETE /games/:slug/items/:item_name` |\n| `zaisma items remove <slug> <item_name>` | Remove an item nobody owns | `DELETE /games/:slug/items/:item_name` |\n| `zaisma kept-rooms <slug>` | The game\'s kept rooms, each one\'s size and when it was last played, and the game\'s storage | `GET /games/:slug/kept-rooms` |\n| `zaisma kept-rooms delete <slug> <room_code>` | Delete a kept room\'s world; it waits a week before it\'s erased | `DELETE /games/:slug/kept-rooms/:room_code` |\n| `zaisma kept-rooms bring-back <slug> <room_code>` | Bring back a deleted world: as it was during its week, then from its last copy for about 28 days | `POST /games/:slug/kept-rooms/:room_code/bring-back` |\n| `zaisma kept-rooms restores <slug> <room_code>` | How far back a world can go, and its restores | `GET /games/:slug/kept-rooms/:room_code/restores` |\n| `zaisma kept-rooms restore <slug> <room_code> <restore_to_at>` | Put a world back as it was at a moment in the last 30 days | `POST /games/:slug/kept-rooms/:room_code/restores` |\n| `zaisma kept-rooms undo-restore <slug> <room_code> <kept_room_restore_id>` | Undo a world\'s restore | `POST /games/:slug/kept-rooms/:room_code/restores/:kept_room_restore_id/undo` |\n| `zaisma kept-rooms restore-all <slug> <restore_to_at>` | Put every world back as it was at a moment | `POST /games/:slug/kept-room-restores` |\n| `zaisma kept-rooms restore-all-status <slug> <kept_room_restore_batch_id>` | How that\'s going | `GET /games/:slug/kept-room-restores/:kept_room_restore_batch_id` |\n| `zaisma kept-rooms undo-restore-all <slug> <kept_room_restore_batch_id>` | Undo it | `POST /games/:slug/kept-room-restores/:kept_room_restore_batch_id/undo` |\n| `zaisma kept-rooms erase-now <slug> <room_code>` | Erase a waiting world at once, with the developer\'s passkey tap | `POST /games/:slug/kept-rooms/:room_code/erase-now` |\n| `zaisma rooms <slug>` | The game\'s live rooms on Zaisma, newest first: each one\'s code, name, players, spectators and labels, and whether it\'s kept | `GET /games/:slug/rooms` |\n| `zaisma logs <slug> [--follow] [--room-code <code>] [--minimum-level debug\\|info\\|warn\\|error] [--source-kind room\\|request\\|schedule\\|webhook] [--search-text "\u2026"] [--maximum-line-count <count>] [--cursor <next_cursor>]` | What the game server printed, oldest first; `--follow` keeps printing new lines every 2 seconds (with `--json`, one answer per line) | `GET /games/:slug/logs` |\n| `zaisma forum [<topic_id>] [--search "words"]` | Your topics and messages, one topic, or a search | `GET /forum`, `GET /forum/:id` |\n| `zaisma forum post --kind \u2026 --title "\u2026" --category \u2026 [--text "\u2026"] [--by-me]` | A public topic | `POST /forum` |\n| `zaisma forum message --kind \u2026 --title "\u2026" [--text "\u2026"] [--category \u2026] [--game <slug>] [--by-me]` | A private message to Zaisma | `POST /forum` with `"is_public": false` |\n| `zaisma forum reply <topic_id> [--text "\u2026"] [--reopen] [--by-me]` | A reply | `POST /forum/:id/posts` |\n| `zaisma database <slug>` | The game database\'s tables, indexes and use this month | `GET /games/:slug/database` |\n| `zaisma database query <slug> ["<sql>"] [--values \'[\u2026]\']` | Run one statement; the SQL in quotes or piped in, the values as a JSON list | `POST /games/:slug/database/query` |\n| `zaisma database batch <slug> [<file>]` | Run statements in one transaction, from a JSON file (or piped in) like `[{"sql": "\u2026", "values": [\u2026]}]` | `POST /games/:slug/database/batch` |\n| `zaisma database export <slug> [<file>]` | Save the whole database: as a SQL dump (a `.sql` file, or printed when there\'s no file) or a ready SQLite file (`.sqlite`, `.sqlite3` or `.db`) | `GET /games/:slug/database/export`, every part |\n| `zaisma database import <slug> [<file>]` | Add a SQL dump (a `.sql` file, or piped in) or a `.sqlite` file, in parts of up to 4 MB cut at whole statements | `POST /games/:slug/database/import`, a part at a time |\n| `zaisma database restore <slug> <restore_to_at>` | Put the database back as it was at a moment in the last 30 days, and print the command that undoes it | `POST /games/:slug/database/restores` |\n| `zaisma database undo-restore <slug> <database_restore_id>` | Undo a restore: back to just before it | `POST /games/:slug/database/restores/:database_restore_id/undo` |\n| `zaisma saves <slug> [--cursor <next_cursor>]` | The players with a save, 100 a page | `GET /games/:slug/saves` |\n| `zaisma saves get <slug> <player_id> [--keys \'[\u2026]\']` | One save; `--keys` a JSON list of localStorage keys | `GET /games/:slug/saves/:player_id` |\n| `zaisma saves change <slug> <player_id> [\'<items_json>\']` | Change some keys: a JSON object like `{"coins": "500", "tutorial_seen": null}`, as an argument or piped in | `PATCH /games/:slug/saves/:player_id` |\n| `zaisma saves replace <slug> <player_id> [<file>]` | Replace the whole save from a JSON file (or piped in): `local_storage_items` and `indexeddb_databases`, or what `saves get --json` printed | `PUT /games/:slug/saves/:player_id` |\n| `zaisma saves reset <slug> <player_id>` | Reset a save | `DELETE /games/:slug/saves/:player_id` |\n| `zaisma saves copies <slug> <player_id>` | A save\'s earlier versions | `GET /games/:slug/saves/:player_id/copies` |\n| `zaisma saves copy <slug> <player_id> <save_copy_id> [--keys \'[\u2026]\']` | One earlier version | `GET /games/:slug/saves/:player_id/copies/:id` |\n| `zaisma saves restore <slug> <player_id> <save_copy_id>` | Make an earlier version the save again | `POST /games/:slug/saves/:player_id/copies/:id/restore` |\n| `zaisma export <slug> [--folder <folder>]` | Save everything about the game in a folder (`./<slug>-export` unless `--folder` says), with the database also as a ready `database.sqlite` | `GET /games/:slug/export/download` |\n| `zaisma skill [--folder <folder>] [--project] [--yes]` | Install the Zaisma skill into the AI tools on this computer, or update the copies it installed (see Teaching your AI) | none, it writes files on this computer |\n\n- **Closed, like the API.** A command takes only its own flags and arguments: anything else is refused before anything is sent, with the flags it does take. Choices (`visibility`, `--screen`, `--kind`, `--category`, `--match-update-mode`) are checked first too, with the valid list. A flag that takes a value takes it as `--flag value` or `--flag=value`. Renamed commands and flags say their new name (`zaisma show` is now `zaisma visibility`; `--notes`, `--publish` and `--at` are `--patch-notes`, `--publish-when-approved` and `--scheduled-publish-at`).\n- **`--json` on every command** prints the API\'s answer as-is, compact, and nothing else on stdout: the same data the MCP gets. On failure it prints the API\'s `{ "error": { code, message, field, fix, message_for_people, retry_after_sec, help_url } }`, or the same shape without `message_for_people` for the command\'s own errors (below), where `field` is the flag (`--game`) or argument (`slug`) at fault. `upload --json` prints the version\'s last answer (`GET /games/:slug/versions/:id`) and sends its progress to stderr; `forum --json` with no topic or search prints both tabs\' answers, as `{ "yours": \u2026, "messages": \u2026 }`. Without `--json`, the command prints lines for people, and errors go to stderr as `zaisma: <message> <fix> (<code>)`.\n- **`upload` fixes two things itself, in what it sends, never in your folder:** files the page, its stylesheets and its modules load from other sites (scripts, styles, fonts, images, import maps and what they import) are downloaded into `zaisma-outside/<site>/<path>` and the game is pointed at them, so they\'re scanned and served like the rest; pre-compressed files (`.gz`, `.br`, `.unityweb`) are unpacked and the game is pointed at the unpacked names. It works in a temporary folder and prints what it changed (on stderr with `--json`). Before sending, it runs the check: a problem Zaisma would refuse that it doesn\'t fix stops it with that problem\'s code, and ones that won\'t work on Zaisma are printed and it goes on. A download that fails stops it with `outside_file_unreachable`, before anything is sent. Addresses the code connects to while it runs are never downloaded.\n- **`check` ends with exit code 6** when something won\'t work and `upload` doesn\'t fix it, and 0 otherwise; `--json` prints the check\'s answer.\n- **A shader\'s folder** is what `shader` sends and `check` draws (a folder with `image.glsl` is a shader\'s; any other is a game\'s). It holds `image.glsl` (the image pass, Shadertoy\'s `mainImage`), `buffer-a.glsl` to `buffer-d.glsl` if it has buffers, `channels.json` if a pass reads a channel, and the PNG, JPEG or WebP textures `channels.json` names (up to 4, each up to 8 MB). `channels.json` is an object of passes (`image`, `buffer-a` to `buffer-d`), each a list of up to 4 channels shaped as the API\'s (Backgrounds, above), with a texture named by its file in the folder, `texture_file`, instead of an `image_id`: `{ "image": [{ "channel_index": 0, "input_kind": "buffer", "buffer_name": "a" }, { "channel_index": 1, "input_kind": "texture", "texture_file": "noise.png", "filter": "linear", "wrap": "repeat" }], "buffer-a": [{ "channel_index": 0, "input_kind": "buffer", "buffer_name": "a" }] }`. `filter` and `wrap` take the API\'s values and defaults. The folder is closed like the command line: a missing `image.glsl` (`no_image_pass`), any other file or a texture no channel names (`unknown_shader_file`), `channels.json` that isn\'t an object of the folder\'s passes (`bad_channels_file`), a field it doesn\'t take (`unknown_field`, saying `texture_file` when it\'s an `image_id`) or a channel that reads what the folder hasn\'t got (`bad_shader_channel`) is refused before anything is sent or drawn, with the file and place as `field` (like `channels.json: image[1].texture_file`); hidden files are left out. `zaisma help` shows the folder, and `help --json` gives it as `shader_folder`.\n- **`shader`** sends each texture first, using an approved `shader_texture` the game has with the same bytes instead of sending it again, and waits about a minute for one image matching couldn\'t check (then `shader_texture_not_approved`; run it again once it\'s approved), then sends the shader, which is checked in a minute or two. `--json` prints `{ "texture_images": [{ "texture_file", "image_id", "added_image" }], "added_shader" }`: each `added_image` is the image\'s answer as-is (`null` for a texture used again), and `added_shader` the shader\'s.\n- **`check` on a shader\'s folder** draws it with the shader check\'s own page and numbers (`packages/cli/shader-check.mjs`, shared with Zaisma\'s check), in headless Chrome on this computer in software, as the check draws it: `CHROME_PATH`, the system\'s Chrome, or one Playwright or `@puppeteer/browsers` downloaded (it never downloads one; Node 22 or newer, `needs_newer_node`). `--screen` picks wide (the default) or phone. With no Chrome, it\'s a check before sending on Zaisma, which needs `--game` and `ZAISMA_KEY` (`no_chrome` otherwise) and sends the textures as `shader` does; a Chrome that can\'t draw it (`local_chrome_failed`) hands it to Zaisma the same way when `--game` and a key are there, and `--draw-on-zaisma` draws it on Zaisma even with a Chrome here. It prints the compiler\'s first error, each quality level\'s time against its most, flashes, the glass Zaisma would put over it and the notes, and saves the sheet beside the folder as `<folder>-<screen>-check.png`. It ends with exit code 6 when the shader doesn\'t compile, is too slow at a level or flashes; notes never change it. `--json` prints `{ "renderer_kind", "shader_check", "remaining_shader_check_count", "sheet_file", "texture_images" }`: `renderer_kind` `local_chrome` or `zaisma`, `shader_check` the API\'s shape (its `sheet_url` `null` when drawn here), `remaining_shader_check_count` `null` when drawn here, and `sheet_file` the saved sheet\'s path.\n- **`--scheduled-publish-at`** takes the API\'s times: ISO 8601 with `Z` or an offset (`2026-11-01T17:00:00Z`, `2026-11-01T17:00+01:00`), nothing else. A time without a zone, like `2026-11-01 17:00`, is refused with the same time and this computer\'s offset written out, so a script on a server in another time zone never publishes at the wrong hour.\n- `--text` can be piped in instead; `--by-me` marks a post as yours, otherwise it says your AI wrote it.\n- `database query` prints the rows as a table (blobs as their size), then the rows read and written; `--values` and a batch\'s file are checked to be JSON lists before anything is sent (`bad_values`, `bad_sql`).\n- `database export` won\'t write over a file that\'s there (`file_exists`), and writes the file only once every part has come. A `.sqlite` file is the same database, ready for the Node runner (`--database-file game.sqlite`); `--json` prints `{ "dump_sql", "file", "part_count", "read_row_count" }`, with `dump_sql` `null` when it went to a file. `database import` reads a `.sqlite` file into the same SQL export writes; when a part fails, the error says which parts went in, and `--json` prints the parts\' answers added up (`part_count`, `statement_count`, `skipped_statement_count`, `read_row_count`, `written_row_count`). `.sqlite` files need Node 22.13 or newer (`needs_newer_node`); `.sql` works on any.\n- `export` downloads the whole .zip first, then unpacks it, so a cut connection leaves nothing half-saved; it saves only into a new or empty folder (`folder_not_empty`). `database.sqlite` needs Node 22.13 or newer and a dump under 400 MB; otherwise it prints the `sqlite3` line that makes it. `--json` prints `{ "folder", "file_count", "size_bytes", "database_file" }`, with `database_file` `null` when there\'s no `database.sqlite`.\n- `saves get` prints each key and its text; `--keys`, `saves change`\'s object and `saves replace`\'s file are checked to be JSON before anything is sent (`bad_keys`, `bad_local_storage_items`). After a change it prints the `saves restore` command that undoes it.\n\nExit codes, the same for every command:\n\n| Exit code | Name | Means |\n| --- | --- | --- |\n| 0 | `done` | Done. For upload: the version passed the scan. |\n| 1 | `failed` | It didn\'t work: Zaisma refused the call or couldn\'t be reached. The error says why and what to do. |\n| 2 | `wrong_command` | The command line is wrong (an unknown command, flag or choice, or a missing argument), so nothing was sent. |\n| 3 | `held` | upload: the version is held for a person at Zaisma to look at, usually within a day. |\n| 4 | `rejected` | upload: the version was rejected. Its review_reason and findings say why and how to fix it. |\n| 5 | `still_scanning` | upload: the version was still being scanned after 10 minutes. Check it later with zaisma versions <slug>. |\n| 6 | `problems_found` | check: something in the game won\'t work on Zaisma as it is, and the upload command doesn\'t fix it; or the shader doesn\'t compile, is too slow or flashes. The problems say what and how to fix it. |\n\nErrors only the command answers with, beside the API\'s own codes (it also uses `unknown_field`, `missing_field`, `no_key`, `internal_error` and the `bad_<field>` codes of the choices it checks):\n\n| Code | Means |\n| --- | --- |\n| `unknown_command` | There\'s no command by that name. |\n| `renamed_command` | The command has a new name; the error names it. |\n| `renamed_field` | The flag has a new name; the error names it. |\n| `repeated_field` | A flag was given twice. |\n| `missing_value` | A flag that takes a value was given none. |\n| `takes_no_value` | A flag that takes no value was given one. |\n| `conflicting_flags` | Two flags that don\'t go together were given, like logs --follow and --cursor. |\n| `not_a_folder` | The folder to check or upload isn\'t a folder. |\n| `not_a_file` | The file given (of statements, a dump to import, or a save) can\'t be read. |\n| `file_exists` | database export won\'t write over a file that\'s already there. |\n| `folder_not_empty` | export saves only into a new or empty folder. |\n| `needs_newer_node` | Reading or writing a .sqlite file needs Node 22.13 or newer, and drawing a shader in a local Chrome Node 22. |\n| `not_a_database` | The .sqlite file to import isn\'t a SQLite database. |\n| `unknown_link` | links remove: the game has no link by that name. |\n| `outside_file_unreachable` | upload: a file the game loads from an outside site couldn\'t be downloaded, so nothing was sent. |\n| `too_many_outside_files` | upload: the game loads more than 500 files from outside sites, so nothing was sent. |\n| `unpack_failed` | upload: a pre-compressed file couldn\'t be unpacked, so nothing was sent. |\n| `no_image_pass` | shader: the folder has no image.glsl, the shader\'s image pass. |\n| `unknown_shader_file` | A file in a shader\'s folder isn\'t one the command reads, or no channel in channels.json names it. |\n| `bad_channels_file` | A shader\'s channels.json isn\'t JSON, or isn\'t an object of the folder\'s passes, each a list of channels. |\n| `shader_texture_not_approved` | shader, check: a texture sent for the shader was rejected, or still waits for a person, so the shader wasn\'t sent. |\n| `no_chrome` | check: there\'s no Chrome on this computer to draw the shader in, and no --game with ZAISMA_KEY to draw it on Zaisma. |\n| `local_chrome_failed` | check: the Chrome on this computer couldn\'t draw the shader. |\n| `game_server_not_run` | play-locally: npx couldn\'t run @zaisma/game-server, which runs the game on this computer. |\n| `server_unreachable` | Zaisma couldn\'t be reached: no connection, or a wrong ZAISMA_API. |\n| `unexpected_answer` | Zaisma answered without JSON, like a page from a network in between. |\n| `skill_not_ours` | skill: a zaisma skill this command didn\'t install is already in that folder, so nothing was written; field names the folder. |\n| `install_not_confirmed` | skill: nothing was installed, since nobody answered the question: give --yes to install without it. |\n'
|
|
60432
60445
|
};
|
|
60433
60446
|
|
|
60434
60447
|
// ../../apps/site/src/mcp-skill.ts
|
|
@@ -60581,7 +60594,7 @@ var details2 = {
|
|
|
60581
60594
|
},
|
|
60582
60595
|
multiplayer_mode: {
|
|
60583
60596
|
enum: ["none", "relay", "own"],
|
|
60584
|
-
description: `Multiplayer on Zaisma rooms. none: single-player or only the game's own servers (own_server_urls). relay: Zaisma passes each message to the others, no server code. own: your game server runs on Zaisma: put it in a zaisma-server/ folder at the top of the upload, where index.js default-exports { setup, onJoin, onLeave, onMessage, onTick, maximumPlayerCount, ticksPerSec } (plus, if it likes, canJoin, answering true, false or { refusalMessage }, onMoved, hostControlsEnabled, and idleCheck, idleTimeoutSec, awayMode, seatHoldDurationSec, reconnectTimeoutSec, onAway and onBack for players who walk away: a player whose connection drops stays in the match as away (room.awayReason(playerId) "lost") for 30 seconds while they reconnect, and idle, hidden or still-disconnected players leave the match with their seat held for 5 minutes unless it decides otherwise; and onEnding(state, room), run once when the game's hosting pauses (its month's free hosting with no budget, its budget, or the developer's credit is used) and Zaisma will end the match at room.endsAt, an hour ahead, to save and tell players, with onEndingCancelled(state, room) if the hosting starts again within that hour and the end is called off (room.endsAt null again); and stateSaveIntervalSec (a real-time room saves its state every 5 seconds by default, 1 to 60) with onRestored(state, restoreInfo, room), run once when the room comes back from a restart with its saved state, restoreInfo.lostDurationSec seconds behind; and stateSyncEnabled, which sends each player the state as a full copy on join and then only what changed, with stateView(state, viewer, room) to cut what each player sees (their game reads room.state or room.smoothedState()); any other option stops it starting, and get_stats says why) and can import the folder's other .js, .json (data) and .wasm (WebAssembly, like a physics engine) files by relative path (plain JavaScript ES modules; npm packages or TypeScript: bundle into zaisma-server/index.js, or one zaisma-server.js). Every other file in the folder is a data file (like prebuilt navigation meshes), read as an ArrayBuffer with room.readDataFile("maps/docks.bin") or server.readDataFile, free to read. Up to 500 files and
|
|
60597
|
+
description: `Multiplayer on Zaisma rooms. none: single-player or only the game's own servers (own_server_urls). relay: Zaisma passes each message to the others, no server code. own: your game server runs on Zaisma: put it in a zaisma-server/ folder at the top of the upload, where index.js default-exports { setup, onJoin, onLeave, onMessage, onTick, maximumPlayerCount, ticksPerSec } (plus, if it likes, canJoin, answering true, false or { refusalMessage }, onMoved, hostControlsEnabled, and idleCheck, idleTimeoutSec, awayMode, seatHoldDurationSec, reconnectTimeoutSec, onAway and onBack for players who walk away: a player whose connection drops stays in the match as away (room.awayReason(playerId) "lost") for 30 seconds while they reconnect, and idle, hidden or still-disconnected players leave the match with their seat held for 5 minutes unless it decides otherwise; and onEnding(state, room), run once when the game's hosting pauses (its month's free hosting with no budget, its budget, or the developer's credit is used) and Zaisma will end the match at room.endsAt, an hour ahead, to save and tell players, with onEndingCancelled(state, room) if the hosting starts again within that hour and the end is called off (room.endsAt null again); and stateSaveIntervalSec (a real-time room saves its state every 5 seconds by default, 1 to 60) with onRestored(state, restoreInfo, room), run once when the room comes back from a restart with its saved state, restoreInfo.lostDurationSec seconds behind; and stateSyncEnabled, which sends each player the state as a full copy on join and then only what changed, with stateView(state, viewer, room) to cut what each player sees (their game reads room.state or room.smoothedState()); any other option stops it starting, and get_stats says why) and can import the folder's other .js, .json (data) and .wasm (WebAssembly, like a physics engine) files by relative path (plain JavaScript ES modules; npm packages or TypeScript: bundle into zaisma-server/index.js, or one zaisma-server.js). Every other file in the folder is a data file (like prebuilt navigation meshes), read as an ArrayBuffer with room.readDataFile("maps/docks.bin") or server.readDataFile, free to read. Up to 500 files and 64 MB in all, of which up to 32 MB code; 128 MB of memory, data files included. Each call (a tick, a message, a join, a request) has 50 ms of CPU; a start (setup, onRestored and a real-time room's first tick after either) has 5 seconds, to build a map once. It runs sealed off: it talks to its players, calls other servers only on the hosts listed in game_server_allowed_hosts (plain fetch(), https only; anything else throws an OutsideCallError), reads the game's secrets (set_secret) as room.secrets and server.secrets, and has the game's own SQLite database as room.database, shared by its rooms and kept between matches (await room.database.query(sql, values) answers rows; room.database.batch([{ sql, values }]) is one transaction; its rows and storage count on the game's hosting meter, up to 10 GB). Players never get the file. get_stats shows its errors. Any game's server (whatever this setting, even with no setup and no rooms) can also answer requests from the game outside rooms, like a leaderboard or a shop: onRequest(player, request, server) answers Zaisma.server.request(request) with plain JSON, with server.database the same database; requests count on the game's hosting meter. And it can run on schedules: schedules: [{ name: "daily-reset", cron: "0 0 * * *" }] (up to 10, cron in UTC, at most once a minute, each run counting as a request) with onSchedule(run, server), where run.name says which is due; get_stats shows them with their next and last runs.`
|
|
60585
60598
|
},
|
|
60586
60599
|
friend_joins_enabled: {
|
|
60587
60600
|
type: "boolean",
|