OpenCaseLaw Legislation API
The Legislation API from OpenCaseLaw — 3 operation(s) for legislation.
The Legislation API from OpenCaseLaw — 3 operation(s) for legislation.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
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.curl "https://apis.io/api/v1/apis/opencaselaw-ch:opencaselaw-ch-legislation-api"
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.
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: 3.2.0
info:
title: OpenCaseLaw Legislation 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: Legislation
paths:
/legislation/search:
get:
tags:
- Legislation
summary: Search legislation
description: Search Swiss legislation (federal + all 26 cantons) by keyword. Covers 33,000+ legislative texts from LexFind.ch.
operationId: api_search_legislation_legislation_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: canton
in: query
required: false
schema:
type: string
description: Filter by canton (CH, ZH, BE, etc.)
title: Canton
description: Filter by canton (CH, ZH, BE, etc.)
- name: language
in: query
required: false
schema:
type: string
description: OPTIONAL filter (de/fr/it). Omit to return whichever language version the portal indexes — set ONLY when the user explicitly asks for one language.
title: Language
description: OPTIONAL filter (de/fr/it). Omit to return whichever language version the portal indexes — set ONLY when the user explicitly asks for one language.
- name: limit
in: query
required: false
schema:
type: integer
maximum: 60
minimum: 1
description: Max results
default: 20
title: Limit
description: Max results
- name: active_only
in: query
required: false
schema:
type: boolean
description: Only show laws currently in force
default: true
title: Active Only
description: Only show laws currently in force
- name: search_in_content
in: query
required: false
schema:
type: boolean
description: Also search in law text content
default: false
title: Search In Content
description: Also search in law text content
- name: fetch_top_n_texts
in: query
required: false
schema:
type: integer
maximum: 10
minimum: 0
description: If > 0, enrich top N results with parsed full text (max 10)
default: 0
title: Fetch Top N Texts
description: If > 0, enrich top N results with parsed full text (max 10)
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/legislation/changes:
get:
tags:
- Legislation
summary: Browse legislation changes
description: Browse recent legislation changes for a canton or federal level.
operationId: api_browse_legislation_changes_legislation_changes_get
parameters:
- name: canton
in: query
required: false
schema:
type: string
description: Canton code (CH for federal, ZH, BE, etc.)
default: CH
title: Canton
description: Canton code (CH for federal, ZH, BE, etc.)
- name: language
in: query
required: false
schema:
type: string
description: OPTIONAL filter (de/fr/it). Omit to return amendments in whichever language the canton indexes them. Set ONLY when the user explicitly asks for one language.
title: Language
description: OPTIONAL filter (de/fr/it). Omit to return amendments in whichever language the canton indexes them. Set ONLY when the user explicitly asks for one language.
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/legislation/{lexfind_id}:
get:
tags:
- Legislation
summary: Get legislation details
description: Get details for a specific Swiss law by LexFind ID or systematic number.
operationId: api_get_legislation_legislation__lexfind_id__get
parameters:
- name: lexfind_id
in: path
required: true
schema:
type: integer
description: LexFind ID of the law
title: Lexfind Id
description: LexFind ID of the law
- name: systematic_number
in: query
required: false
schema:
type: string
description: SR/systematic number
title: Systematic Number
description: SR/systematic number
- name: canton
in: query
required: false
schema:
type: string
description: Canton for systematic number lookup
default: CH
title: Canton
description: Canton for systematic number lookup
- name: language
in: query
required: false
schema:
type: string
description: 'Language: de, fr, it'
default: de
title: Language
description: 'Language: de, fr, it'
- name: include_versions
in: query
required: false
schema:
type: boolean
description: Include full version history
default: false
title: Include Versions
description: Include full version history
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