# Timeline

The Vehicle Timeline Service offers an overview of a vehicle's statistics, formatted as a vector with chronologically sorted data.&#x20;

This information is available in two time scales (weekly and monthly) and is generated by averaging and summarizing trip details over the selected period. The same statistics are retrieved for each individual road context.

The timeline updates automatically with the analysis of each new trip.

{% hint style="info" %}
If you have your **admin API key**, you can try the API via this[ **link**](https://drivequant.stoplight.io/docs/drivequant-public/6ab221a5bc452-get-vehicle-timeline).
{% endhint %}

## GET /drivekit/admin/vehicles/{vehicleId}/timeline

> Get vehicle timeline

```json
{"openapi":"3.0.3","info":{"title":"DKAdminVehiclesV3","version":"1.0"},"servers":[{"url":"https://service.drivequant.com/v3","description":"Prod"}],"security":[{"api-key":[]}],"components":{"securitySchemes":{"api-key":{"name":"DriveKit-Admin-API-Key","type":"apiKey","in":"header"}},"schemas":{"TimelineVehicle":{"title":"TimelineVehicle","type":"object","properties":{"month":{"$ref":"#/components/schemas/TimelineVehicleLists"},"week":{"$ref":"#/components/schemas/TimelineVehicleLists"}}},"TimelineVehicleLists":{"title":"TimelineVehicleLists","type":"object","properties":{"allContext":{"$ref":"#/components/schemas/TimelineVehicleItem"},"roadContexts":{"type":"array","items":{"$ref":"#/components/schemas/RoadTimelineVehicleItem"}}}},"TimelineVehicleItem":{"title":"TimelineVehicleItem","type":"object","properties":{"date":{"type":"array","description":"First day of the timeline period","items":{"type":"string","format":"date-time"}},"numberTrip":{"type":"array","description":"Total number of trips","items":{"type":"integer","minimum":0}},"distance":{"type":"array","description":"Total distance (in km)","items":{"type":"number","minimum":0}},"duration":{"type":"array","description":"Total duration (in min)","items":{"type":"integer","minimum":0}},"fuelVolume":{"type":"array","description":"Total fuel volume (in L)","items":{"type":"number","minimum":0}}}},"RoadTimelineVehicleItem":{"title":"RoadTimelineVehicleItem","type":"object","allOf":[{"$ref":"#/components/schemas/TimelineVehicleItem"},{"type":"object","properties":{"roadContext":{"type":"string","description":"Road context","enum":["HEAVY_URBAN_TRAFFIC","CITY","SUBURBAN","EXPRESSWAYS"]}}}]},"ErrorResponse":{"title":"ErrorResponse","type":"object","properties":{"message":{"type":"string"},"code":{"type":"integer"},"messageKey":{"type":"string"}}}}},"paths":{"/drivekit/admin/vehicles/{vehicleId}/timeline":{"get":{"summary":"Get vehicle timeline","tags":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TimelineVehicle"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Vehicle or Timeline Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"get-drivekit-admin-vehicles-vehicleId-timeline","parameters":[{"schema":{"type":"string"},"in":"header","name":"DriveKit-Admin-API-Key","description":"Drivekit Admin API key","required":true}],"description":""}}}}
```

{% hint style="info" %}

## Note&#x20;

Use the `dateFormat` query parameter to control the format of the date fields in the response. Accepted values are:

* `timestamp` : returns dates as a 64-bit integer representing the number of milliseconds elapsed since the Unix epoch (January 1, 1970, 00:00:00 UTC). Example: `1685625600000`
* `isodate` : returns dates as a string conforming to the ISO 8601 standard. Example: `2023-06-01T13:20:00.168Z`

If the `dateFormat` parameter is not specified, the response defaults to `isodate` format.
{% endhint %}

## Response

The table below summarizes the list of timeline data.

| Field | Type                  | Description        |
| ----- | --------------------- | ------------------ |
| month | [Timeline](#timeline) | Monthly statistics |
| week  | [Timeline](#timeline) | Weekly statistics  |

### Timeline

The table below summarizes the content of a timeline object.

<table><thead><tr><th width="135.03125">Field</th><th width="234.703125">Type</th><th>Description</th></tr></thead><tbody><tr><td>allContext</td><td><a href="#globaltimelineitemvehicle">GlobalTimelineItemVehicle</a></td><td>Average statistics for all contexts</td></tr><tr><td>roadContext</td><td><code>array[object]</code></td><td>Average statistics for each context (see <a href="#timelineitemvehicle">TimelineItemVehicle</a>)</td></tr></tbody></table>

### GlobalTimelineItemVehicle

The table below summarizes the content of a globalTimelineItemVehicle object.

<table><thead><tr><th width="215.21484375">Field</th><th width="149.7109375">Type</th><th>Description</th></tr></thead><tbody><tr><td>date</td><td><code>array[string]</code></td><td>First date of the period<br><em>Default date format: <code>YYYY-MM-dd’T’HH:mm:ss.SSSZ</code></em></td></tr><tr><td>numberTrip</td><td><code>array[integer]</code></td><td>Number of trips during the period</td></tr><tr><td>distance</td><td><code>array[number]</code></td><td>Distance driven during the period (in km)</td></tr><tr><td>distanceLoss </td><td><code>array[number]</code></td><td><p>Estimated loss distance during the period at the beginning of the trips (in km).</p><p><em>Requires the route start completion feature to be enabled.</em></p></td></tr><tr><td>duration</td><td><code>array[number]</code></td><td>Trip duration during the period (in min)</td></tr><tr><td>fuelVolume</td><td><code>array[number]</code></td><td>Amount of fuel used during the period (in L)</td></tr><tr><td>fuelConsumption</td><td><code>array[number]</code></td><td>Fuel consumption during the period (in L/100km)</td></tr><tr><td>co2</td><td><code>array[number]</code></td><td>Consumption during the period (in gCO2/km)</td></tr><tr><td>co2Opti</td><td><code>array[number]</code></td><td>Optimal consumption during the period (in gCO2/km)</td></tr><tr><td>energyKWh</td><td><code>array[number]</code></td><td>Energy during the period (in kWh)</td></tr><tr><td>energyKWhOpti</td><td><code>array[number]</code></td><td>Optimal Energy during the period (in kWh)</td></tr><tr><td>energyConsumption</td><td><code>array[number]</code></td><td>Energy consumption during the period (in kWh/100km)</td></tr><tr><td>energyOptiConsumption</td><td><code>array[number]</code></td><td>Optimal Energy during the period (in kWh/100km)</td></tr></tbody></table>

### TimelineItemVehicle

The table below summarizes the content of a timelineItemVehicle object.

<table><thead><tr><th width="215.3203125">Field</th><th width="149.91015625">Type</th><th>Description</th></tr></thead><tbody><tr><td>date</td><td><code>array[string]</code></td><td>First date of the period<br><em>Default date format: <code>YYYY-MM-dd’T’HH:mm:ss.SSSZ</code></em></td></tr><tr><td>roadContext</td><td><code>array[string]</code></td><td><p>Type of <a href="#roadcontext">RoadContext</a>.</p><p><em>Allowed values: <code>HEAVY_URBAN_TRAFFIC</code>, <code>CITY</code>, <code>SUBURBAN</code>, <code>EXPRESSWAYS</code></em></p></td></tr><tr><td>numberTrip</td><td><code>array[integer]</code></td><td>Number of trips for which this road context was the major one</td></tr><tr><td>distance</td><td><code>array[number]</code></td><td>Distance driven in this context (in km)</td></tr><tr><td>distanceLoss</td><td><code>array[number]</code></td><td><p>Estimated loss distance during the period at the beginning of the trips (in km).</p><p><em>Requires the route start completion feature to be enabled.</em></p></td></tr><tr><td>duration</td><td><code>array[number]</code></td><td>Trip duration in this context (in min)</td></tr><tr><td>fuelVolume</td><td><code>array[number]</code></td><td>Amount of fuel used in this context (in L)</td></tr><tr><td>fuelConsumption</td><td><code>array[number]</code></td><td>Fuel consumption in this context (in L/100km)</td></tr><tr><td>co2</td><td><code>array[number]</code></td><td>Consumption in this context  (in gCO2/km)</td></tr><tr><td>co2Opti</td><td><code>array[number]</code></td><td>Optimal consumption in this context  (in gCO2/km)</td></tr><tr><td>energyKWh</td><td><code>array[number]</code></td><td>Energy in this context (in kWh)</td></tr><tr><td>energyKWhOpti</td><td><code>array[number]</code></td><td>Optimal Energy in this context (in kWh)</td></tr><tr><td>energyConsumption</td><td><code>array[number]</code></td><td>Energy consumption in this context (in kWh/100km)</td></tr><tr><td>energyOptiConsumption</td><td><code>array[number]</code></td><td>Optimal Energy in this context (in kWh/100km)</td></tr></tbody></table>

### RoadContext

Road contexts are calculated from the GPS velocity. They are not based on map data.

<table><thead><tr><th width="195.29296875">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>HEAVY_URBAN_TRAFFIC</code></td><td>Speed below 30 km/h and distance between two stops greater than 100m</td></tr><tr><td><code>CITY</code></td><td>30 km/h &#x3C; Speed &#x3C; 65 km/h</td></tr><tr><td><code>SUBURBAN</code></td><td>65 km/h &#x3C; Speed &#x3C; 96 km/h</td></tr><tr><td><code>EXPRESSWAYS</code></td><td>Speed > 96 km/h</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.drivequant.com/backend/vehicle/timeline.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
