<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[GTMFM Data]]></title><description><![CDATA[GTMFM Data]]></description><link>https://gtmfmdata.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 23:19:56 GMT</lastBuildDate><atom:link href="https://gtmfmdata.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to download all EU legislation as JSON (regulations, directives, decisions)]]></title><description><![CDATA[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…]]></description><link>https://gtmfmdata.hashnode.dev/how-to-download-all-eu-legislation-as-json-regulations-directives-decisions</link><guid isPermaLink="true">https://gtmfmdata.hashnode.dev/how-to-download-all-eu-legislation-as-json-regulations-directives-decisions</guid><category><![CDATA[#OpenData]]></category><category><![CDATA[Python]]></category><category><![CDATA[EU]]></category><category><![CDATA[legal]]></category><dc:creator><![CDATA[GTMFM Data]]></dc:creator><pubDate>Tue, 01 Dec 2026 08:02:05 GMT</pubDate><content:encoded><![CDATA[<p>EUR-Lex is the official home of EU law, but it is built for reading one document at a time. If you need <strong>every regulation and directive on a topic, with dates and in-force status, as JSON or CSV</strong>, for a compliance tracker, a legal-tech app or a RAG pipeline, there are three ways to do it.</p>
<h2>Option 1: the official CELLAR SPARQL endpoint (free, technical)</h2>
<p>The Publications Office of the EU runs <strong>CELLAR</strong>, the database behind EUR-Lex. It has a public SPARQL endpoint at <code>https://publications.europa.eu/webapi/rdf/sparql</code>. No key is needed. A minimal query for regulations adopted in 2025:</p>
<pre><code class="language-sparql">PREFIX cdm: &lt;http://publications.europa.eu/ontology/cdm#&gt;
SELECT ?celex ?date WHERE {
  ?work cdm:resource_legal_id_celex ?celex ;
        cdm:work_date_document ?date ;
        cdm:work_has_resource-type &lt;http://publications.europa.eu/resource/authority/resource-type/REG&gt; .
  FILTER(?date &gt;= "2025-01-01"^^xsd:date &amp;&amp; ?date &lt;= "2025-12-31"^^xsd:date)
} ORDER BY DESC(?date) LIMIT 500
</code></pre>
<p>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.</p>
<h2>Option 2: EUR-Lex web services (SOAP, registration required)</h2>
<p>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.</p>
<h2>Option 3: a ready-made EUR-Lex scraper (one click, pay per result)</h2>
<p><a href="https://apify.com/andreaajohansen/eur-lex-cellar">EUR-Lex Scraper - EU Legislation API</a> on Apify wraps the official CELLAR API and returns one clean JSON row per act:</p>
<pre><code class="language-json">{
  "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"
}
</code></pre>
<h3>Steps</h3>
<ol>
<li>Open the Actor and press <strong>Try for free</strong>. The prefilled search ("artificial intelligence") returns every EU act with that phrase in its title in a few seconds.</li>
<li>To download <strong>all</strong> 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.</li>
<li>Pick one of the 24 EU languages. Turn on <strong>Include full text</strong> if you want the plain text for search or LLM use.</li>
<li>Export as JSON, CSV or Excel, or call it from code:</li>
</ol>
<pre><code class="language-python">from apify_client import ApifyClient
client = ApifyClient("&lt;YOUR_APIFY_TOKEN&gt;")
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])
</code></pre>
<p>Cost: $0.01 per run plus $1 per 1,000 acts, so a full year of regulations costs a few dollars.</p>
<h2>Is it allowed?</h2>
<p>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.</p>
<h2>Tips</h2>
<ul>
<li>CELEX numbers encode the type: <code>32016R0679</code> is a Regulation (R) from 2016 (the GDPR); <code>L</code> is a directive, <code>D</code> a decision.</li>
<li>For monitoring, schedule a weekly run with <code>dateFrom</code> set to last week and send new acts to Slack or Google Sheets.</li>
<li>Keyword search matches whole words in titles. For broad topics also try the EuroVoc term, such as "personal data".</li>
</ul>
]]></content:encoded></item></channel></rss>