Device Data

Get device data

get

Retrieves time-series data from a device with flexible pagination and time range filtering. Data is returned in reverse chronological order (newest first).

Range Types:

  • all: Returns all data with pagination

  • time: Returns data within specified start and end timestamps (requires start and end parameters)

  • last: Returns most recent data points (requires limit parameter)

Pagination:

  • page: Page number starting from 1

  • limit: Number of records per page (max 1000)

  • Results are sorted by timestamp descending

Time Format: Use ISO 8601 format in UTC: 2024-01-15T10:30:00Z

Storage Views: If a storage function (data transformation) is applied, use the storage parameter with the function identifier to retrieve transformed data instead of raw data

Example Queries:

  • Last 100 records: ?page=1&limit=100&range=all

  • Specific time range: ?page=1&limit=100&range=time&start=2024-01-01T00:00:00Z&end=2024-01-02T00:00:00Z

Authorizations
AuthorizationstringRequired

Enter your API key with the Bearer prefix, e.g. "Bearer QB_your_api_key_here"

Path parameters
project_idstringRequired

Project ID (UUID format)

Example: 3e5c0246-c759-48e8-8345-27db13f11ff7
device_idstringRequired

Device ID

Example: 5f8d0d55b54764ca6f3a1234
Query parameters
pageintegerRequired

Page number (starts at 1)

Example: 1
limitintegerRequired

Records per page (max 1000)

Example: 100
rangestringRequired

Range type: 'all', 'time', or 'last'

Example: time
startstringOptional

Start time in ISO 8601 format (required if range=time)

Example: 2024-01-01T00:00:00Z
endstringOptional

End time in ISO 8601 format (required if range=time)

Example: 2024-01-02T00:00:00Z
storagestringOptional

Storage view identifier for transformed data

Example: temperature_hourly_avg
Responses
200

Array of data points - Each object contains 'time' field plus device-specific sensor fields (e.g., temperature, humidity). Field names vary by device.

application/json
get
/v2/projects/{project_id}/devices/{device_id}/data
GET /v2/projects/{project_id}/devices/{device_id}/data?page=1&limit=1&range=text HTTP/1.1
Host: api.qubitro.com
Authorization: YOUR_API_KEY
Accept: */*
[
  {
    "battery": 3.7,
    "humidity": 65.2,
    "temperature": 23.5,
    "time": "2024-01-15T10:30:00Z"
  }
]

Purge all device data

delete

⚠️ DATA ONLY: Permanently deletes ALL time-series data for a device while keeping the device configuration, functions, and settings intact. This action CANNOT be undone.

What Gets Deleted:

  • All time-series measurements from TimescaleDB

  • All historical data points

  • All timestamps and values

What is KEPT:

  • ✅ Device configuration and metadata

  • ✅ Device credentials (MQTT/HTTP)

  • ✅ Functions (decoder, transform, rules, storage, schedules)

  • ✅ Storage views

  • ✅ Dashboard widgets (will show no data)

After Purge:

  • Device can immediately start sending new data

  • Functions continue to execute on new data

  • Dashboards show empty state until new data arrives

Use Cases:

  • Clear test data before production deployment

  • Start fresh after configuration changes

  • Remove corrupted data while keeping device setup

  • Compliance: Delete old data while maintaining device structure

Alternative: Use Device DELETE to remove both device and data

Success Response:

{
"success": true,
"message": "Device data purged successfully",
"action": "delete device data"
}
Authorizations
AuthorizationstringRequired

Enter your API key with the Bearer prefix, e.g. "Bearer QB_your_api_key_here"

Path parameters
project_idstringRequired

Project ID (UUID format)

Example: 3e5c0246-c759-48e8-8345-27db13f11ff7
device_idstringRequired

Device ID

Example: 5f8d0d55b54764ca6f3a1234
Responses
200

Device data purged successfully - Device configuration preserved

application/json
delete
/v2/projects/{project_id}/devices/{device_id}/data
DELETE /v2/projects/{project_id}/devices/{device_id}/data HTTP/1.1
Host: api.qubitro.com
Authorization: YOUR_API_KEY
Accept: */*
{
  "action": "delete device",
  "message": "Operation completed successfully",
  "success": true
}

Get device data keys

get

Retrieves all available data keys (field names) from the device's telemetry data. Data keys are the field names in the JSON payload sent by the device.

What are Data Keys? Field names in your device's telemetry data. For example, if your device sends {"temperature": 25, "humidity": 60, "battery": 3.7}, the data keys are ["temperature", "humidity", "battery"].

Use Cases:

  • Discover available fields before querying data

  • Build dynamic UIs that adapt to device data structure

  • Validate widget configurations before creating dashboards

  • API integration to understand device data schema

Returns: Array of string field names from the most recent data point

Example Response:

["temperature", "humidity", "battery_level", "rssi", "snr", "timestamp"]
Authorizations
AuthorizationstringRequired

Enter your API key with the Bearer prefix, e.g. "Bearer QB_your_api_key_here"

Path parameters
project_idstringRequired

Project ID (UUID format)

Example: 3e5c0246-c759-48e8-8345-27db13f11ff7
device_idstringRequired

Device ID

Example: 5f8d0d55b54764ca6f3a1234
Responses
200

Data keys retrieved successfully - Returns array of field names

application/json
Responsestring[]
get
/v2/projects/{project_id}/devices/{device_id}/data/keys
GET /v2/projects/{project_id}/devices/{device_id}/data/keys HTTP/1.1
Host: api.qubitro.com
Authorization: YOUR_API_KEY
Accept: */*
[
  "text"
]

Last updated