An API for European Union legislation

The API can help you conduct research, create data visualizations or you can even build applications upon it.

This is an application programming interface (API) that opens up core EU legislative data for further use. The interface uses JSON, meaning that you have easy to use machine-readable access to meta data on European Union legislation. It will be useful if you want to use or analyze European Union legislative data in a way that the official databases are not originally build for. The API extracts, organize and connects data from various official sources.

Among other things we have used the data to conduct research on the decision-making time*, analyze voting patterns*, measure the activity of Commissioners* and visualize the legislative integration process over time*, but you can use the API as you want to. When you use it to create something useful or interesting be sure to let us know, if you want to we can post a link to your project from this site.

What data is used?

For most purposes you will be fully satisfied by the official European databases. The most important ones are EUR-Lex, PreLex and OEIL:

  • EUR-Lex contains all documents printed in the Official Journal of the European Union and are dating back to 1951. We have extracted all legislation from the database.

  • PreLex contains many of the same documents as EUR-Lex, the difference is that PreLex focus on the inter-institutional procedures and has information about the different stages in the decision-making process and on law that has not yet been decided upon. PreLex has documents dating back to 1969 and should be complete (with all COM-documents) from 1974. We have extracted all documents from PreLex..

  • OEIL is the database of the European Parliament. Like PreLex it monitors the inter-institutional decision-making process in the European Union, but from the point of view of the European Parliament. OEIL contains useful references to other relevant databases and lets you download dossiers in XML-format. We have used OEIL data for our API at our site It's Your Parliament..


In addition to the above mentioned we have collected voting records from the plenary sessions in the European Parliament and provides an API for this at our site It's Your Parliament. We have also written scripts to fetch and parse the outcome of the voting on legislative acts in the Council of the European Union, these data dates back to 2006.

You should bear in mind that we have selected just the few databases that we find to be the most interesting ones when dealing with European Union legislation and the legislative processes. One could easily complicate the picture further by mentioning The Public Register of Council documents, IPEX, the Rapid database, the Case-law database of Court of Justice or a whole list of other more or less specialized official EU databases.

How do I use it?

You can access the data in JSON format. You can find JSON libraries for most programming languages making it convenient to use if you have just some or little programming skills. The API is organized as described below. We have provided direct links to YQL-consoles for those familiar with YQL. For an overview of the available data you can take a look of our simplified data map/shema.

If you have questions, ideas for improvements or find any errors you are welcome to contact us (contact@buhlrasmussen.eu) and we'll reply as good as we can.

API documentation
Data from EUR-Lex
This part of the API consist of 138.911 documents found using a simple search for all legislation using EUR-Lex. The bibliographic notice for each of these documents has been parsed to extract the meta data given in the API.
The earliest dated document is from 1949-09-24. The newest document is dated 2013-10-04.
eurlex/
document/ - a list of all EUR-Lex documents.

For each document we have obtained information on the form, author, legal basis, directory codes, a reference to the original information at Eur-Lex, the date of the document, the date it was printed in the Official Journal of the European Union and the date of effect and of end of validity, information on relations to other documents, the Eurovoc-descriptor, the subject matter, an URL to the complete text (EN), additional information, the addressee (if any) and possible references to PreLex.

See this regulation on the UN Mission in Kosovo as an example.
author/ - lists the different authors, the number of documents they have drafted and links to a list of these documents.

For an example see the list of documents by the European Central Bank.
Direct link to the YQL Console SELECT * FROM eurlex.author
Enacted EU legislation is categorized by subject in different directory codes (sometimes called classification headings or chapters).

directory_code/ - lists the different directory codes and the number of documents under each code and it links to a list of these documents. As an alternative you can also choose to browse the directory.

For an example see the list of legislation under directory code 07.40.30.00 concerning air safety within the area of transport policy.
Direct link to the YQL Console SELECT * FROM eurlex.directory_code
form/ - lists the different forms of acts, the number of documents in each form and links to a list of these documents. The most well-know forms of EU acts are directives, regulations and decisions.
Direct link to the YQL Console SELECT * FROM eurlex.form
legal_basis/ - contains a list of the different legal bases, the corresponding number of documents and a link to a list of these documents.

As an example you can find documents refering back to article 113 on the common commercial policy in the Treaty Establishing the European Community.
Direct link to the YQL Console SELECT * FROM eurlex.legal_basis
year/ - contains a list of years, the number of documents with a date from that year and a link to a list of the documents.

As an example you can see documents from 1989.
Direct link to the YQL Console SELECT * FROM eurlex.year
Data from PreLex
This part of the API consist of 31.173 documents found using the PreLex search engine. Each dossier has been parsed to extract the meta data given in the API.
The earliest dated document is from 1965-06-25. The newest document is dated 2011-11-30.
prelex/
document/ - a list of all PreLex documents.

For each document we have obtained information on the document number (most often COM-number), the link to the PreLex file and a link to EUR-Lex, the DG responsible, the legal basis, the legislative procedure, the directory codes, the title of the act, the responsible Commissioner, the dates of the different events in the legislative process and any references to EUR-Lex.

For an example see document COM 1990/316 a proposed regulation on products obtained from sour cherries.
Direct link to the YQL Console SELECT * FROM prelex.document
dg_responsible/ - documents grouped by the responsible Directorate General in the European Commission.

