---
title: "Get sensor history"
method: POST
path: "/v1/sensors/history"
tags: ["Sensors"]
---

# Get sensor history

`POST /v1/sensors/history`

## Request

- Base URL: `https://api.samsara.com`
- URL: `https://api.samsara.com/v1/sensors/history`
- Auth: HTTP bearer

> 🚧 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>

## Request body

- InlineObject6
  - `endMs` integer, required: End of the time range, specified in milliseconds UNIX time.
  - `fillMissing` 'withNull' | 'withPrevious'
  - `series` V1SensorsHistorySeries[], required
    - `field` 'ambientTemperature' | 'cargoPercent' | 'currentLoop1Raw' | 'currentLoop1Mapped' | 'currentLoop2Raw' | 'currentLoop2Mapped' | 'doorClosed' | 'humidity' | 'pmPowerTotal' | 'pmPhase1Power' | 'pmPhase2Power' | 'pmPhase3Power' | 'pmPhase1PowerFactor' | 'pmPhase2PowerFactor' | 'pmPhase3PowerFactor' | 'probeTemperature', required: Field to query.
    - `widgetId` integer, required: V1Sensor ID to query.
  - `startMs` integer, required: Beginning of the time range, specified in milliseconds UNIX time.
  - `stepMs` integer, required: Time resolution for which data should be returned, in milliseconds. Specifying 3600000 will return data at hour intervals.

## Response `200`

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

- V1SensorHistoryResponse: Contains the results for a sensor history request. Each result contains a timestamp and datapoint for each requested (sensor, field) pair.
  - `results` V1SensorHistoryResponseResults[]
    - `series` integer[]: List of datapoints, one for each requested (sensor, field) pair.
    - `timeMs` integer: Timestamp in UNIX milliseconds.

## Other responses

- `default`: Unexpected error.

---

[API](https://skmtc.dev/samsara/apis/samsara-api.md) - [All operations](https://skmtc.dev/samsara/apis/samsara-api/llms.txt) - [OpenAPI document](https://skmtc.dev/samsara/apis/samsara-api/revisions/a9e35d4999be?raw)
