OpenCaseLaw Case Law API

The Case Law API from OpenCaseLaw — 5 operation(s) for case law.

GitHub OpenAPI

Operations 5

GET /lookup Instant case-number lookup #
GET /decisions Search court decisions #
GET /decisions/{decision_id} Get a single decision #
GET /courts List available courts #
GET /statistics Get dataset statistics #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/opencaselaw-ch:opencaselaw-ch-case-law-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

opencaselaw-ch-case-law-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: OpenCaseLaw Case Law API
  description: Swiss court decisions, statutes, commentaries, scholarship, and citation graph. 1,040,000+ published decisions from Swiss federal, cantonal, and regulatory bodies, 5,546 federal laws, 16,400 cantonal acts, 1,100+ commentaries, 51,000+ OA scholarship records.
  version: 1.0.0
servers:
- url: https://mcp.opencaselaw.ch/api
  description: OpenCaseLaw public REST API
- url: /api
  description: Relative — for self-hosted or reverse-proxied deployments
tags:
- name: Case Law
paths:
  /lookup:
    get:
      tags:
      - Case Law
      summary: Instant case-number lookup
      description: Resolve a Swiss case number / docket (e.g. 'BGE 140 III 86', '4A_636/2025', 'WBE.2026.33') straight to the matching decision(s) — an indexed exact match first (tens of ms), a search only for partial or near numbers (`match` says which). Returns lean hits with citation + /entscheid/ link. Use /decisions for topic search; `is_case_number=false` when the input is not a recognised docket. `total` counts returned hits, not all matches; at most 25 hits are returned. Inspect multiple hits for ambiguity; a full page cannot establish exhaustive uniqueness.
      operationId: api_lookup_lookup_get
      parameters:
      - name: q
        in: query
        required: false
        schema:
          type: string
          description: A Swiss case number / docket (BGE/BGer/cantonal)
          title: Q
        description: A Swiss case number / docket (BGE/BGer/cantonal)
      - name: query
        in: query
        required: false
        schema:
          type: string
          description: Alias for `q`.
          title: Query
        description: Alias for `q`.
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 25
          minimum: 1
          default: 8
          title: Limit
      - name: exact
        in: query
        required: false
        schema:
          type: boolean
          description: Only decisions whose own docket or BGE label is the reference (separator-agnostic, alias-aware); no related or citing decisions.
          default: false
          title: Exact
        description: Only decisions whose own docket or BGE label is the reference (separator-agnostic, alias-aware); no related or citing decisions.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /decisions:
    get:
      tags:
      - Case Law
      summary: Search court decisions
      description: 'Full-text search across 1,040,000+ Swiss court decisions. Supports keywords, phrases (in quotes), Boolean operators (AND, OR, NOT), and prefix matching (word*). Each result carries citation_string_{de,fr,it} + canonical_url + rule_statement for copy-ready use in LLM responses. Large pages use compact citation entries. Page with `next_offset` while `has_more` is true. Relevance-ranked text searches use a bounded candidate pool: exhausting pages does not prove corpus completeness. When `total_is_lower_bound` is true, `total` is not an exact count. Filter-only searches can enumerate their matching records.'
      operationId: api_search_decisions_decisions_get
      parameters:
      - name: query
        in: query
        required: false
        schema:
          type: string
          description: 'Search query (FTS5 syntax: keywords, "phrases", AND/OR/NOT). Max 4,000 chars; input over 500 chars is auto-condensed to citations + key terms — send 3-8 precise terms for best results.'
          title: Query
        description: 'Search query (FTS5 syntax: keywords, "phrases", AND/OR/NOT). Max 4,000 chars; input over 500 chars is auto-condensed to citations + key terms — send 3-8 precise terms for best results.'
      - name: q
        in: query
        required: false
        schema:
          type: string
          description: Alias for `query` (the short name used in the public docs / by most clients). `query` wins if both are given.
          title: Q
        description: Alias for `query` (the short name used in the public docs / by most clients). `query` wins if both are given.
      - name: court
        in: query
        required: false
        schema:
          type: string
          description: Filter by court code (e.g., bger, bvger, zh_obergericht)
          title: Court
        description: Filter by court code (e.g., bger, bvger, zh_obergericht)
      - name: canton
        in: query
        required: false
        schema:
          type: string
          description: Filter by canton (CH, ZH, BE, GE, etc.)
          title: Canton
        description: Filter by canton (CH, ZH, BE, GE, etc.)
      - name: language
        in: query
        required: false
        schema:
          type: string
          description: 'Filter by language: de, fr, it, rm — plus en, which reaches ECtHR judgments only (no Swiss case law is in English)'
          title: Language
        description: 'Filter by language: de, fr, it, rm — plus en, which reaches ECtHR judgments only (no Swiss case law is in English)'
      - name: date_from
        in: query
        required: false
        schema:
          type: string
          description: Start date (YYYY-MM-DD)
          title: Date From
        description: Start date (YYYY-MM-DD)
      - name: date_to
        in: query
        required: false
        schema:
          type: string
          description: End date (YYYY-MM-DD)
          title: Date To
        description: End date (YYYY-MM-DD)
      - name: chamber
        in: query
        required: false
        schema:
          type: string
          description: Filter by chamber/division (substring match)
          title: Chamber
        description: Filter by chamber/division (substring match)
      - name: marked_for_publication
        in: query
        required: false
        schema:
          type: boolean
          description: If true, return only Federal Supreme Court rulings flagged for the official BGE collection (Neuheiten '*' = 'für die Publikation vorgesehen') — future leading cases, flagged before the BGE number is assigned. Populated for BGer decisions from mid-2026 onward.
          title: Marked For Publication
        description: If true, return only Federal Supreme Court rulings flagged for the official BGE collection (Neuheiten '*' = 'für die Publikation vorgesehen') — future leading cases, flagged before the BGE number is assigned. Populated for BGer decisions from mid-2026 onward.
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 2000
          minimum: 1
          description: Max results to return
          default: 50
          title: Limit
        description: Max results to return
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          description: Skip results for pagination
          default: 0
          title: Offset
        description: Skip results for pagination
      - name: sort
        in: query
        required: false
        schema:
          type: string
          description: 'Sort: relevance (default), date_desc, date_asc (decision_date), published_desc (newest publication_date first)'
          title: Sort
        description: 'Sort: relevance (default), date_desc, date_asc (decision_date), published_desc (newest publication_date first)'
      - name: published_from
        in: query
        required: false
        schema:
          type: string
          description: Only decisions PUBLISHED on or after this date (YYYY-MM-DD; publication_date, not decision_date). Use for 'newly published' alerts. May be limited to decisions decided up to 18 months earlier (always without a court filter); publication_window_decided_from then names the limit, and an earlier date_from widens it. Decisions without a publication_date never match.
          title: Published From
        description: Only decisions PUBLISHED on or after this date (YYYY-MM-DD; publication_date, not decision_date). Use for 'newly published' alerts. May be limited to decisions decided up to 18 months earlier (always without a court filter); publication_window_decided_from then names the limit, and an earlier date_from widens it. Decisions without a publication_date never match.
      - name: published_to
        in: query
        required: false
        schema:
          type: string
          description: Only decisions published on or before this date (YYYY-MM-DD, inclusive). Requires published_from.
          title: Published To
        description: Only decisions published on or before this date (YYYY-MM-DD, inclusive). Requires published_from.
      - name: fields
        in: query
        required: false
        schema:
          type: string
          description: 'Detail level: full or compact'
          default: full
          title: Fields
        description: 'Detail level: full or compact'
      - name: include_pinpoint
        in: query
        required: false
        schema:
          type: boolean
          description: Attach a pinpoint Erwägung citation to the top 5 full-fields results. Set false to skip the per-result lookup (typically saves 0.2-2 s; more for long or statute-heavy queries).
          default: true
          title: Include Pinpoint
        description: Attach a pinpoint Erwägung citation to the top 5 full-fields results. Set false to skip the per-result lookup (typically saves 0.2-2 s; more for long or statute-heavy queries).
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /decisions/{decision_id}:
    get:
      tags:
      - Case Law
      summary: Get a single decision
      description: Fetch a decision by decision_id or docket number. Returns full text, metadata, and citation_string_{de,fr,it} + canonical_url + rule_statement ready to embed verbatim in an LLM response.
      operationId: api_get_decision_decisions__decision_id__get
      parameters:
      - name: decision_id
        in: path
        required: true
        schema:
          type: string
          description: Decision ID (e.g., bger_6B_1_2025) or docket number (e.g., 6B_1/2025)
          title: Decision Id
        description: Decision ID (e.g., bger_6B_1_2025) or docket number (e.g., 6B_1/2025)
      - name: full_text
        in: query
        required: false
        schema:
          type: boolean
          description: Include full text in response
          default: true
          title: Full Text
        description: Include full text in response
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /courts:
    get:
      tags:
      - Case Law
      summary: List available courts
      description: List all courts with decision counts, decision-date ranges, and language coverage. A court's latest decision date is not its last update.
      operationId: api_list_courts_courts_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /statistics:
    get:
      tags:
      - Case Law
      summary: Get dataset statistics
      description: Aggregate statistics about the dataset. Optionally filter by court, canton, or year. by_year counts decision years; the latest years keep rising as courts publish, so their lower counts are publication lag, not missing data.
      operationId: api_get_statistics_statistics_get
      parameters:
      - name: court
        in: query
        required: false
        schema:
          type: string
          description: Filter by court code
          title: Court
        description: Filter by court code
      - name: canton
        in: query
        required: false
        schema:
          type: string
          description: Filter by canton code
          title: Canton
        description: Filter by canton code
      - name: year
        in: query
        required: false
        schema:
          type: integer
          description: Filter by year
          title: Year
        description: Filter by year
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ValidationError:
      properties:
        loc:
          items:
            type: string
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
          type: object
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError