Maton

Query Requests

POST/requests/query

Authorization

bearerAuth
AuthorizationBearer <token>

Your Maton API key, sent as Authorization: Bearer <MATON_API_KEY>. Create one at https://maton.ai/settings.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.maton.ai/requests/query" \  -H "Authorization: Bearer $MATON_API_KEY" \  -H "Content-Type: application/json" \  -d '{"sql": "SELECT app, count() AS requests, quantile(0.95)(duration_ms) AS p95_ms FROM requests WHERE start_time > now() - INTERVAL 1 DAY AND response_status_code >= {min_status:UInt16} GROUP BY app ORDER BY requests DESC", "params": {"min_status": 400}}'
{
  "data": [
    {
      "app": "slack",
      "requests": 42,
      "p95_ms": 1180.5
    },
    {
      "app": "hubspot",
      "requests": 7,
      "p95_ms": 904
    }
  ],
  "truncated": false
}
{
  "message": "Invalid app name.",
  "type": "Bad Request",
  "code": 400
}
{
  "message": "Invalid API key.",
  "type": "Unauthorized",
  "code": 401
}
{
  "message": "Too many requests.",
  "type": "Too Many Requests",
  "code": 429
}
{
  "message": "Internal server error.",
  "type": "Internal Server Error",
  "code": 500
}