Skip to content

Common API Objects

Common Response

Attribute Type Default Required Description
status TNResponseStatus Yes Response Status Enum
message String No
t T No Data Object

TNResponseStatus

Code Name
32200 SUCCESS
32400 INVALID_REQUEST
32500 INTERNAL_SERVER_ERROR

Get aggregated drive score by time range

TNAggregatedScoreRequest

Attribute Type Default Required Description
startDate Date Yes
endDate Date Yes
intervalType TNIntervalType null No Interval Type Enum
assetId String No Vehicle ID (VIN or channel client id)
assetContext Enum (car, global) No Context for assetId

IntervalType

Name
day
week
month

TNAggregatedScoreResponse

Attribute Type Default Required Description
aggregatedScore TNAggregatedScore No Aggregated score

TNAggregatedScore

Attribute Type Default Required Description
score TNDriveScore Yes Aggregated score
tripsInfo TNTripsInfo Yes Aggregated trips info
tripsEventStatistics Array<TNEventStatistic> Yes number of events by event type for all trips
intervalScores Array<TNIntervalScore> No Aggregated score by interval

TNTripsInfo

Attribute Type Default Required Description
totalTripCount Int 0 Yes The total number of trips
totalDuration Int 0 Yes The total duration of all trips in seconds
totalDistance Double 0.0 Yes The total distance of all trips in meters
totalMovingDuration Int No Total trip moving duration (gps speed is larger than 0) in seconds
totalNightDuration Int No Total trip night duration in seconds (local time 10pm - 4am)
totalNightMovingDuration Int No Total trip night moving duration (gps speed is larger than 0) in seconds (local time 10pm - 4am)
totalNightDistance Double No Total trip night distance in meters (local time 10pm - 4am)
firstTripStartTime Date No first trip start time of aggregated trips info
lastTripStarttime Date No last trip start time of aggregated trips info

TNIntervalScore

Attribute Type Default Required Description
intervalType TNIntervalType Yes Interval Type Enum
startDate Date Yes First day of each interval
score TNDriveScore Yes Aggregated score each interval
tripsInfo TNTripsInfo Yes Aggregated trips info each interval
tripsEventStatistics Array<TNEventStatistic> Yes number of events by event type for all trips

TNDriveScore

Attribute Type Default Required Description
safetyScore Int Deprecated Range: 0 - 100
score Int Yes Range: 0 - 100
scoreVersion String No Requested by Ramana
scoreType Enum No COACHING/SAFETY
scoreDetail ScoreDetail NO Coaching score will not have this detail object
scoreFactors Array<ScoreFactor> No
... Can be extended in future. e.g ecoDrivingScore

ScoreFactor

Attribute Type Default Required Description
score Int Yes range: 0 - 100
type String Yes subScoreType: Acceleration, Braking, Cornering, Speeding, Distraction, Weather, TimeOfDay

ScoreFactorType

Name
ACCELERATION("Acceleration")
BRAKING("Braking")
CORNERING("Cornering")
DISTRACTION("Distraction")
SPEEDING("Speeding")
WEATHER("Weather")
TIME_OF_DAY("TimeOfDay")
MILES_DRIVEN("MilesDriven")

Get aggregated safety score by time range

Condition of eligible safety score:

  • Recording of 5 valid trips.
  • Accumulation of 100 miles driven.

DM Internal Configuration is MONTH, i.e. 2023/1/25 - 2023/2/24. This configuration can be updated from Omni BCM configuration.

For example, 1 day - DAY, 7 days - WEEK, 30 days - MONTH

In the BCM, we can configure settings for aggregated safety score with multiple interval, i.e. aggregatedSafetyScoreInterval=[DAY, WEEK, MONTH]

TNAggregatedSafetyScoreRequest

