Aggregated Data

List aggregated views

get

Retrieves all continuous aggregation views configured for a device. Aggregation views provide pre-computed time-series summaries (min/max/avg) at regular intervals for fast long-term trend analysis.

What are Aggregated Views? Pre-computed time-series aggregations that automatically generate summary statistics at regular intervals. Think of them as scheduled SQL GROUP BY queries that run continuously.

Benefits:

  • Fast queries: Retrieve months of data instantly (vs slow raw data queries)

  • Long-term trends: View hourly/daily summaries for historical analysis

  • Reduced storage: Downsample old data while keeping insights

  • Dashboard performance: Charts load faster with aggregated data

Supported Intervals: 1h (hourly), 3h, 6h, 12h, 1d (daily), 1w (weekly)

Supported Aggregations: MIN, MAX, AVG, SUM, COUNT

Use Cases:

  • Long-term trend analysis (months/years)

  • Compliance reporting (daily min/max/avg)

  • Performance optimization for dashboards

  • Historical data analysis without querying raw 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 (UUID format)

Example: dev-abc123
Responses
200

List of aggregation views - Each view contains interval, tags, and creation date

application/json
get
/v2/projects/{project_id}/devices/{device_id}/aggregated-view
GET /v2/projects/{project_id}/devices/{device_id}/aggregated-view HTTP/1.1
Host: api.qubitro.com
Authorization: YOUR_API_KEY
Accept: */*
[
  {
    "created": "2024-01-15T10:30:00Z",
    "id": "ca-uuid-123",
    "interval": "1h",
    "name": "Hourly Temperature Stats",
    "tags": [
      "temperature",
      "humidity"
    ]
  }
]

Get aggregated data

get

Retrieves pre-computed time-series statistics (min/max/avg) from a continuous aggregation view. Returns aggregated data points at the configured interval (hourly, daily, etc.).

What You'll Get: Each data point contains the aggregated statistics for the specified time bucket. For example, with a 1-hour interval, each record represents the min/max/avg values for that hour.

Query Range Types:

Range Type
Description
Required Parameters
Example

all

Retrieve all available aggregated data

page, limit

Get last 168 records (7 days of hourly data)

time

Specific time range

page, limit, start, end

Get data between 2024-01-01 and 2024-01-31

Pagination:

  • page: Page number (1-based indexing)

  • limit: Records per page (recommended: 100-1000 for aggregated data)

  • Results ordered by time (newest first)

Field Filtering: Use the keys query parameter to filter specific aggregated fields. Example: keys=temperature_avg,temperature_max will only return those fields.

When to Use vs Raw Data:

Use Aggregated View When:
Use Raw Data When:

Querying > 24 hours of data

Need real-time, latest values

Need min/max/avg statistics

Need individual data points

Building trend dashboards

Debugging specific events

Performance matters

Precision matters

Example Response:

[
{
"time": "2024-01-15T10:00:00Z",
"temperature_min": 18.5,
"temperature_max": 24.3,
"temperature_avg": 21.4,
"humidity_avg": 65.2
}
]
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 (UUID format)

Example: dev-abc123
contaggr_idstringRequired

Continuous Aggregation ID (UUID format)

Example: ca-uuid-123
Query parameters
pageintegerRequired

Page number for pagination (1-based)

Example: 1
limitintegerRequired

Number of records per page (max: 10000)

Example: 168
rangestringRequired

Range type: 'all' (all data) or 'time' (specific period)

Example: all
startstringOptional

Start time in ISO 8601 format (UTC) - Required if range=time

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

End time in ISO 8601 format (UTC) - Required if range=time

Example: 2024-01-31T23:59:59Z
keysstringOptional

Comma-separated list of fields to include (filters response fields)

Example: temperature_avg,temperature_max
Responses
200

Array of aggregated data points - Each point contains time and aggregated statistics (e.g., temperature_min, temperature_max, temperature_avg)

application/json
get
/v2/projects/{project_id}/devices/{device_id}/aggregated-view/{contaggr_id}
GET /v2/projects/{project_id}/devices/{device_id}/aggregated-view/{contaggr_id}?page=1&limit=1&range=text HTTP/1.1
Host: api.qubitro.com
Authorization: YOUR_API_KEY
Accept: */*
[
  {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  }
]

Delete aggregated data

delete

⚠️ DATA ONLY: Permanently deletes ALL aggregated time-series data from a continuous aggregation view while keeping the view configuration intact. This action CANNOT be undone.

What Gets Deleted:

  • All aggregated data points from TimescaleDB continuous aggregation view

  • All historical statistics (min/max/avg/sum/count)

  • All time buckets and computed values

What is KEPT:

  • ✅ Aggregation view configuration (interval, keys, aggregation types)

  • ✅ View metadata (name, tags, creation date)

  • ✅ The view definition itself (new data will continue to aggregate)

Impact:

  • Dashboard widgets using this view will show no data (but won't break)

  • New device data will continue to aggregate according to the view configuration

  • Historical trends and reports will be empty until new data accumulates

Cannot Be Undone: There is no way to recover purged aggregated data. However, if raw device data still exists, you can recreate the aggregation view to recompute statistics from scratch.

Difference from Device DELETE:

  • This endpoint: Deletes aggregated statistics only, keeps view configuration

  • Device DELETE: Deletes device, all raw data, AND all aggregation views

When to Use:

  • Reset aggregation statistics after fixing data quality issues

  • Clear old aggregated data while keeping view configuration

  • Troubleshoot aggregation issues by starting fresh

Alternative: To delete the entire aggregation view (configuration + data), delete it via the Qubitro web portal instead.

Success Response:

{
"success": true,
"message": "Aggregated data purged successfully",
"action": "purge 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 (UUID format)

Example: dev-abc123
contaggr_idstringRequired

Continuous Aggregation ID (UUID format)

Example: ca-uuid-123
Responses
200

Aggregated data purged successfully - View configuration preserved

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

Get aggregated data keys

get

Retrieves all available field names (keys) from an aggregation view. Keys represent the computed statistics (min/max/avg/sum/count) for each configured field.

What are Aggregated Keys? Field names in your aggregation view that represent computed statistics. Unlike raw data keys which are simple field names like temperature, aggregated keys include the aggregation type suffix.

Example Aggregated Keys:

  • temperature_min - Minimum temperature in time bucket

  • temperature_max - Maximum temperature in time bucket

  • temperature_avg - Average temperature in time bucket

  • humidity_avg - Average humidity in time bucket

  • sensor_count - Number of data points in time bucket

Key Naming Pattern: {original_field_name}_{aggregation_type}

Available Aggregation Types:

  • _min - Minimum value in the interval

  • _max - Maximum value in the interval

  • _avg - Average (mean) value in the interval

  • _sum - Sum of all values in the interval

  • _count - Count of data points in the interval

Use Cases:

  • Discover available statistics before querying aggregated data

  • Build dynamic dashboards that adapt to aggregation configuration

  • Validate chart widgets before creating visualizations

  • API integration to understand aggregation schema

Note: The time field is always present but not included in the keys list (it's automatically included in all responses).

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 (UUID format)

Example: dev-abc123
contaggr_idstringRequired

Continuous Aggregation ID (UUID format)

Example: ca-uuid-123
Responses
200

Array of aggregated field names (e.g., ["temperature_min", "temperature_max", "temperature_avg", "humidity_avg"])

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

Last updated