REST API · OpenAPI 3.0.3
Call the OpenCaseLaw corpus from any language
Public research HTTP endpoints for search, citation graphs, statutes and exports. These research endpoints are free, require no API key and support CORS. They use the same backend as MCP and the web search. The full application specification also contains other features.
Automate research from a terminal
Install the lightweight client with pipx or uv. Save bounded search results, retrieve exact passages, resolve citation lists and preserve evidence bundles. The client is published on PyPI as opencaselaw-cli.
pipx install opencaselaw-cli # or: uv tool install opencaselaw-cli ocl --help ocl bundle create 'missbräuchliche Kündigung Rachekündigung' \ --max-results 5 --law OR:336 --out research-bundle
CLI guide: pipelines, bundles and citation resolution →
Quickstart — search the corpus
curl -s "https://mcp.opencaselaw.ch/api/decisions?q=Mietrecht+K%C3%BCndigung&limit=5"
Returns:
{
"total": 1006,
"total_is_lower_bound": false,
"returned": 5,
"results": [
{ "decision_id": "bge_BGE_140_III_86", "court": "bge",
"decision_date": "2014-04-15", "language": "de",
"title": "Mietrecht; …", "regeste": "…",
"citation_string_de": "BGE 140 III 86", "canonical_url": "https://mcp.opencaselaw.ch/entscheid/…" },
…
],
"limit": 5, "offset": 0, "has_more": true, "next_offset": 5
}
Read total_is_lower_bound before treating total as exact. Follow next_offset while has_more is true. A relevance query can exhaust its bounded candidate pool before all matches are returned: has_more: false is not proof of exhaustive research. Filters narrow the selection; for corpus-scale analysis, use the Parquet download.
Quickstart — look up an article
curl -s "https://mcp.opencaselaw.ch/api/laws/OR?article=41"
{
"sr_number": "220",
"abbreviation": "OR",
"title": "Bundesgesetz vom 30. März 1911 …",
"consolidation_date": "2026-01-01",
"language": "de",
"articles": [
{ "article_num": "41", "heading": null,
"text": "1 Wer einem andern widerrechtlich Schaden zufügt, …" }
]
}
Names are matched in DE/FR/IT, case-insensitively and with or without dots and spaces (Cst, OPP2, o.p.p. 2); treaties by common name (IPBPR, KRK, CISG) and former names (OG → BGG, with a note) resolve through the CC0 table law_aliases.json; cantonal acts take their canton in either order: /api/laws/StG/ZH.
Common parameters
| Param | Used by | Notes |
|---|---|---|
| q | all search endpoints | Free-text query; query and q are accepted on decision search. Supports Boolean operators (AND, OR, NOT), exact phrases, docket numbers and BGE references. Relevance results form a bounded candidate pool; check pagination and lower-bound metadata. |
| query | all search endpoints | Free-text query. On /decisions, a non-empty query takes precedence over q. See each endpoint for accepted parameters. |
| limit | everywhere | Defaults and maxima depend on the endpoint. Decision search can reduce response detail or page size. Use the returned count and continuation fields, not the requested limit, to drive pagination. |
| offset | /decisions · /citations/{decision_id} | Pagination offset where supported. Follow the returned next_offset; citation lists expose continuation for each direction. |
| language | /decisions | de / fr / it. Filters by decision language. |
| canton | /decisions · /laws/search | Two-letter cantonal code (ZH, BE, …) or CH for federal. |
| court | /decisions | Court key (bger, bvger, ge_gerichte, …). See /courts. |
| jurisdiction | /laws/search | all, federal or cantonal. |
| article | /laws/{abbreviation} | Article number (e.g. 41, 266l). |
Endpoint reference
- GET/api/decisionsSearch decisions. Returns paginated results with citation strings + canonical URLs.
- GET/api/decisions/{decision_id}Fetch a single decision with full text.
- GET/api/decisions/{decision_id}/export.docxExport as Word document (citation, regeste, structured Erwägungen).
- GET/api/decisions/{decision_id}/export.bibBibTeX entry for LaTeX bibliographies.
- GET/api/decisions/{decision_id}/export.risRIS record for Zotero / EndNote / Mendeley.
- GET/api/decisions/{decision_id}/export.pdfPDF re-render of the decision.
- GET/api/case-brief/{case}Structured brief: facts · reasoning · statutes · authority · related.
- GET/api/structure/{decision_id}Sachverhalt + Erwägungen-paragraphs + Dispositiv + Regeste.
- GET/api/erwaegung/{decision_id}/{e_number}Verbatim Schweizer Citation-Einheit (e.g.
2.3). - GET/api/regeste/{decision_id}Official BGer / BVGer head-note text.
- GET/api/citations/{decision_id}Both directions: what this cites + what cites it.
- GET/api/appeal-chain/{decision_id}Procedural history through the instances.
- GET/api/leading-casesAuthority-ranked decisions for a statute / topic.
- GET/api/citeBuild a server-formatted citation string.
- GET/api/laws/searchFederated FTS5 over federal + cantonal articles. Returns snippets.
- GET/api/laws/{abbreviation}Single article by abbreviation (OR, ZGB, StGB, …).
- GET/api/legislation/searchLexFind catalog search (33,000+ federal + cantonal acts).
- GET/api/legislation/{lexfind_id}Single legislation record.
- GET/api/legislation/changesRecent & upcoming federal-law amendments.
- GET/api/doctrineStatute text + ranked BGEs + doctrine timeline + commentary excerpt.
- GET/api/materialienFederal Council Botschaften — legislative intent.
- GET/api/materialien/{law_code}Materialien for a specific law.
- GET/api/amendment-refResolve "Art. X (revised version Y)" patterns.
- GET/api/commentaries/searchSearch OnlineKommentar + OpenLegalCommentary excerpts.
- GET/api/commentaries/{abbreviation}Commentary index for a law (OR, ZGB, …).
- GET/api/exam-questionReal BGE fact pattern as Fallbearbeitung with hidden analysis.
- GET/api/mock-decisionResearch-only mock decision from facts + caselaw + statutes.
- POST/api/attestAudit a draft response — verifies every BGE / Art. / quoted string against the corpus before it leaves the server. Certifies the draft's own citations, quotations and statute references; it does not certify that no relevant authority is missing.
- GET/api/courtsList all 121 courts (federal, regulatory, international, cantonal).
- GET/api/statisticsAggregate stats — corpus, citation graph, statutes, languages.
- GET/api/scraper-healthPer-source last-run status (drives /coverage).
- GET/api/atom/{court}.xmlAtom feed — newest 50 decisions per court.
The application specification describes the deployed routes; response schema coverage varies. This source version adds a typed public research subset at /api/research/openapi.json. It becomes available only after deployment; see the contract notes.
Rate limits
Soft-limited at the nginx layer to protect the upstream workers. Pace your batch jobs at ≤ 5 requests/second per IP. If you need higher throughput, run the stack locally — full instructions in README (~65 GB disk, ~30 min setup).