pandex
Python client for Pandex: official law and case law from 25 countries and the EU, for AI agents and apps. Search legislation and court decisions, read an article as it stood on any date, follow citations, and see what changed.
- Docs: https://docs.pandex.io
- API reference: https://api.pandex.io/openapi.json
- Free key: https://www.pandex.io/key (without a key: 50 calls a day)
- MCP server:
https://api.pandex.io/mcp
pip install pandex
export PANDEX_API_KEY=px_...
Quick start
from pandex import Pandex
px = Pandex() # or Pandex(api_key="px_...")
found = px.search("right to erasure personal data", jurisdiction="eu", kind="legislation", limit=3)
for hit in found["hits"]:
print(hit["id"], hit["element"], hit["path"])
eu.legislation:32016R0679 art_17 III Rights of the data subject › 3 Rectification and erasure › 17 Right to erasure ('right to be forgotten')
eu.legislation:32016R0679 art_15 III Rights of the data subject › 2 Information and access to personal data › 15 Right of access by the data subject
eu.legislation:32018R1725 art_19 III RIGHTS OF THE DATA SUBJECT › 3 Rectification and erasure › 19 Right to erasure
Every method returns the API's JSON as a typed dict (see pandex.types). Pass text=True to get the answer written for a model to read instead, the same text the MCP tools return.
Read a law as it stood on a date
document takes an id from a result, or a citation as people write it: "BGB", "art. 6:162 BW", a CELEX number, an ECLI.
doc = px.document("Code civil", "1382", at="2015-01-01", history=True, cases=False)
article = doc["elements"][0]
print(doc["id"], article["valid_from"], article["valid_to"])
print(article["text"])
print(doc["history"])
fr.dila_legi:LEGITEXT000006070721 1804-03-21 2016-10-01
Tout fait quelconque de l'homme, qui cause à autrui un dommage, oblige celui par la faute duquel il est arrivé à le réparer.
[['1804-03-21', '2016-10-01'], ['2016-10-01', None]]
One article of a law comes with its leading decisions, those cited most by the other decisions on it:
doc = px.document("art. 6:162 BW")
for line in doc["leading"][:3]:
print(line["id"], line["cited_by"])
nl.rechtspraak:ECLI:NL:HR:2014:2627 389
nl.rechtspraak:ECLI:NL:HR:2011:BU4204 62
nl.rechtspraak:ECLI:NL:HR:2014:1204 77
Citations
cites = px.citations("32016R0679", "art_17", limit=3)
print(cites["total"])
for line in cites["held"]:
print(line["date"], line["id"])
73
2022-02-24 eu.caselaw:62020CJ0175
2019-09-24 eu.caselaw:62017CJ0136
2022-12-08 eu.caselaw:62020CJ0460
direction="out" lists what a document cites instead.
Outline, changes, sources
px.outline("32016R0679", under="chp_iii", lang="en") # chapters and articles with element ids
px.changes("Awb", limit=3) # amended, inserted, repealed articles, newest first
px.changes(jurisdiction="de", since="2026-11-01") # or for a whole country or source
px.sources("lu") # what is held, per source, as of which day
for c in px.changes("Awb", limit=3)["changes"]:
print(c["from"], c["change"], c["label"])
2026-11-10 amended 2 Beroep bij de Afdeling bestuursrechtspraak van de Raad van State
2026-08-15 amended 7 Beroep bij de rechtbank Rotterdam
2026-08-15 amended 11 Hoger beroep bij het College van Beroep voor het bedrijfsleven
Text for a model
print(px.document("BGB", "823", text=True))
Bürgerliches Gesetzbuch
federal law · 1896-08-18 · in force 2026-11-20– · de · cited by 24787
id de.gii:BJNR001950896 · abbr:de=BGB
https://www.gesetze-im-internet.de/bgb/
Buch 2 Recht der Schuldverhältnisse › Abschnitt 8 Einzelne Schuldverhältnisse › Titel 27 Unerlaubte Handlungen
[art_823] 823 Schadensersatzpflicht (wording in force since 2026-11-20)
§ 823
(1) Wer vorsätzlich oder fahrlässig ...
Async
import asyncio
from pandex import AsyncPandex
async def main():
async with AsyncPandex() as px:
found = await px.search("§ 823 BGB", limit=1)
print(found["hits"][0]["id"])
asyncio.run(main())
Errors
A refused call raises PandexError with the HTTP status and a message that says what to pass instead:
from pandex import PandexError
try:
px.document("nonexistent-xyz")
except PandexError as e:
print(e.status, e.message)
# 400 No document found for "nonexistent-xyz". Use search to find it, or pass an id from a search result.
401 means the key is unknown, 429 that its limit is reached.
Frameworks
- LangChain:
langchain-pandex - More examples (OpenAI Agents, Claude Agent SDK, LlamaIndex, Vercel AI SDK): legal-agent-examples
Licence
MIT. The texts themselves come from official publishers under their own terms; px.sources() gives each one's licence.
Metadata
Release files for pandex 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pandex-0.1.0.tar.gz | 8.9 kB | Without provenance | Details for pandex-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pandex-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pandex-0.1.0-py3-none-any.whl |
Total release size: 18.2 kB
Release files / pandex-0.1.0.tar.gz
| Download URL | pandex-0.1.0.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f70f0fada58e81aafbfa65695457f08473276ae5099e9705cdd6efc4c1844b93
|
|
BLAKE2b-256 checksum How to use checksums |
7f563f9e3b6e1cbe80c5f5b0803525fc934538bec5d5342e1a002bbdcc87165c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.18
|
Release files / pandex-0.1.0-py3-none-any.whl
| Download URL | pandex-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ad95b1f948010eed8ac4504326750d1c55df547ae9ad6e6dea1804549319639
|
|
BLAKE2b-256 checksum How to use checksums |
ec7f42227979377fe4eb4a57855b8203a6aaff5668bcd839459f49b78d71a5e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.18
|
Security for pandex 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.