tripScores API Endpoint

The tripScores API allows customers to look up specific trips taken by a specific driver.

Refer to Zendrive Server APIs for an understanding of how Zendrive server APIs are organized.

Trip Scores

GET https://api.zendrive.com/v4/driver/{driver_id}/trip/{trip_id} -H

Look up the Zendrive scores for specified trips for a specified driver.

Query Parameters

Name
Type
Description

fields

String

Comma-separated list of fields to lookup. See below for detailed explanation. Default: info, driving_behavior

Headers

Name
Type
Description

Authorization*

String

API KEY <APIKEY>

{
    "trip_id": "1696490764708",
    "info": {
        "start_time": "2023-10-05T12:56:04+05:30",
        "end_time": "2023-10-05T13:13:54+05:30",
        "trip_max_speed_kmph": 54.39163625048494,
        "duration_seconds": 1069.55,
        "distance_km": 8.454,
        "extrapolated_distance_km": 0.505,
        "estimated_start_latitude": 12.9583014,
        "estimated_start_longitude": 77.6492627,
        "session_id": "NA",
        "tracking_id": "NA",
        "insurance_period": "NA",
        "vehicle_id": "NA",
        "trip_breached_flag": false,
        "distance_outside_geofence_km": 0.0,
        "is_tagged_by_beacon": "false",
        "is_tagged_by_bluetooth_stereo": "false",
        "user_mode": "driver",
        "drive_type": "driving",
        "vehicle_type": "Car"
    },
    "driving_behavior": {
        "event_rating": {
            "hard_brake_rating": 4,
            "hard_turn_rating": 5,
            "rapid_acceleration_rating": 5,
            "phone_use_rating": 5,
            "overspeeding_rating": -1
        },
        "score": {
            "zendrive_score": 92
        }
    },
    "speed_profile": [],
    "simple_path": [
        {
            "latitude": 12.9593973,
            "longitude": 77.6537806,
            "time_millis": 1696490764708,
            "timestamp": "2023-10-05T12:56:04.708000+05:30"
        },
        {
            "latitude": 12.959434,
            "longitude": 77.653809,
            "time_millis": 1696490770726,
            "timestamp": "2023-10-05T12:56:10.726000+05:30"
        },
        {
            "latitude": 12.9792943,
            "longitude": 77.6914532,
            "time_millis": 1696491832258,
            "timestamp": "2023-10-05T13:13:52.258000+05:30"
        },
        {
            "latitude": 12.9793035,
            "longitude": 77.6914532,
            "time_millis": 1696491834258,
            "timestamp": "2023-10-05T13:13:54.258000+05:30"
        }
    ],
    "events": [
        {
            "event_type": 0,
            "event_type_name": "HARD_BRAKE",
            "start_time": "2023-10-05T12:58:02+05:30",
            "end_time": "2023-10-05T12:58:02+05:30",
            "latitude_start": 12.959366251650632,
            "longitude_start": 77.661011178559,
            "latitude_end": 12.959366251650632,
            "longitude_end": 77.661011178559
        },
        {
            "event_type": 3,
            "event_type_name": "OVERSPEEDING",
            "start_time": "2023-10-05T13:10:38+05:30",
            "end_time": "2023-10-05T13:10:54+05:30",
            "latitude_start": 12.970565366302832,
            "longitude_start": 77.70010989234095,
            "latitude_end": 12.972546197741861,
            "longitude_end": 77.69885898772988,
            "posted_speed_limit_kmph": 40.23356781314575,
            "average_driver_speed_kmph": 54.51889840088128,
            "max_driver_speed_kmph": 58.4395791171367
        }
    ]
}

This API uses Set 2 of the Date Range, Pagination, and Sorting parameters:

  • Date Range fields (start_date and end_date)

  • Pagination fields (limit and offset)

  • Sorting fields (order_by and order_type).

Request Parameters

Request Parameter
Description

driving_behavior

