UK police API

import requests

import pandas as pd

parameters

  • Forces

  • Specific force

  • Force senior officers

  • Street level crimes

  • Street level outcomes

  • Crimes at location

  • Crimes with no location

  • Crime categories

  • Last updated

  • Outcomes for a specific crime

  • Neighbourhoods

  • Specific neighbourhood

  • Neighbourhood boundary

  • Neighbourhood team

  • Neighbourhood events

  • Neighbourhood priorities

  • Locate neighbourhood

  • Stop and searches by area

  • Stop and searches by location

  • Stop and searches with no location

  • Stop and searches by force

Availability last 36 months

# returns list of all available datasets

url = 'https://data.police.uk/api/crimes-street-dates'
req = requests.get(url)
req
<Response [200]>
# data from earliest month
print(req.json()[35]['date'])

# data from latest month
print(req.json()[0]['date'])
2019-09
2022-08

‘params’ as arguments dict

endpoint = 'https://data.police.uk/api/stops-street?'
parameters = {'lat':"52.629729", 'lng':"-1.131592", 'date':"2020-06"}

req = requests.get(endpoint, params = parameters)
req
<Response [200]>
response = req.json()
response[0]
{'age_range': 'over 34',
 'outcome': 'A no further action disposal',
 'involved_person': True,
 'self_defined_ethnicity': 'White - English/Welsh/Scottish/Northern Irish/British',
 'gender': 'Male',
 'legislation': 'Police and Criminal Evidence Act 1984 (section 1)',
 'outcome_linked_to_object_of_search': None,
 'datetime': '2020-06-12T21:04:00+00:00',
 'removal_of_more_than_outer_clothing': False,
 'outcome_object': {'id': 'bu-no-further-action',
  'name': 'A no further action disposal'},
 'location': {'latitude': '52.629909',
  'street': {'id': 883345, 'name': 'On or near Marquis Street'},
  'longitude': '-1.132073'},
 'operation': None,
 'officer_defined_ethnicity': 'White',
 'type': 'Person search',
 'operation_name': None,
 'object_of_search': 'Stolen goods'}