Attribute Type Default Required Description
startDate Date Yes iso format (date + timezone) - date level or hr/minute
endDate Date Yes iso format (date + timezone)
assetId String No Vehicle ID (VIN or channel client id)
assetContext Enum (car, global) No Context for assetId
timeZoneId String null No Time Zone ID, Example: America/Denver
intervalType Enum (day, week) No Return multiple event statistics by different level of intervals.
E.g. if interval is week, return weekly event statistics.
intervalFilter Enum (eventOnly, scoreOnly, all) No Effective when interval_type is not null.
scoreCreatedTime Date No UTC timestamp which score created. Passing to Omni by score_created_time field.
scoreVersion ScoreVersion(V1_0_4, V1_0_5) No The version of safety score algorithm

TNAggregatedSafetyScoreResponse

Attribute Type Default Required Description
aggregatedSafetyScore TNAggregatedSafetyScore No Aggregated safety score

TNAggregatedSafetyScore

Attribute Type Default Required Description
score TNDriveScore No aggregated safety score
tripsInfo TNTripsInfo No aggregated trips info.
vehicleInfo TNVehicleInfo No vehicle's odometer readings
tripsEventStatistics Array<TNEventStatistic> No number of events by event type for all trips.
safetyIntervalScores Array<TNSafetyIntervalScore> No safety score by interval
tripsRating Rating No aggregated trips rating by interval

TNDriveScore

Attribute Type Default Required Description
safetyScore Integer Yes(Deprecated) Range: [0 - 100], using score instead.
score Integer Yes Range: [0 - 100]
scoreVersion String No Score Version String
scoreType ScoreType No Identify this score type
scoreDetail ScoreDetail No Coaching score will not have this detail object.
scoreFactors List<ScoreFactor> No
... Can be extended in future. e.g ecoDrivingScore

TNVehicleInfo

Attribute Type Default Required Description
startOdometer Double Yes Start of the first trip (in kilometers)
startOdometerTime Integer Yes Start time of the first trip (in millisecond)
endOdometer Double Yes End of the last trip (in kilometers)
endOdometerTime Integer Yes End time of the first trip (in millisecond)

ScoreDetail

Attribute Type Default Required Description
scoreStartDate Date No start date base on aggregatedSafetyScoreInterval setting
ScoreEndDate Date No aggregated trips info.
ScoreQualified Bool No true - qualified safety score, false - unqualified safety score.
scoreUnqualifiedReason String No
scoreQualifiedCriteria String No
scoreCreatedTime Date No score_created_time timestamp from Omni in UTC.
scoreQualificationCriteria Condition No

Condition

Attribute Type Default Required Description
operation OperationType No
conditions List No
criteriaType CriteriaType No
criteriaValue String No

OperationType

Name
and
or

CriteriaType

Name
minimumTripCount
minimumMileage

TNSafetyIntervalScore

Attribute Type Default Required Description
intervalType Enum(day, week) No Required Interval level.
startDate Date No first day of each interval.
tripsInfo TNTripsInfo No trips' summary info.
tripsEventStatistics Array<TNEventStatistic> No number of events by event type for all trips.
score TNDriveScore No

Get cumulative safety score by time range

TNCumulativeSafetyScoreRequest

Attribute Type Default Required Description
startDate Date Yes iso format (date + timezone) - date level or hr/minute
endDate Date Yes iso format (date + timezone)
assetId String null No Vehicle ID (VIN or channel client id)
assetContext Enum(car,global) No Context for assetId
timeZoneId String null No Time Zone ID, Example: America/Denver
intervalType TNCumulativeSafetyScoreIntervalType null No interval level from start date to current date
scoreCreatedTime Date No UTC timestamp which score created. Passing to Omni by score_created_time field.
scoreVersion ScoreVersion No The version of safety score algorithm.
scoreBaseTime Date No the calculation of the CumulativeSafetyScore based on the start period of trip

TNCumulativeSafetyScoreIntervalType

Name
incremental

TNCumulativeSafetyScoreResponse

Attribute Type Default Required Description
cumulativeSafetyScore TNCumulativeSafetyScore No

CumulativeSafetyScore

