How to download all EU legislation as JSON
Also published on dev.to: How to download all EU legislation as JSON (regulations, directives, decisions)
EUR-Lex is the official home of EU law, but it is built for reading one document at a time. If you need every regulation and directive on a topic, with dates and in-force status, as JSON or CSV, for a compliance tracker, a legal-tech app or a RAG pipeline, there are three ways to do it.
Option 1: the official CELLAR SPARQL endpoint (free, technical)
The Publications Office of the EU runs CELLAR, the database behind EUR-Lex. It has a public SPARQL endpoint at https://publications.europa.eu/webapi/rdf/sparql. No key is needed. A minimal query for regulations adopted in 2025:
PREFIX cdm: <http://publications.europa.eu/ontology/cdm#>
SELECT ?celex ?date WHERE {
?work cdm:resource_legal_id_celex ?celex ;
cdm:work_date_document ?date ;
cdm:work_has_resource-type <http://publications.europa.eu/resource/authority/resource-type/REG> .
FILTER(?date >= "2025-01-01"^^xsd:date && ?date <= "2025-12-31"^^xsd:date)
} ORDER BY DESC(?date) LIMIT 500
It works, but you then need separate queries for titles in your language, entry-into-force dates, EuroVoc subjects, authors and PDF/HTML manifestations, plus paging, de-duplication and corrigenda filtering. Expect a day of work to get it right.
Option 2: EUR-Lex web services (SOAP, registration required)
EUR-Lex offers a SOAP web service for expert search. You need to register for an account, and responses are XML. It suits large institutions more than quick projects.
Option 3: a ready-made EUR-Lex scraper (one click, pay per result)
EUR-Lex Scraper – EU Legislation API on Apify wraps the official CELLAR API and returns one clean JSON row per act:
{
"celex": "32026R1744",
"title": "Regulation (EU) 2026/1744 ... (Digital Omnibus on AI)",
"documentType": "regulation",
"documentDate": "2026-07-08",
"entryIntoForceDate": "2026-07-27",
"inForce": true,
"eurovocDescriptors": ["artificial intelligence", "data protection", "personal data"],
"eliUrl": "http://data.europa.eu/eli/reg/2026/1744/oj",
"pdfUrl": "https://publications.europa.eu/resource/cellar/.../DOC_1"
}
Steps
- Open the Actor and press Try for free. The prefilled search (“artificial intelligence”) returns every EU act with that phrase in its title in a few seconds.
- To download all legislation of a type, leave the keyword empty, choose document types (regulation, directive, decision, recommendation) and a date range. One year at a time works well.
- Pick one of the 24 EU languages. Turn on Include full text if you want the plain text for search or LLM use.
- Export as JSON, CSV or Excel, or call it from code:
from apify_client import ApifyClient
client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("andreaajohansen/eur-lex-cellar").call(run_input={
"documentTypes": ["regulation", "directive"],
"dateFrom": "2025-01-01", "dateTo": "2025-12-31",
"inForceStatus": "in_force", "maxResults": 2000,
})
acts = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(len(acts), acts[0]["celex"], acts[0]["title"][:80])
Cost: $0.01 per run plus $1 per 1,000 acts, so a full year of regulations costs a few dollars.
Is it allowed?
Yes. EU legal documents may be reused, including commercially, under Commission Decision 2011/833/EU, as long as you credit the source and do not distort the content. The Actor credits the Publications Office in every row and never calls the eur-lex.europa.eu website itself.
Tips
- CELEX numbers encode the type:
32016R0679is a Regulation (R) from 2016 (the GDPR);Lis a directive,Da decision. - For monitoring, schedule a weekly run with
dateFromset to last week and send new acts to Slack or Google Sheets. - Keyword search matches whole words in titles. For broad topics also try the EuroVoc term, such as “personal data”.
Run it from Python
A ready-to-run example is in notebooks/eur_lex_cellar.py. It reads your token from the APIFY_TOKEN environment variable.