Skip to main content
POST
/
v1
/
sensors
/
history
Get sensor history
curl --request POST \
  --url https://api.samsara.com/v1/sensors/history \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "endMs": 1462881998034,
  "series": [
    {
      "field": "ambientTemperature",
      "widgetId": 1
    }
  ],
  "startMs": 1462878398034,
  "stepMs": 3600000,
  "fillMissing": "withNull"
}
'
{
  "results": [
    {
      "series": [
        1
      ],
      "timeMs": 1453449599999
    }
  ]
}

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.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Time range and resolution, and list of sensor ID, field pairs to query.

endMs
integer
required

End of the time range, specified in milliseconds UNIX time.

Example:

1462881998034

series
object[]
required
Maximum array length: 40
startMs
integer
required

Beginning of the time range, specified in milliseconds UNIX time.

Example:

1462878398034

stepMs
integer
required

Time resolution for which data should be returned, in milliseconds. Specifying 3600000 will return data at hour intervals.

Example:

3600000

fillMissing
enum<string>
default:withNull
Available options:
withNull,
withPrevious

Response

List of results objects, each containing a time and a datapoint for each requested sensor/field pair.

Contains the results for a sensor history request. Each result contains a timestamp and datapoint for each requested (sensor, field) pair.

results
object[]