ReferenceHTTP API
HTTP API
The Courthouse's JSON API. Every read is public; every write except asking an ancestor needs the admin token.
2 min readUpdated
In shortFor anyone building on the live family, or reading it from a script
One origin serves the API and the live site. Pick a route in the sidebar for its parameters, response schema, a real example response from a simulated family, code samples, and a playground that sends the request for you.
Basics
- Base URL
- The Courthouse's Sprite URL, e.g.
https://probate-courthouse-….sprites.app. Locally,http://localhost:8080(make apiormake dev). - Format
- JSON in and out. Errors are
{"detail": "…"}with a 4xx status. - Auth
- None for reads and for asking an ancestor. Admin routes need the
X-Probate-Adminheader set toPROBATE_ADMIN_TOKEN. The judge mailroom needs the sharedX-Probate-Keyjudge key, which no admin route accepts. - CORS
- Only
GET /api/summarymay be read from other origins, so the landing page can show who is alive. - Rate limits
- Asking an ancestor: 10 questions a minute per visitor, then
429. - Mode
/healthzand/api/summarysayliveorsimulation. Simulated data is labelled wherever it's shown.
Routes
FamilyThe register, a generation's life, trials, the genome, the evidence and the event feed.AncestorsAsk a dead generation a question.AdminPause and resume births, force a death, decide held items, run the clock once.JudgesNeeds the judge key. Send a real email to the family as the Friend or the Stranger and follow it to its verdict.HealthIs the Courthouse awake, and who is alive.
Examples
curl -s "$COURTHOUSE/api/summary" | jq '{mode, living: .living.name, counts}'
curl -s "$COURTHOUSE/api/trials/latest" | jq '.cases[] | {text, verdict, reason}'The schema these pages are built from is apps/site/openapi.json, exported from the FastAPI app by make api-spec. Its examples come from a real simulated family, not from hand-written samples.
Edit on GitHub
Last updated on