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
}
'import requests
url = "https://api.flashcat.cloud/monit/query/rows?app_key="
payload = {
"account_id": 10001,
"ds_type": "prometheus",
"ds_name": "prod-prom",
"expr": "up",
"delay_seconds": 30
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 10001,
ds_type: 'prometheus',
ds_name: 'prod-prom',
expr: 'up',
delay_seconds: 30
})
};
fetch('https://api.flashcat.cloud/monit/query/rows?app_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flashcat.cloud/monit/query/rows?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'account_id' => 10001,
'ds_type' => 'prometheus',
'ds_name' => 'prod-prom',
'expr' => 'up',
'delay_seconds' => 30
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/monit/query/rows?app_key="
payload := strings.NewReader("{\n \"account_id\": 10001,\n \"ds_type\": \"prometheus\",\n \"ds_name\": \"prod-prom\",\n \"expr\": \"up\",\n \"delay_seconds\": 30\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.flashcat.cloud/monit/query/rows?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": 10001,\n \"ds_type\": \"prometheus\",\n \"ds_name\": \"prod-prom\",\n \"expr\": \"up\",\n \"delay_seconds\": 30\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/monit/query/rows?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": 10001,\n \"ds_type\": \"prometheus\",\n \"ds_name\": \"prod-prom\",\n \"expr\": \"up\",\n \"delay_seconds\": 30\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": [
{
"fields": {
"__name__": "up",
"instance": "10.0.0.1:9100",
"job": "node"
},
"values": {
"__value__": 1
}
}
]
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}Query data source rows
Run a synchronous ad-hoc query against a configured data source and get back its raw rows. Used by Flashduty AI SRE and by UI preview. The request is forwarded over WebSocket to monit-edge, which executes the query against the underlying source (Prometheus / Loki / VictoriaLogs / SLS / MySQL / Postgres / Oracle / ClickHouse / Elasticsearch).
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
}
'import requests
url = "https://api.flashcat.cloud/monit/query/rows?app_key="
payload = {
"account_id": 10001,
"ds_type": "prometheus",
"ds_name": "prod-prom",
"expr": "up",
"delay_seconds": 30
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 10001,
ds_type: 'prometheus',
ds_name: 'prod-prom',
expr: 'up',
delay_seconds: 30
})
};
fetch('https://api.flashcat.cloud/monit/query/rows?app_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flashcat.cloud/monit/query/rows?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'account_id' => 10001,
'ds_type' => 'prometheus',
'ds_name' => 'prod-prom',
'expr' => 'up',
'delay_seconds' => 30
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/monit/query/rows?app_key="
payload := strings.NewReader("{\n \"account_id\": 10001,\n \"ds_type\": \"prometheus\",\n \"ds_name\": \"prod-prom\",\n \"expr\": \"up\",\n \"delay_seconds\": 30\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.flashcat.cloud/monit/query/rows?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": 10001,\n \"ds_type\": \"prometheus\",\n \"ds_name\": \"prod-prom\",\n \"expr\": \"up\",\n \"delay_seconds\": 30\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/monit/query/rows?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": 10001,\n \"ds_type\": \"prometheus\",\n \"ds_name\": \"prod-prom\",\n \"expr\": \"up\",\n \"delay_seconds\": 30\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": [
{
"fields": {
"__name__": "up",
"instance": "10.0.0.1:9100",
"job": "node"
},
"values": {
"__value__": 1
}
}
]
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}Restrictions
| Aspect | Value |
|---|---|
| Rate limits | 600 requests/minute; 10 requests/second per account |
| Permissions | Any valid app_key (read-only; not gated by a specific permission class) |
Usage
- The request is forwarded to
monit-edgeover WebSocket; the data source named byds_type+ds_namemust already exist under the calling account. account_idin the body is optional. When supplied it must equal the authenticated account; mismatched values are rejected.- Validation failures use the standard error envelope. When
monit-edgerejects a query, its{"error": {"code": ..., "message": ...}}body is preserved and the HTTP status matches the edge error code; an invalid or absent code becomes HTTP 500. Check both the status and the error body. - 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. argsis a polymorphicstring→stringmap that is forwarded verbatim. Semantics depend onds_type(SLS requiressls.project+sls.logstore; Loki / VictoriaLogs raw mode requires a time range via*.start/*.endor*.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 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
Data source type; must match a configured data source under the tenant. Examples: prometheus, loki, victorialogs, sls, elasticsearch, mysql, postgres, oracle, clickhouse.
Data source name; must match a configured data source under the tenant.
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.).
Optional consistency check. Must equal the authenticated account when supplied; mismatched values are rejected. Business execution always uses the authenticated account.
Look-back offset in seconds applied to point-in-time queries (Prometheus, Loki stats, VictoriaLogs stats). Ignored for raw / detail queries.
Polymorphic key/value extension parameters forwarded verbatim to monit-edge. All values must be strings, and keys are always namespaced by source (e.g. sls.project, loki.type). Validation depends on ds_type: SLS requires sls.project + sls.logstore. Elasticsearch accepts es.type of sql, or omitted — any other value is rejected. Loki and VictoriaLogs accept <source>.type of stats, raw, or omitted; raw additionally requires a time range, either <source>.start + <source>.end or <source>.timespan.value + <source>.timespan.unit (unit one of s, m, h, d). Prometheus and the remaining SQL sources ignore args entirely.
Show child attributes
Show child attributes
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.
Unique ID for this request. Mirrored in the Flashcat-Request-Id response header. Include it when reporting issues.
"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
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.
Show child attributes
Show child attributes
Was this page helpful?