Skip to content

API Base URL

Every code example in these docs is written against one origin:

http://localhost:8731

That is the development origin — the address the dockerized backend listens on when you run Restfall locally (docker compose up; see the repository’s CLAUDE.md). It is not a public server, and nothing outside your machine can reach it.

Pointing at a deployed instance

Against a real deployment, replace the origin and change nothing else. The path, the method, the headers and the body are identical. Where these docs need to name a deployed instance — the MCP connector URL, the webhook-style examples — they write it as:

https://YOUR-RESTFALL-HOST

which is a placeholder, not a real host. Substitute the origin of the instance you play on.

Who can run the examples

An example that sends a token is a script’s request, not the web client’s. A free account’s tokens work only in the web client, so run these with a token a script may use: one from the OAuth flow, or an account with a premium or creator entitlement. See Scripting needs Premium.

Anatomy of a URL

http://localhost:8731/api/v1/towns/
  • Origin — http://localhost:8731 in development, your instance’s origin otherwise.
  • Prefix — /api/v1. Every game endpoint hangs off it. The MCP server (/mcp), the OpenAPI schema (/openapi.json) and the health check sit outside it.
  • Path — the endpoint itself. Copy it exactly, trailing slash and all: a collection route like /api/v1/towns/ ends in a slash and an action route like /api/v1/units/train does not, and a client that does not follow redirects sees the difference as a failed request rather than a 307.

Paths in these docs are written the way the OpenAPI schema writes them, so a path parameter appears as a braced name — /api/v1/towns/{town_id} — that you substitute before sending.

The schema, and no in-app explorer

Every instance publishes its whole API as one OpenAPI document, http://localhost:8731/openapi.json in development and /openapi.json on your instance’s origin otherwise. There is no interactive API explorer on the game’s own origin: download that document and open it in any OpenAPI viewer, or feed it to a client generator. The game’s origin is where the web client keeps its sign-in, so it runs no third-party scripts, and an explorer is built from them.

A development instance (one running with DEBUG on) still serves Swagger UI at /docs and ReDoc at /redoc. A deployed instance answers both with a 404.

Why the examples are not templated

The origin lives in exactly one place in this site’s source (docs/src/lib/api.ts), and prose renders it from there. Fenced code blocks spell it out literally instead, because MDX does not evaluate expressions inside a code fence and an example you cannot copy verbatim is worse than one you can. A CI check (scripts/check_docs_api_paths.py) reads that constant and fails the build if any example anywhere in the docs disagrees with it — so the two cannot drift, and the same check validates that every documented method and path really exists in the generated OpenAPI schema.