Documentation Index
Fetch the complete documentation index at: https://samsara-showcase.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
The/fleet/vehicles/stats/history endpoint allows you to pull a historical report of GPS and onboard diagnostic data. See the query parameters section for details on which types of data are available.
If you’re looking for a way to sync telematics data (either continuously or on a periodic basis), see the Telematics Feed guide instead. The /feed endpoint is designed for synchronization use cases and less susceptible to “missing” data due to connectivity issues.
This endpoint is most suited for the use cases such as:
- Back-filling historical vehicle stat data
- Ad-hoc querying of a historical time period of data
Start and End Time
The main features of this endpoint are thestartTime and endTime parameters, which are required.
The following request retrieves engine state data for the 24 hours between June 23, 2020 and June 24, 2020 in UTC time. The types parameter indicates which vehicle stats to query. See the Timestamps guide for details on timestamp formatting.
data array, which contains an entry for each vehicle in the fleet. In this example, there are two vehicles: "Little Red", and "Big Red". The engineStates array for each vehicle lists all the engine states changes during the requested time range for that vehicle.
Pagination
The data returned by this endpoint may be paginated to improve performance. This means that if there are a large number of vehicles in the fleet and/or you query for a long time period, then the results will be returned across multiple pages. ThehasNextPage field indicates whether there are more pages in your query. If so, you can use the endCursor to request the subsequent page.
The following sample code demonstrates how to paginate through all pages in the query to make sure that you receive all the data you requested: