> ## Documentation Index
> Fetch the complete documentation index at: https://docs.beta.ontoto.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch latest sensor data

> Returns the most recent reading for each requested parameter.



## OpenAPI

````yaml post /sensor-data/latest
openapi: 3.1.0
info:
  title: Ontoto API
  description: Ontoto backend API
  version: 1.0.0
servers:
  - url: https://api.beta.ontoto.com/v1
security:
  - ApiKeyAuth: []
paths:
  /sensor-data/latest:
    post:
      summary: Fetch latest sensor data
      description: Returns the most recent reading for each requested parameter.
      operationId: postSensor-dataLatest
      requestBody:
        content:
          application/json:
            schema:
              description: Request body for querying latest sensor data
              type: object
              properties:
                parameterUuids:
                  description: Array of parameter UUIDs
                  type: array
                  items:
                    type: string
                    format: uuid
                deviceSerialNumbers:
                  description: Array of device serial numbers
                  type: array
                  items:
                    type: string
                legacyDeviceIds:
                  description: Array of legacy device IDs
                  type: array
                  items:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                sensorUuids:
                  description: Array of sensor UUIDs
                  type: array
                  items:
                    type: string
                    format: uuid
                parameterPaths:
                  description: Array of parameter paths to query specific data points
                  type: array
                  items:
                    $ref: '#/components/schemas/SensorParameterPath'
                includeDeleted:
                  description: Include soft-deleted sensor data in results
                  type: boolean
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SensorDataPostResponse'
        '400':
          description: Invalid request format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrBadRequest'
        '401':
          description: Client must be authenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrUnauthorized'
        '403':
          description: Client does not have necessary permissions to access the resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrForbidden'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrNotFound'
        '409':
          description: Request could not be completed due to a uniqueness constraint
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrConflict'
        '500':
          description: Unexpected server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrInternalServerError'
components:
  schemas:
    SensorParameterPath:
      description: Path to a specific parameter on a device
      example:
        deviceSerialNumber: '1234567890'
        sensorName: VibratingWire_CH1
        parameterName: Frequency_CH1
      type: object
      properties:
        deviceSerialNumber:
          description: Device serial number
          type: string
        sensorName:
          description: Unique name for the sensor on the device
          type: string
        parameterName:
          description: Unique name for the parameter on the sensor
          type: string
      required:
        - deviceSerialNumber
        - sensorName
        - parameterName
      title: SensorParameterPath
    SensorDataPostResponse:
      description: Response body for querying sensor data
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/ScalarSensorDataItem'
      required:
        - items
      title: SensorDataPostResponse
    ErrBadRequest:
      example:
        message: Invalid request body
      type: object
      properties:
        message:
          description: Human readable message describing the issue
          type: string
      required:
        - message
      title: ErrBadRequest
    ErrUnauthorized:
      example:
        message: Authentication required
      type: object
      properties:
        message:
          description: Human readable message describing the issue
          type: string
      required:
        - message
      title: ErrUnauthorized
    ErrForbidden:
      example:
        message: You do not have permission to access this resource
      type: object
      properties:
        message:
          description: Human readable message describing the issue
          type: string
      required:
        - message
      title: ErrForbidden
    ErrNotFound:
      example:
        message: Resource not found
      type: object
      properties:
        message:
          description: Human readable message describing the issue
          type: string
      required:
        - message
      title: ErrNotFound
    ErrConflict:
      example:
        message: Duplicate entry
      type: object
      properties:
        message:
          description: Human readable message describing the issue
          type: string
      required:
        - message
      title: ErrConflict
    ErrInternalServerError:
      example:
        message: Internal server error
      type: object
      properties:
        message:
          description: Human readable message describing the issue
          type: string
      required:
        - message
      title: ErrInternalServerError
    ScalarSensorDataItem:
      description: Sensor data for a singular parameter
      type: object
      properties:
        deviceSerialNumber:
          description: Device serial number
          type: string
        deviceAlias:
          description: Device alias
          anyOf:
            - type: string
            - type: 'null'
        legacyDeviceId:
          description: Legacy device ID, if available
          anyOf:
            - type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        sensorUuid:
          description: Sensor UUID
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
        sensorAlias:
          description: Sensor alias
          anyOf:
            - type: string
            - type: 'null'
        channelIndex:
          description: >-
            Zero-indexed sensor channel, the order the sensor is read on the
            device
          anyOf:
            - type: number
            - type: 'null'
        sensorStatus:
          $ref: '#/components/schemas/SensorStatus'
        parameterUuid:
          description: Parameter UUID
          type: string
          format: uuid
        parameterName:
          description: Parameter name
          type: string
        parameterAlias:
          description: Parameter alias
          type: string
        parameterSourceType:
          description: Origin of a parameter's data
          type: string
          oneOf:
            - const: derived
              title: derived
              description: Parameter computed from a formula or aggregation
            - const: raw
              title: raw
              description: Parameter measured directly by the device
            - const: imported
              title: imported
              description: Parameter ingested from an external (third party) source
            - const: weather_forecast
              title: weather_forecast
              description: Parameter populated from a weather forecast provider
            - const: gnss
              title: gnss
              description: Parameter produced by GNSS post-processing
            - const: gnss_field
              title: gnss_field
              description: Individual GNSS solution field (e.g. lat, lon, height)
        parameterStatus:
          description: Overall health status of a sensor parameter
          type: string
          oneOf:
            - const: ok
              title: ok
              description: No issues
            - const: data_fault
              title: data_fault
              description: >-
                Latest data points are faulty (null, out-of-range, or evaluation
                error)
            - const: config_error
              title: config_error
              description: Parameter configuration is invalid and cannot be evaluated
        displayPrecision:
          description: Rounding applied to parameter data, if any
          anyOf:
            - type: number
            - type: 'null'
        unit:
          description: Unit of parameter values (UCUM code)
          anyOf:
            - type: string
            - type: 'null'
        data:
          description: Array of timestamped sensor data
          type: array
          items:
            type: object
            properties:
              timestamp:
                description: ISO 8601 formatted timestamp
                type: string
                format: date-time
              value:
                description: Sensor parameter value
                anyOf:
                  - type: number
                  - type: 'null'
            required:
              - timestamp
              - value
      required:
        - deviceSerialNumber
        - deviceAlias
        - legacyDeviceId
        - sensorUuid
        - sensorAlias
        - channelIndex
        - sensorStatus
        - parameterUuid
        - parameterName
        - parameterAlias
        - parameterSourceType
        - parameterStatus
        - displayPrecision
        - unit
        - data
      title: ScalarSensorDataItem
    SensorStatus:
      description: >-
        Overall status dynamically derived from parameter errors. View details
        in the errors array.
      type: string
      oneOf:
        - const: ok
          title: ok
          description: All parameters are healthy
        - const: error
          title: error
          description: One or more parameters are in an error state
        - const: warning
          title: warning
          description: Sensor is operational but at least one parameter is faulty
        - const: unknown
          title: unknown
          description: Health cannot be determined (e.g. no data received yet)
      title: SensorStatus
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````