The documentation below is for developers who want to use MapIt as a web service, describing its REST API. If that’s all Greek to you, please see our page for non-developers.
All calls return JSON, and you can generally get an HTML representation by adding .html on the end.
To use your API key, include it in each API call as either an
api_key URL query parameter, e.g.
https://mapit.mysociety.org/area/2244?api_key=KEY, or an
X-Api-Key HTTP request header. All API responses
include your current usage and limit in the
Whenever an area is returned from MapIt, it is as a dictionary with the following keys: id, name, country, type, parent_area, generation_low, generation_high, codes.
Your current quota usage and limit. Note: Accessing this endpoint does not count against your limit.
Information on a particular postcode, including its centroid location in WGS84 latitude/longitude, and the areas that is contained within.
generation, to return results from a previous generation.
If your postcode was SW1A 1AA you would load /postcode/SW1A1AA
By default the response is in JSON, if you want a human readable page then append ‘.html’ to the url /postcode/SW1A1AA.html
SRID is a unique number referring to a particular co-ordinate system; the ones you probably are interested in are 27700 for British National Grid, 4326 for WGS84 lon/lat, and 29902 for the Irish National Grid.
x and y are the co-ordinates of the point in the co-ordinate system; note that x,y means longitude,latitude.
A hash of the areas that the point is contained within. If the /box version is used, only the area bounding boxes are considered.
Information on multiple areas that match the parameters provided, as a dictionary indexed by area ID. The geometry argument lets you fetch multiple single area geometry results at once.
This returns an HTTP 302 Found redirect to the corresponding /area/[area ID] page. Any format extension (.html or .json) will be preserved in the URL that's redirected to.
Point-to-boundary mapping for the UK. Input a postcode or geographical location, and MapIt returns the relevant constituency or authority.
Your donations keep this site and others like it runningDonate now