@zaisma/cli 0.44.0 → 0.45.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/package.json +2 -1
- package/skill/SKILL.md +97 -0
- package/skill/references/developer-api.md +1965 -0
- package/skill/references/errors.md +341 -0
- package/skill/references/game-server.md +599 -0
- package/skill/references/loading.md +29 -0
- package/skill/references/multiplayer.md +37 -0
- package/skill/references/naming.md +449 -0
- package/skill/references/phones.md +32 -0
- package/skill/references/saves.md +30 -0
- package/skill/references/sdk.md +2383 -0
- package/zaisma.mjs +115 -2
|
@@ -0,0 +1,1965 @@
|
|
|
1
|
+
<!-- Made by scripts/build-skill.mjs: never edit it by hand. -->
|
|
2
|
+
|
|
3
|
+
# Developer API
|
|
4
|
+
|
|
5
|
+
One 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).
|
|
6
|
+
|
|
7
|
+
Names 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…`, `topic_9x2m…`, `post_4kq7…`; 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`.
|
|
8
|
+
|
|
9
|
+
## The MCP
|
|
10
|
+
|
|
11
|
+
Any 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:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
claude mcp add --transport http zaisma https://zaisma.com/mcp --header "Authorization: Bearer $ZAISMA_KEY"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Apps that can't send a key connect by signing in instead. In claude.ai: Settings → Connectors → 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.
|
|
18
|
+
|
|
19
|
+
Every 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`, `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.
|
|
20
|
+
|
|
21
|
+
Every 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.
|
|
22
|
+
|
|
23
|
+
## Teaching your AI
|
|
24
|
+
|
|
25
|
+
Zaisma teaches any AI its own workflow, the same way everywhere, from one source in the repository (`skills/zaisma/`, the open SKILL.md format):
|
|
26
|
+
|
|
27
|
+
- **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).
|
|
28
|
+
- **The Claude Code plugin,** the MCP and the skill together, from this repository: `/plugin marketplace add zaisma/zaisma`, then `/plugin install zaisma@zaisma`.
|
|
29
|
+
- **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).
|
|
30
|
+
- **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.
|
|
31
|
+
- **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`.
|
|
32
|
+
|
|
33
|
+
## Errors
|
|
34
|
+
|
|
35
|
+
Every error, in the API and the MCP, has the same shape:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{"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"}}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- `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.
|
|
42
|
+
- `message`: what happened, in one sentence.
|
|
43
|
+
- `field`: the input at fault, with its place in a list when it's in one (`files[3].path`, `debug_context.call`), or `null`.
|
|
44
|
+
- `fix`: what to do about it, naming the call or the value when there is one.
|
|
45
|
+
- `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.
|
|
46
|
+
- `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`.
|
|
47
|
+
- `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.
|
|
48
|
+
- `confirm_url`: only with `confirmation_needed`, where the developer does it themselves on zaisma.com with their passkey (see Hosting and credit).
|
|
49
|
+
- `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_…`).
|
|
50
|
+
- `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_…`).
|
|
51
|
+
|
|
52
|
+
The 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.
|
|
53
|
+
|
|
54
|
+
**Signing in and requests**
|
|
55
|
+
|
|
56
|
+
| Code | HTTP | Meaning |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| `no_key` | 401 | The MCP was called without an API key or a connected app's token. |
|
|
59
|
+
| `bad_key` | 401 | The API key isn't valid: removed, mistyped or never made. |
|
|
60
|
+
| `key_turned_off` | 401 | The API key was found in public and turned off for good. |
|
|
61
|
+
| `key_ended` | 401 | The API key reached the end date it was made with. |
|
|
62
|
+
| `access_token_ended` | 401 | A connected app's access token is past its hour; the app refreshes it by itself. |
|
|
63
|
+
| `token_not_for_api` | 401 | A connected app's token works only at the MCP, not the REST API. |
|
|
64
|
+
| `signed_out` | 401 | No API key, and no signed-in session. |
|
|
65
|
+
| `no_account` | 401 | The account isn't finished yet. |
|
|
66
|
+
| `bad_origin` | 403 | A call with a session came from another site. |
|
|
67
|
+
| `key_not_allowed` | 403 | The API key is limited to other games, or its access doesn't cover the call. |
|
|
68
|
+
| `slow_down` | 429 | Too many calls in a minute. |
|
|
69
|
+
| `not_found` | 404 | There's no API call at that path. |
|
|
70
|
+
| `bad_method` | 405 | The path doesn't take that method. |
|
|
71
|
+
| `gone` | 410 | The call was removed, like the first feedback calls. |
|
|
72
|
+
| `bad_json` | 400 | The body isn't a JSON object. |
|
|
73
|
+
| `json_too_big` | 413 | The JSON body is over the call's size limit. |
|
|
74
|
+
| `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. |
|
|
75
|
+
| `unknown_field` | 400 | A field, argument or query parameter the call doesn't take. |
|
|
76
|
+
| `missing_field` | 400 | A field the call needs wasn't sent. |
|
|
77
|
+
| `wrong_id_kind` | 400 | An ID of another kind was sent, like an image ID as version_id. |
|
|
78
|
+
| `internal_error` | 500 | Something broke on Zaisma's side. |
|
|
79
|
+
|
|
80
|
+
**Games**
|
|
81
|
+
|
|
82
|
+
| Code | HTTP | Meaning |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| `no_game` | 404 | You have no game with that slug. |
|
|
85
|
+
| `bad_slug` | 400 | The link name isn't lowercase letters, numbers and single hyphens, or is reserved. |
|
|
86
|
+
| `slug_taken` | 409 | Another game has that link name, or a deleted game had it. |
|
|
87
|
+
| `too_many_games` | 403 | The account has as many games as it can have. |
|
|
88
|
+
| `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. |
|
|
89
|
+
| `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. |
|
|
90
|
+
| `publishing_not_open` | 403 | Until the beta, only accounts Zaisma adds can make, upload and publish games. |
|
|
91
|
+
| `bad_title` | 400 | A game's, topic's or precedent's title is empty or too long. |
|
|
92
|
+
| `title_names_zaisma` | 400 | A game's title holds the whole word Zaisma, which only Zaisma's own games can use. |
|
|
93
|
+
| `bad_description` | 400 | The description isn't text of up to 500 characters. |
|
|
94
|
+
| `bad_visibility` | 400 | visibility isn't draft, listed, unlisted or private. |
|
|
95
|
+
| `bad_devices` | 400 | devices isn't a list of phone, tablet and computer. |
|
|
96
|
+
| `bad_genres` | 400 | genres isn't a list of up to 3 of Zaisma's genres. |
|
|
97
|
+
| `bad_controls` | 400 | controls isn't a list of touch, keyboard_mouse and gamepad. |
|
|
98
|
+
| `bad_screen_orientation` | 400 | screen_orientation isn't portrait, landscape, either or null. |
|
|
99
|
+
| `bad_play_modes` | 400 | play_modes isn't a list of play modes, or one of them is wrong. |
|
|
100
|
+
| `bad_cloud_saves_enabled` | 400 | cloud_saves_enabled isn't true or false. |
|
|
101
|
+
| `bad_account_offer_enabled` | 400 | account_offer_enabled isn't true or false. |
|
|
102
|
+
| `bad_deleted_account_erase_enabled` | 400 | deleted_account_erase_enabled isn't true or false. |
|
|
103
|
+
| `bad_friend_joins_enabled` | 400 | friend_joins_enabled isn't true or false. |
|
|
104
|
+
| `bad_performance_measuring_enabled` | 400 | performance_measuring_enabled isn't true or false. |
|
|
105
|
+
| `bad_room_browsing` | 400 | room_browsing isn't page, game or off. |
|
|
106
|
+
| `bad_multiplayer_mode` | 400 | multiplayer_mode isn't none, relay or own. |
|
|
107
|
+
| `bad_account_requirement` | 400 | account_requirement isn't none, multiplayer or whole_game. |
|
|
108
|
+
| `bad_minimum_player_age` | 400 | minimum_player_age_years isn't 13, 16 or 18. |
|
|
109
|
+
| `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. |
|
|
110
|
+
| `content_needs_minimum_age` | 409 | A version shows lifelike gore, which plays only in games for 16 and up. |
|
|
111
|
+
| `gallery_picture_needed` | 409 | A listed game needs at least one gallery picture. |
|
|
112
|
+
| `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. |
|
|
113
|
+
| `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. |
|
|
114
|
+
| `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. |
|
|
115
|
+
| `built_in_server` | 403 | The game runs a game server built into Zaisma, which only Zaisma changes. |
|
|
116
|
+
| `game_removed` | 403 | Zaisma took the game down, so this can't change. |
|
|
117
|
+
| `needs_confirm` | 409 | Hiding a game players can play, or ending a live room, needs the developer's OK. |
|
|
118
|
+
| `bad_period_duration_days` | 400 | period_duration_days isn't a whole number from 1 to 90. |
|
|
119
|
+
| `bad_cursor` | 400 | cursor isn't a next_cursor from an earlier answer. |
|
|
120
|
+
|
|
121
|
+
**Players**
|
|
122
|
+
|
|
123
|
+
| Code | HTTP | Meaning |
|
|
124
|
+
| --- | --- | --- |
|
|
125
|
+
| `no_player` | 404 | No account has that player ID: a guest's, or a deleted account's. |
|
|
126
|
+
|
|
127
|
+
**Covers, gallery pictures, backgrounds and other images**
|
|
128
|
+
|
|
129
|
+
| Code | HTTP | Meaning |
|
|
130
|
+
| --- | --- | --- |
|
|
131
|
+
| `bad_kind` | 400 | kind isn't one of the choices the call takes. |
|
|
132
|
+
| `not_an_image` | 415 | The file isn't an image of a type the call takes. |
|
|
133
|
+
| `image_too_big` | 413 | The image is over 10 MB. |
|
|
134
|
+
| `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. |
|
|
135
|
+
| `not_square` | 400 | A square cover isn't as wide as it is tall. |
|
|
136
|
+
| `too_many_gallery_pictures` | 400 | The game has 8 gallery pictures already. |
|
|
137
|
+
| `image_refused` | 422 | The image can't be used. |
|
|
138
|
+
| `no_image` | 404 | The game has no image with that ID. |
|
|
139
|
+
| `no_file` | 400 | A form on Zaisma's pages was sent without its image. |
|
|
140
|
+
| `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. |
|
|
141
|
+
| `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. |
|
|
142
|
+
| `shader_too_big` | 413 | A shader's pass is over 64 KB. |
|
|
143
|
+
| `bad_buffers` | 400 | buffers isn't a list of { buffer_name, source, channels } with buffer_name a, b, c or d, each once. |
|
|
144
|
+
| `too_many_buffers` | 400 | A shader has more than 4 buffers. |
|
|
145
|
+
| `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. |
|
|
146
|
+
| `shader_texture_too_big` | 413 | A shader texture is over 8 MB, or over 4,096 px on a side. |
|
|
147
|
+
| `too_many_shader_textures` | 400 | The game has 16 shader textures already, or a shader's channels name more than 4. |
|
|
148
|
+
| `shader_texture_in_use` | 409 | A shader the game keeps reads this texture. |
|
|
149
|
+
| `daily_shader_checks_used` | 429 | The account has run 100 shader checks in the last day. |
|
|
150
|
+
| `daily_page_previews_used` | 429 | The account has run every page preview its plan has in the last day (20, or 60 with Pro). |
|
|
151
|
+
| `page_preview_unavailable` | 503 | Zaisma can't open pages in Chrome right now, so it can't picture them. |
|
|
152
|
+
| `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. |
|
|
153
|
+
| `bad_page_preview_shaders` | 400 | shaders isn't a list of { screen, image, buffers } with each screen at most once. |
|
|
154
|
+
| `shader_check_unavailable` | 503 | Zaisma can't draw shaders here right now, so it can't check one. |
|
|
155
|
+
| `no_shader` | 404 | The game has no shader with that ID. |
|
|
156
|
+
| `bad_screen` | 400 | screen isn't wide or phone. |
|
|
157
|
+
| `bad_background_source` | 400 | source isn't zaisma, image or shader, or wide (which only phone takes). |
|
|
158
|
+
| `background_not_ready` | 409 | The image or shader isn't this game's, isn't approved yet, or is for the other screen. |
|
|
159
|
+
| `bad_color` | 400 | The color isn't #RRGGBB. |
|
|
160
|
+
|
|
161
|
+
**Uploading versions**
|
|
162
|
+
|
|
163
|
+
| Code | HTTP | Meaning |
|
|
164
|
+
| --- | --- | --- |
|
|
165
|
+
| `bad_files` | 400 | files isn't a list of files in the shape the call takes. |
|
|
166
|
+
| `bad_path` | 400 | A file's path is absolute, has . or .. in it, has control characters or is over 200 characters. |
|
|
167
|
+
| `hidden_file` | 400 | A file or folder's name starts with a dot. |
|
|
168
|
+
| `precompressed_file` | 400 | A file is pre-compressed (.gz or .br). |
|
|
169
|
+
| `file_type_not_allowed` | 400 | A file is of a type games can't have. |
|
|
170
|
+
| `file_too_big` | 413 | A file is over 500 MB. |
|
|
171
|
+
| `duplicate_path` | 400 | Two files share a path. |
|
|
172
|
+
| `no_index_html` | 400 | There's no index.html at the top of the game. |
|
|
173
|
+
| `too_many_files` | 400 | The game has more than 20,000 files. |
|
|
174
|
+
| `storage_full` | 413 | The upload doesn't fit in what the account can store. |
|
|
175
|
+
| `new_data_limit` | 429 | The account has sent all the new data it can today, counted from UTC midnight. |
|
|
176
|
+
| `too_big_for_mcp` | 413 | upload_files and check_game take up to 5 MB; bigger builds go through the upload command. |
|
|
177
|
+
| `bad_base64` | 400 | Something sent as base64 isn't valid base64. |
|
|
178
|
+
| `files_missing` | 409 | Some of the version's files haven't been sent yet. |
|
|
179
|
+
| `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. |
|
|
180
|
+
| `bad_is_big_update` | 400 | is_big_update isn't true or false, or an upload sent it without publish_when_approved. |
|
|
181
|
+
| `big_update_needs_patch_notes` | 400 | A big update has no patch_notes, and a big update must say what's new. |
|
|
182
|
+
| `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. |
|
|
183
|
+
| `bad_publish_when_approved` | 400 | publish_when_approved isn't true or false. |
|
|
184
|
+
| `bad_publish_after_ai_review_enabled` | 400 | publish_after_ai_review_enabled isn't true or false, or it came with nothing to publish. |
|
|
185
|
+
| `bad_match_update_mode` | 400 | match_update_mode isn't next_match or now, or it came without publish_when_approved. |
|
|
186
|
+
| `version_limit` | 429 | The game has had 100 versions in the last day. |
|
|
187
|
+
| `version_in_use` | 409 | The version can't be deleted: it's live, set to publish, or a tester link picked it. |
|
|
188
|
+
| `kept_for_review` | 403 | The version or game is kept for a person at Zaisma, so it can't be deleted. |
|
|
189
|
+
| `bad_confirm_slug` | 400 | confirm_slug isn't the game's link name. |
|
|
190
|
+
| `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. |
|
|
191
|
+
| `already_erasing` | 409 | The game's week is over and its erasing has started, so it can't be brought back. |
|
|
192
|
+
| `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. |
|
|
193
|
+
| `no_game_deletion_request` | 404 | This game has no deletion request with that ID. |
|
|
194
|
+
| `bad_monthly_storage_budget_cents` | 400 | monthly_storage_budget_cents isn't null or a whole number from 100 to 1,000,000. |
|
|
195
|
+
| `no_content_length` | 411 | A file was sent without a Content-Length header. |
|
|
196
|
+
| `file_needs_parts` | 413 | A file over 95 MB was sent in one go. |
|
|
197
|
+
| `no_body` | 400 | A file was sent without a body. |
|
|
198
|
+
| `hash_mismatch` | 400 | A file doesn't match the SHA-256 it was sent as. |
|
|
199
|
+
| `forbidden_file` | 400 | A file is a program or an archive, whatever its name says. |
|
|
200
|
+
| `bad_size_bytes` | 400 | size_bytes isn't a whole number above 0. |
|
|
201
|
+
| `bad_part_number` | 400 | A part's number isn't from 1 to 10,000. |
|
|
202
|
+
| `no_upload_id` | 400 | A part was sent without its upload_id. |
|
|
203
|
+
| `bad_part_size` | 400 | A part is empty, over 50 MB or has no Content-Length header. |
|
|
204
|
+
| `upload_closed` | 400 | The upload_id isn't an open upload any more. |
|
|
205
|
+
| `bad_parts` | 400 | The finishing call isn't { upload_id, parts: [{ part_number, etag }] }. |
|
|
206
|
+
| `parts_incomplete` | 400 | The parts sent don't make a whole file. |
|
|
207
|
+
|
|
208
|
+
**Versions and publishing**
|
|
209
|
+
|
|
210
|
+
| Code | HTTP | Meaning |
|
|
211
|
+
| --- | --- | --- |
|
|
212
|
+
| `no_version` | 404 | The game has no version with that ID. |
|
|
213
|
+
| `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. |
|
|
214
|
+
| `still_scanning` | 409 | The version is still being scanned. |
|
|
215
|
+
| `not_approved` | 409 | The version didn't pass review, so it can't be published. |
|
|
216
|
+
|
|
217
|
+
**Tester links**
|
|
218
|
+
|
|
219
|
+
| Code | HTTP | Meaning |
|
|
220
|
+
| --- | --- | --- |
|
|
221
|
+
| `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. |
|
|
222
|
+
| `too_many_tester_links` | 403 | The game has 50 tester links on already. |
|
|
223
|
+
| `no_tester_link` | 404 | The game has no tester link on with that ID. |
|
|
224
|
+
| `bad_version_choice` | 400 | version_choice isn't live, newest_passed or picked, or picked_version_id doesn't go with it. |
|
|
225
|
+
|
|
226
|
+
**Sign in with Zaisma**
|
|
227
|
+
|
|
228
|
+
| Code | HTTP | Meaning |
|
|
229
|
+
| --- | --- | --- |
|
|
230
|
+
| `bad_redirect_urls` | 400 | redirect_urls isn't a list of 1 to 10 https URLs (http only for localhost) without #fragments. |
|
|
231
|
+
| `bad_replace_client_secret` | 400 | replace_client_secret isn't true or false, or the app is public and has no client secret. |
|
|
232
|
+
| `too_many_sign_in_apps` | 403 | The account has 20 sign-in apps already. |
|
|
233
|
+
| `no_sign_in_app` | 404 | You have no sign-in app with that ID. |
|
|
234
|
+
| `bad_destination_kind` | 400 | destination_kind isn't endpoint_url or game_server. |
|
|
235
|
+
| `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. |
|
|
236
|
+
| `bad_event_kinds` | 400 | event_kinds isn't a list of 1 or more of the webhook event kinds. |
|
|
237
|
+
| `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. |
|
|
238
|
+
| `bad_replace_signing_secret` | 400 | replace_signing_secret isn't true or false. |
|
|
239
|
+
| `too_many_webhooks` | 403 | The account has 10 webhooks already. |
|
|
240
|
+
| `no_webhook` | 404 | You have no webhook with that ID. |
|
|
241
|
+
|
|
242
|
+
**The game database**
|
|
243
|
+
|
|
244
|
+
| Code | HTTP | Meaning |
|
|
245
|
+
| --- | --- | --- |
|
|
246
|
+
| `bad_sql` | 400 | The SQL isn't one statement SQLite takes, or statements isn't a list of { sql, values }. |
|
|
247
|
+
| `bad_values` | 400 | values isn't a list of text, numbers, null and { blob_base64 } for the SQL's ?s. |
|
|
248
|
+
| `bad_player_id` | 400 | player_id isn't a player ID (player_…). |
|
|
249
|
+
| `too_many_rows` | 400 | A statement answered more than 10,000 rows. |
|
|
250
|
+
| `integer_too_large` | 400 | A statement answered a whole number past 2^53, which JavaScript can't hold exactly. |
|
|
251
|
+
| `answer_too_big` | 400 | The rows answered come to more than 8 MB. |
|
|
252
|
+
| `database_full` | 403 | The statement would grow the game's storage (its database and kept rooms) past the 10 GB a game can keep. |
|
|
253
|
+
| `database_unavailable` | 503 | The game's database didn't answer. |
|
|
254
|
+
| `database_restore_unavailable` | 501 | This Zaisma's game databases can't go back in time: its storage keeps no history, like a local preview. |
|
|
255
|
+
| `no_database_restore` | 404 | The game has no database restore with that ID in the last 30 days. |
|
|
256
|
+
| `bad_secret_name` | 400 | A secret's name isn't capitals, digits and underscores starting with a capital, up to 64 characters. |
|
|
257
|
+
| `bad_secret_value` | 400 | secret_value isn't text of up to 8 KB. |
|
|
258
|
+
| `no_secret` | 404 | The game has no secret by that name. |
|
|
259
|
+
| `too_many_secrets` | 403 | The game has 50 secrets, the most it can have. |
|
|
260
|
+
| `secrets_unavailable` | 503 | The game's secrets didn't answer. |
|
|
261
|
+
| `no_kept_room` | 404 | The game has no kept room with that code. |
|
|
262
|
+
| `no_kept_room_restore` | 404 | The kept room has no restore with that ID in the last 30 days. |
|
|
263
|
+
| `no_kept_room_restore_batch` | 404 | The game has no restore of every kept room with that ID in the last 30 days. |
|
|
264
|
+
| `kept_room_restore_unavailable` | 501 | This Zaisma's rooms can't go back in time: their storage keeps no history, like a local preview. |
|
|
265
|
+
| `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. |
|
|
266
|
+
| `kept_room_copies_unavailable` | 501 | This Zaisma can't read its kept rooms' copies, so an erased kept room can't come back. |
|
|
267
|
+
| `no_kept_room_copy` | 404 | No copy of the deleted world is left: a copy lasts about 28 days after a world is deleted. |
|
|
268
|
+
| `room_code_in_use` | 409 | Another room of the game has that code now, so the deleted world can't come back under it. |
|
|
269
|
+
| `game_storage_full` | 403 | The deleted world doesn't fit in the 10 GB a game can keep. |
|
|
270
|
+
| `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. |
|
|
271
|
+
| `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. |
|
|
272
|
+
| `no_room` | 404 | The game has no live room with that code on Zaisma. |
|
|
273
|
+
| `no_player_in_room` | 404 | That player isn't in the room now. |
|
|
274
|
+
| `bad_room_message` | 400 | message isn't plain JSON of up to 16 KB. |
|
|
275
|
+
| `bad_labels` | 400 | labels isn't a list of up to 4 labels, each { label_name, label_value } of text. |
|
|
276
|
+
| `bad_kick_message` | 400 | A kick's message isn't text of up to 200 characters. |
|
|
277
|
+
| `bad_end_message` | 400 | An end's message isn't text of up to 200 characters. |
|
|
278
|
+
| `room_busy` | 429 | The room took 100 room messages in the last second. |
|
|
279
|
+
| `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. |
|
|
280
|
+
| `too_many_scheduled_room_messages` | 409 | The game has 100 scheduled room messages waiting, the most it can have. |
|
|
281
|
+
| `no_scheduled_room_message` | 404 | The game has no scheduled room message with that ID waiting. |
|
|
282
|
+
| `dump_too_big` | 413 | dump_sql is over 5 MB: import a dump in parts, each ending on a whole statement. |
|
|
283
|
+
|
|
284
|
+
**Hosting and credit**
|
|
285
|
+
|
|
286
|
+
| Code | HTTP | Meaning |
|
|
287
|
+
| --- | --- | --- |
|
|
288
|
+
| `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. |
|
|
289
|
+
| `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. |
|
|
290
|
+
| `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. |
|
|
291
|
+
| `bad_top_up_amount` | 400 | amount_cents isn't a whole number of cents from 1,000 ($10) to 100,000 ($1,000). |
|
|
292
|
+
| `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. |
|
|
293
|
+
| `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. |
|
|
294
|
+
| `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. |
|
|
295
|
+
| `no_top_up` | 404 | You have no top-up with that ID. |
|
|
296
|
+
| `no_spending_request` | 404 | You have no spending request with that ID. |
|
|
297
|
+
| `top_up_not_refundable` | 409 | The top-up has nothing left to refund: it's spent, refunded, or over 30 days old. |
|
|
298
|
+
| `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). |
|
|
299
|
+
| `already_credit_plan` | 409 | The developer already has a monthly credit plan, so there's nothing to start: change its level or stop it. |
|
|
300
|
+
| `no_credit_plan` | 409 | The developer has no monthly credit plan to change or stop. |
|
|
301
|
+
| `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. |
|
|
302
|
+
| `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. |
|
|
303
|
+
| `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). |
|
|
304
|
+
| `stripe_unavailable` | 503 | Stripe didn't answer, or this Zaisma has no Stripe account set up. |
|
|
305
|
+
|
|
306
|
+
**A game server's logs**
|
|
307
|
+
|
|
308
|
+
| Code | HTTP | Meaning |
|
|
309
|
+
| --- | --- | --- |
|
|
310
|
+
| `bad_room_code` | 400 | room_code isn't a room's code: six characters like K7Q2MX. |
|
|
311
|
+
| `bad_minimum_level` | 400 | minimum_level isn't debug, info, warn or error. |
|
|
312
|
+
| `bad_source_kind` | 400 | source_kind isn't room, request, schedule or webhook. |
|
|
313
|
+
| `bad_search_text` | 400 | search_text is empty or over 200 characters. |
|
|
314
|
+
| `bad_maximum_line_count` | 400 | maximum_line_count isn't a whole number from 1 to 500. |
|
|
315
|
+
| `two_log_cursors` | 400 | get_logs got both cursor and new_lines_cursor. |
|
|
316
|
+
|
|
317
|
+
**Items and purchases**
|
|
318
|
+
|
|
319
|
+
| Code | HTTP | Meaning |
|
|
320
|
+
| --- | --- | --- |
|
|
321
|
+
| `no_item` | 404 | The game has no item by that name. |
|
|
322
|
+
| `too_many_items` | 400 | The game has 1,000 items, the most it can have. |
|
|
323
|
+
| `bad_item` | 400 | An item's name, title, description, kind, category, price or local prices isn't one set_item takes; field says which. |
|
|
324
|
+
| `unsupported_currency` | 400 | Zaisma doesn't price in that currency. |
|
|
325
|
+
| `price_too_low` | 400 | The price is under the least Stripe charges in its currency. |
|
|
326
|
+
| `refund_policy_needed` | 409 | A game that sells anything states its refund policy first. |
|
|
327
|
+
| `bad_refund_policy` | 400 | refund_policy isn't no_refunds, unused_within_14_days, within_14_days, own_words or null. |
|
|
328
|
+
| `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. |
|
|
329
|
+
| `bad_own_payment_categories` | 400 | own_payment_categories isn't a list of cosmetic, gameplay, content and currency. |
|
|
330
|
+
| `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. |
|
|
331
|
+
| `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. |
|
|
332
|
+
| `bad_game_account_id` | 400 | game_account_id isn't text of up to 200 characters, or null. |
|
|
333
|
+
| `bad_purchase_source` | 400 | purchase_source isn't sale or grant. |
|
|
334
|
+
| `bad_purchase_status` | 400 | purchase_status isn't pending, completed, failed, refunded or charged_back. |
|
|
335
|
+
| `no_purchase` | 404 | The game has no purchase with that ID. |
|
|
336
|
+
| `already_refunded` | 409 | The purchase was refunded or charged back already. |
|
|
337
|
+
| `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. |
|
|
338
|
+
| `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. |
|
|
339
|
+
| `stripe_account_banned` | 403 | The Stripe account was banned from Zaisma with the account that connected it, so it can't be connected again. |
|
|
340
|
+
| `email_banned` | 403 | The email was banned from Zaisma with the account it was on, so it can't be added to an account. |
|
|
341
|
+
| `bad_is_stripe_tax_used` | 400 | is_stripe_tax_used isn't true or false. |
|
|
342
|
+
| `bad_amount_minor_units` | 400 | amount_minor_units isn't a whole number from 1 to what's left of the sale to refund. |
|
|
343
|
+
| `purchase_not_paid` | 409 | The sale wasn't paid (pending or failed), so there's nothing to refund. |
|
|
344
|
+
| `not_for_sale` | 409 | The item has no price, so players can't buy it; it's only granted. |
|
|
345
|
+
| `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. |
|
|
346
|
+
| `bad_purchase_delivery` | 400 | purchase_delivery isn't game, game_server or own_server. |
|
|
347
|
+
| `no_game_server` | 409 | purchase_delivery game_server needs a game server, on Zaisma or the developer's own, and the game has none. |
|
|
348
|
+
| `already_handled` | 409 | The purchase was handed over already, or its refund was told already. |
|
|
349
|
+
| `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. |
|
|
350
|
+
| `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. |
|
|
351
|
+
| `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. |
|
|
352
|
+
| `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. |
|
|
353
|
+
| `account_requirement_locked` | 400 | A game that sells itself (full_game_item_name) needs account_requirement whole_game, since only accounts own it. |
|
|
354
|
+
| `full_game_not_owned` | 403 | The game sells itself, and the player's account doesn't own it: buy it on its game page. |
|
|
355
|
+
|
|
356
|
+
**Cloud saves**
|
|
357
|
+
|
|
358
|
+
| Code | HTTP | Meaning |
|
|
359
|
+
| --- | --- | --- |
|
|
360
|
+
| `no_save` | 404 | The player has no save in the game. |
|
|
361
|
+
| `no_save_copy` | 404 | The player's save has no earlier version with that ID. |
|
|
362
|
+
| `bad_keys` | 400 | keys isn't a list of 1 to 100 localStorage keys of up to 1,000 characters. |
|
|
363
|
+
| `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). |
|
|
364
|
+
| `bad_indexeddb_databases` | 400 | indexeddb_databases isn't a list of databases, each { name, version, stores } as get_save answers them. |
|
|
365
|
+
| `save_too_big` | 413 | The save would be over 5 MB. |
|
|
366
|
+
| `cloud_saves_off` | 409 | The game has cloud saves off, so it doesn't read saves from players' accounts. |
|
|
367
|
+
| `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. |
|
|
368
|
+
| `save_busy` | 409 | The player's game kept saving at the same moment, so the change didn't go through. |
|
|
369
|
+
|
|
370
|
+
**The developer forum**
|
|
371
|
+
|
|
372
|
+
| Code | HTTP | Meaning |
|
|
373
|
+
| --- | --- | --- |
|
|
374
|
+
| `no_topic` | 404 | There's no topic with that ID you can see. |
|
|
375
|
+
| `no_post` | 404 | There's no post with that ID you can see in the topic. |
|
|
376
|
+
| `no_known_issue` | 404 | There's no known issue with that ID. |
|
|
377
|
+
| `no_media` | 404 | There's no image there you can see. |
|
|
378
|
+
| `bad_tab` | 400 | tab isn't latest, top, unanswered, known, yours, messages or bookmarks. |
|
|
379
|
+
| `bad_section` | 400 | section isn't one of the forum's sections. |
|
|
380
|
+
| `bad_category` | 400 | category isn't one of the forum's categories. |
|
|
381
|
+
| `no_category` | 400 | A public topic was sent without its category. |
|
|
382
|
+
| `bad_tag` | 400 | tag isn't one of the forum's tags. |
|
|
383
|
+
| `bad_tags` | 400 | tags isn't a list of up to 3 of the forum's tags. |
|
|
384
|
+
| `bad_topic_status` | 400 | topic_status isn't one of the statuses. |
|
|
385
|
+
| `bad_is_answered` | 400 | is_answered isn't true or false. |
|
|
386
|
+
| `bad_maximum_topic_count` | 400 | maximum_topic_count isn't a whole number from 1 to 30. |
|
|
387
|
+
| `bad_detail` | 400 | detail isn't brief. |
|
|
388
|
+
| `bad_post_selection` | 400 | post_selection isn't all, answer, latest or none. |
|
|
389
|
+
| `bad_is_public` | 400 | is_public isn't true or false. |
|
|
390
|
+
| `bad_text_markdown` | 400 | text_markdown is empty or over 8,000 characters. |
|
|
391
|
+
| `bad_author_kind` | 400 | author_kind isn't developer or ai. |
|
|
392
|
+
| `bad_debug_context` | 400 | debug_context isn't an object of its five text fields, up to 8,000 characters in all. |
|
|
393
|
+
| `bad_images_base64` | 400 | images_base64 isn't a list of base64 images. |
|
|
394
|
+
| `too_many_images` | 400 | A post carries more than 10 images. |
|
|
395
|
+
| `bad_reopen` | 400 | reopen isn't true or false. |
|
|
396
|
+
| `bad_answer_post_id` | 400 | answer_post_id isn't a post ID or null. |
|
|
397
|
+
| `bad_reason` | 400 | reason isn't one of the report reasons. |
|
|
398
|
+
| `post_limit` | 429 | The account has posted 100 times in the last day. |
|
|
399
|
+
| `image_limit` | 429 | The account has uploaded 200 forum images in the last day. |
|
|
400
|
+
| `not_yours` | 403 | Only the developer who started the topic can do that. |
|
|
401
|
+
| `not_a_question` | 400 | Only a question has an answer to mark. |
|
|
402
|
+
| `not_closed` | 400 | The topic isn't closed, so there's nothing to reopen. |
|
|
403
|
+
| `not_released` | 400 | The topic isn't a known issue whose fix is out. |
|
|
404
|
+
| `cant_vote` | 400 | The topic doesn't take your vote: it's yours, private, or a discussion. |
|
|
405
|
+
| `cant_flag` | 400 | Only public topics others can see can be flagged as misplaced. |
|
|
406
|
+
| `retired_tool` | 410 | The tool is retired; the error names the one that replaces it. |
|
|
407
|
+
| `bad_rating` | 400 | rating isn't like or dislike. |
|
|
408
|
+
| `cant_rate_post` | 400 | Only posts in public topics take likes and dislikes. |
|
|
409
|
+
| `cant_rate_own_post` | 400 | Your own posts take no likes or dislikes from you. |
|
|
410
|
+
| `cant_report` | 400 | The post can't be reported: it's yours, or Zaisma's. |
|
|
411
|
+
|
|
412
|
+
## Next steps
|
|
413
|
+
|
|
414
|
+
Every 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.
|
|
415
|
+
|
|
416
|
+
```json
|
|
417
|
+
"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."}]
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
- `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).
|
|
421
|
+
- `after_sec`: how long to wait first, or `null` for straight away.
|
|
422
|
+
- 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.
|
|
423
|
+
|
|
424
|
+
## The AI review
|
|
425
|
+
|
|
426
|
+
The 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.
|
|
427
|
+
|
|
428
|
+
- **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.
|
|
429
|
+
- **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.
|
|
430
|
+
- **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.
|
|
431
|
+
- **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.
|
|
432
|
+
- **A game with 1,000 counted plays in the last 7 days** is reviewed at once, at full price.
|
|
433
|
+
- **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.
|
|
434
|
+
- **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.
|
|
435
|
+
- **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.
|
|
436
|
+
- **Files are read once.** A file any version that passed already had read is never read again, whoever sends it.
|
|
437
|
+
|
|
438
|
+
`ai_review_status` is `not_started`, `waiting`, `reviewing`, `passed`, `stopped` or `skipped`; `ai_review_speed` is `at_once` or `batch`.
|
|
439
|
+
|
|
440
|
+
## Holds and takedowns
|
|
441
|
+
|
|
442
|
+
When 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.
|
|
443
|
+
|
|
444
|
+
```json
|
|
445
|
+
"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."}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
- `code`: stable, one problem per code, from the list below, never the same as an error code; search the forum with it (`search_forum`).
|
|
449
|
+
- `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.
|
|
450
|
+
- `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.
|
|
451
|
+
- `fix`: what to do about it, naming the call when there is one.
|
|
452
|
+
- `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.
|
|
453
|
+
|
|
454
|
+
Where it shows:
|
|
455
|
+
|
|
456
|
+
- **A game's `review_reason`**: why it's `held` or `removed`; `null` while it's `pending` or `live`.
|
|
457
|
+
|
|
458
|
+
Zaisma 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.
|
|
459
|
+
|
|
460
|
+
When 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.
|
|
461
|
+
|
|
462
|
+
- **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.
|
|
463
|
+
|
|
464
|
+
The 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.
|
|
465
|
+
- **An image's `review_reason`**: why it wasn't approved.
|
|
466
|
+
- **`get_history`**: each hold, rejection and takedown with its `review_reason`, kept after it's over.
|
|
467
|
+
- **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.
|
|
468
|
+
- **Errors:** `game_removed` and `not_approved` put the reason's code and message in theirs, and its fix as theirs.
|
|
469
|
+
|
|
470
|
+
The 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.
|
|
471
|
+
|
|
472
|
+
**The scan's checks**
|
|
473
|
+
|
|
474
|
+
| Code | Rule | Meaning |
|
|
475
|
+
| --- | --- | --- |
|
|
476
|
+
| `crypto_miner` | `malware` | The code mines cryptocurrency. |
|
|
477
|
+
| `packed_code` | `malware` | Code is packed or decoded at runtime (eval of encoded text), which hides what it does. |
|
|
478
|
+
| `top_navigation` | `malware` | The code tries to change the page outside the game (the top or parent window's location). |
|
|
479
|
+
| `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. |
|
|
480
|
+
| `password_field` | `malware` | The game has a password field. Games don't need one, and phishing pages do. |
|
|
481
|
+
| `external_form` | `personal_details` | The game has a form that sends what players type to another site. |
|
|
482
|
+
| `antivirus_flag` | `malware` | Antivirus engines flag a file: three or more reject the version, fewer hold it for a person. |
|
|
483
|
+
| `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. |
|
|
484
|
+
| `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. |
|
|
485
|
+
| `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. |
|
|
486
|
+
| `matches_banned_account_files` | none | Most of its files match a game Zaisma took down. |
|
|
487
|
+
| `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. |
|
|
488
|
+
|
|
489
|
+
**Checks that couldn't finish (no rule broken)**
|
|
490
|
+
|
|
491
|
+
| Code | Rule | Meaning |
|
|
492
|
+
| --- | --- | --- |
|
|
493
|
+
| `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. |
|
|
494
|
+
| `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. |
|
|
495
|
+
| `image_matching_off` | none | Image matching isn't connected, so a person at Zaisma approves each version. |
|
|
496
|
+
| `image_matching_failed` | none | Image matching couldn't check every picture and video, so a person at Zaisma looks first. |
|
|
497
|
+
| `ai_review_off` | none | AI review isn't set up, so a person at Zaisma approves each version. |
|
|
498
|
+
| `ai_review_budget_used` | none | This month's AI reviews are used up, so this version went on with the fixed checks alone. |
|
|
499
|
+
| `ai_review_declined` | none | The AI reviewer wouldn't review the game, so a person at Zaisma looks. |
|
|
500
|
+
| `ai_review_failed` | none | The AI review didn't finish, so a person at Zaisma looks. |
|
|
501
|
+
| `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. |
|
|
502
|
+
| `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. |
|
|
503
|
+
| `version_replaced` | none | A newer version of this game came in while this one waited, so this one isn't reviewed. |
|
|
504
|
+
| `scan_failed` | none | The scan didn't finish after three tries, so a person at Zaisma looks. |
|
|
505
|
+
|
|
506
|
+
**The AI review**
|
|
507
|
+
|
|
508
|
+
Every 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.
|
|
509
|
+
|
|
510
|
+
Each 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.
|
|
511
|
+
|
|
512
|
+
| Code | Rule | Meaning |
|
|
513
|
+
| --- | --- | --- |
|
|
514
|
+
| `ai_malware` | `malware` | The AI review found malware: a crypto miner, or code that hides what it runs. |
|
|
515
|
+
| `ai_phishing_or_scam` | `malware` | The AI review found phishing or a scam. |
|
|
516
|
+
| `ai_data_collection` | `personal_details` | The AI review found the game asking players for personal details, like emails, real names, birthdays or location. |
|
|
517
|
+
| `ai_sexual_content` | `sexual` | The AI review found sexual content or nudity. |
|
|
518
|
+
| `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. |
|
|
519
|
+
| `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. |
|
|
520
|
+
| `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. |
|
|
521
|
+
| `ai_real_money_gambling` | `illegal` | The AI review found real-money gambling. |
|
|
522
|
+
| `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. |
|
|
523
|
+
| `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. |
|
|
524
|
+
| `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). |
|
|
525
|
+
| `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. |
|
|
526
|
+
| `ai_other` | none | The AI review found faked plays or players, or text that addresses the reviewer. |
|
|
527
|
+
| `ai_concern` | none | The AI review held or rejected the version without naming one concern; the message is its summary. |
|
|
528
|
+
|
|
529
|
+
**People and reports**
|
|
530
|
+
|
|
531
|
+
| Code | Rule | Meaning |
|
|
532
|
+
| --- | --- | --- |
|
|
533
|
+
| `needs_review` | none | A person at Zaisma needs to look at it first. |
|
|
534
|
+
| `report_paused_game` | none | A player report paused the game while Zaisma checks it. |
|
|
535
|
+
| `report_paused_update` | none | A player report paused this update while Zaisma checks it; players get the version before it. |
|
|
536
|
+
| `rejected_by_zaisma` | picked | A person at Zaisma rejected the version; the message says why. |
|
|
537
|
+
| `taken_down` | picked | A person at Zaisma took the game down; the message says why. |
|
|
538
|
+
| `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. |
|
|
539
|
+
| `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. |
|
|
540
|
+
| `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. |
|
|
541
|
+
| `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. |
|
|
542
|
+
| `developer_account_deleted` | none | The game's developer deleted their Zaisma account, which takes their games down with it. |
|
|
543
|
+
| `developer_deleted_game` | none | The game's developer deleted it. |
|
|
544
|
+
| `image_rejected` | picked | A person at Zaisma didn't approve the image; the message says why. |
|
|
545
|
+
| `link_flagged` | `malware` | Cloudflare lists the link's site for malware or phishing, so the link opens for nobody. |
|
|
546
|
+
| `details_rejected` | picked | A person at Zaisma didn't approve the new title or description; the message says why. |
|
|
547
|
+
|
|
548
|
+
**The listing check** (covers, gallery pictures, backgrounds and titles; see Covers, gallery pictures and share pictures, and Backgrounds), **and the shader check** (see Backgrounds)
|
|
549
|
+
|
|
550
|
+
| Code | Rule | Meaning |
|
|
551
|
+
| --- | --- | --- |
|
|
552
|
+
| `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. |
|
|
553
|
+
| `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. |
|
|
554
|
+
| `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". |
|
|
555
|
+
| `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. |
|
|
556
|
+
| `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. |
|
|
557
|
+
| `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. |
|
|
558
|
+
| `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. |
|
|
559
|
+
| `shader_does_not_compile` | none | The shader didn't compile; the message gives the first compiler error. |
|
|
560
|
+
| `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. |
|
|
561
|
+
| `shader_flashes` | none | The shader flashes more than 3 times a second, which can cause seizures. |
|
|
562
|
+
|
|
563
|
+
| Rule | What it says |
|
|
564
|
+
| --- | --- |
|
|
565
|
+
| `child_safety` | Sexual content involving minors, in any form. Zaisma reports it to the National Center for Missing & Exploited Children. |
|
|
566
|
+
| `sexual` | Sexually explicit content. |
|
|
567
|
+
| `malware` | Malware, crypto mining, phishing, scams or anything that tries to break out of the game. |
|
|
568
|
+
| `illegal` | Content that is illegal in the United States, including real-money gambling. |
|
|
569
|
+
| `real_people` | Private details about real people, real threats, or calls for real violence. |
|
|
570
|
+
| `copyright` | Other people's games, art, music or characters used without permission. |
|
|
571
|
+
| `defamation` | False claims that a real private person committed a crime. |
|
|
572
|
+
| `trademark` | Other people's trademarks used so that players would think their owner made or backs the game. |
|
|
573
|
+
| `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. |
|
|
574
|
+
| `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. |
|
|
575
|
+
| `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. |
|
|
576
|
+
| `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. |
|
|
577
|
+
| `faked_plays` | Faking plays or players, with bots, scripts or click farms. |
|
|
578
|
+
|
|
579
|
+
Allowed, even where other platforms ban it (`ALLOWED_CONTENT`): the AI review passes it and report triage dismisses reports about it.
|
|
580
|
+
|
|
581
|
+
- Offensive, edgy and dark humor, insults and swearing.
|
|
582
|
+
- Jokes and opinions about any group, religion, country or political side. There's no hate-speech rule.
|
|
583
|
+
- Mocking, memes and satire of real people, from politicians to celebrities, with their name, face and photo.
|
|
584
|
+
- Violence that is gameplay: shooting, fighting, war and horror, including against real people.
|
|
585
|
+
- Real wars and history, with their uniforms, flags and symbols.
|
|
586
|
+
- Drinking, smoking and drugs as part of a story or setting.
|
|
587
|
+
- Casino and card games played for points or coins that cannot be bought or cashed out.
|
|
588
|
+
- Trash talk and fiery lobbies: how players talk to each other is up to each game.
|
|
589
|
+
- Bitcoin games: teaching it, Bitcoin themes, selling items for sats, and tips.
|
|
590
|
+
|
|
591
|
+
One 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.
|
|
592
|
+
|
|
593
|
+
For 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.
|
|
594
|
+
|
|
595
|
+
## Signing in
|
|
596
|
+
|
|
597
|
+
Make an API key on Developer settings (zaisma.com/dashboard/settings, under Keys) and send it as `Authorization: Bearer zsk_…`. 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.
|
|
598
|
+
|
|
599
|
+
An 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.
|
|
600
|
+
|
|
601
|
+
Until 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.
|
|
602
|
+
|
|
603
|
+
### Standing
|
|
604
|
+
|
|
605
|
+
Every 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.
|
|
606
|
+
|
|
607
|
+
| Power | Opens |
|
|
608
|
+
| --- | --- |
|
|
609
|
+
| Zaisma's own lists (home, Browse, search) | From the first day, for listed games |
|
|
610
|
+
| Links on trusted domains (see Registered links) | From the first day |
|
|
611
|
+
| 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 |
|
|
612
|
+
| Search engines (the sitemap, and no `noindex` on game pages) | Only once established |
|
|
613
|
+
|
|
614
|
+
A ruling closes links to other sites and search engines at once, for 30 days; a ban closes them for as long as it lasts. `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.
|
|
615
|
+
|
|
616
|
+
### Bans
|
|
617
|
+
|
|
618
|
+
Zaisma 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.
|
|
619
|
+
|
|
620
|
+
### Connected apps (OAuth)
|
|
621
|
+
|
|
622
|
+
For 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_…`) 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_…`) 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.
|
|
623
|
+
|
|
624
|
+
### What a key can do
|
|
625
|
+
|
|
626
|
+
A 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.
|
|
627
|
+
|
|
628
|
+
| Level | What it can do |
|
|
629
|
+
| --- | --- |
|
|
630
|
+
| `full` | Everything. Keys made before levels existed are full keys for every game. |
|
|
631
|
+
| `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. |
|
|
632
|
+
| `upload` | Send files and make versions (drafts), and read everything. Can't publish, change games or post on the forum. |
|
|
633
|
+
| `read` | Read games, versions, stats, the database, saves, items and purchases, the forum and hosting credit. Changes nothing. |
|
|
634
|
+
| `custom` | A choice per area, below. |
|
|
635
|
+
|
|
636
|
+
| Area, in `area_access` | Choices | What it covers |
|
|
637
|
+
| --- | --- | --- |
|
|
638
|
+
| `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. |
|
|
639
|
+
| `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`. |
|
|
640
|
+
| `stats_access` | `none`, `read` | Stats, player reports and history. |
|
|
641
|
+
| `database_access` | `none`, `read`, `write` | read: tables, indexes, use and `export`. write: run SQL (`query`, `batch`), `import` and restore to a time. |
|
|
642
|
+
| `save_access` | `none`, `read`, `write` | Players' cloud saves. read: read them and their copies. write: change, reset and restore them. |
|
|
643
|
+
| `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. |
|
|
644
|
+
| `forum_access` | `none`, `read`, `write` | write: post, reply, vote, follow and message Zaisma, in your name. |
|
|
645
|
+
| `sign_in_app_access` | `none`, `read`, `write` | Sign-in apps. |
|
|
646
|
+
| `webhook_access` | `none`, `read`, `write` | Webhooks. |
|
|
647
|
+
| `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`). |
|
|
648
|
+
| `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. |
|
|
649
|
+
|
|
650
|
+
Every 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.
|
|
651
|
+
|
|
652
|
+
Every 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`).
|
|
653
|
+
|
|
654
|
+
| Call | What it does |
|
|
655
|
+
| --- | --- |
|
|
656
|
+
| `GET /whats-on` | What the home's window shows right now: `event` and up to 3 `cards` (MCP `get_whats_on`) |
|
|
657
|
+
| `GET /playing-now` | Everyone playing on Zaisma right now: `playing_now_player_count` and the `busiest_games`. See Who's playing on Zaisma. |
|
|
658
|
+
| `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. |
|
|
659
|
+
|
|
660
|
+
### Your account's activity
|
|
661
|
+
|
|
662
|
+
| Call | What it does |
|
|
663
|
+
| --- | --- |
|
|
664
|
+
| `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. |
|
|
665
|
+
| `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. |
|
|
666
|
+
|
|
667
|
+
**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.
|
|
668
|
+
|
|
669
|
+
## Games
|
|
670
|
+
|
|
671
|
+
| Call | What it does |
|
|
672
|
+
| --- | --- |
|
|
673
|
+
| `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. |
|
|
674
|
+
| `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. |
|
|
675
|
+
| `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`. |
|
|
676
|
+
| `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`. |
|
|
677
|
+
|
|
678
|
+
A 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`.
|
|
679
|
+
|
|
680
|
+
- **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.
|
|
681
|
+
- **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.
|
|
682
|
+
- **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).
|
|
683
|
+
- **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.
|
|
684
|
+
- **devices:** any of `phone`, `tablet`, `computer`. **controls:** any of `touch`, `keyboard_mouse`, `gamepad`. **screen_orientation:** `portrait`, `landscape`, `either` or `null` (not set).
|
|
685
|
+
- **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`.
|
|
686
|
+
- **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.
|
|
687
|
+
- **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()`.
|
|
688
|
+
- **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.
|
|
689
|
+
- **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) 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 5 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.
|
|
690
|
+
- **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.
|
|
691
|
+
- **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.
|
|
692
|
+
- **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`.
|
|
693
|
+
- **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.
|
|
694
|
+
- **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.
|
|
695
|
+
- **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).
|
|
696
|
+
- **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 ⋯ 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`.
|
|
697
|
+
- **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.
|
|
698
|
+
- **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.
|
|
699
|
+
- 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`.
|
|
700
|
+
- 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).
|
|
701
|
+
|
|
702
|
+
| Call | What it does |
|
|
703
|
+
| --- | --- |
|
|
704
|
+
| `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. |
|
|
705
|
+
| `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: []`. |
|
|
706
|
+
| `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. |
|
|
707
|
+
| `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`. |
|
|
708
|
+
|
|
709
|
+
### Alerts
|
|
710
|
+
|
|
711
|
+
`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):
|
|
712
|
+
|
|
713
|
+
- `game_removed`: Zaisma took the game down; `message` and `fix` are its `review_reason`'s.
|
|
714
|
+
- `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.
|
|
715
|
+
- `game_held`: players can't open the game while Zaisma checks it; likewise.
|
|
716
|
+
- `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.
|
|
717
|
+
- `version_rejected`: the newest version was rejected. `GET /games/:slug/versions/:id` has its `findings`.
|
|
718
|
+
- `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.
|
|
719
|
+
- `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.
|
|
720
|
+
- `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.
|
|
721
|
+
- `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.
|
|
722
|
+
- `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.
|
|
723
|
+
- `second_free_allowance_started`: the game filled its free hosting for the first time, so it has a second free allowance this month, once.
|
|
724
|
+
- `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.
|
|
725
|
+
- `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).
|
|
726
|
+
- `hosting_budget_nearly_used`: 80% of the game's monthly budget is used.
|
|
727
|
+
- `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.
|
|
728
|
+
- `database_nearly_full`: the game's storage is 80% of the 10 GB a game can keep.
|
|
729
|
+
|
|
730
|
+
A heads-up is never given alongside its own paused or full kind.
|
|
731
|
+
- `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.
|
|
732
|
+
- `reports_open`: player reports from the last 90 days waiting for Zaisma, counted as `GET /games/:slug/reports` counts them.
|
|
733
|
+
|
|
734
|
+
New kinds can be added, so show the `message` of one you don't know.
|
|
735
|
+
|
|
736
|
+
### What's on at Zaisma
|
|
737
|
+
|
|
738
|
+
`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.
|
|
739
|
+
|
|
740
|
+
### Who's playing on Zaisma
|
|
741
|
+
|
|
742
|
+
`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).
|
|
743
|
+
|
|
744
|
+
### Play stats
|
|
745
|
+
|
|
746
|
+
`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.
|
|
747
|
+
|
|
748
|
+
- **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.
|
|
749
|
+
- **play_count**, **started_play_count**, **new_player_count** and **play_duration_min** over the period, and **average_play_duration_min** per counted play.
|
|
750
|
+
- **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.
|
|
751
|
+
|
|
752
|
+
A 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.
|
|
753
|
+
|
|
754
|
+
`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.
|
|
755
|
+
|
|
756
|
+
- **version_totals:** each version played in the period, every device together, newest first.
|
|
757
|
+
- **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.
|
|
758
|
+
|
|
759
|
+
Each row has `version_id`, `play_count` and:
|
|
760
|
+
|
|
761
|
+
- **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.
|
|
762
|
+
- **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.
|
|
763
|
+
- **long_frames_per_min:** frames of 50 ms or longer, stutter a player feels, a minute of measured play.
|
|
764
|
+
- **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).
|
|
765
|
+
- **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.
|
|
766
|
+
|
|
767
|
+
Plays 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.
|
|
768
|
+
|
|
769
|
+
### Export everything
|
|
770
|
+
|
|
771
|
+
| Call | What it does |
|
|
772
|
+
| --- | --- |
|
|
773
|
+
| `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`. |
|
|
774
|
+
| `GET /games/:slug/export/download` | The export itself: a .zip (`application/zip`), made as it downloads. |
|
|
775
|
+
|
|
776
|
+
Everything 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.
|
|
777
|
+
|
|
778
|
+
In the .zip:
|
|
779
|
+
|
|
780
|
+
- `README.txt`: what's where.
|
|
781
|
+
- `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.
|
|
782
|
+
- `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.
|
|
783
|
+
- `versions/<version_id>/…`: each version's files, as they were uploaded.
|
|
784
|
+
- `images/<kind>-<image_id>.png` (or `.jpg`, `.webp`): the cover, square cover and gallery pictures that passed review.
|
|
785
|
+
- `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`.
|
|
786
|
+
- `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`.
|
|
787
|
+
- `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.
|
|
788
|
+
- `stats.json`, `reports.json`, `history.json`: as `get_stats` (90 days), `get_reports` and `get_history` answer them.
|
|
789
|
+
|
|
790
|
+
Account-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.
|
|
791
|
+
|
|
792
|
+
## Hosting and credit
|
|
793
|
+
|
|
794
|
+
Everything 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).
|
|
795
|
+
|
|
796
|
+
`hosting_use_this_month`, in `GET /games/:slug/stats` and `GET /games/:slug/database`:
|
|
797
|
+
|
|
798
|
+
- `free_used_pct`: how much of the month's free hosting is used, 0 to 100. `resets_on_date` is when it starts again.
|
|
799
|
+
- `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.
|
|
800
|
+
- `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.
|
|
801
|
+
- `is_paused`, `paused_reason` (`free_used`, `budget_used`, `credit_used`, `no_real_players`, `free_hosting_ended` or `null`) and `paused_at`.
|
|
802
|
+
- `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.
|
|
803
|
+
- `monthly_budget_cents` and `spent_from_credit_cents`: the game's budget and what credit paid for it this month.
|
|
804
|
+
- **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`.
|
|
805
|
+
- **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.
|
|
806
|
+
- 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.
|
|
807
|
+
|
|
808
|
+
**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.
|
|
809
|
+
|
|
810
|
+
**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.
|
|
811
|
+
|
|
812
|
+
**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:
|
|
813
|
+
|
|
814
|
+
- **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.
|
|
815
|
+
- **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.
|
|
816
|
+
- **Relayed data:** $0.20 per GB.
|
|
817
|
+
- **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.
|
|
818
|
+
- **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.
|
|
819
|
+
- **Chat checks:** $0.20 per 1,000 checks of chat between adults, when its game server turns on `adultChatFilterEnabled`.
|
|
820
|
+
|
|
821
|
+
Only 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.
|
|
822
|
+
|
|
823
|
+
**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.
|
|
824
|
+
|
|
825
|
+
**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.
|
|
826
|
+
|
|
827
|
+
**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.
|
|
828
|
+
|
|
829
|
+
**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.
|
|
830
|
+
|
|
831
|
+
**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.
|
|
832
|
+
|
|
833
|
+
**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 → $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).
|
|
834
|
+
|
|
835
|
+
| Call | What it does |
|
|
836
|
+
| --- | --- |
|
|
837
|
+
| `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`. |
|
|
838
|
+
| `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_…`). `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`. |
|
|
839
|
+
| `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. |
|
|
840
|
+
| `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. |
|
|
841
|
+
| `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. |
|
|
842
|
+
| `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. |
|
|
843
|
+
| `POST /credit/plan/stop` | Stop the plan at once; credit stays. Answers the `credit` and `next_steps`. `no_credit_plan` (409) with none. |
|
|
844
|
+
| `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. |
|
|
845
|
+
|
|
846
|
+
## Zaisma Pro
|
|
847
|
+
|
|
848
|
+
Zaisma 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):
|
|
849
|
+
|
|
850
|
+
| | Free | Pro |
|
|
851
|
+
| --- | --- | --- |
|
|
852
|
+
| Storage | 10 GB, or 50 GB once established or paid by card | 500 GB |
|
|
853
|
+
| New data a day | 10 GB, or 25 GB once established or paid by card | 100 GB |
|
|
854
|
+
| Performance checks a day | 20 | 60 |
|
|
855
|
+
|
|
856
|
+
Reviews 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`).
|
|
857
|
+
|
|
858
|
+
| Call | What it does |
|
|
859
|
+
| --- | --- |
|
|
860
|
+
| `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"}`. |
|
|
861
|
+
| `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. |
|
|
862
|
+
| `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. |
|
|
863
|
+
| `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. |
|
|
864
|
+
| `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. |
|
|
865
|
+
|
|
866
|
+
## Storage
|
|
867
|
+
|
|
868
|
+
A game can be any size. What's limited is what an account stores and how much new data it sends in a day:
|
|
869
|
+
|
|
870
|
+
| | Stored | New data a day |
|
|
871
|
+
| --- | --- | --- |
|
|
872
|
+
| A new account | 10 GB | 10 GB |
|
|
873
|
+
| Established (see Standing), or paid by card | 50 GB | 25 GB |
|
|
874
|
+
| Zaisma Pro | 500 GB | 100 GB |
|
|
875
|
+
|
|
876
|
+
Everything 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.
|
|
877
|
+
|
|
878
|
+
An account over its limit keeps its live versions. New uploads must fit: `storage_full` says what to delete.
|
|
879
|
+
|
|
880
|
+
**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.
|
|
881
|
+
|
|
882
|
+
**Past what's included,** set a monthly storage budget. Storage then draws from your credit at 12¢ 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.
|
|
883
|
+
|
|
884
|
+
| Call | What it does |
|
|
885
|
+
| --- | --- |
|
|
886
|
+
| `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. |
|
|
887
|
+
| `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. |
|
|
888
|
+
| `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. |
|
|
889
|
+
| `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. |
|
|
890
|
+
| `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. |
|
|
891
|
+
| `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. |
|
|
892
|
+
| `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. |
|
|
893
|
+
|
|
894
|
+
## Players
|
|
895
|
+
|
|
896
|
+
A signed-in player plays as their Zaisma account in every game, with the same player ID (`player_…`) 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.
|
|
897
|
+
|
|
898
|
+
| Call | What it does |
|
|
899
|
+
| --- | --- |
|
|
900
|
+
| `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`. |
|
|
901
|
+
|
|
902
|
+
A 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.
|
|
903
|
+
|
|
904
|
+
Games 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_…`, 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.
|
|
905
|
+
|
|
906
|
+
In 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`.
|
|
907
|
+
|
|
908
|
+
### Chat
|
|
909
|
+
|
|
910
|
+
Players 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.
|
|
911
|
+
|
|
912
|
+
- **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.
|
|
913
|
+
- **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 }) => …)` brings the others' messages; messages from players this player muted or blocked never come. Show the player's own line when `room.chat` resolves.
|
|
914
|
+
- **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.
|
|
915
|
+
- **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…"), 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.
|
|
916
|
+
- **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.
|
|
917
|
+
- **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.
|
|
918
|
+
|
|
919
|
+
A 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):
|
|
920
|
+
|
|
921
|
+
```js
|
|
922
|
+
const room = await Zaisma.joinRoom();
|
|
923
|
+
const log = document.querySelector("#chat-log");
|
|
924
|
+
const input = document.querySelector("#chat-input");
|
|
925
|
+
const send = document.querySelector("#chat-send");
|
|
926
|
+
const nameOf = (playerId) => room.players.find((player) => player.id === playerId)?.name ?? "Someone";
|
|
927
|
+
function addLine(name, text) {
|
|
928
|
+
const line = document.createElement("div");
|
|
929
|
+
line.textContent = `${name}: ${text}`; // textContent: never as HTML
|
|
930
|
+
log.append(line);
|
|
931
|
+
log.scrollTop = log.scrollHeight;
|
|
932
|
+
}
|
|
933
|
+
input.hidden = send.hidden = !room.canChat;
|
|
934
|
+
room.on("chat", (chat) => addLine(nameOf(chat.fromPlayerId), chat.hasSlur ? "(hidden)" : chat.text));
|
|
935
|
+
async function sendLine() {
|
|
936
|
+
const text = input.value;
|
|
937
|
+
input.value = "";
|
|
938
|
+
try {
|
|
939
|
+
await room.chat(text);
|
|
940
|
+
addLine(room.me.name, text);
|
|
941
|
+
} catch (error) {
|
|
942
|
+
addLine("Zaisma", error.message);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
send.addEventListener("click", sendLine);
|
|
946
|
+
input.addEventListener("keydown", (event) => event.key === "Enter" && sendLine());
|
|
947
|
+
```
|
|
948
|
+
|
|
949
|
+
Every 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.").
|
|
950
|
+
|
|
951
|
+
- **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.
|
|
952
|
+
- **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.
|
|
953
|
+
|
|
954
|
+
Contact 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.
|
|
955
|
+
|
|
956
|
+
## Room connections
|
|
957
|
+
|
|
958
|
+
How 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.
|
|
959
|
+
|
|
960
|
+
### Staying connected
|
|
961
|
+
|
|
962
|
+
- **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).
|
|
963
|
+
- **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.
|
|
964
|
+
- **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.
|
|
965
|
+
- **`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"`.
|
|
966
|
+
- **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).
|
|
967
|
+
|
|
968
|
+
### Dropped players
|
|
969
|
+
|
|
970
|
+
A 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:
|
|
971
|
+
|
|
972
|
+
- **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.
|
|
973
|
+
- **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`.
|
|
974
|
+
- **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.
|
|
975
|
+
- **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`.
|
|
976
|
+
- **`reconnectTimeoutSec: 0`** takes a dropped player out of the match at once (`onLeave`, reason `lost`), as before this option.
|
|
977
|
+
- **`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.
|
|
978
|
+
|
|
979
|
+
Real-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.
|
|
980
|
+
|
|
981
|
+
### Updates
|
|
982
|
+
|
|
983
|
+
A 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 … --publish-when-approved --match-update-mode now`, or Update running games now on the dashboard.
|
|
984
|
+
|
|
985
|
+
- **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.
|
|
986
|
+
- **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.
|
|
987
|
+
- **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) => …)` 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.
|
|
988
|
+
- **Next match:** nothing changes for running matches: a room keeps the version it started on until its match ends.
|
|
989
|
+
- **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`.
|
|
990
|
+
- **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).
|
|
991
|
+
|
|
992
|
+
### Restarts
|
|
993
|
+
|
|
994
|
+
Zaisma restarts its rooms whenever Zaisma itself is updated, and a match carries on:
|
|
995
|
+
|
|
996
|
+
- **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.
|
|
997
|
+
- **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.
|
|
998
|
+
- **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).
|
|
999
|
+
- **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.
|
|
1000
|
+
- **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.
|
|
1001
|
+
|
|
1002
|
+
### Walking away
|
|
1003
|
+
|
|
1004
|
+
Players who walk away stop holding seats and running matches, with no code:
|
|
1005
|
+
|
|
1006
|
+
- **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"`).
|
|
1007
|
+
- **Hidden:** in a real-time room, a game hidden for 2 minutes counts as away.
|
|
1008
|
+
- **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.
|
|
1009
|
+
- **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.
|
|
1010
|
+
|
|
1011
|
+
### Message limits
|
|
1012
|
+
|
|
1013
|
+
- **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.
|
|
1014
|
+
- **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.
|
|
1015
|
+
- **Join and setup data:** up to 4 KB of JSON (`joinData`, `setupData`).
|
|
1016
|
+
- **From the room:** what your game server sends isn't capped, but a player who can't keep up is dropped (below).
|
|
1017
|
+
|
|
1018
|
+
### Ping and the room's clock
|
|
1019
|
+
|
|
1020
|
+
- **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.
|
|
1021
|
+
- **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.
|
|
1022
|
+
- **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.
|
|
1023
|
+
|
|
1024
|
+
### Slow connections
|
|
1025
|
+
|
|
1026
|
+
A 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.
|
|
1027
|
+
|
|
1028
|
+
Before 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.
|
|
1029
|
+
|
|
1030
|
+
### State sync
|
|
1031
|
+
|
|
1032
|
+
An 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.
|
|
1033
|
+
|
|
1034
|
+
- **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.
|
|
1035
|
+
- **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.
|
|
1036
|
+
- **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.
|
|
1037
|
+
- **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.
|
|
1038
|
+
- **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`.
|
|
1039
|
+
|
|
1040
|
+
### Latest-only messages
|
|
1041
|
+
|
|
1042
|
+
`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 }`:
|
|
1043
|
+
|
|
1044
|
+
- **`delivery: "reliable"`** (the default) reaches every player, in order.
|
|
1045
|
+
- **`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.
|
|
1046
|
+
- **`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.
|
|
1047
|
+
- **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.
|
|
1048
|
+
|
|
1049
|
+
### The fast lane to your own server
|
|
1050
|
+
|
|
1051
|
+
`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.
|
|
1052
|
+
|
|
1053
|
+
The wire:
|
|
1054
|
+
|
|
1055
|
+
- **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).
|
|
1056
|
+
- **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.
|
|
1057
|
+
- **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.
|
|
1058
|
+
- **Closing:** the session's close info carries the WebSocket's close codes and reasons (`closeCode` 4000 to 4004, as in [Close codes](#close-codes)).
|
|
1059
|
+
|
|
1060
|
+
A 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.
|
|
1061
|
+
|
|
1062
|
+
### Room error codes
|
|
1063
|
+
|
|
1064
|
+
A 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.
|
|
1065
|
+
|
|
1066
|
+
| Code | Meaning |
|
|
1067
|
+
| --- | --- |
|
|
1068
|
+
| `room_full` | The room has no space for another player. |
|
|
1069
|
+
| `room_closed` | The room isn't taking new players (`room.setOpen(false)`). |
|
|
1070
|
+
| `ended` | The match is over. |
|
|
1071
|
+
| `too_big` | A message over 16 KB, or `joinData` over 4 KB. |
|
|
1072
|
+
| `too_fast` | More messages than the room takes (30 a second, burst of 60). |
|
|
1073
|
+
| `bad_message` | A message the room couldn't read or use. |
|
|
1074
|
+
| `bad_pass` | The player pass wasn't accepted; the SDK gets a new one and tries once more. |
|
|
1075
|
+
| `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. |
|
|
1076
|
+
| `no_hello` | The first message wasn't a hello with a player pass (or, to your own server, a `playerToken`). |
|
|
1077
|
+
| `not_allowed` | Only the game server or the room's host can do that. |
|
|
1078
|
+
| `game_unavailable` | The game can't be played right now. |
|
|
1079
|
+
| `busy` | The room couldn't take the player right now; the SDK tries again soon. |
|
|
1080
|
+
| `kept_out` | The player was removed for the rest of the match. |
|
|
1081
|
+
| `refused` | The game server's `canJoin` turned the player away. |
|
|
1082
|
+
| `room_not_running` | The room isn't running, like one with nobody playing to watch. |
|
|
1083
|
+
| `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. |
|
|
1084
|
+
| `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. |
|
|
1085
|
+
| `account_needed` | The game needs a Zaisma account for multiplayer, and the player is a guest. |
|
|
1086
|
+
| `game_not_open_to_player` | The account is younger than the game's minimum age. |
|
|
1087
|
+
| `blocked_player_here` | Someone the player blocked is in the room; `quickJoin` tries other rooms first. |
|
|
1088
|
+
| `other_version` | The room runs another version of the game (see Updates above). |
|
|
1089
|
+
| `spectators_full` | The room takes no more spectators. |
|
|
1090
|
+
| `spectator_cannot_send` | A spectator tried to send to the room. |
|
|
1091
|
+
| `already_playing` | A player in the room tried to watch it too. |
|
|
1092
|
+
| `bad_origin` | The connection didn't come from the game's own page. |
|
|
1093
|
+
| `send_queue_full` | The SDK's own: more than 60 sends waited while it reconnected, so the oldest were dropped. |
|
|
1094
|
+
| `chat_not_here` | A chat message reached a room whose server doesn't take chat (an older runner). |
|
|
1095
|
+
| `chat_not_allowed` | `room.chat` from a guest, or a player whose chat is set to nobody or paused (`room.canChat` is `false`). |
|
|
1096
|
+
| `chat_empty` | `room.chat` with nothing but spaces. |
|
|
1097
|
+
| `chat_too_long` | `room.chat` over 2000 characters. |
|
|
1098
|
+
| `chat_too_fast` | More than 20 chat messages in 10 seconds from one player. |
|
|
1099
|
+
| `bad_region` | The SDK's own: a `region` that isn't a continent code (`"AF"`, `"AN"`, `"AS"`, `"EU"`, `"NA"`, `"OC"` or `"SA"`). |
|
|
1100
|
+
| `bad_idle_timeout` | The SDK's own: an `idleTimeoutSec` that isn't from 30 to 86400. |
|
|
1101
|
+
| `bad_transport` | The SDK's own: a `transport` that isn't `"websocket"` or `"webtransport"`. |
|
|
1102
|
+
| `zaisma_rooms_not_used` | The SDK's own: the game doesn't use Zaisma rooms, so there are none to join or list. |
|
|
1103
|
+
|
|
1104
|
+
### Close codes
|
|
1105
|
+
|
|
1106
|
+
| Code | Why | What the SDK does |
|
|
1107
|
+
| --- | --- | --- |
|
|
1108
|
+
| `4000` | The match ended (`room.end`, or Zaisma ending it) | Stops: `connectionStatus` `"closed"`, after the `ended` event with its `endReason` |
|
|
1109
|
+
| `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"` |
|
|
1110
|
+
| `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` |
|
|
1111
|
+
| `4003` | The connection stopped answering probes or fell too far behind | Reconnects by itself, as a dropped player |
|
|
1112
|
+
| `4004` | The match switched to a version published `"now"` | Reconnects by itself, or the page reloads the game at the new version (`isReloading`) |
|
|
1113
|
+
| `1012` | The Node runner is restarting | Reconnects by itself, as a dropped player |
|
|
1114
|
+
| `1013` | Zaisma rooms are busy (an `error` with `busy` comes first) | Reconnects by itself, waiting longer each try |
|
|
1115
|
+
|
|
1116
|
+
Any other close (a network drop) reconnects by itself too.
|
|
1117
|
+
|
|
1118
|
+
### Room events
|
|
1119
|
+
|
|
1120
|
+
Every 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.
|
|
1121
|
+
|
|
1122
|
+
| Event | Listener gets |
|
|
1123
|
+
| --- | --- |
|
|
1124
|
+
| `message` | `(message, fromPlayerId)` |
|
|
1125
|
+
| `bytes` | `(bytes, fromPlayerId)` |
|
|
1126
|
+
| `state` | `(state, changes)` |
|
|
1127
|
+
| `players` | `(players)`, each `{ id, name, kind, awayReason }` |
|
|
1128
|
+
| `connectionStatus` | `(connectionStatus)` |
|
|
1129
|
+
| `settings` | `{ isListed, isOpen, friendJoinsEnabled, name, labels, spectatorCount }` |
|
|
1130
|
+
| `ended` | `{ message, endReason }`: `game`, `no_players`, `hosting_paused`, `kept_room_deleted`, `game_unavailable` or `game_server_stopped` |
|
|
1131
|
+
| `ending` | `{ endsAt }` |
|
|
1132
|
+
| `endingCancelled` | `()`: the end `ending` announced is off, since the game's hosting started again; `room.endsAt` is `null` |
|
|
1133
|
+
| `kicked` | `{ message, isKeptOut }` |
|
|
1134
|
+
| `chat` | `{ fromPlayerId, text, hasSwearing, hasSlur, sentAt }`: another player's chat line (see Chat) |
|
|
1135
|
+
| `move` | `{ roomCode, follow(), join(joinOptions) }` |
|
|
1136
|
+
| `moved` | `{ roomCode, fromRoomCode }` |
|
|
1137
|
+
| `idle` | `{ idleStatus, answerTimeoutSec }` |
|
|
1138
|
+
| `away` | `{ awayReason, seatHoldDurationSec }` |
|
|
1139
|
+
| `back` | `{ roomCode, isSeatHeld, rejoin() }` |
|
|
1140
|
+
| `muted` | `(playerIds)` |
|
|
1141
|
+
| `error` | `{ code, message }` |
|
|
1142
|
+
| `versionUpdate` | `{ versionId, appliesAt, isReloading }` |
|
|
1143
|
+
| `roomMessage` | `{ message, senderKind, fromRoomCode, sentAt }`: a room message for a room whose game server has no `onRoomMessage` (see Reaching live rooms) |
|
|
1144
|
+
|
|
1145
|
+
The 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.
|
|
1146
|
+
|
|
1147
|
+
## Sign in with Zaisma
|
|
1148
|
+
|
|
1149
|
+
Players 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`.
|
|
1150
|
+
|
|
1151
|
+
| Call | What it does |
|
|
1152
|
+
| --- | --- |
|
|
1153
|
+
| `GET /sign-in-apps` | Your sign-in apps: `{"id", "name", "kind", "redirect_urls", "issuer_url", "created_at", "updated_at"}`. |
|
|
1154
|
+
| `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). |
|
|
1155
|
+
| `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. |
|
|
1156
|
+
| `DELETE /sign-in-apps/:id` | Delete one for good, with every player's yes to it; answers `removed_sign_in_app_id`. |
|
|
1157
|
+
|
|
1158
|
+
- **The app's `id`** (`sign_in_app_…`) is its OAuth `client_id`.
|
|
1159
|
+
- **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.
|
|
1160
|
+
- **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.
|
|
1161
|
+
- **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.
|
|
1162
|
+
- **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`.
|
|
1163
|
+
- **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_…` 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.
|
|
1164
|
+
- **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.
|
|
1165
|
+
|
|
1166
|
+
## Registered links
|
|
1167
|
+
|
|
1168
|
+
The 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`).
|
|
1169
|
+
|
|
1170
|
+
They'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`:
|
|
1171
|
+
|
|
1172
|
+
- **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.
|
|
1173
|
+
- **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.
|
|
1174
|
+
- **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.
|
|
1175
|
+
- **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.
|
|
1176
|
+
- **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.
|
|
1177
|
+
|
|
1178
|
+
**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`).
|
|
1179
|
+
|
|
1180
|
+
On your own site there's no Zaisma page, so the SDK opens the address the game gives as `ownSiteUrl` straight away.
|
|
1181
|
+
|
|
1182
|
+
## Secrets
|
|
1183
|
+
|
|
1184
|
+
Tokens 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.
|
|
1185
|
+
|
|
1186
|
+
| Call | What it does |
|
|
1187
|
+
| --- | --- |
|
|
1188
|
+
| `GET /games/:slug/secrets` | The game's `secrets`, by name, each `{"name", "set_at"}`: never the value. |
|
|
1189
|
+
| `PUT /games/:slug/secrets/:secret_name` | Set one, replacing any of that name: `{"secret_value"}`. Answers the `secret` and `next_steps`. |
|
|
1190
|
+
| `DELETE /games/:slug/secrets/:secret_name` | Delete one. Answers `deleted_secret_name` and `next_steps`. |
|
|
1191
|
+
|
|
1192
|
+
- **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.
|
|
1193
|
+
- **When it changes:** requests and schedules use the new value from their next call; running rooms get it within a minute.
|
|
1194
|
+
- **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.
|
|
1195
|
+
- **On your own server** the Node runner's `server.secrets` is its environment variables, so set the same names there.
|
|
1196
|
+
- A key reads the names with `game_access` `read` and sets and deletes with `write`.
|
|
1197
|
+
|
|
1198
|
+
## Items and purchases
|
|
1199
|
+
|
|
1200
|
+
What 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.
|
|
1201
|
+
|
|
1202
|
+
### Sell your game once
|
|
1203
|
+
|
|
1204
|
+
A 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).
|
|
1205
|
+
|
|
1206
|
+
- **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".
|
|
1207
|
+
- **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.
|
|
1208
|
+
- **Bought means kept:** owners still play after you make the game unlisted, private or a draft. A takedown still ends it.
|
|
1209
|
+
- **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.
|
|
1210
|
+
- **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.
|
|
1211
|
+
- **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.
|
|
1212
|
+
- **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.
|
|
1213
|
+
|
|
1214
|
+
| Call | What it does |
|
|
1215
|
+
| --- | --- |
|
|
1216
|
+
| `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. |
|
|
1217
|
+
| `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`. |
|
|
1218
|
+
| `DELETE /games/:slug/items/:item_name` (`remove_item`) | Remove one nobody bought or was granted. Answers `removed_item_name` and `next_steps`. |
|
|
1219
|
+
| `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. |
|
|
1220
|
+
| `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`. |
|
|
1221
|
+
| `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`. |
|
|
1222
|
+
| `GET /games/:slug/purchases/:purchase_id` (`get_purchase`) | One `purchase`, with its `receipt`. |
|
|
1223
|
+
| `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). |
|
|
1224
|
+
| `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`. |
|
|
1225
|
+
| `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. |
|
|
1226
|
+
|
|
1227
|
+
- **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.
|
|
1228
|
+
- **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.
|
|
1229
|
+
- **Prices** are in the currency's smallest unit (`price_minor_units`: 199 for $1.99, 300 for ¥300), 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.
|
|
1230
|
+
- **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).
|
|
1231
|
+
- **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.
|
|
1232
|
+
- **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.
|
|
1233
|
+
- **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.
|
|
1234
|
+
- **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.
|
|
1235
|
+
- **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`).
|
|
1236
|
+
- **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`.
|
|
1237
|
+
- A key reads items and purchases with `purchase_access` `read` (read, upload and publish keys) and changes them with `write` (full keys).
|
|
1238
|
+
|
|
1239
|
+
### Getting purchases to your game
|
|
1240
|
+
|
|
1241
|
+
Every 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`.
|
|
1242
|
+
|
|
1243
|
+
| `purchase_delivery` | Who takes the purchase | Who marks it handled |
|
|
1244
|
+
| --- | --- | --- |
|
|
1245
|
+
| `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)`. |
|
|
1246
|
+
| `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. |
|
|
1247
|
+
| `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`). |
|
|
1248
|
+
|
|
1249
|
+
**`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).
|
|
1250
|
+
|
|
1251
|
+
```js
|
|
1252
|
+
Zaisma.items.on("purchase", async (purchase) => {
|
|
1253
|
+
await Zaisma.items.markHandled(purchase.id); // already_handled: another tab took it, so this one skips it
|
|
1254
|
+
if (purchase.itemName === "revive") addRevives(purchase.itemCount);
|
|
1255
|
+
});
|
|
1256
|
+
Zaisma.items.on("refund", async (purchase) => {
|
|
1257
|
+
await Zaisma.items.markHandled(purchase.id);
|
|
1258
|
+
if (purchase.itemName === "revive") removeRevives(purchase.itemCount);
|
|
1259
|
+
});
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
`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`.
|
|
1263
|
+
|
|
1264
|
+
**`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`.
|
|
1265
|
+
|
|
1266
|
+
```js
|
|
1267
|
+
// zaisma-server.js: revives are kept in the player's state
|
|
1268
|
+
export default {
|
|
1269
|
+
onPurchase(state, player, room, purchase) {
|
|
1270
|
+
if (purchase.itemName !== "revive") return;
|
|
1271
|
+
state.players[player.id].reviveCount += purchase.itemCount;
|
|
1272
|
+
},
|
|
1273
|
+
onRefund(state, player, room, purchase) {
|
|
1274
|
+
if (purchase.itemName !== "revive") return;
|
|
1275
|
+
const kept = state.players[player.id];
|
|
1276
|
+
kept.reviveCount = Math.max(0, kept.reviveCount - purchase.itemCount);
|
|
1277
|
+
},
|
|
1278
|
+
};
|
|
1279
|
+
```
|
|
1280
|
+
|
|
1281
|
+
On 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.
|
|
1282
|
+
|
|
1283
|
+
**`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.
|
|
1284
|
+
|
|
1285
|
+
### When Zaisma covers your game
|
|
1286
|
+
|
|
1287
|
+
Zaisma 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:
|
|
1288
|
+
|
|
1289
|
+
- `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.
|
|
1290
|
+
- `"card"` while one of its cards is over the game's corner: the game stays in view and playable.
|
|
1291
|
+
- `null` otherwise, and always outside Zaisma's page (your own site, `play-locally`).
|
|
1292
|
+
|
|
1293
|
+
`Zaisma.page.on("coveredBy", (coveredBy) => …)` hears each change (a wrong event name fails with `unknown_event`):
|
|
1294
|
+
|
|
1295
|
+
```js
|
|
1296
|
+
Zaisma.page.on("coveredBy", (coveredBy) => {
|
|
1297
|
+
if (coveredBy === "sheet") pauseGame();
|
|
1298
|
+
else resumeGame();
|
|
1299
|
+
});
|
|
1300
|
+
```
|
|
1301
|
+
|
|
1302
|
+
## Selling with the buy sheet
|
|
1303
|
+
|
|
1304
|
+
Players 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`.
|
|
1305
|
+
|
|
1306
|
+
**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.
|
|
1307
|
+
|
|
1308
|
+
| Call | What it does |
|
|
1309
|
+
| --- | --- |
|
|
1310
|
+
| `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`. |
|
|
1311
|
+
| `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. |
|
|
1312
|
+
| `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. |
|
|
1313
|
+
| `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. |
|
|
1314
|
+
|
|
1315
|
+
- **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.
|
|
1316
|
+
- **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.
|
|
1317
|
+
- **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.
|
|
1318
|
+
|
|
1319
|
+
**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`:
|
|
1320
|
+
|
|
1321
|
+
- `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.
|
|
1322
|
+
- `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.
|
|
1323
|
+
- `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.
|
|
1324
|
+
|
|
1325
|
+
Every 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`.
|
|
1326
|
+
|
|
1327
|
+
- **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.
|
|
1328
|
+
- **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.
|
|
1329
|
+
- **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.
|
|
1330
|
+
- **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.
|
|
1331
|
+
- **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.
|
|
1332
|
+
- **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.
|
|
1333
|
+
- **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.
|
|
1334
|
+
|
|
1335
|
+
## Kept rooms
|
|
1336
|
+
|
|
1337
|
+
Rooms 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.
|
|
1338
|
+
|
|
1339
|
+
| Call | What it does |
|
|
1340
|
+
| --- | --- |
|
|
1341
|
+
| `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). |
|
|
1342
|
+
| `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()`. |
|
|
1343
|
+
| `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. |
|
|
1344
|
+
| `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. |
|
|
1345
|
+
| `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. |
|
|
1346
|
+
| `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). |
|
|
1347
|
+
| `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. |
|
|
1348
|
+
| `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). |
|
|
1349
|
+
| `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. |
|
|
1350
|
+
| `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. |
|
|
1351
|
+
|
|
1352
|
+
- **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.
|
|
1353
|
+
- **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.
|
|
1354
|
+
- **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.
|
|
1355
|
+
- **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`.
|
|
1356
|
+
- **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.
|
|
1357
|
+
- **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.
|
|
1358
|
+
- **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`).
|
|
1359
|
+
- **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.
|
|
1360
|
+
- **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`.
|
|
1361
|
+
- **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.
|
|
1362
|
+
- A key lists with `game_access` `read` and deletes with `write`.
|
|
1363
|
+
|
|
1364
|
+
## Reaching live rooms
|
|
1365
|
+
|
|
1366
|
+
A 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.
|
|
1367
|
+
|
|
1368
|
+
A 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.
|
|
1369
|
+
|
|
1370
|
+
| Call | What it does |
|
|
1371
|
+
| --- | --- |
|
|
1372
|
+
| `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. |
|
|
1373
|
+
| `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`. |
|
|
1374
|
+
| `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. |
|
|
1375
|
+
| `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_…` ID), going out within a minute after its time; the other field is null. |
|
|
1376
|
+
| `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"}`. |
|
|
1377
|
+
| `DELETE /games/:slug/room-messages/:scheduled_room_message_id` | Cancel one waiting: `is_cancelled`. One that went out is `no_scheduled_room_message`. |
|
|
1378
|
+
| `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. |
|
|
1379
|
+
| `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`. |
|
|
1380
|
+
|
|
1381
|
+
- **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.
|
|
1382
|
+
- **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.
|
|
1383
|
+
- **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.
|
|
1384
|
+
- **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").
|
|
1385
|
+
- A key lists and looks with `game_access` `read`, and sends, kicks and ends with `write`.
|
|
1386
|
+
|
|
1387
|
+
A live event that starts everywhere at 8pm, sent with `send_at`:
|
|
1388
|
+
|
|
1389
|
+
```js
|
|
1390
|
+
// zaisma-server.js
|
|
1391
|
+
export default {
|
|
1392
|
+
setup: () => ({ isBloodMoon: false }),
|
|
1393
|
+
onRoomMessage(state, roomMessage, room) {
|
|
1394
|
+
if (roomMessage.message.kind !== "blood_moon") return;
|
|
1395
|
+
room.broadcast({ kind: "blood_moon", durationSec: roomMessage.message.duration_sec });
|
|
1396
|
+
return { ...state, isBloodMoon: true };
|
|
1397
|
+
},
|
|
1398
|
+
};
|
|
1399
|
+
```
|
|
1400
|
+
|
|
1401
|
+
```bash
|
|
1402
|
+
curl -X POST https://zaisma.com/api/dev/games/frostbound/room-messages \
|
|
1403
|
+
-H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" \
|
|
1404
|
+
-d '{"message": {"kind": "blood_moon", "duration_sec": 600}, "send_at": "2026-11-06T20:00:00Z"}'
|
|
1405
|
+
```
|
|
1406
|
+
|
|
1407
|
+
## A game server's logs
|
|
1408
|
+
|
|
1409
|
+
Everything 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`.
|
|
1410
|
+
|
|
1411
|
+
| Call | What it does |
|
|
1412
|
+
| --- | --- |
|
|
1413
|
+
| `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. |
|
|
1414
|
+
|
|
1415
|
+
- **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`).
|
|
1416
|
+
- **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.
|
|
1417
|
+
- **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.
|
|
1418
|
+
- **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.
|
|
1419
|
+
- **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.
|
|
1420
|
+
- **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.
|
|
1421
|
+
|
|
1422
|
+
## The game database
|
|
1423
|
+
|
|
1424
|
+
Every 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.
|
|
1425
|
+
|
|
1426
|
+
| Call | What it does |
|
|
1427
|
+
| --- | --- |
|
|
1428
|
+
| `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. |
|
|
1429
|
+
| `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`. |
|
|
1430
|
+
| `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. |
|
|
1431
|
+
| `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. |
|
|
1432
|
+
| `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`. |
|
|
1433
|
+
| `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`. |
|
|
1434
|
+
| `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`. |
|
|
1435
|
+
| `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. |
|
|
1436
|
+
|
|
1437
|
+
- **values** fill the `?`s in order: text, numbers, `null`, or `{"blob_base64": "…"}` 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.
|
|
1438
|
+
- **One statement per query**, a trailing `;` is fine. `BEGIN`, `COMMIT`, `ROLLBACK`, `SAVEPOINT`, `RELEASE`, `ATTACH` and `DETACH` are refused: a batch is the transaction.
|
|
1439
|
+
- **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.
|
|
1440
|
+
- **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.
|
|
1441
|
+
- **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.
|
|
1442
|
+
- **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('…')`, 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.
|
|
1443
|
+
- **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.
|
|
1444
|
+
- **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.
|
|
1445
|
+
- **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`).
|
|
1446
|
+
|
|
1447
|
+
## Cloud saves
|
|
1448
|
+
|
|
1449
|
+
A 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.
|
|
1450
|
+
|
|
1451
|
+
| Call | What it does |
|
|
1452
|
+
| --- | --- |
|
|
1453
|
+
| `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). |
|
|
1454
|
+
| `GET /games/:slug/saves/:player_id` | One save: `{"save": {…the 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`. |
|
|
1455
|
+
| `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. |
|
|
1456
|
+
| `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). |
|
|
1457
|
+
| `DELETE /games/:slug/saves/:player_id` | Reset it: the save becomes empty, so the game starts fresh on every device. |
|
|
1458
|
+
| `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"}`. |
|
|
1459
|
+
| `GET /games/:slug/saves/:player_id/copies/:save_copy_id` | One earlier version: `{"save_copy": {…the same, "local_storage_items", "missing_keys", "indexeddb_databases"}}`, whole or with `?keys=`. |
|
|
1460
|
+
| `POST /games/:slug/saves/:player_id/copies/:save_copy_id/restore` | Make it the save again. |
|
|
1461
|
+
|
|
1462
|
+
- **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`).
|
|
1463
|
+
- **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.
|
|
1464
|
+
- **How a save is stored:** one text, `{"save_format_version_number": 1, "local_storage_items": {…}, "indexeddb_databases": […]}`, 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.
|
|
1465
|
+
- **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.
|
|
1466
|
+
- **Values are text**, as localStorage holds them: `"500"`, not `500`, and a list or object as the JSON text the game stores.
|
|
1467
|
+
- **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, …]}`, 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.
|
|
1468
|
+
|
|
1469
|
+
| Tag | Stands for | Written as |
|
|
1470
|
+
| --- | --- | --- |
|
|
1471
|
+
| `num` | A number JSON can't hold: `-0`, `NaN`, `Infinity`, `-Infinity` | `["num", "-0"]` |
|
|
1472
|
+
| `undef` | `undefined` | `["undef"]` |
|
|
1473
|
+
| `bigint` | A BigInt | `["bigint", "12345678901234567890"]` |
|
|
1474
|
+
| `date` | A Date | `["date", time in ms]`, the time a `num` tag for an invalid date |
|
|
1475
|
+
| `regexp` | A RegExp | `["regexp", source, flags]` |
|
|
1476
|
+
| `bytes` | An ArrayBuffer | `["bytes", base64]` |
|
|
1477
|
+
| `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` |
|
|
1478
|
+
| `blob` | A Blob | `["blob", type, base64]` |
|
|
1479
|
+
| `file` | A File | `["file", type, base64, name, lastModified in ms]` |
|
|
1480
|
+
| `map` | A Map | `["map", [[key, value], …]]` |
|
|
1481
|
+
| `set` | A Set | `["set", [item, …]]` |
|
|
1482
|
+
| `obj` | An object with its own `$z` key | `["obj", the object]` |
|
|
1483
|
+
|
|
1484
|
+
- **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:
|
|
1485
|
+
- **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.
|
|
1486
|
+
- **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 `""`.
|
|
1487
|
+
- **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.
|
|
1488
|
+
- **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.
|
|
1489
|
+
- **The cursor** is opaque: pass `next_cursor` back as it came. Anything else is `bad_cursor`.
|
|
1490
|
+
- **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.
|
|
1491
|
+
- **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).
|
|
1492
|
+
- **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.
|
|
1493
|
+
- **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.
|
|
1494
|
+
|
|
1495
|
+
## Webhooks
|
|
1496
|
+
|
|
1497
|
+
Zaisma 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).
|
|
1498
|
+
|
|
1499
|
+
| Call | What it does |
|
|
1500
|
+
| --- | --- |
|
|
1501
|
+
| `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. |
|
|
1502
|
+
| `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`). |
|
|
1503
|
+
| `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. |
|
|
1504
|
+
| `DELETE /webhooks/:id` | Delete one for good, with what was still on its way to it; answers `removed_webhook_id`. |
|
|
1505
|
+
| `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. |
|
|
1506
|
+
| `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`. |
|
|
1507
|
+
|
|
1508
|
+
- **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`).
|
|
1509
|
+
- **endpoint_url:** https on a name (no IP addresses, user names or `#fragment`), and not on Zaisma's own domains. Up to 500 characters.
|
|
1510
|
+
- **event_kinds**, any of:
|
|
1511
|
+
- `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).
|
|
1512
|
+
- `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.
|
|
1513
|
+
- `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.
|
|
1514
|
+
- `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.
|
|
1515
|
+
- `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.
|
|
1516
|
+
- `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).
|
|
1517
|
+
- `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).
|
|
1518
|
+
- `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.
|
|
1519
|
+
- `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`.
|
|
1520
|
+
- `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.
|
|
1521
|
+
- `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.
|
|
1522
|
+
- `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`.
|
|
1523
|
+
- `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.
|
|
1524
|
+
- **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.
|
|
1525
|
+
- **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.
|
|
1526
|
+
- **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.
|
|
1527
|
+
- **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.
|
|
1528
|
+
- **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.
|
|
1529
|
+
- Deleting your account deletes your webhooks.
|
|
1530
|
+
|
|
1531
|
+
A 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.
|
|
1532
|
+
|
|
1533
|
+
### Webhooks to the game server
|
|
1534
|
+
|
|
1535
|
+
With `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.
|
|
1536
|
+
|
|
1537
|
+
```js
|
|
1538
|
+
// zaisma-server.js; set_secret DISCORD_WEBHOOK_URL, and game_server_allowed_hosts ["discord.com"]
|
|
1539
|
+
export default {
|
|
1540
|
+
async onWebhook(event, server) {
|
|
1541
|
+
if (event.kind !== "bug_reported") return;
|
|
1542
|
+
const response = await fetch(server.secrets.DISCORD_WEBHOOK_URL, {
|
|
1543
|
+
method: "POST",
|
|
1544
|
+
headers: { "content-type": "application/json" },
|
|
1545
|
+
body: JSON.stringify({ content: `Bug in ${event.game.title}: ${event.bug_report.summary ?? event.bug_report.player_text}` }),
|
|
1546
|
+
});
|
|
1547
|
+
if (!response.ok) throw new Error(`Discord answered ${response.status}`);
|
|
1548
|
+
},
|
|
1549
|
+
};
|
|
1550
|
+
```
|
|
1551
|
+
|
|
1552
|
+
The 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`).
|
|
1553
|
+
|
|
1554
|
+
- **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.
|
|
1555
|
+
- **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.
|
|
1556
|
+
- **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.
|
|
1557
|
+
- **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"}`.
|
|
1558
|
+
|
|
1559
|
+
## Tester links
|
|
1560
|
+
|
|
1561
|
+
Secret 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.
|
|
1562
|
+
|
|
1563
|
+
Before 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").
|
|
1564
|
+
|
|
1565
|
+
| Call | What it does |
|
|
1566
|
+
| --- | --- |
|
|
1567
|
+
| `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. |
|
|
1568
|
+
| `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`. |
|
|
1569
|
+
| `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`. |
|
|
1570
|
+
| `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. |
|
|
1571
|
+
|
|
1572
|
+
- **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).
|
|
1573
|
+
- **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.
|
|
1574
|
+
- 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.
|
|
1575
|
+
- 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.
|
|
1576
|
+
- Testers' progress stays in their browser (no cloud saves), and the game stays off their Continue playing.
|
|
1577
|
+
- 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.
|
|
1578
|
+
- 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.
|
|
1579
|
+
|
|
1580
|
+
## Covers, gallery pictures and share pictures
|
|
1581
|
+
|
|
1582
|
+
| Call | What it does |
|
|
1583
|
+
| --- | --- |
|
|
1584
|
+
| `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`. |
|
|
1585
|
+
| `DELETE /games/:slug/images/:id` | Remove one; answers `removed_image_id`. |
|
|
1586
|
+
|
|
1587
|
+
**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):
|
|
1588
|
+
|
|
1589
|
+
| Kind | Shape | Shows sharp on the largest screens | At least |
|
|
1590
|
+
| --- | --- | --- | --- |
|
|
1591
|
+
| `cover` | landscape, 16:9 shows best | 2560 by 1440 | 1280 by 720 |
|
|
1592
|
+
| `square` | as wide as it is tall | 1024 by 1024 | 512 by 512 |
|
|
1593
|
+
| `gallery_picture` | any shape, landscape or portrait | 2560 by 1440 | 1280 by 720 (720 by 1280 upright) |
|
|
1594
|
+
| `share` | landscape, 1200 by 630 shows best | 1200 by 630 | 600 by 315 |
|
|
1595
|
+
| `background` | landscape, 1.3 to 2.4 times as wide as tall | 3840 by 2160 | 1600 wide |
|
|
1596
|
+
| `phone_background` | portrait, 1.6 to 2.4 times as tall as wide | 1440 by 3120 | 1600 tall |
|
|
1597
|
+
|
|
1598
|
+
The 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`.
|
|
1599
|
+
|
|
1600
|
+
**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:
|
|
1601
|
+
|
|
1602
|
+
- **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`).
|
|
1603
|
+
- **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.
|
|
1604
|
+
- **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.
|
|
1605
|
+
|
|
1606
|
+
A 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.
|
|
1607
|
+
|
|
1608
|
+
**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.
|
|
1609
|
+
|
|
1610
|
+
```bash
|
|
1611
|
+
curl -X POST "https://zaisma.com/api/dev/games/sky-hopper/images?kind=cover" \
|
|
1612
|
+
-H "Authorization: Bearer $ZAISMA_KEY" --data-binary @cover.png
|
|
1613
|
+
```
|
|
1614
|
+
|
|
1615
|
+
## Seeing it as players do
|
|
1616
|
+
|
|
1617
|
+
Every 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:
|
|
1618
|
+
|
|
1619
|
+
| Call | What it does |
|
|
1620
|
+
| --- | --- |
|
|
1621
|
+
| `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. |
|
|
1622
|
+
|
|
1623
|
+
Nothing 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.
|
|
1624
|
+
|
|
1625
|
+
**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).
|
|
1626
|
+
|
|
1627
|
+
## Backgrounds
|
|
1628
|
+
|
|
1629
|
+
A 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.
|
|
1630
|
+
|
|
1631
|
+
What 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.
|
|
1632
|
+
|
|
1633
|
+
| Call | What it does |
|
|
1634
|
+
| --- | --- |
|
|
1635
|
+
| `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. |
|
|
1636
|
+
| `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`). |
|
|
1637
|
+
| `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. |
|
|
1638
|
+
| `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. |
|
|
1639
|
+
| `DELETE /games/:slug/shaders/:shader_id` | Remove one; answers `removed_shader_id` and both `backgrounds`. A screen showing it goes back to its default. |
|
|
1640
|
+
| `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`). |
|
|
1641
|
+
| `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. |
|
|
1642
|
+
|
|
1643
|
+
`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.
|
|
1644
|
+
|
|
1645
|
+
**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.
|
|
1646
|
+
|
|
1647
|
+
**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).
|
|
1648
|
+
|
|
1649
|
+
**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)):
|
|
1650
|
+
|
|
1651
|
+
- `image` is the image pass (Shadertoy's Image tab): it draws the background, each frame, after the buffers.
|
|
1652
|
+
- `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.
|
|
1653
|
+
- `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_…" }` (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`).
|
|
1654
|
+
|
|
1655
|
+
Every 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:
|
|
1656
|
+
|
|
1657
|
+
- `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.
|
|
1658
|
+
- `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.
|
|
1659
|
+
|
|
1660
|
+
No 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.
|
|
1661
|
+
|
|
1662
|
+
```glsl
|
|
1663
|
+
// Fewer clouds and no stars on phones: iQuality picks how much to draw.
|
|
1664
|
+
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
1665
|
+
vec2 uv = fragCoord / iResolution.xy;
|
|
1666
|
+
vec3 sky = mix(vec3(0.05, 0.07, 0.2), vec3(0.4, 0.2, 0.5), uv.y);
|
|
1667
|
+
int octaves = 3 + int(iQuality) * 2;
|
|
1668
|
+
float clouds = 0.0, weight = 0.5;
|
|
1669
|
+
vec2 p = uv * 3.0 + vec2(iTime * 0.02, 0.0);
|
|
1670
|
+
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; }
|
|
1671
|
+
fragColor = vec4(mix(sky, vec3(0.9), smoothstep(0.55, 0.9, clouds)), 1.0);
|
|
1672
|
+
}
|
|
1673
|
+
```
|
|
1674
|
+
|
|
1675
|
+
**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:
|
|
1676
|
+
|
|
1677
|
+
- 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).
|
|
1678
|
+
- 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.
|
|
1679
|
+
- 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.
|
|
1680
|
+
- 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.
|
|
1681
|
+
|
|
1682
|
+
**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).
|
|
1683
|
+
|
|
1684
|
+
**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.
|
|
1685
|
+
|
|
1686
|
+
```bash
|
|
1687
|
+
curl -X POST "https://zaisma.com/api/dev/games/sky-hopper/images?kind=shader_texture" \
|
|
1688
|
+
-H "Authorization: Bearer $ZAISMA_KEY" --data-binary @nebula.png
|
|
1689
|
+
curl -X POST "https://zaisma.com/api/dev/games/sky-hopper/shader-checks" \
|
|
1690
|
+
-H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" \
|
|
1691
|
+
-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"}]}]}'
|
|
1692
|
+
curl -X PUT "https://zaisma.com/api/dev/games/sky-hopper/backgrounds/wide" \
|
|
1693
|
+
-H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" -d '{"source":"shader","shader_id":"shader_8f3k2m9q1x7c4v6b0n5z"}'
|
|
1694
|
+
```
|
|
1695
|
+
|
|
1696
|
+
## The developer forum
|
|
1697
|
+
|
|
1698
|
+
Where 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.
|
|
1699
|
+
|
|
1700
|
+
- **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.
|
|
1701
|
+
- **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`).
|
|
1702
|
+
- **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.
|
|
1703
|
+
- **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.
|
|
1704
|
+
- **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.
|
|
1705
|
+
- **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`.
|
|
1706
|
+
- **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.
|
|
1707
|
+
- **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).
|
|
1708
|
+
|
|
1709
|
+
| Call | What it does |
|
|
1710
|
+
| --- | --- |
|
|
1711
|
+
| `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 «like this». `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`. |
|
|
1712
|
+
| `GET /forum/similar?search_text=` | Topics and known issues that look like a title, while you write one. |
|
|
1713
|
+
| `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`. |
|
|
1714
|
+
| `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. |
|
|
1715
|
+
| `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`. |
|
|
1716
|
+
| `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`. |
|
|
1717
|
+
| `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. |
|
|
1718
|
+
| `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`. |
|
|
1719
|
+
| `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. |
|
|
1720
|
+
| `POST /forum/:id/posts/:post/helpful` | Deprecated: works as a like (`PUT …/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). |
|
|
1721
|
+
| `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`. |
|
|
1722
|
+
| `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. |
|
|
1723
|
+
| `POST /forum/:id/follow` | Follow a topic; `DELETE` stops. Your own topics and ones you reply to are followed already. |
|
|
1724
|
+
| `POST /forum/:id/answer` | On your own question, the reply that answered it: `{"answer_post_id"}` (`null` clears it). |
|
|
1725
|
+
| `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. |
|
|
1726
|
+
| `GET /forum/:id/media/:media` | An image in a post you can see. |
|
|
1727
|
+
| `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`. |
|
|
1728
|
+
|
|
1729
|
+
- **`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`).
|
|
1730
|
+
- **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.
|
|
1731
|
+
- Up to 100 posts a day per account: new topics and replies alike (`remaining_post_count`).
|
|
1732
|
+
- Deleting your account deletes your topics, posts, votes, likes and dislikes, bookmarks, flags and images; a known issue you started stays, without your name.
|
|
1733
|
+
- The first feedback calls (`/feedback`) are gone: they answer `410` with `gone`, pointing here.
|
|
1734
|
+
|
|
1735
|
+
## Uploading versions
|
|
1736
|
+
|
|
1737
|
+
The `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).
|
|
1738
|
+
|
|
1739
|
+
Files are stored once, by their SHA-256, and shared by every version that has them, so an update only sends what changed.
|
|
1740
|
+
|
|
1741
|
+
| Call | What it does |
|
|
1742
|
+
| --- | --- |
|
|
1743
|
+
| `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`). |
|
|
1744
|
+
| `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. |
|
|
1745
|
+
| `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`. |
|
|
1746
|
+
| `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`. |
|
|
1747
|
+
| `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`. |
|
|
1748
|
+
| `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`). |
|
|
1749
|
+
| `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`, `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). |
|
|
1750
|
+
| `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. |
|
|
1751
|
+
| `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`. |
|
|
1752
|
+
| `DELETE /games/:slug/versions/:id/publish` | Cancel a publish-later, and its big update mark. Answers with the `game` and the `version`. |
|
|
1753
|
+
| `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`. |
|
|
1754
|
+
|
|
1755
|
+
- 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.
|
|
1756
|
+
- 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.
|
|
1757
|
+
- 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.
|
|
1758
|
+
- 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.
|
|
1759
|
+
- 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.
|
|
1760
|
+
- Publishing makes it the version players get. We keep the live version plus the last 5 that passed, for rolling back.
|
|
1761
|
+
- Drafts nobody publishes are deleted after 30 days, and files no version uses after a day. Held and rejected versions are kept.
|
|
1762
|
+
- Publishing doesn't change visibility: a draft game stays hidden until you set it to `listed` or `unlisted`.
|
|
1763
|
+
|
|
1764
|
+
### How it started in Chrome
|
|
1765
|
+
|
|
1766
|
+
A 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.
|
|
1767
|
+
|
|
1768
|
+
| Field | What it holds |
|
|
1769
|
+
| --- | --- |
|
|
1770
|
+
| `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). |
|
|
1771
|
+
| `checked_at` | When the run finished, or `null`. |
|
|
1772
|
+
| `browser_description` | Where it ran, like `Chrome 141 on a computer with no graphics card`. |
|
|
1773
|
+
| `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. |
|
|
1774
|
+
| `start_download_size_bytes`, `start_file_count` | What was downloaded before the first frame, as sent (compressed), and how many files. |
|
|
1775
|
+
| `start_memory_size_bytes` | JavaScript and WebAssembly memory 5 seconds after the first frame; graphics memory isn't counted. |
|
|
1776
|
+
| `longest_start_task_duration_ms` | The longest the page froze in one go while starting. |
|
|
1777
|
+
| `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. |
|
|
1778
|
+
|
|
1779
|
+
`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.
|
|
1780
|
+
|
|
1781
|
+
| Code | Meaning |
|
|
1782
|
+
| --- | --- |
|
|
1783
|
+
| `error_at_start` | The game threw an error while starting (up to 5, with the file and line). |
|
|
1784
|
+
| `missing_file_at_start` | The game asked for a file that isn't in the version while starting. |
|
|
1785
|
+
| `blocked_at_start` | An address the game loaded or connected to was blocked while starting. |
|
|
1786
|
+
| `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. |
|
|
1787
|
+
| `big_download_at_start` | Players download 200 MB or more before the first frame. |
|
|
1788
|
+
| `long_freeze_at_start` | The page froze for 2 seconds or more in one go while starting. |
|
|
1789
|
+
| `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. |
|
|
1790
|
+
| `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). |
|
|
1791
|
+
| `models_could_be_smaller` | 8 MB or more of glTF models with no mesh compression (meshopt or Draco). |
|
|
1792
|
+
| `development_build` | An engine's development or debug build, bigger and slower for players: Godot exported with Export With Debug. |
|
|
1793
|
+
|
|
1794
|
+
### Checking a game
|
|
1795
|
+
|
|
1796
|
+
Before 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.
|
|
1797
|
+
|
|
1798
|
+
| Call | What it does |
|
|
1799
|
+
| --- | --- |
|
|
1800
|
+
| `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. |
|
|
1801
|
+
|
|
1802
|
+
Each 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.
|
|
1803
|
+
|
|
1804
|
+
| Code | Kind | Upload fixes | Meaning |
|
|
1805
|
+
| --- | --- | --- | --- |
|
|
1806
|
+
| `no_index_html` | refused | no | There's no index.html at the top. |
|
|
1807
|
+
| `file_type_not_allowed` | refused | no | A file is of a type games can't have. |
|
|
1808
|
+
| `precompressed_file` | refused | yes | A file is pre-compressed (.gz, .br or Unity's .unityweb); the upload command unpacks it. |
|
|
1809
|
+
| `hidden_file` | refused | yes | A file or folder's name starts with a dot; the upload command leaves it out. |
|
|
1810
|
+
| `duplicate_path` | refused | no | Two files share a path (paths don't depend on case). |
|
|
1811
|
+
| `bad_path` | refused | no | A path is absolute, has . or .. or an empty part in it, has control characters or is over 200 characters. |
|
|
1812
|
+
| `file_too_big` | refused | no | A file is over 500 MB. |
|
|
1813
|
+
| `too_many_files` | refused | no | The game has more than 20,000 files. |
|
|
1814
|
+
| `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. |
|
|
1815
|
+
| `outside_address` | broken | no | The code connects to or loads from another site while it runs. |
|
|
1816
|
+
| `address_not_allowed` | broken | no | The code connects to an address no game can use: plain ws:// or http://, localhost, or an IP address. |
|
|
1817
|
+
| `needs_threads` | broken | no | The build needs threads (SharedArrayBuffer), which games on Zaisma have only in Chrome and Edge. |
|
|
1818
|
+
| `browser_dialog` | broken | no | alert, confirm or prompt, which never show in the game's frame. |
|
|
1819
|
+
| `form_submission` | broken | no | A form, which never submits in the game's frame. |
|
|
1820
|
+
| `file_download` | broken | no | A file download, which the game's frame doesn't allow. |
|
|
1821
|
+
| `outside_link` | broken | no | A link that opens another site or a new window, which the game's frame doesn't allow. |
|
|
1822
|
+
| `outside_frame` | broken | no | A frame of another site, which games can't show. |
|
|
1823
|
+
| `blocked_feature` | broken | no | Camera, microphone, screen capture, location, payments, USB, serial, Bluetooth or HID, which games on Zaisma can't use. |
|
|
1824
|
+
|
|
1825
|
+
`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.
|
|
1826
|
+
|
|
1827
|
+
- **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.
|
|
1828
|
+
- **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.
|
|
1829
|
+
- 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.
|
|
1830
|
+
- **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.
|
|
1831
|
+
|
|
1832
|
+
### Big files
|
|
1833
|
+
|
|
1834
|
+
Files over 95 MB are sent in parts, 50 MB each (the last can be smaller):
|
|
1835
|
+
|
|
1836
|
+
1. `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`).
|
|
1837
|
+
2. `PUT /files/:sha256/parts/:n?upload_id=…` for each part, numbered from 1. Each answers `{"part_number", "etag"}`.
|
|
1838
|
+
3. `POST /files/:sha256/parts/done` with `{"upload_id", "parts": [{"part_number", "etag"}]}`.
|
|
1839
|
+
|
|
1840
|
+
Storage 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.
|
|
1841
|
+
|
|
1842
|
+
Zaisma 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.
|
|
1843
|
+
|
|
1844
|
+
The 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.
|
|
1845
|
+
|
|
1846
|
+
## The upload command
|
|
1847
|
+
|
|
1848
|
+
`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.
|
|
1849
|
+
|
|
1850
|
+
| Command | What it does | Call |
|
|
1851
|
+
| --- | --- | --- |
|
|
1852
|
+
| `zaisma games` | Your games | `GET /games` |
|
|
1853
|
+
| `zaisma new <title> [--slug <slug>]` | Make a game (a draft) | `POST /games` |
|
|
1854
|
+
| `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` |
|
|
1855
|
+
| `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 |
|
|
1856
|
+
| `zaisma upload <folder> --game <slug> [--patch-notes "…"] [--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 |
|
|
1857
|
+
| `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` |
|
|
1858
|
+
| `zaisma versions <slug>` | The game and its versions, with preview links | `GET /games/:slug` |
|
|
1859
|
+
| `zaisma ai-review <slug> <version_id>` | Start a version's AI review without publishing it | `POST /games/:slug/versions/:version_id/ai-review` |
|
|
1860
|
+
| `zaisma publish <slug> <version_id> [--after-review] [--scheduled-publish-at <time>] [--match-update-mode next_match\|now] [--big-update] [--patch-notes "…"]` | Publish, roll back, or publish later | `POST /games/:slug/versions/:id/publish` |
|
|
1861
|
+
| `zaisma unschedule <slug> <version_id>` | Cancel a publish-later | `DELETE /games/:slug/versions/:id/publish` |
|
|
1862
|
+
| `zaisma visibility <slug> listed\|unlisted\|private\|draft` | Who can see the game | `PATCH /games/:slug` |
|
|
1863
|
+
| `zaisma allowed-hosts <slug> [<host> …] [--none]` | The hosts the game server can call; given hosts (or `--none`), sets the whole list | `GET` or `PATCH /games/:slug` |
|
|
1864
|
+
| `zaisma own-servers <slug> [<url> …] [--none]` | The servers the game connects to from players' browsers; given addresses (or `--none`), sets the whole list | `GET` or `PATCH /games/:slug` |
|
|
1865
|
+
| `zaisma links <slug>` | The game's registered links, with who each opens for | `GET /games/:slug` |
|
|
1866
|
+
| `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 |
|
|
1867
|
+
| `zaisma links remove <slug> <link_name>` | Remove a link | `PATCH /games/:slug` with the whole `links` list |
|
|
1868
|
+
| `zaisma secrets <slug>` | The game's secrets' names and when each was set | `GET /games/:slug/secrets` |
|
|
1869
|
+
| `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` |
|
|
1870
|
+
| `zaisma secrets delete <slug> <secret_name>` | Delete a secret | `DELETE /games/:slug/secrets/:secret_name` |
|
|
1871
|
+
| `zaisma items <slug>` | The game's items, each one's kind, category and price, and its refund policy | `GET /games/:slug/items` |
|
|
1872
|
+
| `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` |
|
|
1873
|
+
| `zaisma items remove <slug> <item_name>` | Remove an item nobody owns | `DELETE /games/:slug/items/:item_name` |
|
|
1874
|
+
| `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` |
|
|
1875
|
+
| `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` |
|
|
1876
|
+
| `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` |
|
|
1877
|
+
| `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` |
|
|
1878
|
+
| `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` |
|
|
1879
|
+
| `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` |
|
|
1880
|
+
| `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` |
|
|
1881
|
+
| `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` |
|
|
1882
|
+
| `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` |
|
|
1883
|
+
| `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` |
|
|
1884
|
+
| `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` |
|
|
1885
|
+
| `zaisma logs <slug> [--follow] [--room-code <code>] [--minimum-level debug\|info\|warn\|error] [--source-kind room\|request\|schedule\|webhook] [--search-text "…"] [--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` |
|
|
1886
|
+
| `zaisma forum [<topic_id>] [--search "words"]` | Your topics and messages, one topic, or a search | `GET /forum`, `GET /forum/:id` |
|
|
1887
|
+
| `zaisma forum post --kind … --title "…" --category … [--text "…"] [--by-me]` | A public topic | `POST /forum` |
|
|
1888
|
+
| `zaisma forum message --kind … --title "…" [--text "…"] [--category …] [--game <slug>] [--by-me]` | A private message to Zaisma | `POST /forum` with `"is_public": false` |
|
|
1889
|
+
| `zaisma forum reply <topic_id> [--text "…"] [--reopen] [--by-me]` | A reply | `POST /forum/:id/posts` |
|
|
1890
|
+
| `zaisma database <slug>` | The game database's tables, indexes and use this month | `GET /games/:slug/database` |
|
|
1891
|
+
| `zaisma database query <slug> ["<sql>"] [--values '[…]']` | Run one statement; the SQL in quotes or piped in, the values as a JSON list | `POST /games/:slug/database/query` |
|
|
1892
|
+
| `zaisma database batch <slug> [<file>]` | Run statements in one transaction, from a JSON file (or piped in) like `[{"sql": "…", "values": […]}]` | `POST /games/:slug/database/batch` |
|
|
1893
|
+
| `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 |
|
|
1894
|
+
| `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 |
|
|
1895
|
+
| `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` |
|
|
1896
|
+
| `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` |
|
|
1897
|
+
| `zaisma saves <slug> [--cursor <next_cursor>]` | The players with a save, 100 a page | `GET /games/:slug/saves` |
|
|
1898
|
+
| `zaisma saves get <slug> <player_id> [--keys '[…]']` | One save; `--keys` a JSON list of localStorage keys | `GET /games/:slug/saves/:player_id` |
|
|
1899
|
+
| `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` |
|
|
1900
|
+
| `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` |
|
|
1901
|
+
| `zaisma saves reset <slug> <player_id>` | Reset a save | `DELETE /games/:slug/saves/:player_id` |
|
|
1902
|
+
| `zaisma saves copies <slug> <player_id>` | A save's earlier versions | `GET /games/:slug/saves/:player_id/copies` |
|
|
1903
|
+
| `zaisma saves copy <slug> <player_id> <save_copy_id> [--keys '[…]']` | One earlier version | `GET /games/:slug/saves/:player_id/copies/:id` |
|
|
1904
|
+
| `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` |
|
|
1905
|
+
| `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` |
|
|
1906
|
+
| `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 |
|
|
1907
|
+
|
|
1908
|
+
- **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`).
|
|
1909
|
+
- **`--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": …, "messages": … }`. Without `--json`, the command prints lines for people, and errors go to stderr as `zaisma: <message> <fix> (<code>)`.
|
|
1910
|
+
- **`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.
|
|
1911
|
+
- **`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.
|
|
1912
|
+
- **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`.
|
|
1913
|
+
- **`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.
|
|
1914
|
+
- **`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.
|
|
1915
|
+
- **`--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.
|
|
1916
|
+
- `--text` can be piped in instead; `--by-me` marks a post as yours, otherwise it says your AI wrote it.
|
|
1917
|
+
- `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`).
|
|
1918
|
+
- `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.
|
|
1919
|
+
- `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`.
|
|
1920
|
+
- `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.
|
|
1921
|
+
|
|
1922
|
+
Exit codes, the same for every command:
|
|
1923
|
+
|
|
1924
|
+
| Exit code | Name | Means |
|
|
1925
|
+
| --- | --- | --- |
|
|
1926
|
+
| 0 | `done` | Done. For upload: the version passed the scan. |
|
|
1927
|
+
| 1 | `failed` | It didn't work: Zaisma refused the call or couldn't be reached. The error says why and what to do. |
|
|
1928
|
+
| 2 | `wrong_command` | The command line is wrong (an unknown command, flag or choice, or a missing argument), so nothing was sent. |
|
|
1929
|
+
| 3 | `held` | upload: the version is held for a person at Zaisma to look at, usually within a day. |
|
|
1930
|
+
| 4 | `rejected` | upload: the version was rejected. Its review_reason and findings say why and how to fix it. |
|
|
1931
|
+
| 5 | `still_scanning` | upload: the version was still being scanned after 10 minutes. Check it later with zaisma versions <slug>. |
|
|
1932
|
+
| 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. |
|
|
1933
|
+
|
|
1934
|
+
Errors 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):
|
|
1935
|
+
|
|
1936
|
+
| Code | Means |
|
|
1937
|
+
| --- | --- |
|
|
1938
|
+
| `unknown_command` | There's no command by that name. |
|
|
1939
|
+
| `renamed_command` | The command has a new name; the error names it. |
|
|
1940
|
+
| `renamed_field` | The flag has a new name; the error names it. |
|
|
1941
|
+
| `repeated_field` | A flag was given twice. |
|
|
1942
|
+
| `missing_value` | A flag that takes a value was given none. |
|
|
1943
|
+
| `takes_no_value` | A flag that takes no value was given one. |
|
|
1944
|
+
| `conflicting_flags` | Two flags that don't go together were given, like logs --follow and --cursor. |
|
|
1945
|
+
| `not_a_folder` | The folder to check or upload isn't a folder. |
|
|
1946
|
+
| `not_a_file` | The file given (of statements, a dump to import, or a save) can't be read. |
|
|
1947
|
+
| `file_exists` | database export won't write over a file that's already there. |
|
|
1948
|
+
| `folder_not_empty` | export saves only into a new or empty folder. |
|
|
1949
|
+
| `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. |
|
|
1950
|
+
| `not_a_database` | The .sqlite file to import isn't a SQLite database. |
|
|
1951
|
+
| `unknown_link` | links remove: the game has no link by that name. |
|
|
1952
|
+
| `outside_file_unreachable` | upload: a file the game loads from an outside site couldn't be downloaded, so nothing was sent. |
|
|
1953
|
+
| `too_many_outside_files` | upload: the game loads more than 500 files from outside sites, so nothing was sent. |
|
|
1954
|
+
| `unpack_failed` | upload: a pre-compressed file couldn't be unpacked, so nothing was sent. |
|
|
1955
|
+
| `no_image_pass` | shader: the folder has no image.glsl, the shader's image pass. |
|
|
1956
|
+
| `unknown_shader_file` | A file in a shader's folder isn't one the command reads, or no channel in channels.json names it. |
|
|
1957
|
+
| `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. |
|
|
1958
|
+
| `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. |
|
|
1959
|
+
| `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. |
|
|
1960
|
+
| `local_chrome_failed` | check: the Chrome on this computer couldn't draw the shader. |
|
|
1961
|
+
| `game_server_not_run` | play-locally: npx couldn't run @zaisma/game-server, which runs the game on this computer. |
|
|
1962
|
+
| `server_unreachable` | Zaisma couldn't be reached: no connection, or a wrong ZAISMA_API. |
|
|
1963
|
+
| `unexpected_answer` | Zaisma answered without JSON, like a page from a network in between. |
|
|
1964
|
+
| `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. |
|
|
1965
|
+
| `install_not_confirmed` | skill: nothing was installed, since nobody answered the question: give --yes to install without it. |
|