Using this data via the API

The data that's submitted to this site is available as a CSV/Excel download and programmatically via a RESTful API.

Election results

There is a separate page explaining how to get election results from this site.

CSV/Excel Download

All Candidates

This CSV file contains details of all candidates in the database.

Current Elections



Past Elections

There are no past elections.


This API is a work in progress

This is an alpha version of the YourNextRepresentative API, which is likely to change in the near future.

Browsable API root

The browsable base URL of the site's read-only API is:

The following sections give examples of how to use the API.

Find a Constituency ID

In order to look up candidates for a constituency, you have to find the ID of that constituency. The IDs that we use for constituencies are the IDs for Westminster constituencies areas in another web service, MapIt.

... from a postcode

Suppose you want to find the constituency for the postcode SW1A 1AA, then you would make a GET request to the following URL:

This returns a JSON object, wherein the constituency ID can be found at .shortcuts.WMC.

There's more documentation available on postcode lookups on the MapIt front-page.

... from a latitude / longitude or other coordinate

You can look up constituencies in MapIt using a variety of coordinate systems. To give the most common example, you might have a WGS84 coordinate from a GPS or location API, in which can you should put the SRID 4326 in your lookup. For example, latitude 52.205083 and longitude 0.115194 could be looked up with:,52.205083?type=WMC
(Note that the longitude comes before the latitude, which might not be what you expect.) The only key in that object is the constituency ID.

There's more documentation available on point lookups on the MapIt front-page.

... by selecting it from its name

If you need to produce a list of all constituencies (e.g. for a select box) and allow the user to pick one, you can get a list of all Westminster constituencies in the UK from this request:

The returned data from that request has the constituency ID as its keys; the values are objects that include (among other things) a name element that gives you the official name of the constituency.

Find Candidates for a Constituency

You can request all the candidates in that constituency by querying posts with the extra_slug filter parameter. For example, for Dulwich and West Norwood, which has the ID 65808, you would make the request:

Each of the memberships in that reponse links to a person who is a candidate in that constituency for any known election. The election property of each membership tells you which election that candidacy is for.