Skip to main content
POST
Run Explore query

Restrictions

Usage

  • Use this endpoint when you need the data source’s native result shape; /monit/query/data returns the stable query_result.v1 contract instead. Dispatch on data.result.kind (frames, samples, or logs) here.
  • The data source is identified by datasource_id. It must belong to the account, be enabled, have an Edge cluster, and be one of prometheus, elasticsearch, loki, clickhouse, mysql, oracle, postgres, sls, victorialogs, or tencent_cls. When the data source restricts querying to certain teams, only members of those teams, its managing team, and account owners or admins can query it.
  • execution.kind decides which companion fields are accepted: instant needs to_ms (from_ms is optional), range requires from_ms, to_ms, and max_data_points, and window requires from_ms and to_ms. When both times are given, from_ms must be less than to_ms. step_seconds is not accepted; the step is derived from max_data_points and min_step_seconds.
  • args is required (send {} when unused) and carries macro substitutions such as Grafana-style variables; every value is a string. Unknown or duplicate JSON keys are rejected.
  • A logs result is capped at 1,000 entries (100 for sls) and reports applied_limit plus has_more. A frames result holds at most 1,000 frames, 1,000 table rows in total, and 100,000 values in total; a samples result holds at most 1,000 samples. The request body is limited to 256 KiB and the whole success response to 10 MiB.
  • Failures use the standard error envelope. error.reason is a stable machine-readable value; a data source ID that does not exist returns HTTP 400 with code ResourceNotFound and no reason.
  • Query execution may take up to 35 seconds across WebAPI forwarding and Edge execution. Configure client timeouts to at least 40 seconds.

Authorizations

app_key
string
query
required

APP Key created in the Flashduty console under My → APP Key. Send it as the app_key query parameter or in the Fd-App-Key request header. Its effective access is the intersection of the key's permission scope and the creator's current role permissions. Keep it secret.

Body

application/json

Explore query request. All four top-level fields are required and unknown fields are rejected.

datasource_id
integer<int64>
required

Data source ID from /monit/datasource/list. Must be a positive JavaScript-safe integer for an enabled data source of the authenticated account that the caller may query.

Required range: 1 <= x <= 9007199254740991
expr
string
required

Query expression in the data source's native language (PromQL, LogsQL, SQL, and so on). Non-empty UTF-8 of at most 64 KiB; mysql allows at most 16 KiB and tencent_cls at most 12 KiB.

Minimum string length: 1
args
object
required

Macro substitutions keyed by variable name, used for Grafana-style variables. Keys are at most 256 bytes, values at most 64 KiB, with a 128 KiB total budget.

execution
object
required

Time semantics of the query. The accepted companion fields depend on kind: instant takes to_ms (and optionally from_ms), range requires from_ms, to_ms, and max_data_points, and window takes only from_ms and to_ms. When both times are present, from_ms must be less than to_ms. step_seconds is never accepted over HTTP.

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

Explore query result payload.