API
Three read-only JSON endpoints. No key, no cookies, no writes, CORS open. They exist because a browser agent cannot play a 3D shooter, but it can read a maze.
/api/maze is the seed the player will
walk into. Responses are deterministic: same URL, same body, until the
generator version changes.GET /api/maps
The seven authored campaign maps, in order, with title, subtitle, theme and intermission lines.
| Field | Meaning |
|---|---|
| count | Always 7 |
| maps[].index | Play order, 1-based |
| maps[].id | Stable id, e.g. 01-foundry |
| maps[].title | Display name, e.g. THE FOUNDRY |
| maps[].subtitle | One-line flavour, e.g. steel remembers the screaming |
| maps[].playUrl | All seven are played from the same URL; progress is client-side |
GET /api/maze?seed=&difficulty=
Describes the maze a seed produces. seed defaults to
nightjar; difficulty is easy,
normal (default) or hard. Seeds are up to 64
printable characters; anything else is a 400.
| Field | Meaning |
|---|---|
| summary | One sentence an assistant can quote directly |
| stats | Rooms, spurs, doors, enemies, medikits, ammo boxes |
| enemiesByType | Counts per enemy type |
| rooms[] | id, kind, theme, outdoor flag, cell rect, route distance from the start |
| guns[] | Which gun sits in which room, and where |
| doors[] | Door cells, and whether a door is the locked vault door |
| floorplan[] | 88 strings of 88 characters: the walkable grid, one char per cell |
| playUrl | Canonical link that presets this seed and skill in the game |
Floorplan legend
# | wall | ' ' | floor |
+ | door | L | locked door |
= | arena seal | S | player start |
o | loot spur centre | A | arena |
X | antechamber | V | vault |
g | gun pickup | k | vault key |
Example, truncated. These numbers are the real response for that seed, not
illustrative ones; if they drift from /api/maze the page is
wrong.
GET /api/maze?seed=nightjar&difficulty=normal
{
"seed": "nightjar",
"difficulty": "normal",
"generatorVersion": 4,
"summary": "74 enemies across 12 rooms and 1 loot spur, 2 doors, 11 medikits and 17 ammo boxes on Normal.",
"stats": { "spineRooms": 12, "spurs": 1, "doors": 2, "enemies": 74,
"medikits": 11, "ammoBoxes": 17 },
"playUrl": "https://seventhgun.com/?seed=nightjar&difficulty=normal",
"floorplan": [
"###########...",
"..."
]
}
GET /api/share?seed=&difficulty=
Just the canonical play URL, for tools that need the link but not the layout. Prefer this to composing a URL by hand: encoding and host stay correct.
Using it from an agent
- Read
/api/mapsif the question is about the campaign. - Call
/api/mazefor a seed, then describe the run fromsummary,statsandgunsrather than from the floorplan, which is for orientation only. - Hand the player
playUrl. Do not invent seed links.
Custom maps are not available here: they live in the URL fragment
(#m=SGMAP.v1.…), which never reaches a server. They only work when
opened in a browser.
Policy
- GET and HEAD only. POST, PUT and DELETE return 405.
- Cached at the edge:
s-maxageis a day for the stable endpoints, an hour for/api/maze. - No rate limiting is applied. Be reasonable; a maze costs a few milliseconds of CPU, and repeated requests for the same URL are served from the edge cache.
- These endpoints are served by the Cloudflare Worker. Self-hosted Node
builds (Docker,
npx, static tarball) serve the text pages but not/api/*. /api/mazeis excluded from robots.txt because its seed space is unbounded, which is not a crawl budget you should spend.