Skip to main content

Trip Detail

Get Trip Detail

GET
https://api.fairmatic.com/api/v1/trip/trip_id/<trip_id>?page=1

GET
https://api.fairmatic.com/api/v1/trip/tracking_id/<tracking_id>?page=1

The trip detail API provides comprehensive information about a specific trip, highlighting its path and events. By utilising either trip_id or tracking_id, users can retrieve these details.

The trip_id is generated by fairmatic and can be fetched from the trip list API. The tracking_id is set when you start a trip via the SDK.

info
  • This API is paginated with limit of 5 records per page.
  • All dates and epoch time is provided here are as per UTC timezone.
  • It takes 4 hours for the trips to get collected and processed. Therefore, the trips will reflect in this API after 4 hours of trip completion.

Headers

NameValue
Content-Typeapplication/json
AuthorizationAPIKEY <token>

Body

NameTypeDescription
pageintegerPage number

Response

{
"count": 4,
"current_page": 1,
"next_page": 2,
"limit": 5,
"trips": [
{
"trip_id": "96a4f7c842f74bfab0962feeae52a21b",
"driver_id": "fe497c39d28b4c50828389730e2292fd",
"trip_start_time": 1716432408087,
"trip_end_time": 1716432708087,
"duration_seconds": 2259.8329999999996,
"distance_miles": 52.11779602592761,
"insurance_period": null, // valid values 1/2/3/null
"start_latitude": 38.04636977126205,
"start_longitude": -121.39782655062564,
"end_latitude": 37.76203001834099,
"end_longitude": -121.4533660947544,
"night_driving_seconds": 0.0,
"highway_miles": 39.90748363242293,
"night_driving_miles": 0.0,
"event_summary": {
"phone_use_count": 6,
"rapid_acceleration_count": 3,
"hard_brake_count": 1,
"overspeeding_count": 0,
"phone_use_time_seconds": 491.98999999999995,
"overspeeding_time_seconds": 0.0
},
"focus_area": {
"is_phone_use": true,
"is_rapid_acceleration": false,
"is_hard_brake": false,
"is_overspeeding": false,
},
"trail_path": [
{
"timestamp": 1699143824003,
"latitude": 38.04636977126205,
"longitude": -121.39782655062564,
"course": 281.0
},
{
"timestamp": 1699143825003,
"latitude": 38.04638866462499,
"longitude": -121.39790476231067,
"course": 281.0
},
...
{
"timestamp": 1699146082999,
"latitude": 37.76203001834099,
"longitude": -121.4533660947544,
"course": 0.0
}
],
"events": [
{
"event_type": 7,
"event_start_timestamp": 1699143826002,
"event_end_timestamp": 1699143845471,
"event_start_longitude": -121.39797110712945,
"event_start_latitude": 38.04640469134358,
"event_end_latitude": 38.04698855623943,
"event_end_longitude": -121.39842772248213,
"event_name": "PHONE_USE",
"event_data": {}
},
...
{
"event_type": 9,
"event_start_timestamp": 1699145915999,
"event_end_timestamp": 1699145994000,
"event_start_longitude": -121.43680840646454,
"event_start_latitude": 37.765052542883616,
"event_end_latitude": 37.765024732272934,
"event_end_longitude": -121.45345899693541,
"event_name": "OVERSPEEDING",
"event_data": {
"user_speed_mph": 43.3692,
"speed_limit_mph": 25,
"max_user_speed_mph": 49.287
}
}
]
},
trip 2 ...,
trip 3 ...,
]
}

Event Types

  • PHONE_USE (event_type: 7): No additional event data.
  • HARD_BRAKE (event_type: 2): No additional event data.
  • RAPID_ACCELERATION (event_type: 1): No additional event data.
  • OVERSPEEDING (event_type: 9): Includes data fields: "user_speed_mph", "speed_limit_mph", "max_user_speed_mph".

Events

Events of the above types will be included in the events list. Each event will have:

  • Start and end timestamps
  • Start and end location latitude and longitude

Trail Path

The trail path shows the route taken by the vehicle. The course indicates the direction the vehicle is heading in degrees relative to North.

Insurance Periods

If an insurance period applies to your fleet, you will receive values of 1, 2, or 3. Otherwise, fleets that do not require insurance periods will have a value of null.