Skip to main content

Vehicle Segments

Get segmented trip data from DIMO-connected vehicles.

Overview

The segments resource serves as the "trips" part of the Telemetry API, allowing developers to gather trip data for vehicles.

Detection Mechanism

Segments can be detected using different mechanisms. This is a crucial part of querying segments.

DetectionMechanism Enum

ignitionDetection
Ignition-based detection: Segments are identified by isIgnitionOn state transitions. Most reliable for vehicles with proper ignition signal support.
frequencyAnalysis
Frequency analysis: Segments are detected by analyzing signal update patterns. Uses pre-computed materialized view for optimal performance. Ideal for real-time APIs and bulk queries.
changePointDetection
Change point detection: Uses CUSUM algorithm to detect statistical regime changes. Monitors cumulative deviation in signal frequency via materialized view. Excellent noise resistance with 100% accuracy match to ignition baseline. Best alternative when ignition signal is unavailable - same accuracy, same speed as frequency analysis.

segments

The segments query allows you to retrieve trip segments.

Query Arguments

Arguments

tokenIdInt!Required
The vehicle token ID.
fromTime!Required
Start time of the range.
toTime!Required
End time of the range.
mechanismDetectionMechanism!Optional
The method used to detect segments (default: frequencyAnalysis).
configSegmentConfigOptional
Configuration for segment detection parameters.

Response Fields

Fields

startTimeTime!
Segment start timestamp (actual activity start transition).
endTimeTime
Segment end timestamp (activity end after debounce period). Null if segment is ongoing (extends beyond query range).
durationSecondsInt!
Duration in seconds. If ongoing: from start to query 'to' time. If complete: from start to end.
isOngoingBoolean!
True if segment extends beyond query time range (last activity is ongoing).
startedBeforeRangeBoolean!
True if segment started before query time range. Indicates startTime may be approximate.
query getSegment {
segments(
tokenId: 117315,
from: "2025-11-01T09:21:19Z",
to: "2025-11-07T09:21:19Z",
mechanism: frequencyAnalysis
config: {
signalCountThreshold: 10
minIdleSeconds: 60
minSegmentDurationSeconds: 120
}
) {
startTime
endTime
isOngoing
durationSeconds
startedBeforeRange
}
}

Response Example

{
"data": {
"segments": [
{
"startTime": "2025-11-01T21:07:00Z",
"endTime": "2025-11-01T22:02:00Z",
"isOngoing": false,
"durationSeconds": 3300,
"startedBeforeRange": false
},
{
"startTime": "2025-11-01T22:15:00Z",
"endTime": "2025-11-01T22:40:00Z",
"isOngoing": false,
"durationSeconds": 1500,
"startedBeforeRange": false
}
]
}
}