# Good Browser Games Developer API OpenAPI: /api/v1/openapi.json Human reference: /developers/api Base path: /api/v1 Create a publisher key at /my/api-keys. You must be a publisher member: submitting a game at /submit makes you one, or an admin can add you to an existing publisher. Copy the full key once and save it as GBG_API_KEY in your CI secret store. Only the hash is stored. Revoke it on the same page. Keys belong to the publisher and survive the departure of their creator. All keys have the display prefix gbg_dev_; use the key name and ID to tell keys apart. Audit records include that prefix and the unique key ID. Use Authorization: Bearer with your key. Do not send Cookie or Origin headers. Use a server, terminal, or CI client; browser fetch is not supported. Select only the scopes you need: games:read, games:write, builds:write, stats:read. A build pipeline needs only builds:write. Requests are limited to 600 per key per minute. On 429, wait for Retry-After (60 seconds). Bad credentials return 404 and count toward a 10-failure per-IP minute limit. Every response uses Cache-Control: no-store. JSON bodies have a 2 MiB limit. ## Read games GET /api/v1/games?limit=100&offset=0 returns games and nextOffset. Continue until nextOffset is null. Use each game's id in subsequent calls. GET /api/v1/games/{id} returns {game, mediaLinks}, including status, buildId and embedUrl. ## Edit details PATCH /api/v1/games/{id} with application/json. For example: {"title":"My game","orientation":"landscape"} Draft, submitted, qa_review, playable and published games can be edited; rejected and archived games return 409. Edits to a published game go live at once and notify our operators. Images and media links follow the same rule. A new title or shortDescription replaces any search title or description we wrote for the page. Omitted fields are preserved. See GamePatch in OpenAPI for all names and lengths. URLs must use HTTPS. iframeUrl must be embeddable and cannot be edited while there is a hosted build. Empty strings clear optional URLs; null is rejected. officialUrl is optional; a hosted game needs only its build. Tags, category, withdrawal and admin fields are outside v1; admins set them in review. ## Create a game POST /api/v1/games with application/json (scope games:write). For example: {"title":"My game","shortDescription":"A short pitch.","orientation":"portrait"} Only title is required. The body takes the GamePatch fields. The 201 response is {game}; the game is in submitted status for review. Use its id to upload images and a build (below). Admins review and publish the game. ## Images Upload the cover, thumbnail and screenshots that show on the game page and browse cards. A game needs a cover and a thumbnail before it can be published. Same status rule as edits (409). A published game must keep at least one cover and one thumbnail; add the new one before removing the old (409 otherwise). At most 20 images per game, including /submit uploads. GET /api/v1/games/{id}/media list images POST /api/v1/games/{id}/media multipart/form-data: file, type, alt_text PATCH /api/v1/games/{id}/media/{mediaId} {"type":"cover","altText":"...","sortOrder":0} DELETE /api/v1/games/{id}/media/{mediaId} 204 file is a PNG, JPEG or WebP of at most 5 MB. type is cover, thumbnail, screenshot (the default), poster or icon. poster is the play screen behind the Play button on the game page; without one we show the cover. You can also set it on the game's Build page under My games. For example, with ORIGIN set to https://goodbrowsergames.com and GAME_ID to the game's id: curl -H "Authorization: Bearer $GBG_API_KEY" -F file=@cover.png -F type=cover -F "alt_text=Title screen" "$ORIGIN/api/v1/games/$GAME_ID/media" ## Media links Link trailers, dev logs, playthroughs and streams that already exist online. They show in a Media section on the game page. YouTube, Twitch and Vimeo URLs embed (the player loads only when a visitor clicks it); other https URLs show as plain links. At most 10 links per game. Same status rule as edits (409). GET /api/v1/games/{id}/media-links list, in display order POST /api/v1/games/{id}/media-links {"url":"https://youtu.be/...","title":"Launch trailer"} GET /api/v1/games/{id}/media-links/{linkId} read one PATCH /api/v1/games/{id}/media-links/{linkId} {"title":"...","url":"...","sortOrder":0} DELETE /api/v1/games/{id}/media-links/{linkId} 204 POST /api/v1/games/{id}/media-links/reorder {"ids":[""]} kind (youtube, twitch, vimeo or link) is detected from the URL. ## Deploy a build The upload script does steps 2 to 4 for you. It needs Node 18+, Bun or Deno: curl -O https://goodbrowsergames.com/developers/upload.mjs GBG_API_KEY=gbg_dev_... node upload.mjs ./build --slug my-game --create --title "My game" --create makes the game through the API when the slug does not exist yet (games:write); after that, pass --game {id} or --slug. The key needs builds:write, plus games:read for --slug. 1. Export an uncompressed HTML5 folder with index.html at its root. 2. POST /api/v1/games/{id}/builds with application/json: {"files":[{"path":"index.html","size":15}]} List every file with its exact byte size. Maximum: 2,000 files, 200 MiB total. A common wrapper folder is removed. OS metadata files are ignored. Starting a new upload removes abandoned uploads; use one build at a time. 3. Read buildId and files from the 201 response. For each returned file, read the local file named from. PUT its raw bytes to /api/v1/games/{id}/builds/{buildId}/files/{path}. Use the returned path, not from. Percent-encode each segment and keep /. Send application/octet-stream and Content-Length when available. A successful PUT returns 204. Use four concurrent uploads; retry failed PUTs at the same URL. 4. POST /api/v1/games/{id}/builds/{buildId}/finalize with no body. The response is {"url":"..."}. Missing or wrong-sized files return 400. The new build becomes live immediately and old files are removed in the background. A published game's new build sends an operator notification. Retrying finalize can send another notification. 5. DELETE /api/v1/games/{id}/build to remove the hosted build (204). This works in every status and can be retried. To patch a live build, read its file set first: GET /api/v1/games/{id}/builds/live (games:read) returns {"build":{"buildId","url","createdAt","fileCount","totalBytes","files":[{"path","size","uploadedAt"}]}}. Files are sorted by path; times are Unix milliseconds. Unfinished uploads are not included. A game without a hosted build returns 404 no_build. Every upload replaces the whole build, so send every file again, not only the changed ones. Build uploads accept editable statuses plus published. Archived/rejected games cannot take uploads. {"dailyChallenge":true|false} tags or untags a game with a daily mode, on any status except archived and rejected. POST /games accepts it too, and every game response includes it. A daily leaderboard (/developers/leaderboards) turns it on. Use relative asset URLs. Builds run on a separate cookie-less play host in an iframe. Threaded builds (SharedArrayBuffer, pthreads) are not supported. For Godot, disable thread support in the Web export. For Unity, use a non-threaded Web build and uncompressed output. For other engines, use standard HTML5 output with plain, uncompressed assets. Do not embed secrets in the game files. ## Read statistics GET /api/v1/games/{id}/stats?from=2026-10-01&to=2026-10-31 returns from, to, daily and totals. Dates are UTC and inclusive, at most 366 days. Without dates, the last 30 days including today are used. Missing days are omitted. Counts: impressions, cardClicks, pageViews, playStarts, iframeLoads, iframeErrors. These are aggregate counts, not unique users. No onsite/outbound split in v1. Play time: activeSeconds is active play credited after server limits, engagedSessions counts sessions with 30 s or more, and players counts distinct players with an engaged session (filled in nightly). playTime gives the median and p75 minutes per engaged session, players, and minutes per player (top 2% dropped), split by confidence. "input" means the game frame reported player input. "focus" means we saw only frame focus and tab visibility, which is less exact. Your own plays, automation and datacenter traffic are left out. Hosted builds report input automatically: the play host adds a small passive script to the build's root index.html. A build that sets its own Content-Security-Policy meta tag is served unchanged. An embedded game can opt in to input confidence with no SDK: at most every 15 s while the player gives input, call window.parent.postMessage({ gbg: "input" }, "https://goodbrowsergames.com"). ## Errors and isolation Errors are JSON {error, message}. 400: invalid input; 403: missing scope or email_unverified (a publisher member must confirm their email before creating a game); 404: invalid/revoked key, forbidden browser headers, or inaccessible game; 409: locked status, media link or image limit; 413: JSON or image too large; 429: key rate limit; 503: storage unavailable. Never retry a rejected edit without checking its cause. Games outside your publisher return 404. Each successful write is audited.