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.
GET https://api.samsara.com/fleet/routes/audit-logs/feed
See the full reference docs here.
You can read more about stop state changes in the Route Tracking Knowledge Base article.
This endpoint is designed for you to repeatedly poll using an endCursor to get updates since the last time you sent a request. For example:
You can repeatedly poll the endpoint as described above and get new updates each time.
An example response to the GET /fleet/routes/audit-logs/feed with one update (the data array could contain many updates) looks like:
{
"data": [
{
"time": "2021-05-06T11:24:21.887Z",
"type": "route tracking",
"source": "automatic",
"operation": "stop en route",
"route": {
"id": "4319641111",
"name": "Route 1234"
},
"changes": {
"before": {
"stops": [
{
"id": "4439719125",
"state": "scheduled"
}
]
},
"after": {
"stops": [
{
"id": "4439719125",
"enRouteTime": "2021-05-06T11:23:40.746Z",
"state": "en route"
}
]
}
}
}
],
"pagination": {
"endCursor": "3e71bf73-eb3a-4ee5-a997-6a2c4c98b7fa",
"hasNextPage": false
}
}
You can write a loop to repeatedly poll the endpoint to get new updates:
import requests
import json
import time
url = "https://api.samsara.com/fleet/routes/audit-logs/feed"
headers = {"Authorization": "Bearer <token>"}
params = {}
while True:
response = requests.request("GET", url, headers=headers, params=params).json()
for update in response["data"]:
# Do something with stop update
pass
params["after"] = response["pagination"]["endCursor"]
if response["pagination"]["hasNextPage"] == False:
time.sleep(5)