Returns driver score and event ratings calculated over the interval specified. See the driving_behavior fields in the table below.

info

Returns recorded information about the trip (total distance driven, drive time, etc,.)

events

Returns events detected by Zendrive during the trip, such as over-speeding, phone use, aggressive acceleration, hard brake, hard turn, collision and phone screen interaction.

simple_path

Returns a coarse GPS trail of the trip. Useful for visualization of the trip path.

Response Fields

This section contains documentation on all the response fields. Fields are in alphabetical order.

Response Parameter
Description

driving_behavior

Returns driver score and event ratings calculated over the interval specified.

events

An array containing a list of driving events that happened during the trip. The events are low level details that are reflected in scores.

simple_path

An array of latitude, longitude, timestamp tuples representing a simplified path of the trip. The timestamp is in ISO format.

trip_id

Unique Id assigned by Zendrive for the trip where the event occurred.

driving_behavior Fields

driving_behavior Data Points
Description

driving_behavior.event_rating

An array containing a list of driving events that happened during the trip. Events represent granular details of Zendrive scores.

driving_behavior.event_rating.

hard_brake_rating

Hard brake rating of the trip

driving_behavior.event_rating.

hard_turn_rating

Hard turn rating of the trip

driving_behavior.event_rating.

overspeeding_rating

Overspeeding rating of the trip

driving_behavior.event_rating.

phone_use_rating

Phone use rating of the trip

driving_behavior.event_rating.

rapid_acceleration_rating

Acceleration rating of the trip

driving_behavior.score.

zendrive_score

Zendrive score of the trip.

info Fields

info Data Points
Description

info_start_time

Start time of the trip in ISO format.

info_end_time

End time of the trip in ISO format.

info.trip_max_speed_kmph

Maximum speed achieved during the trip (in kilometers per hour).

info.duration_seconds

Total duration of the trip represented in seconds

info.distance_km

The distance between (in kilometers) covered in the trip.

info.extrapolated_distance_km

The distance between the last trip's end location and the current trip's start location.

info.estimated_start_latitude

Estimated start latitude for the current trip is the last trip end latitude.

info.estimated_start_longitude

The estimated start longitude for the current trip is the last trip's end longitude.

info.session_id

Session id attached the trip if specified in the Zendrive SDK when the trip was recorded.

info_tracking_id

The tracking Id associated with the vehicle.

info.insurance_period

The insurance period associated with the trip (valid only for trips recorded by Fairmatic customers using the Zendrive SDK). The response will be 'NA’ if Fairmatic insurance does not apply to the customer or the trip.

info_vehicle_id

VIN number of the vehicle. .

info.trip_breached_flag

This flag indicates that the trip breached the geofence boundary.

info.distance_outside_geofence_km

The total distance travelled outside the geofence boundary.

info.user_mode

Identifies whether the user was a driver, passenger, or none.

info.drive_type

Classifies the trip as driving or non_driving.

info.vehicle_type

Vehicle Type of the trip, such as Car or Motorcycle

info.is_tagged_by_bluetooth_stereo

This field returns one of two string values: true if the vehicle information was recorded through bluetooth, else false.

info.is_tagged_by_beacon

This field returns one of two string values: true if the vehicle information was recorded through beacon, else false.

events Fields

Event Response Fields
Description

events[i].average_driver_speed_kmph

Average speed of the driver during the event. This is valid only for OVERSPEEDING event.

events[i].end_time

Timestamp of when the event ended in ISO format.

events[i].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

events[i].event_type_name

Type of driving event. The possible types are OVERSPEEDING, PHONE_USE, RAPID_ACCELERATION, HARD_BRAKE, HARD_TURN, PHONE_SCREEN_INTERACTION and COLLISION.

events[i].latitude_start

Latitude of location where the event started.

events[i].latitude_end

Latitude of location where the event ended.

events[i].longitude_start

Longitude of location where the event started.

events[i].longitude_end

Longitude of location where the event ended.

