{"id":"metrics.query","module":"observability","namespace":"metrics","action":"query","method":"GET","path":"/v1/metrics/query","idempotent":false,"available":true,"vendors":[],"vendors_ready":[],"vendors_pending":[],"key_status":"live","default_vendor":null,"self_hosted":true,"minimum_tier":"standard","supported_message_classes":null,"regions":["western","china"],"dynamic_params":{},"models_tracked":false,"sdk_hint":"Regular parameters + types are stable — read them from the typed SDK signature / API reference for this capability. discovery only carries the runtime-dynamic values above (available, vendors, dynamic_params).","params":{"title":"MetricQueryRequest","description":"Query shape for metrics.query — time-series query of a metric with an aggregation. Returns MetricSeries.","type":"object","required":["name","agg"],"additionalProperties":false,"properties":{"name":{"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_.-]{0,127}$","description":"Human-readable name for this resource"},"agg":{"type":"string","enum":["p50","p99","sum","avg","count"],"description":"Aggregation function (sum, avg, max, min)"},"tags":{"type":["object","null"],"additionalProperties":{"type":"string"},"description":"Filter to points matching these tags. Encode each entry in the query string as tag.<key>=<value>, for example tag.region=cn."},"window":{"type":["string","null"],"description":"Bucket size, e.g. '1m', '5m', '1h'."},"step":{"type":["string","null"],"description":"Alias for window; bucket size such as '60', '5m', '1h', or '1d'."},"since":{"type":["string","null"],"format":"date-time","description":"ISO 8601 date when the current tier or state became effective"},"until":{"type":["string","null"],"format":"date-time","description":"ISO 8601 date/time for the end of the query range"},"from":{"type":["string","null"],"format":"date-time","description":"Alias for since."},"to":{"type":["string","null"],"format":"date-time","description":"Alias for until."}}},"response":{"title":"MetricSeries","description":"Result of metrics.query — an aggregated time series of (timestamp, value) points.","type":"object","required":["points"],"additionalProperties":false,"properties":{"name":{"type":["string","null"],"description":"Human-readable name for this resource"},"agg":{"type":["string","null"],"enum":["p50","p99","sum","avg","count",null],"description":"Aggregation function (sum, avg, max, min)"},"points":{"type":"array","items":{"type":"object","required":["ts","value"],"additionalProperties":false,"properties":{"ts":{"type":"string","format":"date-time"},"value":{"type":"number"}}},"description":"Metric data points"}}},"errors":["ACCOUNT_AUTORECHARGE_LIMIT","ACCOUNT_FROZEN","AUTH_RATE_LIMIT","AUTH_REFRESH_TOO_FREQUENT","COLD_TIER_NOT_ENABLED","ERROR_EVENT_NOT_FOUND","ERROR_GROUP_NOT_FOUND","ERROR_TAGS_HIGH_CARDINALITY","FLAG_ALREADY_EXISTS","FLAG_DESCRIPTION_TOO_SHORT","FLAG_KEY_INVALID","FLAG_NOT_FOUND","FLAG_RULE_INVALID","FLAG_TYPE_MISMATCH","FLAG_VERSION_CONFLICT","IDEMPOTENCY_KEY_CONFLICT","INSUFFICIENT_CREDIT","INTERNAL_ERROR","INVALID_ARGUMENT","KEY_REVOKED","MAINTENANCE","NETWORK_ERROR","RATE_LIMIT_ACCOUNT","RATE_LIMIT_USER","RATE_LIMIT_VENDOR","RETENTION_FOREVER_NOT_ALLOWED","RETENTION_HARD_CAP_EXCEEDED","SCOPE_INSUFFICIENT","UNAUTHORIZED","VENDOR_AUTH_ERROR","VENDOR_DOWN","VENDOR_TIMEOUT","WALLET_EXPIRED"],"examples":{"curl":"curl -X GET https://api.infrai.cc/v1/metrics/query?name=example&agg=p50 \\\n  -H \"Authorization: Bearer $INFRAI_API_KEY\"","python":"# Zero-install REST call — no SDK required (short-term the API is REST-only).\nimport os, requests\n\nresp = requests.get(\n    \"https://api.infrai.cc/v1/metrics/query?name=example&agg=p50\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['INFRAI_API_KEY']}\",\n    },\n)\nresp.raise_for_status()\nprint(resp.json())","javascript":"// Zero-install REST call — no SDK required (short-term the API is REST-only).\nconst resp = await fetch(\n  \"https://api.infrai.cc/v1/metrics/query?name=example&agg=p50\",\n  {\n    method: \"GET\",\n    headers: {\n      \"Authorization\": `Bearer ${process.env.INFRAI_API_KEY}`,\n    },\n  },\n);\nconsole.log(await resp.json());","typescript":"// Zero-install REST call — no SDK required (short-term the API is REST-only).\nconst resp = await fetch(\n  \"https://api.infrai.cc/v1/metrics/query?name=example&agg=p50\",\n  {\n    method: \"GET\",\n    headers: {\n      \"Authorization\": `Bearer ${process.env.INFRAI_API_KEY}`,\n    },\n  },\n);\nif (!resp.ok) throw new Error(`infrai ${resp.status}`);\nconst data: unknown = await resp.json();\nconsole.log(data);","go":"// Zero-install REST call — no SDK required (short-term the API is REST-only).\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(\"GET\", \"https://api.infrai.cc/v1/metrics/query?name=example&agg=p50\", nil)\n\treq.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"INFRAI_API_KEY\"))\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\tfmt.Println(resp.Status)\n}","java":"// Zero-install REST call — no SDK required (short-term the API is REST-only).\nimport java.net.URI;\nimport java.net.http.*;\n\nHttpRequest req = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.infrai.cc/v1/metrics/query?name=example&agg=p50\"))\n    .header(\"Authorization\", \"Bearer \" + System.getenv(\"INFRAI_API_KEY\"))\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> resp = HttpClient.newHttpClient()\n    .send(req, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(resp.body());","csharp":"// Zero-install REST call — no SDK required (short-term the API is REST-only).\nusing System;\nusing System.Net.Http;\n\nvar client = new HttpClient();\nvar req = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.infrai.cc/v1/metrics/query?name=example&agg=p50\");\nvar key = Environment.GetEnvironmentVariable(\"INFRAI_API_KEY\");\nreq.Headers.Add(\"Authorization\", \"Bearer \" + key);\nvar resp = await client.SendAsync(req);\nConsole.WriteLine(await resp.Content.ReadAsStringAsync());","php":"<?php\n// Zero-install REST call — no SDK required (short-term the API is REST-only).\n$ch = curl_init(\"https://api.infrai.cc/v1/metrics/query?name=example&agg=p50\");\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"Authorization: Bearer \" . getenv(\"INFRAI_API_KEY\"),\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;","ruby":"# Zero-install REST call — no SDK required (short-term the API is REST-only).\nrequire \"net/http\"\nrequire \"uri\"\n\nuri = URI(\"https://api.infrai.cc/v1/metrics/query?name=example&agg=p50\")\nhttp = Net::HTTP.new(uri.host, uri.port)\nhttp.use_ssl = true\nreq = Net::HTTP::Get.new(uri)\nreq[\"Authorization\"] = \"Bearer #{ENV['INFRAI_API_KEY']}\"\nres = http.request(req)\nputs res.body","rust":"// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)\nuse std::env;\n\n#[tokio::main]\nasync fn main() -> Result<(), Box<dyn std::error::Error>> {\n    let resp = reqwest::Client::new()\n        .get(\"https://api.infrai.cc/v1/metrics/query?name=example&agg=p50\")\n        .header(\"Authorization\", format!(\"Bearer {}\", env::var(\"INFRAI_API_KEY\")?))\n        .send()\n        .await?;\n    println!(\"{}\", resp.text().await?);\n    Ok(())\n}","request":{"name":"example","agg":"p50"}},"billing":{"is_billable":false,"free":true,"billing_class":"self_dev_market","unit":"per_call","note":"free (rate-limited); does NOT consume the new-account trial"}}