Crime by Postcode

Rate Crime by Postcode

How useful is the site?

Sent by email to the person who runs the site. Please leave out personal details.

API for developers

The figures on Crime by Postcode, as JSON. It is free. You need a key, and we give keys to anyone with a reasonable use for them.

What you get

The same figures the site shows, for England, Wales, Northern Ireland and Scotland. In Scotland there is no Safety score yet; Living covers it. Scottish council answers carry the Scottish Government's recorded crime. Every answer also carries the data release, the months it covers and the attribution text. House price data is not included.

Endpoints

All are GET and return JSON.

PathReturns
/api/v1/postcode/{code}A full postcode (S45 9DE) or a district (S45). Optional radius in metres, 100 to 10,000 (default 1,000). A full postcode also returns its coordinates and the pin summary. Add points=1 for the list of map points (schools, GPs, stations, shops) in the circle.
/api/v1/point?lat=&lon=&radius=The pin summary at a UK point: Safety, Living, crime by type, schools, GPs, stations and shops. Add points=1 for the list of map points in the circle.
/api/v1/town/{slug}The figures on a town or city page, e.g. mansfield.
/api/v1/council/{slug}The figures on a council page, e.g. north-east-derbyshire, with the detailed crime types and outcomes.
/api/v1/search?q=Postcodes, districts, places and streets with coordinates. 1 to 60 characters: letters, digits, spaces and common punctuation. Optional near=lon,lat (longitude first, e.g. -1.42,53.165) lists same-name streets nearest first; a value that is not a UK point is ignored.

Example

curl -H "X-API-Key: cbp_..." https://crimebypostcode.co.uk/api/v1/postcode/S45

Send the key in the X-API-Key header. A key in the URL is refused, so it stays out of logs. There are no CORS headers: call the API from your server, not from a web page, so your key is never public. Answers are not cacheable (cache-control: private, no-store).

Limits

1,000 requests a day per key (the day runs on UTC) and 5 a second. Over either, you get a 429 with a Retry-After header.

Errors

Errors are JSON, { "error": "..." }, with these statuses.

StatusMeaning
300Several places share this name: pick a slug from choices
400Bad input
401Missing, unknown or revoked key
404Unknown place
429Over the limit. Wait for the number of seconds in Retry-After
500Something broke on our side. Try again later
503No data release yet

Attribution

Show the attribution text from the response wherever you show the data.

Terms in short

Free to use. A guide, not advice. Do not resell the raw data as a competing dataset. Keys are personal and can be revoked for abuse or for going over the limits. No promise of uptime. The full wording is in the terms, and what we keep about key holders is in the privacy policy.

Request a key

Tell us who you are and what you will build. We read every request, and email you the key if we approve it.