events[i].max_driver_speed_mph

Maximum speed of the driver during the event. This is valid only for OVERSPEEDING event.

events[i].posted_speed_limit_mph

Posted legal speed limit where the event occurred. This is valid only for OVERSPEEDING event.

events[i].start_time

Timestamp of the event in ISO format.

extrapolated_distance_km

The distance between the last trip's end location and the current trip's start location.

estimated_start_latitude

Estimated start latitude for the current trip is the last trip end latitude.

estimated_start_longitude

The estimated start longitude for the current trip is the last trip's end longitude.

vehicle id

The Id of the vehicle in which the trip was taken. This value comes from the Zendrive SDK's Vehicle Tagging feature.

trip_breached_flag

This flag indicates that the trip breached the geofence boundary.

distance_outside_geofence_km

The total distance travelled outside the geofence boundary.

Response Body

{
    "trip_id": "1696490764708",
    "info": {
        "start_time": "2023-10-05T12:56:04+05:30",
        "end_time": "2023-10-05T13:13:54+05:30",
        "trip_max_speed_kmph": 54.39163625048494,
        "duration_seconds": 1069.55,
        "distance_km": 8.454,
        "extrapolated_distance_km": 0.505,
        "estimated_start_latitude": 12.9583014,
        "estimated_start_longitude": 77.6492627,
        "session_id": "NA",
        "tracking_id": "NA",
        "insurance_period": "NA",
        "vehicle_id": "NA",
        "trip_breached_flag": false,
        "distance_outside_geofence_km": 0.0,
        "is_tagged_by_beacon": "false",
        "is_tagged_by_bluetooth_stereo": "false",
        "user_mode": "driver",
        "drive_type": "driving",
        "vehicle_type": "Car"
    },
    "driving_behavior": {
        "event_rating": {
            "hard_brake_rating": 4,
            "hard_turn_rating": 5,
            "rapid_acceleration_rating": 5,
            "phone_use_rating": 5,
            "overspeeding_rating": -1
        },
        "score": {
            "zendrive_score": 92
        }
    },
    "speed_profile": [],
    "simple_path": [
        {
            "latitude": 12.9593973,
            "longitude": 77.6537806,
            "time_millis": 1696490764708,
            "timestamp": "2023-10-05T12:56:04.708000+05:30"
        },
        {
            "latitude": 12.959434,
            "longitude": 77.653809,
            "time_millis": 1696490770726,
            "timestamp": "2023-10-05T12:56:10.726000+05:30"
        },
        {
            "latitude": 12.9792943,
            "longitude": 77.6914532,
            "time_millis": 1696491832258,
            "timestamp": "2023-10-05T13:13:52.258000+05:30"
        },
        {
            "latitude": 12.9793035,
            "longitude": 77.6914532,
            "time_millis": 1696491834258,
            "timestamp": "2023-10-05T13:13:54.258000+05:30"
        }
    ],
    "events": [
        {
            "event_type": 0,
            "event_type_name": "HARD_BRAKE",
            "start_time": "2023-10-05T12:58:02+05:30",
            "end_time": "2023-10-05T12:58:02+05:30",
            "latitude_start": 12.959366251650632,
            "longitude_start": 77.661011178559,
            "latitude_end": 12.959366251650632,
            "longitude_end": 77.661011178559
        },
        {
            "event_type": 3,
            "event_type_name": "OVERSPEEDING",
            "start_time": "2023-10-05T13:10:38+05:30",
            "end_time": "2023-10-05T13:10:54+05:30",
            "latitude_start": 12.970565366302832,
            "longitude_start": 77.70010989234095,
            "latitude_end": 12.972546197741861,
            "longitude_end": 77.69885898772988,
            "posted_speed_limit_kmph": 40.23356781314575,
            "average_driver_speed_kmph": 54.51889840088128,
            "max_driver_speed_kmph": 58.4395791171367
        }
    ]
}

Was this helpful?