Attribute Type Default Required Description
intervalType TNCumulativeSafetyScoreIntervalType Yes cumulative safety score by score interval
historicalSafetyScores List<TNHistoricalSafetyScore> No historic cumulative safety score by historic range

HistoricalSafetyScore

Attribute Type Default Required Description
endDate Date No Last day of each interval
tripsInfo TNTripsInfo No Cumulative trips info each interval
tripsEventStatistics List<TNEventStatistic> No number of events by event type for all trips.
score TNDriveScore No Cumulative score each interval

Get cumulative* score by fixed time window

TNGetCumulativeScoreRequest

Attribute Type Default Required Description
lastNumOfDays Int 0 No Return historic score and sub scores. Greater than 0 and less than 30 days
assetId String No Vehicle ID (VIN or channel client id)
assetContext Enum (car, global) No Context for assetId

TNGetCumulativeScoreResponse

Attribute Type Default Required Description
cumulativeScore TNCumulativeScore Yes

TNCumulativeScore

Attribute Type Default Required Description
currentScore TNDriveScore Yes cumulative score by score interval
interval TNScoringInterval Yes
tripsInfo TNTripsInfo Yes
historicalScores Array<TNHistoricalScore> No historic cumulative score by historic range

TNTripsInfo

Attribute Type Default Required Description
totalTripCount Int 0 Yes The total number of trips
totalDuration Int 0 Yes The total duration of all trips in seconds
totalDistance Double 0.0 Yes The total distance of all trips in meters
totalMovingDuration Int No Total trip moving duration (gps speed is larger than 0) in seconds
totalNightDuration Int No Total trip night duration in seconds (local time 10pm - 4am)
totalNightMovingDuration Int No Total trip night moving duration (gps speed is larger than 0) in seconds (local time 10pm - 4am)
totalNightDistance Double No Total trip night distance in meters (local time 10pm - 4am)
firstTripStartTime Date No first trip start time of aggregated trips info
lastTripStarttime Date No last trip start time of aggregated trips info |

HistoricalScore

Attribute Type Default Required Description
date Date Yes date of historical cumulative score
score DriveScore Yes overall score

Get score factor descriptions

TNGetConfigDescriptionsRequest

Attribute Type Default Required Description
type TNConfigDescriptionType Yes

TNConfigDescriptionType

Name
SCORE_FACTOR_DESCRIPTION

TNGetConfigDescriptionsResponse

Attribute Type Default Required Description
descriptions Array<TNDescriptionItem> Yes

TNDescriptionItem

Attribute Type Default Required Description
type String Yes Same with factor's type
label String Yes The display label for this factor
detail String Yes The detail description for this factor

Get trips by time range

TNGetTripsRequest

Attribute Type Default Required Description
startDate Date Yes
endDate Date Yes
assetId String No Vehicle ID (VIN or channel client id)
assetContext Enum (car, global) No Context for assetId
limit Int 20 No Limit on the number of trips to be returned, 0 for all trips without size limitation
offset Int 0 No Offset is the index of object that defines your place in the list, starting with 0, only take effect when limit is not 0
sortType TelenavDriveMotionAPI.TripSortType TripSortType.tripStartTimeDESC No Trips sort order. Enum: TripSortType.tripStartTimeDESC/TripSortType.tripStartTimeASE
transportationModes Array<String> nil No Trips transportation modes which request such as: ["DRIVER", "PASSENGER"], Default value is nil for all type of trips.
tripSelectionStatus AllTripSelectionStatus nil No The value indicate matching different set of trips

TripSortType

Name
tripStartTimeASE
tripStartTimeDESC

AllTripSelectionStatus

Name
all
selected
duplicate
unknown

TNGetTripsResponse

Attribute Type Default Required Description
hasMore Bool Yes if there are more trips
trips Array<TNBasicTrip> Yes The trips that hit the request query condition

TNBasicTrip

