Retrieve vehicle location and trip data from a Samsara fleet for rental vehicle tracking
domain: developers.samsara.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Create a Samsara account and navigate to Settings > API Tokens to generate an API token with the appropriate read scopes (vehicles, locations, trips).
Authenticate all requests by including the token as a Bearer token in the Authorization header.
Call GET /fleet/vehicles to list all vehicles in the fleet; capture vehicle IDs for use in subsequent calls.
Call GET /fleet/vehicles/locations with a vehicle ID or tag filter to retrieve real-time GPS positions, heading, and speed for vehicles of interest.
Call GET /fleet/vehicles/stats with types set to fuelPercents or obdOdometerMeters to retrieve fuel level and odometer readings per vehicle.
Call GET /fleet/trips with a vehicle ID and startMs/endMs time window to retrieve historical trip segments including distance, start/end addresses, and driver (if assigned).
Known gotchas
Samsara's API uses cursor-based pagination for large fleets; always check the hasNextPage field and use the endCursor value to retrieve subsequent pages.
Location data freshness depends on the vehicle gateway's cellular connectivity; vehicles in underground garages or tunnels will show the last known position, not real-time.
Samsara token scopes are configured at generation time; a token without the locations:read scope returns 403 for location endpoints — request the correct scopes up front.
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?