REST API · OpenAPI 3.0.3
Call the OpenCaseLaw corpus from any language
29 documented HTTP routes covering search, citation graph, statute lookup, doctrine timelines, and exports. Free. No API key. CORS enabled (Access-Control-Allow-Origin: *). Same backend that powers Claude, ChatGPT, the Word add-in, and opencaselaw.ch/search.
Quickstart — search the corpus
curl -s "https://mcp.opencaselaw.ch/api/decisions?q=Mietrecht+K%C3%BCndigung&limit=5"
Returns:
{
"total": 1006,
"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
}
total is the exact number of decisions matching your query (capped at 10,000 — broader text searches report 10000 as a floor). Results are relevance-ranked: the most relevant come first, and you can page the top matches via offset until has_more is false. To retrieve every decision of a very large result set, narrow with court, canton, date_from/date_to or language filters — those give exact totals and page through the full set (e.g. ?court=bger&date_from=2024-01-01 → 17,707 decisions).
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, …" }
]
}
Common parameters
| Param | Used by | Notes |
|---|---|---|
| q | all search endpoints | Free-text query, interchangeable with query (on /decisions, /laws/search, /commentaries/search, /scholarship/search, /legislation/search, /materialien, /search-botschaft). On /decisions it is relevance-ranked; total is the exact match count (capped at 10,000), and filters (court/canton/date_from) page through the full set. Boolean operators (AND, OR, NOT), exact phrases ("…"), docket numbers, BGE references. |
| query | all search endpoints | Canonical name for the free-text query; q is an accepted alias everywhere. |
| limit | everywhere | 1–50, default 10 (decisions) / 20 (laws). |
| offset | /decisions · /laws/search | For pagination. ?offset=20&limit=20 = page 2. |
| 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. |
| level | /laws/search | 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.
- 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.
Schema, parameter docs and example responses are auto-generated in openapi.json. Validated against Microsoft Power Platform / Copilot Studio's WADL converter (2026-04-25, with LALIVE) — same connector used in the Microsoft Word add-in.
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).