Attribute Type Default Required Description
tripInfo TNTripInfo Yes Trip summary info
score TNDriveScore Yes Trip score
tripEventStatistics Array<TNEventStatistic> No Trip event statistics
tripEvents Array<DMEvent> No Trip events
tripRating Rating No Trip events

Rating

Attribute Type Default Required Description
ratingScaled Int Yes The scaled rating value belongs to the requested lower bound and upper bound. Value is [1, 10].
ratingFactors List No factors of rating.
ratingVersion String No

RatingFactor

Attribute Type Default Required Description
ratingScaled Int Yes The scaled rating value belongs to the requested lower bound and upper bound.
type String No Same as ScoreFactor type, only has Acceleration, Brake, Speeding.

TNTripInfo

Attribute Type Default Required Description
tripId String Yes Trip id
startTime Date Yes Trip start time
endTime Date Yes Trip end time
startLocation TNLocation Yes Trip start location
endLocation TNLocation Yes Trip end location
duration Int64 Yes Trip duration time in seconds
distance Double Yes Trip distance in meters
transportationMode TNTransportationMode No Trip transportation mode or label
maxSpeed Double No Trip max speed in meters per seconds
movingDuration Int64 No Trip moving duration (gps speed is larger than 0) in seconds
nightDuration Int64 No Trip night duration in seconds (local time 10pm - 4am)
nightMovingDuration Int64 No Trip night moving duration (gps speed is larger than 0) in seconds (local time 10pm - 4am)
nightDistance Double No Trip night distance in meters (local time 10pm - 4am)
isAnonymized boolean Yes Whether the data is truncated.
isUploaded boolean Yes Whether the trip has been uploaded.
isMatch boolean No Whether the trip matches the selection criteria.
tripSelectionStatus TripSelectionStatus No The status of the trip selection, which can be either valid or duplicate

TripSelectionStatus

Name
selected
duplicate
unknown

TNLocation

Attribute Type Default Required Description
lat Double Yes Location latitude
lon Double Yes Location longitude
label String No Location label
time Date No Location time
isPredict Bool Yes Is this location predicted by routing

Get trip detail by trip id

TNGetTripDetailRequest

Attribute Type Default Required Description
tripId String Yes Trip id
assetId String No Vehicle ID (VIN or channel client id)
assetContext Enum (car, global) No Context for assetId

TNGetTripDetailResponse

Attribute Type Default Required Description
trip TNTrip No

TNTrip

Attribute Type Default Required Description
tripInfo TNTripInfo Yes
score TNDriveScore Yes Trip score
tripEventStatistics Array<TNEventStatistic> Yes Event statistic information
tripEvents Array<DMEvent> No Trip events
tripRating Rating No
tripRoute Array<TNLocation> Yes Trip route points for the whole trip

TNEventStatistic

Attribute Type Default Required Description
eventType DMEventType Yes Event Type Enum
count Int Yes Event count
distance Double NO distance (meters) of event
duration Double NO duration (seconds) of event

DMEvent

Attribute Type Default Required Description
eventType DMEventType Yes Event Type Enum
eventTime Date Yes Event time
eventLevel String No Level: LOW/MEDIUM/HIGH
eventLocation TNLocation Yes Event location
eventDetails Array<EventItem> No

DMEventType

label Name
HardBrake HARD_BRAKE
HardAcceleration HARD_ACCELERATION
SharpTurn SHARP_TURN

EventItem

Attribute Type Default Required Description
itemType EventItemType Yes event item type
itemLevel Enum No Different levels of event item
itemStartTime Date Yes event item start time
itemStartLocation TNLocation No event item start location
itemEndTime Date No event item end time
itemEndLocation TNLocation No event item end location

Get latest trip detail

TNGetLatestTripDetailRequest

Attribute Type Default Required Description
assetId String No Vehicle ID (VIN or channel client id)
assetContext Enum (car, global) No Context for assetId

TNGetLatestTripDetailResponse

Attribute Type Default Required Description
trip TNTrip No

TNGetLiveTripDetailResponse

