Sensors

Get sensor history

🚧 This endpoint is still on our legacy API.

Get historical data for specified sensors. This method returns a set of historical data for the specified sensors in the specified time range and at the specified time resolution.

<b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).

Submit Feedback: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

To use this endpoint, select Write Sensors under the Equipment category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

post/v1/sensors/history

Request

  • Base URL
    https://api.samsara.com
  • Auth
    HTTP bearer

Request body

endMsinteger required

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

fillMissing'withNull' | 'withPrevious'
startMsinteger required

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

stepMsinteger required

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

Example request

{
  "endMs": 1462881998034,
  "series": [
    {
      "field": "ambientTemperature",
      "widgetId": 1
    }
  ],
  "startMs": 1462878398034,
  "stepMs": 3600000
}

Response

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

Example response

{
  "results": [
    {
      "series": [
        1
      ],
      "timeMs": 1453449599999
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.