Skip to main content
POST
/
monit
/
query
/
rows
Query data source rows
curl --request POST \
  --url 'https://api.flashcat.cloud/monit/query/rows?app_key=' \
  --header 'Content-Type: application/json' \
  --data '
{
  "account_id": 10001,
  "ds_type": "prometheus",
  "ds_name": "prod-prom",
  "expr": "up",
  "delay_seconds": 30
}
'
{
  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
  "data": [
    {
      "fields": {
        "__name__": "up",
        "instance": "10.0.0.1:9100",
        "job": "node"
      },
      "values": {
        "__value__": 1
      }
    }
  ]
}

Restrictions

AspectValue
Rate limits600 requests/minute; 10 requests/second per account
PermissionsAny valid app_key (read-only; not gated by a specific permission class)

Usage

  • The request is forwarded to monit-edge over WebSocket; the data source named by ds_type + ds_name must already exist under the calling account.
  • account_id in the body is optional. When supplied it must equal the authenticated account; mismatched values are rejected.
  • Two error layers: webapi-level failures use the standard error envelope, but errors raised by monit-edge while executing the query are returned as HTTP 200 with an error object in the body. Always check the response body for error in addition to the HTTP status.
  • monit-edge enforces a row cap; large result sets come back as error.message = "too many rows". Narrow the time range or aggregate at the source.
  • args is a polymorphic string→string map that is forwarded verbatim. Semantics depend on ds_type (SLS requires sls.project + sls.logstore; Loki / VictoriaLogs raw mode requires a time range via *.start/*.end or *.timespan.value/*.timespan.unit; Prometheus and SQL sources ignore it). See the monit-webapi query-api docs for the per-source key list.

Authorizations

app_key
string
query
required

App key issued from the Flashduty console under Account → APP Keys. Required on every public API call. Keep it secret — it grants the same access as the owning account.

Body

application/json
ds_type
string
required

Data source type; must match a configured data source under the tenant. Examples: prometheus, loki, victorialogs, sls, elasticsearch, mysql, postgres, oracle, clickhouse.

ds_name
string
required

Data source name; must match a configured data source under the tenant.

expr
string
required

Query expression. Syntax depends on ds_type and is interpreted by the corresponding monit-edge client (PromQL for Prometheus, LogQL for Loki, SQL for SQL sources, etc.).

account_id
integer<int64>

Optional consistency check. Must equal the authenticated account when supplied; mismatched values are rejected. Business execution always uses the authenticated account.

delay_seconds
integer
default:0

Look-back offset in seconds applied to point-in-time queries (Prometheus, Loki stats, VictoriaLogs stats). Ignored for raw / detail queries.

args
object

Polymorphic key/value extension parameters forwarded verbatim to monit-edge. All values must be strings. Semantics depend on ds_type: SLS requires sls.project + sls.logstore; Loki / VictoriaLogs raw mode requires a time range via <source>.start/<source>.end or <source>.timespan.value + <source>.timespan.unit; Prometheus and SQL sources ignore it. Always namespace keys by source (e.g. sls.project, loki.type).

Response

Success

Success response envelope. On every 2xx response, request_id identifies the call (also mirrored in the Flashcat-Request-Id header) and data holds the endpoint-specific payload. Failure responses use a different shape — see ErrorResponse.

request_id
string
required

Unique ID for this request. Mirrored in the Flashcat-Request-Id response header. Include it when reporting issues.

Example:

"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"

data
object[]
required

Result rows. Different data sources populate fields vs values differently — metric sources (Prometheus, *-stats) put numbers into values; detail sources (SQL, SLS, raw logs) put data into fields and may return values: null.