mySociety believes in open data for the benefit of everyone.
For many years, our sites have been outputting data — but it wasn’t always obvious where to find it, or how to query it. Now we’ve gathered all our data sources together in one place, making them much easier to explore: data.mysociety.org.
All of mySociety’s projects either run on data or generate data — and frequently they do both.
For example, our Parliamentary website TheyWorkforYou takes in data from various official sources and then republishes it to present Parliamentary proceedings in a way that’s easy to follow.
It also analyses some of that data to output new information such as the number of speeches each MP has made, or which MPs have used a given word or phrase the most times.
Both of these types of data — and lots more from our other sites — are available for anyone to use. They can be extremely useful for both researchers and developers. See our datasets here.
APIs (Application Programming Interface) are a way of querying a database for information. They are typically used by developers, but can also be useful for researchers or journalists pursuing data-driven stories.
We have a number of databases at mySociety: FixMyStreet could be looked at as a huge and ever-growing database of street problems in the UK, neatly divided into category and local authority, while TheyWorkForYou is a massive database of speeches and information about MPs.
The APIs that query mySociety’s databases can be very useful if you are building a site or an app which needs to return tailored information depending on a user’s input: for example, where one of your supporters puts in their postcode, you might return their MP’s name, or their Twitter handle, so that your user can send them a message.
Equally, APIs are useful for research. They can be a way of obtaining bulk information that’s easy to work with in a spreadsheet, or to read programmatically. You might, say, download every Written Answer in Parliament and then analyse the data to find certain keywords, or to discover which MPs ask the most questions on a given topic.
Some of our APIs can be used for free with no restrictions. Others offer free usage to registered charities, up to certain limits. See further down this page for more details. Find current APIs here.
Using APIs does require a degree of coding knowledge (though some mySociety APIs are simpler to use than others — for example the csv files you can download from EveryPolitician are usable in Excel or any other spreadsheet programme). If you have developers working in your organisation, you should find it’s something that they can handle without too much trouble.
But if you don’t have any such contacts, or if you hit problems, please do feel free to drop us a line — when we have time, we will help as much as we can (though note that we are a small organisation and will not always have the resource to do so).
People, politicians and parliaments
TheyWorkForYou covers the UK’s parliaments (currently with the exception of the Welsh Assembly).
Its APIs allow you to obtain data on MPs, MLAs, MSPs, and Lords.
Just a few of the many types of return you can get from this API include:
- Input postcode/s: get the MP/s for that constituency (current or past)
- Input MP/s: get their speeches, written answers, expenses, and data such as how many contributions they’ve made to debates in the last year.
- Input party: get all MPs belonging to that party
- Input date: get list of MPs in position at that time
Many of these APIs require an ID number for the MP you are querying: this can be obtained by putting the MPs’ names into the getMPs API function.
EveryPolitician is an ambitious attempt to gather and freely share data on the world’s politicians. It currently has information on elected officials in most countries’ upper parliaments (or equivalent), and is actively collecting more and deeper data too.
You can obtain politicians’ names, positions, and, where known, contact details, Twitter handles, dates of birth, images and more.
This data is Open Source, free for anyone to use, and available in JSON or CSV formats. Start here.
A common need for campaigners is to match a supporter with a constituency or the MP who represents that constituency.
For example, if you want your supporters to see how their own MPs have voted on a topic, you can build a tool that asks for an email address and then shows information specific to their MP.
Or if you have data that differs per constituency – say funding provision differs across the country – you might want to display facts that are personalised to the user.
(Note that while you could also use this API to ask your supporters to email their MPs, that is more simply achieved with our WriteToThem tool – read more here).
Constituency matching can be achieved with our MapIt API.
It works by asking for a geographic point (in the UK, a postcode) and returning the constituency bounded by that point.
UK MapIt Unitary authorities, Westminster constituencies, CCGs or various output areas
Global MapIt Country, region, city, constituency, or state
Sometimes it is useful to be able to analyse speeches made in Parliament: for example, you want to:
– highlight how often — or how rarely — your topic is mentioned
– discover which Lords or MPs have a particular interest in your area
– analyse whether language around your topic is mostly positive or negative
– see whether swings in public opinion have been reflected in Parliament
TheyWorkForYou’s API can return Hansard debates within any set dates (or as far back as our archive goes, which varies according to House and Parliament — see our FAQs for more details); Written Answers; and Written Ministerial Statements. These can be combined with other fields to, for example, return all speeches made by specific MPs.
Freedom of Information
Our FOI site WhatDoTheyKnow has an API with which you can encourage your users to make requests to a particular public authority.
You can also download existing FOI requests and responses for research.
Costs (and what you can do for free)
|What do you need?||Covering what area?||API||Conditions|
|Politician data||UK||TheyWorkForYou API||Low volume, direct use by registered charities, or individuals pursuing a non-profit project on an unpaid basis, is free. All other use requires a licence. Find out more.|
|Global||Every Politician||All use is completely free|
|Speeches data||UK||TheyWorkForYou API||Low volume, direct use by registered charities, or individuals pursuing a non-profit project on an unpaid basis, is free. All other use requires a licence. Find out more.|
|Freedom of Information data||UK||WhatDoTheyKnow||All use is completely free|
|Constituencies/boundaries data||UK or global||MapIt||Low volume, direct use by registered charities, or individuals pursuing a non-profit project on an unpaid basis, is free. More details on UK MapIt and Global MapIt.|
Keep up to date with mySociety
Sign up to our newsletter.