See acts by DG Environment as an example.
Direct link to the YQL Console SELECT * FROM prelex.dg_responsible
legal_basis/ - contains a list of the different legal bases, the corresponding number of documents and a link to a list of these documents.

As an example you can find documents refering back to article 113 on the common commercial policy in the Treaty Establishing the European Community.
Direct link to the YQL Console SELECT * FROM prelex.legal_basis
procedure/ - documents grouped by the procedure of the legislative act.

See acts under the assent procedure as an example.
Direct link to the YQL Console SELECT * FROM prelex.procedure
form/ documents grouped by the legislative type. See fx. all directives.
Direct link to the YQL Console SELECT * FROM prelex.form
commissioner/ - documents grouped by the responsible Commissioner. See fx. acts by Neelie Kroes the Commissioner for Digital Agenda.
Direct link to the YQL Console SELECT * FROM prelex.commissioner
year_commission/ - documents grouped by the year of adoption in the European Commission. See fx. documents adopted in 1989.
Direct link to the YQL Console SELECT * FROM prelex.year_commission
year_council/ - documents grouped by the year of adoption in the Council. See fx. documents adopted in 1989.
Direct link to the YQL Console SELECT * FROM prelex.year_council
Data from the Council
These data are found at the website of the Council of the European Union. Here the voting results of votes on legislative acts are made public. The first public voting results found are from 2006-08-01, the latest is from 2011-08-23. In total 590 legislative acts are found and 15.773 votes has been cast. The original source is not easily machine-readable.
council/
year/ - contains a list of years, the number of public votes from that year and a link to a list of the votes. See fx. votes from 2011.
Direct link to the YQL Console SELECT * FROM council.year
country/ - each member state and a link to a list of their votes in Council. See fx. United Kingdom.
Direct link to the YQL Console SELECT * FROM council.country
document/ - a list of all Council votes/documents.
For each vote we have obtained information on the vote title, the document reference, the date of the vote and a link to the original result (pdf). See an example here.
Direct link to the YQL Console SELECT * FROM council.document
Data from Europarl.europa.eu
As part of one of our other projects (itsyourparliament.eu) we are following the activity in the European Parliament. Our dataset contains voting records from 2004 and are updated during every plenary session. In total 8.265.782 votes on 13.358 different issues has been collected. The first votes are from 2004-09-15 latest votes are from 2014-04-17.
itsyourparliament.eu/api/ This is the API we build in connection to out website It's Your Parliament. It contains voting records of the plenary voting in the European Parliament. The data is organized in XML-format and dates back to 2004.

Terms
From our side we don't impose any restrictions on your use of the API. You can mash up with other data sets and pass that on to others. You can sub-license derived works and in generel do whatever you want to with the API. We don't require you to attribute us, but will be very happy if you do so. However you should be aware that the data itself is taken from the mentioned databases and that these databases might impose their terms of use, that we cannot be responsible for. You are responsible yourself to comply with any such third party terms.

For the content that is ours (ie. does not belong to EUR-Lex, PreLex or any other official source) - the API for European Union legislation is made available under the Open Database License: http://opendatacommons.org/licenses/odbl/1.0/. Any rights in individual contents of the database are licensed under the Database Contents License: http://opendatacommons.org/licenses/dbcl/1.0/

No key required

You do no longer need a key to access the API. You can use it free of charge. If you're using it in any way we'd be happy to hear about it, questions are also welcome and can be send to contact@buhlrasmussen.eu - we cannot promise to provide useful answers or help to everyone but we'll try.

Examples

We have constructed a few simple examples showing how to extract data from the API to create simple visualizations.

Legal acts by author

This simple example shows how to draw a pie chart of the legal acts found in EUR-Lex grouped by the author of the acts. The example uses Google Chart tools and the interaction with the API is made with PHP.

Show example | View source
Acts by type

A simple bar chart showing the number of acts of the different legislative types. The example uses Google Chart tools and the interaction with the API is made with PHP.

Show example | View source
Documents by year

Using an annotated timeline this chart shows the number of documents each year. It uses EUR-Lex data and groups documents by the date of the document. The example uses Google Chart tools and the interaction with the API is made with PHP.

Show example | View source
Acts by directory code

This example groups the documents from EUR-Lex after the directory code and visualize it using a treemap. The example uses Google Chart tools and the interaction with the API is made with PHP.

Show example | View source
Number of adoptions each year

Here two lines are drawn representing the number of adoptions in the Commission and in the Council each year. The data is taken from PreLex. The example uses Google Chart tools and the interaction with the API is made with PHP.

Show example | View source
Words in titles

This word-cloud highlights the most frequently used words in the titles of legislative acts from 2011. The example is made using IBM's Many Eyes. The titles of the acts are taken from the API with a very simple PHP script (see source).

Show example | View source
Activity of the Directorate Generals

This bubble-chart shows the different DG's of the European Commission scaled after the number of acts they are responsible for. The example is made using IBM's Many Eyes. The data originates from PreLex and are extracted from the API with a very simple PHP script (see source).

Show example | View source
Result of a vote in the Council

This small example is made to show how you can visualiza a voting result from the Council of the European Union on a map. It takes data from the Council via the API and presents it with Google Chart API.

Show example | View source

What's next?

We are working on various projects related to politics in the European Union. If you have a great idea or even better a source of funding for a forth coming project, don't hesitate to contact us.

You can find out more about us at BuhlRasmussen.eu.