CollisionDetail API Endpoint
CollisionDetail
API Endpoint
CollisionDetail
API EndpointThe CollisionDetail
API helps customers get all the information about a user's claim in instances where Zendrive didn't detect a crash but a claim was still made.
This API works asynchronously, which means that users send query details and a webhook URL with the API call. The server processes the information and sends it to the webhook URL. The API includes data collected by the SDK, like collision triggers, and trip details.
The dataset includes Auth
and Heartbeat
information for the user within the last 6 months, accessible only for requests within that period, providing a full view of claim-related data.
Collision Detail API
POST
https://api.zendrive.com/v1/collision_detail
The Detail API fetches all the information against a filed claim. It will contain collision and trip related information, if possible
Path Parameters
user_id*
string
User identifier associated with the collision.
date*
string
The date for which you want to query the API. It will query the trip/collision related information within +/- 1 day of the specified date. Format of the date must be YYYY-MM-DD.
webhook_url*
String
The URL to which the webhook notifications should be sent.
collision_id
String
collision_timestamp
in epoch
latitude
String
Latitude of the collision
longitude
String
Longitude of the collision
Headers
Authorization*
String
API KEY <APIKEY>
Content-Type
String
application/json
{
"trip_info": [
{
"trip": {
"start_time": "2023-11-22T19:05:31-05:00",
"end_time": "2023-11-22T19:55:09-05:00",
"trip_id": 1700697931030,
"latitude_start": 28.4029306,
"longitude_start": -81.5805704,
"latitude_end": 28.2809896,
"longitude_end": -81.6482348,
"trip_max_speed_kmph": 119.81836422831643,
"duration_seconds": 2978.051,
"distance_km": 31.903,
"session_id": "",
"tracking_id": "",
"insurance_period": "NA",
"device_type": "Google-Pixel 6 Pro",
"platform": "android",
"user_mode": "driver",
"drive_type": "driving",
"vehicle_type": "Car"
},
"events": [
{
"event_type": 3,
"event_type_name": "OVERSPEEDING",
"start_time": "2023-11-22T19:06:58-05:00",
"end_time": "2023-11-22T19:07:33-05:00",
"latitude_start": 28.401550967939514,
"longitude_start": -81.58046929794247,
"latitude_end": 28.39958143835078,
"longitude_end": -81.5787259334949,
"posted_speed_limit_kmph": 24.140140687887445,
"average_driver_speed_kmph": 44.10548544521164,
"max_driver_speed_kmph": 50.87196688002649
},
{
"event_type": 0,
"event_type_name": "HARD_BRAKE",
"start_time": "2023-11-22T19:22:36-05:00",
"end_time": "2023-11-22T19:22:36-05:00",
"latitude_start": 28.36529624190947,
"longitude_start": -81.61022139639286,
"latitude_end": 28.364565760881142,
"longitude_end": -81.6103333360221
}
],
"collision_info": {},
"raw_gps": [
{
"course": 33.0,
"horizontal_accuracy": 5.0,
"latitude": 28.4029306,
"longitude": -81.5805704,
"timestamp": 1700697931030,
"raw_speed_mps": 0.600335,
"heading": -1.0,
"date_time": "2023-11-22T19:05:31-05:00"
},
{
"course": 37.0,
"horizontal_accuracy": 5.0,
"latitude": 28.4029355,
"longitude": -81.5805688,
"timestamp": 1700697932030,
"raw_speed_mps": 0.571983,
"heading": -1.0,
"date_time": "2023-11-22T19:05:32-05:00"
},
{
"course": 41.0,
"horizontal_accuracy": 5.0,
"latitude": 28.4029407,
"longitude": -81.5805661,
"timestamp": 1700697933030,
"raw_speed_mps": 0.731368,
"heading": -1.0,
"date_time": "2023-11-22T19:05:33-05:00"
}
],
"trip_end_location_given_col_loc_dist": -1,
"trip_timestamp_end_given_col_ts_diff": -1
},
{
"trip": {
"start_time": "2023-11-25T10:57:11-06:00",
"end_time": "2023-11-25T12:23:01-06:00",
"trip_id": 1700931431685,
"latitude_start": 32.5722655,
"longitude_start": -93.2044213,
"latitude_end": 32.5420932,
"longitude_end": -94.7334021,
"trip_max_speed_kmph": 136.27335747301322,
"duration_seconds": 5149.635,
"distance_km": 156.0,
"session_id": "",
"tracking_id": "",
"insurance_period": "NA",
"device_type": "Google-Pixel 6 Pro",
"platform": "android",
"user_mode": "driver",
"drive_type": "driving",
"vehicle_type": "Car"
},
"events": [
{
"event_type": 3,
"event_type_name": "OVERSPEEDING",
"start_time": "2023-11-25T11:13:01-06:00",
"end_time": "2023-11-25T11:13:37-06:00",
"latitude_start": 32.54200013065827,
"longitude_start": -93.5396022224945,
"latitude_end": 32.54233872527983,
"longitude_end": -93.5539452155325,
"posted_speed_limit_kmph": 112.65398987680808,
"average_driver_speed_kmph": 133.256956216835,
"max_driver_speed_kmph": 138.35696327282938
},
{
"event_type": 2,
"event_type_name": "PHONE_USE",
"start_time": "2023-11-25T11:51:56-06:00",
"end_time": "2023-11-25T11:52:01-06:00",
"latitude_start": 32.495364590997745,
"longitude_start": -94.25796064741856,
"latitude_end": 32.49529586006803,
"longitude_end": -94.25976919097626
},
{
"event_type": 4,
"event_type_name": "COLLISION",
"start_time": "2023-11-25T12:23:01-06:00",
"end_time": "2023-11-25T12:23:01-06:00",
"latitude_start": 32.5420932,
"longitude_start": -94.7334021,
"latitude_end": 32.5420932,
"longitude_end": -94.7334021
}
],
"collision_info": {
"final_callback_timestamp": 1700936701417,
"confidence_number": 10,
"message": "NA",
"current_speed_mps": 1.0981917458741108e-10,
"g_force": 5.983116593894024,
"heading_degrees": -1,
"brake_distance_meters": 3.1870447259052526e-07,
"deceleration_rate_miles_per_hour_per_second": -5.144642153240398e-07,
"airbag_deployed": false,
"collision_severity": "LOW",
"direction_of_impact": "UNKNOWN",
"latitude": 32.5420932,
"longitude": -94.7334021,
"confidence": "LOW",
"time": "2023-11-25T12:23:01-06:00",
"motion": [
{
"timestamp": 1700936571325,
"date_time": "2023-11-25T12:22:51-06:00",
"acceleration_R": -0.0054789838099412735
},
{
"timestamp": 1700936571334,
"date_time": "2023-11-25T12:22:51-06:00",
"acceleration_R": -0.006050086830050372
},
{
"timestamp": 1700936571343,
"date_time": "2023-11-25T12:22:51-06:00",
"acceleration_R": -0.007396908818051884
}
]
},
"raw_gps": [
{
"course": 268.0,
"horizontal_accuracy": 36.0,
"latitude": 32.5722655,
"longitude": -93.2044213,
"timestamp": 1700931431685,
"raw_speed_mps": 18.286905,
"heading": -1.0,
"date_time": "2023-11-25T10:57:11-06:00"
},
{
"course": 242.0,
"horizontal_accuracy": 21.0,
"latitude": 32.5717824,
"longitude": -93.2060338,
"timestamp": 1700931432737,
"raw_speed_mps": 26.06133,
"heading": -1.0,
"date_time": "2023-11-25T10:57:12-06:00"
},
{
"course": 278.0,
"horizontal_accuracy": 16.0,
"latitude": 32.5718043,
"longitude": -93.2062807,
"timestamp": 1700931433721,
"raw_speed_mps": 21.348354,
"heading": -1.0,
"date_time": "2023-11-25T10:57:13-06:00"
}
],
"trip_end_location_given_col_loc_dist": -1,
"trip_timestamp_end_given_col_ts_diff": -1
}
],
"auth_data": {
"2023-11-23": true,
"2023-11-24": true,
"2023-11-25": true
},
"heartbeat": [
{
"application_id": "prod-autoc_bzdghlzscn",
"user_id": "391695020081806",
"platform_string": "android",
"overall_color_code": "G",
"setup_color_code": "G",
"location_permissions_color_code": "G",
"location_service_color_code": "G",
"activity_permissions_color_code": "G",
"background_restrictions_color_code": "G",
"precise_location_color_code": "G",
"battery_optimization_color_code": "R",
"start_date": "2023-11-23"
},
{
"application_id": "prod-autoc_bzdghlzscn",
"user_id": "391695020081806",
"platform_string": "android",
"overall_color_code": "G",
"setup_color_code": "G",
"location_permissions_color_code": "G",
"location_service_color_code": "G",
"activity_permissions_color_code": "G",
"background_restrictions_color_code": "G",
"precise_location_color_code": "G",
"battery_optimization_color_code": "R",
"start_date": "2023-11-24"
},
{
"application_id": "prod-autoc_bzdghlzscn",
"user_id": "391695020081806",
"platform_string": "android",
"overall_color_code": "G",
"setup_color_code": "G",
"location_permissions_color_code": "G",
"location_service_color_code": "G",
"activity_permissions_color_code": "G",
"background_restrictions_color_code": "G",
"precise_location_color_code": "G",
"battery_optimization_color_code": "R",
"start_date": "2023-11-25"
}
],
"user_id": "391695020081806",
"date": "2023-11-24"
}
Response Fields
Trip_info
Fields
Trip_info
FieldsContains details related to the trip such as start time, end time, latitude, longitude, and so on.
start_time
Start time of the trip.
end_time
End time of the trip.
trip_id
Unique Id assigned by Zendrive for the trip where the event occurred.
latitude_start
Latitude of location where the trip started.
longitude_start
Longitude of location where the trip started.
latitude_end
Latitude of location where the trip ended.
longitude_end
Longitude of location where the trip ended.
trip_max_speed_kmph
The maximum speed of the driver during the trip.
duration_seconds
Total drive time of the driver for a trip represented in seconds.
distance_km
Total distance in kms logged by the driver.
session_id
The session id provided by the application in the Zendrive SDK.
tracking_id
The tracking id provided by the application in the Zendrive SDK.
insurance_period
The insurance period associated with the trip.
device_type
Classifies the trip as driving
or non_driving
.
platform
Type of platform - iOS or Android.
user_mode
The mode of user during the trip.
drive_type
Type of drive for a trip. The possible types are driving
and non_driving
.
vehicle_type
Vehicle Type of the trip like Car
or Motorcycle.
Events
Fields
Events
FieldsContains all the events that occurred in the above trip.
start_time
Start time of the event.
end_time
End time of the event.
event_type
Numeric value associated with event. The possible values are 0 for HARD_BRAKE
, 1 for RAPID_ACCELERATION
, 2 for PHONE_USE
, 3 for OVERSPEEDING
, 4 for COLLISION
, 5 for HARD_TURN
, 6 for PHONE_SCREEN_INTERACTION
, 8 for HANDS_FREE_PHONE_CALL
, 9 for PASSIVE_DISTRACTION
, 10 for NEAR_COLLISION.
event_type_name
Type of driving event. The possible types are OVERSPEEDING
, PHONE_USE
, RAPID_ACCELERATION
, HARD_BRAKE
, HARD_TURN
, PHONE_SCREEN_INTERACTION
, COLLISION
, HANDS_FREE_PHONE_CALL
, PASSIVE_DISTRACTION
, and NEAR_COLLISION
.
latitude_start
Latitude of location where the event started.
latitude_end
Latitude of location where the event ended.
longitude_start
Longitude of location where the event started.
longitude_end
Longitude of location where the event ended.
average_driver_speed_kmph
Average speed of the driver during the event.
This is valid only for OVERSPEEDING event.
max_driver_speed_kmph
Maximum speed of the driver during the event.
This is valid only for OVERSPEEDING event.
posted_speed_limit_kmph
Posted legal speed limit where the event occurred.
This is valid only for OVERSPEEDING event.
collision_information
Fields
collision_information
FieldsThis field replicates collision information from the Collision API and includes 100 Hz sensor data. It is populated in the trip only if the algorithm identifies a possible collision or near-collision. If there are multiple triggers, no triggers, or the algorithm cannot pinpoint a collision trigger, this field will be empty for that trip.
airbag_deployed
The boolean value that indicates whether airbags were deployed or not.
brake_distance_meters
The distance at which the vehicle speed starts dropping till the collision time stamp.
confidence
Confidence level. Can be either HIGH
or LOW
.
confidence_number
A numeric value (0-100) that specifies how confident Zendrive is that a collision occurred. Used to apply custom thresholds for emergency action.
collision_severity
The measure of collision severity, indicated as LOW
, MEDIUM
, HIGH
or UNKNOWN.
current_speed_mps
The speed at which the event occurred, expressed in metres per second.
deceleration_rate_miles_per_hour_per_second
Indicates how quickly the vehicle decelerated within the collision window.
direction_of_impact
The direction from which the vehicle was hit. The value for the direction_of_impact field can be FRONT
, REAR
, BROADSIDE
or UNKNOWN
.
g_force
The maximum g-force generated within the collision window.
heading_degrees
The direction of motion indicated via a degree of rotation from the North.
latitude
The latitudinal value of the location of the collision.
longitude
The longitudinal value of the location of the collision.
message
A string that displays the message sent to the user at the time of collision.
time
Time of occurrence of the collision. Uses the timezone of the location where the collision occurred, for example, 2017-09-07T15:15:56-04:00
.
motion
Motion data around +/- 10 seconds of the collision.
motion.acceleration_R
Overall acceleration recorded by accelerometer in Gs
motion.date_time
Human-readable timestamp, for example, 2017-09-07T15:15:56-04:00
.
motion.timestamp
The time at which the motion information was recorded, expressed as a Unix timestamp, for example, 537582314814
.
Raw_gps
Fields
Raw_gps
FieldsThis field contains raw_gps
data for the entire trip.
timestamp
The time at which the GPS information was recorded, expressed as a Unix timestamp, for example, 153758231481
.
date_time
Human-readable timestamp, for example, 2017-09-07T15:15:56-04:00
.
course
The direction of movement, expressed as degrees of rotation from the North.
heading
The compass direction in which a user's device is travelling.
horizontal_accuracy
Accuracy of location, expressed in meters.
latitude
The latitude value of the location recorded by the GPS sensor.
longitude
The longitude value of the location recorded by the GPS sensor.
raw_speed_mps
Raw speed of vehicle as detected by the GPS sensor, expressed in meters per second
Auth_data
Fields
Auth_data
FieldsThis field shows whether Zendrive's backend received an authentication call in the +/- 1 day period from the date in the request payload.
auth_data
Containing True/False value for each date within +/- 1 day. True if authentication was done on a day, False otherwise.
{'2023-11-23': True, '2023-11-24': True, '2023-11-25': True}
Heartbeat
Fields
Heartbeat
FieldsContains heartbeat related information in the +/- 1 day period date in the request payload.
activity_permissions_color_code
This value indicates whether the Physical Activity permission is enabled on the device. Possible values: G
, O
, R
.
application_id
The id of the customer's application.
background_restrictions_color_code
This value indicates whether the Background Restriction permission is disabled on the device. Possible values: G
, O
, R
.
battery_optimization_color_code
This value indicates whether the Battery Optimization permission is disabled on the device. Ideally this permission should be disabled (G
). Possible values: G
, O
, R
.
The value will be NULL
on Android devices where the Zendrive SDK version is below 9.2, and on iOS devices irrespective of their SDK versions.
location_permissions_color_code
This value indicates whether the
Location Permission is enabled on the device. Possible values: G
, O
, R
.
location_service_color_code
This value indicates whether the GPS data was available on the device. Possible values: G
, O
, R
.
overall_color_code
This value indicates whether the device is healthy. Possible values are as follows:
G
: Green for a healthy value.
O
: Orange for a partially healthy value.
R
: Red for an unhealthy value.
platform_string
OS of the user's device (iOS or Android).
precise_location_color_code
This value indicates whether the Precise Location permission is enabled on the device. Possible values: G
, O
, R
.
setup_color_code
This value indicates whether zendrive.setup
was called successfully. Possible values: G
, O
, R
.
start_date
The start date for which data is requested. Date format is YYYY-MM-DD
. Time Zone is in UTC.
user_id
The user for which the trip or collision information was requested. This is passed in the request payload.
There are two additional response fields as follows:
trip_end_location_given_col_loc_dist
: Haversine distance between thetrip_end
and collision location provided in the request payload. Default is set to -1 if collision location is not provided.trip_timestamp_end_given_col_ts_diff
: Time difference between thetrip_timestamp_end
andcollision_id
(i.e, collision timestamp) provided in the request payload. Default is set to -1 ifcollision_id
is not provided.
To send an API request to Zendrive's FNOL Detail API, you need to submit a POST request to the exposed endpoint.
Sample CURL Request
curl -X POST "https://api.zendrive.com/v1/collision_detail" \
-H "Content-Type: application/json" \
-H "Authorization: APIKEY <api_key>" \
--data '{
"user_id": "abc",
"date": "2023-11-01",
"webhook_url": "https://d790-106-201-151-38.ngrok-free.app/fnol_detail_api/webhook"
}'
Sample Python Request
import requests
headers = {
'Content-Type': 'application/json',
'Authorization': 'APIKEY <api_key>'
}
message_payload = {"user_id": "abc", "date": "2023-11-01", "webhook_url": "https://d790-106-201-151-38.ngrok-free.app/fnol_detail_api/webhook"}
enqueue_url = "https://api.zendrive.com/v1/collision_detail"
response = requests.post(enqueue_url, headers=headers, json=message_payload)
The request requires JSON headers with the customer's API key. You must include mandatory fields such as user_id
, date
, and webhook_url
. Optional fields like collision_id
, latitude
, and longitude
can be added for specific collision details. A successful submission yields a 202 response, and the webhook is triggered after a few minutes. Ensure the webhook endpoint is functional, or the response payload won't be submitted.
Sample Request Payload
# Start webhook receiving server $GIT_ROOT/analysis/experimental/priyanshu/fnol_tasks/fnol_detail_api_webhook_test.py
# Do ngrok http http://localhost:5001, this will give you the url you can use as webhook_url in the request.
message_payload = {"user_id": "391695020081806", "date": "2023-11-24", "webhook_url": "https://d790-106-201-151-38.ngrok-free.app/fnol_detail_api/webhook"}
Was this helpful?