Requant documentation
Requant Lab API
Everything Requant Lab does is open to programs over HTTP: runs of scenarios, series over many seeds, stories for the map, long-lived worlds on the server, the lab's plans and the live channels. The full reference with curl, Python and TypeScript examples is at requant.network/lab/docs/api.
Address and contract
- Base address:
https://requant.network/lab/api/v1. The version is the first path segment; an incompatible change gets/v2and/v1stays. - Contract: OpenAPI 3.1. Request and result bodies refer to versioned JSON schemas.
- Client: a generated TypeScript client, quantlab.ts: one file without dependencies, a method per operation, event streams as async iterators. It works in the browser, Node 22+ and Deno.
Access
- No key is needed. Without a key, hourly quotas count per address, as for the lab in the browser.
- An API key (
Authorization: Bearer qlk_…) gives a client its own hourly quotas. Keys are issued by the server's owner; an unknown or revoked key gets 401. To ask for one, see Contact. - A world key (
X-QuantLab-World-Key) is given once when a world is created; without it the world is not found.
Operations
| Area | Operations |
|---|---|
| Service | GET /health (queue, counts, limits), GET /openapi.json |
| Scenarios and plans | POST /scenarios/check, POST /plans/compile, POST /plans/amendment, GET /profiles, GET /presets |
| Runs | POST /runs with a TOML scenario, GET /runs/{id}, GET /runs/{id}/events, GET /runs/{id}/{file} |
| Series | POST /series (up to 1,000,000 runs on the fast engine), GET /series/{id}, GET /series/{id}/events, GET /series/{id}/{file} |
| Stories for the map | POST /stories, GET /stories/{id}, GET /stories/{id}/slices/{index} |
| Worlds | POST /worlds, POST /worlds/realtime/{pace}, GET /worlds/{id}, GET /worlds/{id}/events, POST /worlds/{id}/commands, POST /worlds/{id}/amend, GET /worlds/{id}/{file} |
| Live channels | GET /channels, GET /channels/{id}, GET /channels/{id}/now, POST /channels/{id}/impacts |
Event streams are Server-Sent Events. A run's files are the same as the command line writes: report.md, manifest.json, scenario.json, events.jsonl, blocks.jsonl, metrics.csv and summary.json.
Examples
Service state:
curl https://requant.network/lab/api/v1/health
A run of a scenario:
curl -X POST -H "Content-Type: application/toml" --data-binary @scenario.toml \
https://requant.network/lab/api/v1/runs
curl https://requant.network/lab/api/v1/runs/<id>
curl -o summary.json https://requant.network/lab/api/v1/runs/<id>/summary.json
A viewer's impact on a live channel:
curl -X POST -H "Content-Type: application/json" -d '{"kind": "partition"}' \
https://requant.network/lab/api/v1/channels/bitcoin/impacts
Errors and retention
- Every answer outside 2xx is
{"error": "…", "status": code}. 400: the body or the scenario failed validation; 401: unknown or revoked key; 404: no such thing; 409: not possible in the world's state; 413: the body is too big; 429: the hourly quota is used up; 503: the queue is full or the service is busy. - Results are kept for a day, idle worlds for 7 days.