Skip to main content
Returns a single IndicatorStatistics object computed across all data points stored for the indicator. Statistics are cached in Redis and recomputed on cache expiry.

Path parameters

indicator_id
string
required
The indicator’s unique identifier. Must be a valid MongoDB ObjectId (24-character hex string).

Response

count
integer
required
Total number of data points stored for the indicator. Returns 0 if no data exists.
min_x
string | number | null
The smallest x-axis value across all data points. For time-series indicators this is an ISO 8601 datetime string; for numeric indicators it is a float. null when count is 0.
max_x
string | number | null
The largest x-axis value across all data points. Same type rules as min_x. null when count is 0.
avg_y
number | null
Arithmetic mean of all y values. null when count is 0.
min_y
number | null
Minimum y value across all data points. null when count is 0.
max_y
number | null
Maximum y value across all data points. null when count is 0.

Error responses

StatusDescription
400 Bad Requestindicator_id is not a valid ObjectId.

Examples

curl -X GET \
  "https://api.example.com/indicators/64b1f2c3d4e5f6a7b8c9d0e1/statistics" \
  -H "Accept: application/json"

Example response — indicator with data

200
{
  "count": 3652,
  "min_x": "2014-01-01T00:00:00",
  "max_x": "2023-12-31T00:00:00",
  "avg_y": 2341.87,
  "min_y": 894.0,
  "max_y": 4102.5
}

Example response — indicator with no data

200
{
  "count": 0,
  "min_x": null,
  "max_x": null,
  "avg_y": null,
  "min_y": null,
  "max_y": null
}
Statistics are computed with a MongoDB aggregation pipeline and then cached in Redis. If you ingest new data points and immediately call this endpoint, you may receive stale statistics until the cache expires.

Build docs developers (and LLMs) love