Donate using PayPal

CycleStreets API (v2)

  • Details for:
  • API overview
  • Obtain API key
  • Usage policy
  • Uptime policy

Collision report

This API call provides the data for a single collision location in the STATS19 data.

An example usage of this API can be seen on the collisions pages.

An API call to browse the same data as a set of locations is also available.

Example

Example which retrieves a particular collision, also requesting label strings.

https://api.cyclestreets.net/v2/collisions.location?id=2013353084513&datetime=friendly&labels=1

Result:

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {
                "accident": {
                    "id": "2013353084513",
                    "accyr": "2013",
                    "casualties": "Cyclist",
                    "Location_Easting_OSGR": "545490",
                    "Location_Northing_OSGR": "257790",
                    "longitude": "0.127413",
                    "latitude": "52.199108",
                    "Police_Force": "Cambridgeshire",
                    "Accident_Severity": "Serious",
                    "number_of_vehicles": "2",
                    "number_of_casualties": "2",
                    "Date": "2013-10-04",
                    "Day_of_Week": "Friday",
                    "Time": "18:55:00",
                    "Local_Authority_(District)": "Cambridge",
                    "Local_Authority_(Highway)": "Cambridgeshire",
                    "1st_Road_Class": "A",
                    "1st_Road_Number": "603",
                    "Road_Type": "Single carriageway",
                    "Speed_limit": "30",
                    "Junction_Detail": "Crossroads",
                    "Junction_Control": "Auto traffic signal",
                    "2nd_Road_Class": "A",
                    "2nd_Road_Number": "1307",
                    "Pedestrian_Crossing-Human_Control": "None within 50 metres",
                    "Pedestrian_Crossing-Physical_Facilities": "Pedestrian phase at traffic signal junction",
                    "Light_Conditions": "Darkness - lights lit",
                    "Weather_Conditions": "Fine no high winds",
                    "Road_Surface_Conditions": "Dry",
                    "Special_Conditions_at_Site": "None",
                    "Carriageway_Hazards": "None",
                    "Urban_or_Rural_Area": "Urban",
                    "Did_Police_Officer_Attend_Scene_of_Accident": "Yes",
                    "LSOA_of_Accident_Location": "E01018005",
                    "datetime": "6:55pm, 4th October 2013"
                },
                "casualties": {
                    "1": {
                        "Vehicle_Reference": "1",
                        "Casualty_Reference": "1",
                        "Casualty_Class": "Driver or rider",
                        "Sex_of_Casualty": "Male",
                        "Age_Band_of_Casualty": "4",
                        "Casualty_Severity": "Serious",
                        "Pedestrian_Location": "Not a Pedestrian",
                        "Pedestrian_Movement": "Not a Pedestrian",
                        "Car_Passenger": "Not car passenger",
                        "Bus_or_Coach_Passenger": "Not a bus or coach passenger",
                        "Pedestrian_Road_Maintenance_Worker": "No / Not applicable",
                        "Casualty_Type": "Cyclist",
                        "Casualty_Home_Area_Type": "Urban area"
                    },
                    "2": {
                        "Vehicle_Reference": "2",
                        "Casualty_Reference": "2",
                        "Casualty_Class": "Driver or rider",
                        "Sex_of_Casualty": "Male",
                        "Age_Band_of_Casualty": "6",
                        "Casualty_Severity": "Serious",
                        "Pedestrian_Location": "Not a Pedestrian",
                        "Pedestrian_Movement": "Not a Pedestrian",
                        "Car_Passenger": "Not car passenger",
                        "Bus_or_Coach_Passenger": "Not a bus or coach passenger",
                        "Pedestrian_Road_Maintenance_Worker": "No / Not applicable",
                        "Casualty_Type": "Cyclist",
                        "Casualty_Home_Area_Type": "Urban area"
                    }
                },
                "vehicles": {
                    "1": {
                        "Vehicle_Reference": "1",
                        "Vehicle_Type": "Pedal cycle",
                        "Towing_and_Articulation": "No tow/articulation",
                        "Vehicle_Manoeuvre": "Going ahead other",
                        "Vehicle_Location-Restricted_Lane": "On main c'way - not in restricted lane",
                        "Junction_Location": "Mid Junction - on roundabout or on main road",
                        "Skidding_and_Overturning": "None",
                        "Hit_Object_in_Carriageway": "None",
                        "Vehicle_Leaving_Carriageway": "Did not leave carriageway",
                        "Hit_Object_off_Carriageway": "None",
                        "1st_Point_of_Impact": "Front",
                        "Was_Vehicle_Left_Hand_Drive?": "No",
                        "Journey_Purpose_of_Driver": "Not known",
                        "Sex_of_Driver": "Male",
                        "Age_Band_of_Driver": "16 - 20",
                        "Engine_Capacity_(CC)": "Data missing or out of range",
                        "Propulsion_Code": "Data missing or out of range",
                        "Age_of_Vehicle": "Data missing or out of range",
                        "Driver_IMD_Decile": "Less deprived 30-40%",
                        "Driver_Home_Area_Type": "Urban area"
                    },
                    "2": {
                        "Vehicle_Reference": "2",
                        "Vehicle_Type": "Pedal cycle",
                        "Towing_and_Articulation": "No tow/articulation",
                        "Vehicle_Manoeuvre": "Going ahead other",
                        "Vehicle_Location-Restricted_Lane": "On main c'way - not in restricted lane",
                        "Junction_Location": "Mid Junction - on roundabout or on main road",
                        "Skidding_and_Overturning": "None",
                        "Hit_Object_in_Carriageway": "None",
                        "Vehicle_Leaving_Carriageway": "Did not leave carriageway",
                        "Hit_Object_off_Carriageway": "None",
                        "1st_Point_of_Impact": "Front",
                        "Was_Vehicle_Left_Hand_Drive?": "No",
                        "Journey_Purpose_of_Driver": "Not known",
                        "Sex_of_Driver": "Male",
                        "Age_Band_of_Driver": "26 - 35",
                        "Engine_Capacity_(CC)": "Data missing or out of range",
                        "Propulsion_Code": "Data missing or out of range",
                        "Age_of_Vehicle": "Data missing or out of range",
                        "Driver_IMD_Decile": "Less deprived 20-30%",
                        "Driver_Home_Area_Type": "Urban area"
                    }
                },
                "labels": {
                    "accident": {
                        "id": "Accident Index",
                        "accyr": "Year",
                        "casualties": "Casualties",
                        "Location_Easting_OSGR": "Location Easting OSGR (Null if not known)",
                        "Location_Northing_OSGR": "Location Northing OSGR (Null if not known)",
                        "longitude": "Longitude (Null if not known)",
                        "latitude": "Latitude (Null if not known)",
                        "Police_Force": "Police Force",
                        "Accident_Severity": "Accident Severity",
                        "number_of_vehicles": "Number of Vehicles",
                        "number_of_casualties": "Number of Casualties",
                        "Date": "Date",
                        "Day_of_Week": "Day of Week",
                        "Time": "Time",
                        "Local_Authority_(District)": "Local Authority (District)",
                        "Local_Authority_(Highway)": "Local Authority (Highway Authority - ONS code)",
                        "1st_Road_Class": "1st Road Class",
                        "1st_Road_Number": "1st Road Number",
                        "Road_Type": "Road Type",
                        "Speed_limit": "Speed limit",
                        "Junction_Detail": "Junction Detail",
                        "Junction_Control": "Junction Control",
                        "2nd_Road_Class": "2nd Road Class",
                        "2nd_Road_Number": "2nd Road Number",
                        "Pedestrian_Crossing-Human_Control": "Pedestrian Crossing-Human Control",
                        "Pedestrian_Crossing-Physical_Facilities": "Pedestrian Crossing-Physical Facilities",
                        "Light_Conditions": "Light Conditions",
                        "Weather_Conditions": "Weather Conditions",
                        "Road_Surface_Conditions": "Road Surface Conditions",
                        "Special_Conditions_at_Site": "Special Conditions at Site",
                        "Carriageway_Hazards": "Carriageway Hazards",
                        "Urban_or_Rural_Area": "Urban or Rural Area",
                        "Did_Police_Officer_Attend_Scene_of_Accident": "Did Police Officer Attend Scene of Accident",
                        "LSOA_of_Accident_Location": "Lower Super Ouput Area of Accident_Location (England & Wales only)",
                        "datetime": "Timestamp"
                    },
                    "casualties": {
                        "Vehicle_Reference": "Vehicle Reference",
                        "Casualty_Reference": "Casualty Reference",
                        "Casualty_Class": "Casualty Class",
                        "Sex_of_Casualty": "Sex of Casualty",
                        "Age_Band_of_Casualty": "Age Band of Casualty",
                        "Casualty_Severity": "Casualty Severity",
                        "Pedestrian_Location": "Pedestrian Location",
                        "Pedestrian_Movement": "Pedestrian Movement",
                        "Car_Passenger": "Car Passenger",
                        "Bus_or_Coach_Passenger": "Bus or Coach Passenger",
                        "Pedestrian_Road_Maintenance_Worker": "Pedestrian Road Maintenance Worker (From 2011)",
                        "Casualty_Type": "Casualty Type",
                        "Casualty_Home_Area_Type": "Casualty Home Area Type"
                    },
                    "vehicles": {
                        "Vehicle_Reference": "Vehicle Reference",
                        "Vehicle_Type": "Vehicle Type",
                        "Towing_and_Articulation": "Towing and Articulation",
                        "Vehicle_Manoeuvre": "Vehicle Manoeuvre",
                        "Vehicle_Location-Restricted_Lane": "Vehicle Location-Restricted Lane",
                        "Junction_Location": "Junction Location",
                        "Skidding_and_Overturning": "Skidding and Overturning",
                        "Hit_Object_in_Carriageway": "Hit Object in Carriageway",
                        "Vehicle_Leaving_Carriageway": "Vehicle Leaving Carriageway",
                        "Hit_Object_off_Carriageway": "Hit Object off Carriageway",
                        "1st_Point_of_Impact": "1st Point of Impact",
                        "Was_Vehicle_Left_Hand_Drive?": "Was Vehicle Left Hand Drive",
                        "Journey_Purpose_of_Driver": "Journey Purpose of Driver",
                        "Sex_of_Driver": "Sex of Driver",
                        "Age_Band_of_Driver": "Age Band of Driver",
                        "Engine_Capacity_(CC)": "Engine Capacity",
                        "Propulsion_Code": "Vehicle Propulsion Code",
                        "Age_of_Vehicle": "Age of Vehicle (manufacture)",
                        "Driver_IMD_Decile": "Driver IMD Decile",
                        "Driver_Home_Area_Type": "Driver Home Area Type"
                    }
                }
            },
            "geometry": {
                "type": "Point",
                "coordinates": [
                    0.127413,
                    52.199108
                ]
            }
        }
    ]
}

