UKCrimestats API Documentation
https://ukcrimestats.com/api/{method}/[parameters../]key={your_api_key}
The basic form of an API call is the API path, https://ukcrimestats.com/api/ followed by the method and it's parameters separated by the forward slashes, and finally key= and your API key, which you can find by logging in to your account or in the email that is sent when you sign up. For example, https://ukcrimestats.com/api/areas/policeforce/key=ncc1701d would provide a list of the names of all policeforces and their identifier, if ncc1701d was a valid api key (which it's not.)
The data is returned as a JSON object or array. If the method or parameters are wrong or the data is missing, it will return an object with a single field, error, whose value describes the error.
The UKCrimestats API currently has the following methods:
- areas
- crime
- crime (postcode level)
- crime_rank
- crime_rate_rank
Areas
https://ukcrimestats.com/api/areas/{area_type}/key={your_key}
Returns lists of administrative regions for which UKCrimeStats calculates totals. The field area_type can be any one of the following, which are the types of administrative regions we currently track. These same area types are used in the method "crime".
- policeforce
- neighbourhood
- cty (county council)
- ced (county ward)
- dis (district council)
- diw (district ward)
- gla (london assembly)
- lac (london assembly constituency)
- lbo (london borough)
- lbw (london borough ward)
- mtd (metropolitan district)
- mtw (metropolitan ward)
- uta (unitary authority)
- ute (unitary authority electoral division)
- utw (unitary authority ward)
- wac (welsh assembly constituency)
- wae (welsh assembly region)
- wmc (westminster constituency)
- postcode_sector
- postcode_district
- postcode_area
- lsoa
- msoa
- workzone
example: https://ukcrimestats.com/api/areas/wae/key=ncc1701d
[ { "name": "Mid and West Wales", "id": "W10000002" }, { "name": "North Wales", "id": "W10000001" }, { "name": "South Wales West", "id": "W10000003" }, { "name": "South Wales East", "id": "W10000005" }, { "name": "South Wales Central", "id": "W10000004" } ]
Crime Totals for Area
https://ukcrimestats/api/crime/{area_type}/{id}/{month}/key={your_key}
Gives totals by type of crime within an administrative regions for one month.
POST VARIABLES
- area_type: type of area (see above for list of area types)
- id: the official code, which can be gotten from the first query - for instance, W10000001 would be used for North Wales.
- month: Month of a year in the format YYYY-MM, for example, 2018-03. The earliest month for which we have data is 2010-12 for England and Wales and 2011-09 for Northern Ireland, (Scotland does not release monthly data for crime,) and the latest month can be found at ukcrimestats.com
Example: https://ukcrimestats.com/api/crime/policeforce/cumbria/2021-03/key=ncc1701d
{ "asb": "917", "burglary": "112", "robbery": "9", "vehicle": "41", "violent": "1177", "shoplifting": "113", "criminal_damage_and_arson": "349", "other_theft": "170", "drugs": "109", "bike_theft": "19", "theft_from_the_person": "7", "weapons": "20", "public_order": "294", "other": "86", "total": "3423" }
The crime types returned may vary based on the month requested as they have changed twice.
Crime Totals for Postcode Radius
ukcrimestats/api/crime/postcode/{radius}/{month}/key={your_key}
Parameters
- id: the postcode (Without a space following the postcode district, i.e. W1D1AL)
- radius: radius in miles. Options are: 1, 0.5, 0.25
- month: the month in the format YYYY-MM, for example, 2018-03
example: https://ukcrimestats/api/crime/postcode/W1D1AL/0.5/2020-05/key=ncc1701d
{ "asb": "253", "burglary": "30", "robbery": "3", "vehicle": "12", "violent": "63", "shoplifting": "10", "criminal_damage_and_arson": "11", "other_theft": "23", "drugs": "138", "bike_theft": "22", "theft_from_the_person": "21", "weapons": "1", "public_order": "10", "other": "3", "total": "600" }
Crime Rank for Postcode Radius
https://ukcrimestats/api/crime_rank/postcode/W1D1AL/0.5/2020-05/key=ncc1701d
Provides percentile ranking for total crime for the most recent 12 months of data
POST VARIABLES
- id: the postcode
- radius: radius in mile. Options are: 1, 0.5, 0.25
example: https://ukcrimestats/api/crime_rate_rank/postcode/W1D1AL/0.25/key=ncc1701d
{ "asb": "98.726", "burglary": "98.478", "robbery": "99.725", "vehicle": "98.338", "violent": "98.041", "shoplifting": "98.105", "criminal_damage_and_arson": "97.020", "other_theft": "99.588", "drugs": "99.453", "bike_theft": "99.061", "theft_from_the_person": "99.665", "weapons": "96.181", "public_order": "97.166", "other": "96.288", "total": "99.077" }
Crime Rate Rank for Postcode Radius
https://ukcrimestats/api/crime_rate_rank/postcode/W1D1AL/1/2020-05/key=ncc1701d
Provides percentile ranking for crime rate for the most recent 12 months of data
POST VARIABLES
- id: the postcode
- radius: radius in mile. Options are: 1, 0.5, 0.25
example: https://ukcrimestats/api/crime_rate_rank/postcode/W1D1AL/0.25/key=ncc1701d
{ "asb": "35.989", "burglary": "64.437", "robbery": "71.635", "vehicle": "73.079", "violent": "23.423", "shoplifting": "35.465", "criminal_damage_and_arson": "19.767", "other_theft": "35.094", "drugs": "64.599", "bike_theft": "48.158", "theft_from_the_person": "53.116", "weapons": "41.787", "public_order": "26.349", "other": "19.146", "total": "29.103" }
Appendex
Crime Types
- "asb": Includes personal, environmental and nuisance anti-social behaviour.
- "burglary": Includes offences where a person enters a house or other building with the intention of stealing.
- "robbery": Includes offences where a person uses force or threat of force to steal.
- "vehicle": Includes theft from or of a vehicle or interference with a vehicle.
- "violent": Includes offences against the person such as common assaults, Grievous Bodily Harm and sexual offences.
- "shoplifting": Includes theft from shops or stalls. (Since 2011-11)
- "criminal_damage_and_arson": Includes damage to buildings and vehicles and deliberate damage by fire. (Since 2011-11)
- "other_theft": Includes theft by an employee, blackmail and making off without payment. (Since 2011-11)
- "drugs": Includes offences related to possession, supply and production. (Since 2011-11)
- "public_disorder_and_weapons": Combined public order and weapons below. (2011-11 to 2013-04)
- "bike_theft": Includes the taking without consent or theft of a pedal cycle. (Since 2013-05)
- "theft_from_the_person": Includes crimes that involve theft directly from the victim (including handbag, wallet, cash, mobile phones) but without the use or threat of physical force. (Since 2013-05)
- "weapons": Includes possession of a weapon, such as a firearm or knife. (Since 2013-05)
- "public_order": Includes offences which cause fear, alarm or distress. (Since 2013-05)
- "other": Includes forgery, perjury, other miscellaneous crime, and categories that did not exist at the time that the data was released.
- "total": Combined total of all crime and anti social behaviour.