OpenCaseLaw Statutes API

The Statutes API from OpenCaseLaw — 4 operation(s) for statutes.

GitHub OpenAPI

Operations 4

GET /laws/search Search Swiss statute articles (federal + cantonal) #
GET /laws/{abbreviation} Look up a Swiss law (federal + cantonal) #
GET /laws/{abbreviation}/{canton} Look up a cantonal law by name and canton #
GET /amendment-ref Resolve AS/BBl reference to Fedlex ELI URI #

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-statutes-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-statutes-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: OpenCaseLaw Statutes 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: Statutes
paths:
  /laws/search:
    get:
      tags:
      - Statutes
      summary: Search Swiss statute articles (federal + cantonal)
      description: Unified FTS5 search across statutes.db (federal) and cantonal_laws.db (all 26 cantons).
      operationId: api_search_laws_laws_search_get
      parameters:
      - name: query
        in: query
        required: false
        schema:
          type: string
          description: Search query
          title: Query
        description: Search query
      - name: q
        in: query
        required: false
        schema:
          type: string
          description: Alias for `query`.
          title: Q
        description: Alias for `query`.
      - name: sr_number
        in: query
        required: false
        schema:
          type: string
          description: Restrict to specific federal law by SR
          title: Sr Number
        description: Restrict to specific federal law by SR
      - name: canton
        in: query
        required: false
        schema:
          type: string
          description: Restrict to canton (ZH, BE, …, CH=federal)
          title: Canton
        description: Restrict to canton (ZH, BE, …, CH=federal)
      - name: jurisdiction
        in: query
        required: false
        schema:
          type: string
          description: all | federal | cantonal
          default: all
          title: Jurisdiction
        description: all | federal | cantonal
      - name: language
        in: query
        required: false
        schema:
          type: string
          description: OPTIONAL filter (de/fr/it). Omit to search all three official languages — most laws exist in DE/FR/IT and a filter silently hides valid hits in the others. Set ONLY when the user explicitly asks for one language.
          title: Language
        description: OPTIONAL filter (de/fr/it). Omit to search all three official languages — most laws exist in DE/FR/IT and a filter silently hides valid hits in the others. Set ONLY when the user explicitly asks for one language.
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          maximum: 50
          minimum: 1
          description: Max results
          default: 10
          title: Limit
        description: Max results
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /laws/{abbreviation}:
    get:
      tags:
      - Statutes
      summary: Look up a Swiss law (federal + cantonal)
      description: Look up a federal law by abbreviation/SR or a cantonal law by SR + canton.
      operationId: api_get_law_laws__abbreviation__get
      parameters:
      - name: abbreviation
        in: path
        required: true
        schema:
          type: string
          description: Law abbreviation (e.g., BV, OR, ZGB, StGB) — or '_' for cantonal lookup by SR
          title: Abbreviation
        description: Law abbreviation (e.g., BV, OR, ZGB, StGB) — or '_' for cantonal lookup by SR
      - name: sr_number
        in: query
        required: false
        schema:
          type: string
          description: SR number (e.g., 210 for ZGB)
          title: Sr Number
        description: SR number (e.g., 210 for ZGB)
      - name: article
        in: query
        required: false
        schema:
          type: string
          description: Article number to retrieve (e.g., 8, 41a)
          title: Article
        description: Article number to retrieve (e.g., 8, 41a)
      - name: language
        in: query
        required: false
        schema:
          type: string
          description: 'Language: de, fr, it'
          default: de
          title: Language
        description: 'Language: de, fr, it'
      - name: canton
        in: query
        required: false
        schema:
          type: string
          description: Canton code (CH=federal, ZH, BE, …)
          default: CH
          title: Canton
        description: Canton code (CH=federal, ZH, BE, …)
      - name: as_of
        in: query
        required: false
        schema:
          type: string
          description: 'Past date (YYYY-MM-DD or DD.MM.YYYY): the historical Fedlex edition in force on that date; federal laws only'
          title: As Of
        description: 'Past date (YYYY-MM-DD or DD.MM.YYYY): the historical Fedlex edition in force on that date; federal laws only'
      - name: format
        in: query
        required: false
        schema:
          type: string
          description: 'json (default) or xml — for a single federal article, returns its verbatim Akoma Ntoso XML (application/xml). Issue #22.'
          default: json
          title: Format
        description: 'json (default) or xml — for a single federal article, returns its verbatim Akoma Ntoso XML (application/xml). Issue #22.'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /laws/{abbreviation}/{canton}:
    get:
      tags:
      - Statutes
      summary: Look up a cantonal law by name and canton
      description: 'Cantonal law by abbreviation + canton in either order: /api/laws/GOG/GL or /api/laws/GL/GOG. Same response as /api/laws/{abbreviation}?canton=GL.'
      operationId: api_get_law_cantonal_path_laws__abbreviation___canton__get
      parameters:
      - name: abbreviation
        in: path
        required: true
        schema:
          type: string
          description: Law abbreviation or canton code
          title: Abbreviation
        description: Law abbreviation or canton code
      - name: canton
        in: path
        required: true
        schema:
          type: string
          description: Canton code or law abbreviation — either order
          title: Canton
        description: Canton code or law abbreviation — either order
      - name: article
        in: query
        required: false
        schema:
          type: string
          description: Article / § number to retrieve
          title: Article
        description: Article / § number to retrieve
      - name: language
        in: query
        required: false
        schema:
          type: string
          description: 'Language: de, fr, it (the canton''s publication language)'
          default: de
          title: Language
        description: 'Language: de, fr, it (the canton''s publication language)'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /amendment-ref:
    get:
      tags:
      - Statutes
      summary: Resolve AS/BBl reference to Fedlex ELI URI
      description: Maps an AS or BBl page reference to its Fedlex ELI URI. Backed by materialien.db.amendment_refs (83k+ resolved refs). BBl/FF refs construct to eli/fga/{year}/{page}; AS/RO/RU to eli/oc/{year}/{page}. Each URL is validated against Fedlex's RDF graph via a SPARQL ASK — inner-page citations whose page number is not a first-page document return null with a fedlex_status='inner_page_no_direct_url' note.
      operationId: api_amendment_ref_amendment_ref_get
      parameters:
      - name: ref_type
        in: query
        required: true
        schema:
          type: string
          description: 'Reference type: AS, BBl, RO, RU, FF'
          title: Ref Type
        description: 'Reference type: AS, BBl, RO, RU, FF'
      - name: year
        in: query
        required: true
        schema:
          type: integer
          description: Publication year
          title: Year
        description: Publication year
      - name: page
        in: query
        required: true
        schema:
          type: integer
          description: Page number
          title: Page
        description: Page number
      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