Request parameters - required

id string
The STATS19 collision ID.

Request parameters - optional

labels 1
If labels=1 is specified, human-readable label titles will be included, which match up with the field names, one for each.
datetime string

If specified, the datetime field (if requested in the fields list) will be converted from unixtime (the default output format) to a formatted version; the available output formats are:

  • friendly A friendly format suitable for showing on a webpage, e.g. '6:55pm, 4th October 2013'; this is equivalent to date ('g:ia, jS F Y', $date) in PHP
  • friendlydate A friendly date format suitable for showing on a webpage, e.g. '4th October, 2013'; this is equivalent to date ('jS F, Y', $date) in PHP
  • sqldatetime SQL DATETIME format (i.e. simplified ISO 8601 format): YYYY-MM-DD HH:MM:SS
  • unixtime Unixtime (the default)

Response

GeoJSON feature list as per example above. Geometry types will always be Point.

Note that the casualties and vehicles lists will be indexed from 1, not 0.

The field keys (e.g. 'number_of_vehicles') are copied directly from STATS19 raw data. At this time, it is not guaranteed that these will remain consistent after each annual import of data. We would advise not hard-coding field names in your application.

Error response

JSON object containing an error key and a text string.

Example error (text string will vary):

{
    "error": "The specified ID was not found."
}

We welcome your feedback, especially to report bugs or give us route feedback.

My comments relate to: *






Your comments: *
URL of page: * https://edinburgh.cyclestreets.net/api/v2/collisions.location/
How did you find out about CycleStreets?:
Your name:
Our ref: Please leave blank - anti-spam measure

* Items marked with an asterisk [*] are required fields and must be fully completed.