> For the complete documentation index, see [llms.txt](https://docs.sofarocean.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sofarocean.com/~/revisions/i4w2YzZYZxcM4UMsnSvX/spotter-and-smart-mooring/smart-mooring/sensor-data.md).

# (GET) Sensor Data

Retrieve data collected by a specified Spotter's Smart Mooring sensors during a specified time window.

<mark style="color:blue;">`GET`</mark> `https://api.sofarocean.com/api/sensor-data?spotterId=:spotterId&startDate=:startDate&endDate=:endDate`

Returns Smart Mooring sensor data collected by the specified Spotter between `startDate` and `endDate`.

### Query Parameters

| Name        | Type   | Description                                                                                                                      |
| ----------- | ------ | -------------------------------------------------------------------------------------------------------------------------------- |
| `spotterId` | string | SpotterId of the device to retrieve data for.                                                                                    |
| `startDate` | string | <p>ISO 8601-formatted timestamp indicating the start date for data inclusion.<br><br>e.g., <code>2021-01-01T07:00:00Z</code></p> |
| `endDate`   | string | <p>ISO 8601-formatted timestamp indicating the end date for data inclusion.<br><br>e.g.,  <code>2021-01-02T07:00:00Z</code></p>  |

{% hint style="info" %}
If neither `startDate` nor `endDate` are specified, `startDate` will default to 24 hours ago and `endDate` will default to now.
{% endhint %}

### Response Description

{% hint style="info" %}
For more information about Smart Mooring sensors and data, please refer to the [**Sensors & Payloads guide**](https://sofarocean.notion.site/Sensors-Payloads-a26e005cc5374a7eb6a1e64a3b54b7de?pvs=74).
{% endhint %}

The `/sensor-data` response format consists of a “flat” (uncategorized) data stream ordered by timestamp. Keep in mind that these timestamps, while ordered, are not necessarily unique. It is possible for two or more sensors to send different values with identical timestamps (e.g., a temperature sensor and a pressure sensor could emit data at the same time).

The location data in each sample dict is the location of the Spotter when the report was encoded and transmitted. If the Spotter is configured to send multiple sample periods in a single transmission (eg to save on data telemetry costs) all samples in the report will have the same location data.

| Name                     | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                           |
| ------------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `latitude`               |         |                                                                                                                                                                                                                                                                                                                                                                                                       |
| `longitude`              |         |                                                                                                                                                                                                                                                                                                                                                                                                       |
| `timestamp`              | string  | ISO 8601-formatted timestamp indicating the end of a sample collection period.                                                                                                                                                                                                                                                                                                                        |
| `sensorPosition`         | integer | The sensor's physical position in the Smart Mooring relative to the Spotter, with `1` being closest to the Spotter.                                                                                                                                                                                                                                                                                   |
| `units`                  |         | The physical units of the data.                                                                                                                                                                                                                                                                                                                                                                       |
| `value`                  |         | The measured value.                                                                                                                                                                                                                                                                                                                                                                                   |
| `unit_type`              |         | A contextual description of what is being measured.                                                                                                                                                                                                                                                                                                                                                   |
| `data_type_name`         | string  | The type of information being sent by a sensor, as ingested by the API.                                                                                                                                                                                                                                                                                                                               |
| `configuration_checksum` |         | Property indicating the physical layout of the sensors on the Smart Mooring that can be cross-referenced with the configurations returned by the [Configuration History endpoint](https://docs.sofarocean.com/~/revisions/i4w2YzZYZxcM4UMsnSvX/spotter-and-smart-mooring/smart-mooring/sensor-configuration-history) to determine the sensor configuration in use at the time the data was collected. |

The `configuration_checksum` property is unique to the physical layout of the sensors on the Smart Mooring, together with their respective configuration settings. It can be cross-referenced with the configurations returned by `/sensor-configuration-history` to determine the sensor configuration in use at the time the data was collected.

### Examples

#### Example Request

```bash
curl "https://api.sofarocean.com/api/sensor-data?spotterId=SPOT-0222&startDate=2021-12-01T00:00:00Z&endDate=2021-12-02T00:00:00Z" -H 'token: YOUR_API_TOKEN'
```

#### Example Response

{% tabs %}
{% tab title="200" %}

```json
{
  "status": "success",
  "data": [
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:02:13.000Z",
      "sensorPosition": 2,
      "units": "μbar",
      "value": 50,
      "unit_type": "pressure",
      "data_type_name": "rbrcoda3_stdevpressure_15bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:02:13.000Z",
      "sensorPosition": 2,
      "units": "°C",
      "value": 25.266200000000005,
      "unit_type": "temperature",
      "data_type_name": "rbrcoda3_meantemperature_20bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:02:13.000Z",
      "sensorPosition": 1,
      "units": "°C",
      "value": 25.480000000000004,
      "unit_type": "temperature",
      "data_type_name": "sofar_temperature_12bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:02:13.000Z",
      "sensorPosition": 2,
      "units": "μbar",
      "value": 1122270,
      "unit_type": "pressure",
      "data_type_name": "rbrcoda3_meanpressure_21bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:17:13.000Z",
      "sensorPosition": 2,
      "units": "°C",
      "value": 25.268500000000003,
      "unit_type": "temperature",
      "data_type_name": "rbrcoda3_meantemperature_20bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:17:13.000Z",
      "sensorPosition": 1,
      "units": "°C",
      "value": 25.520000000000003,
      "unit_type": "temperature",
      "data_type_name": "sofar_temperature_12bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:17:13.000Z",
      "sensorPosition": 2,
      "units": "μbar",
      "value": 1122190,
      "unit_type": "pressure",
      "data_type_name": "rbrcoda3_meanpressure_21bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:17:13.000Z",
      "sensorPosition": 2,
      "units": "μbar",
      "value": 70,
      "unit_type": "pressure",
      "data_type_name": "rbrcoda3_stdevpressure_15bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:17:13.000Z",
      "sensorPosition": 3,
      "units": "cm/s",
      "value": 188.69,
      "unit_type": "speed",
      "data_type_name": "aanderaa_abs_speed_mean_15bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:17:13.000Z",
      "sensorPosition": 3,
      "units": "cm/s",
      "value": 76.92,
      "unit_type": "speed",
      "data_type_name": "aanderaa_abs_speed_std_15bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:17:13.000Z",
      "sensorPosition": 3,
      "units": "rad",
      "value": 4.058,
      "unit_type": "direction",
      "data_type_name": "aanderaa_direction_circ_mean_13bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:17:13.000Z",
      "sensorPosition": 3,
      "units": "rad",
      "value": 1.074,
      "unit_type": "direction",
      "data_type_name": "aanderaa_direction_circ_std_13bits",
      "configuration_checksum": "0xb6929687"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:17:13.000Z",
      "sensorPosition": 3,
      "configuration_checksum": "0xb6929687",
      "value": 7,
      "unit_type": "reading_count",
      "data_type_name": "aanderaa_reading_count_10bits"
    },
    {
      "latitude": 13.1203,
      "longitude": 100.91925,
      "timestamp": "2021-12-01T03:17:13.000Z",
      "sensorPosition": 3,
      "units": "°C",
      "value": -0.17999999999999972,
      "unit_type": "temperature",
      "data_type_name": "aanderaa_temperature_mean_13bits",
      "configuration_checksum": "0xb6929687"
    }
  ]
}
```

{% endtab %}
{% endtabs %}