Attribute Type Default Required Description
liveTrip TNLiveTrip No

TNLiveTrip

Attribute Type Default Required Description
liveTripInfo TNLiveTripInfo Yes
score TNDriveScore Yes Trip score
tripEventStatistics Array<TNEventStatistic> Yes Event statistic information
tripEvents Array<DMEvent> No Trip events

TNLiveTripInfo

Attribute Type Default Required Description
tripId String Yes Trip id
startTime Date Yes Trip start time
startLocation TNLocation Yes Trip start location
lastUpdateTime Date Yes Trip end time
lastUpdateLocation TNLocation Yes Trip end location
distance Double Yes Trip distance in meters

Update trip transportation mode labeling by trip id

UpdateTripTransportationModeRequest

Attribute Type Default Required Description
tripId String Yes The trip id which need to update
transportationMode TransportationMode Yes The trip's transportation mode which manually specified by user.

TransportationMode

Name
DRIVER
PASSENGER
TRAIN
AIRPLANE
BIKE
BOAT
BUS
MOTORCYCLE
FOOT
OTHER

UpdateTripTransportationModeResponse

Attribute Type Default Required Description
trip TNTripInfo No The trip info with updated transportation mode

Get Streaks

TNGetStreaksRequest

Attribute Type Default Required Description
assetId String No Vehicle ID (VIN or channel client id)
assetContext Enum (car, global) No Context for assetId

GetStreaksResponse

Attribute Type Default Required Description
streaks List Yes

Streak

Attribute Type Default Required Description
eventType EventType Yes Same with EventStatistic event_type
current StreakStatistic Yes Streak statistics for current
best StreakStatistic Yes Streak statistics for best

StreakStatistic

Attribute Type Default Required Description
startTime Date No
endTime Date No
tripCount Integer No
distance Double No trip distance in meters
duration Integer No trip duration in seconds

Get simulated safety score

GetSimulatedSafetyScoreRequest

Attribute Type Default Required Description
tripsInfo BasicTripsInfo Yes total trip distance in meters
tripsEventStatistics List<EventStatistic> Yes
state String No
score_version String No Should be same as getAggregatedSafetyScore.score.scoreVersion

BasicTripsInfo

Attribute Type Default Required Description
totalTripCount Int Yes total trip count
totalDistance number Yes total trip distance in meters

GetSimulatedSafetyScoreResponse

Attribute Type Default Required Description
aggregatedSafetyScore AggregatedSafetyScore No
status ResponseStatus Yes 32200 - Success 32400 - Invalid Request 32500 - Internal Service Error

Get event percentile table

GetEventPercentileTableRequest

Attribute Type Default Required Description
state Enum Yes such as: "AZ"
scoreVersion Enum No

State

Name
AZ
AK
... 51 State

ScoreVersion

Name
V1_0_3
V1_0_4
V1_0_5

GetEventPercentileTableResponse

Attribute Type Default Required Description
eventPercentileTable EventPercentileTable No all event percentile value(count = 100)
status ResponseStatus Yes 32200 - Success 32400 - Invalid Request 32500 - Internal Service Error

EventPercentileTable

Attribute Type Default Required Description
haCountPerMile List Yes hard acceleration count per mile
hbCountPerMile List Yes hard braking count per mile
spDistanceOverSpeedLimitPerMile List Yes speed distance over the speed limit per mile

Get Contextual Coaching Statistics

TNGetContextualCoachingStatisticsRequest (Class)

Attribute Type Default Required Description
previousPeriod DateRange No The previous period date range
currentPeriod DateRange Yes The current period date range
assetId String No Vehicle Identification which wants to be requested, nil for request all trips
assetContext Enum(car,global) No Context for assetId
timezone String No Policy timezone
scoreVersion String No The version of the score algorithm, if not set, the latest version will be used
groupBy Set No Group factors for the statistics, nil for calculate all the factors
rankBy Set No Rank metrics for the statistics, nil for calculate all the metrics

DateRange (Class)

