---
title: "Statistics query"
method: POST
path: "/statistics/query"
tags: ["Statistics"]
---

# Statistics query

`POST /statistics/query`

Executes a read-only SQL query for Grafana-style statistics panels.
Each `rawquery` in the request body is validated before execution (same
rules as `POST /api/v4/query`): allowed statement types include SELECT,
WITH, SHOW, DESCRIBE, EXPLAIN, PRAGMA; semicolons and DML/DDL are rejected.

## Request body

- StatisticQuery
  - `param` object
    - `limit` integer
    - `precision` integer
    - `query` object[]
      - `main` string
      - `database` string
      - `retention` string
      - `rawquery` string
      - `type` string[]
      - `tag` string[]
    - `bfrom` integer
    - `total` boolean
  - `timestamp` object
    - `from` integer — Unix epoch milliseconds (UTC).
    - `to` integer — Unix epoch milliseconds (UTC).

## Response `200`

Response

- StatisticResponse
  - `data` object
  - `total` integer
  - `meta` Meta
    - `request_id` string
    - `trace_id` string
    - `pagination` Pagination
      - `limit` integer
      - `next_cursor` string
      - `prev_cursor` string
      - `total` integer
      - `has_more` boolean
    - `message` string

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `500` — Server error

---

[API](https://skmtc.net/sipcapture/apis/homer-next-gen-api.md) · [All operations](https://skmtc.net/sipcapture/apis/homer-next-gen-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sipcapture/homer-next-gen-api/versions/1966dd0df318/schema)