Attribute Type Default Required Description
start Date Yes Start date of the range
end Date Yes End date of the range

TNGetContextualCoachingStatisticsResponse (Class)

Attribute Type Default Required Description
responseStatus TNResponseStatus(Enum) Yes 32200 - Success 32400 - Invalid Request 32500 - Internal Service Error
responseMessage String No Response message from TNDriveMotionResponse
currentStatistics ContextualCoachingStatisticsBundle No Current statistics detail
previousStatistics ContextualCoachingStatisticsBundle No Previous statistics detail
standouts Dictionary<ContextualCoachingGroupFactor, Dictionary<ContextualCoachingRankMetrics, ContextualCoachingStandouts>> No Standouts detail
objcStandouts NSDictionary Yes The original dictionary of standouts provided to objective-C

ContextualCoachingStatisticsBundle

Attribute Type Default Required Description
aggregatedMetrics ContextualCoachingStatisticsMetrics Yes Aggregated metrics for the statistics bundle
statistics Dictionary {} No Statistics grouped by coaching group factor
objcStatistics NSDictionary Yes The original dictionary of statistics provided to objective-C
objcStatistics NSDictionary Yes The original dictionary of statistics provided to objective-C

ContextualCoachingStandouts

Attribute Type Default Required Description
upper ContextualCoachingStandoutsMetrics No Upper bound metrics for coaching standouts
lower ContextualCoachingStandoutsMetrics No Lower bound metrics for coaching standouts

ContextualCoachingStandoutsMetrics

Attribute Type Default Required Description
trips Dictionary<ContextualCoachingFactorBucket, Array<TNBasicTrip>> Yes Trips grouped by coaching factor bucket
aggregateScoreImpacted Int Yes Aggregate score impact value

ContextualCoachingGroupFactor (Enum)

Name Value Description
timeOfDay 0 Time of day factor
dayOfMonth 1 Day of month factor
dayOfWeek 2 Day of week factor
tripLength 3 Trip length factor

TimeOfDay (Enum)

Name Value Description
morning 0 Morning time period
noon 1 Noon time period
lateAfternoon 2 Late afternoon time period
earlyNight 3 Early night time period
lateNight 4 Late night time period

DayOfMonth (Class)

Attribute Type Default Required Description
year Int Yes Calendar year
month Int Yes Month of the year
day Int Yes Day of the month

DayOfWeek (Enum)

Name Value Description
sunday 1 Sunday
monday 2 Monday
tuesday 3 Tuesday
wednesday 4 Wednesday
thursday 5 Thursday
friday 6 Friday
saturday 7 Saturday

TripLength (Enum)

Name Value Description
short 0 Short trip
medium 1 Medium trip
long 2 Long trip

ContextualCoachingRankMetrics (Enum)

Name Value Description
score 0 Overall score
hardAccelerationPerMile 1 Hard acceleration events per mile
hardBrakingPerMile 2 Hard braking events per mile
speedingPerMile 3 Speeding events per mile

ContextualCoachingStatistics

Attribute Type Default Required Description
buckets Dictionary Yes Statistics metrics grouped by coaching factor bucket

ContextualCoachingStatisticsMetrics

Attribute Type Default Required Description
trips Array Yes List of basic trips
score TNDriveScore Yes Drive score for the statistics
valueByMetrics Dictionary Yes Values for different metrics (score, hardAccelerationPerMile, etc.)
totalTrips Int Yes Total number of trips
totalMiles Double Yes Total distance in miles
objcValueByMetrics NSDictionary Yes Objective-C bridge for valueByMetrics dictionary

ContextualCoachingFactorBucket (Class)

Attribute Type Default Required Description
type ContextualCoachingGroupFactor Yes Type of coaching factor
timeOfDayValue TimeOfDay No Time of day value when type is timeOfDay
dayOfWeekValue DayOfWeek No Day of week value when type is dayOfWeek
dayOfMonthValue DayOfMonth No Day of month value when type is dayOfMonth