---
updatedAt: 2026-10-14T21:49:02.000Z
agentTools:
  projectIndex: https://docs.observeinc.com/llms.txt
---

# Get monitor attribute statistics

Counts monitors by one or more fields. No monitors are returned. Each
entry in `attributes` is a field to group by, and the response carries one
block per entry: that field's distinct-value count, and its most frequent
values with a count each. Grouping by `health` answers "how many monitors
are in each health state".

Fields are the ones `GET /v1/monitors` lists under `filter`, written the
same way. An entry may also be a CEL expression over them, for buckets no
single field provides: `aiTriagingMode == "Triage"` gives `"true"` and
`"false"` rather than one bucket per stored mode. The expression must yield
one scalar per monitor — that value becomes the bucket key — so a list or
object is rejected with `400`.

Keys come back as JSON strings whatever the field's type: numbers as
decimal digits, bools as `"true"` or `"false"`, timestamps as RFC 3339.

`meta` reports `totalMonitors` (before the filter) and `filteredMonitors`
(after).

For example, facet counts for the list's Health and Type columns:

```
GET /v1/monitors/stats?attributes=health,ruleKind&topK=10
```

The AI column's two buckets, over enabled monitors only. Both values hold
quotes, so both are CSV-escaped — inner `"` doubled, the item wrapped —
then URL-encoded:

```
GET /v1/monitors/stats
  ?attributes="aiTriagingMode == ""Triage"""
  &filter=disabled == false
```


# OpenAPI definition

````json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Observe by Snowflake API",
    "description": "# Overview\nWelcome to the Observe API Docs!\n\nThe Observe API is a RESTful API. POST bodies and responses are typically JSON-encoded.\n\n## Authentication\nRequests to the Observe API are authenticated with an API token. The token can be supplied using HTTP Bearer authentication:\n```\n// passing token as bearer token\ncurl -H \"Authorization: Bearer <customerid> <token>\" https://<customerid>.<observe-domain>.com/v1/...\n```\n",
    "version": "1.0.230307"
  },
  "servers": [
    {
      "url": "https://{customerid}.observeinc.com",
      "description": "US west server",
      "variables": {
        "customerid": {
          "default": "OBSERVE_CUSTOMERID",
          "description": "The customer ID for your instance."
        }
      }
    },
    {
      "url": "https://{customerid}.{cluster}.observeinc.com",
      "description": "Specific regional cluster (prod)",
      "variables": {
        "customerid": {
          "default": "OBSERVE_CUSTOMERID",
          "description": "The customer ID for your instance."
        },
        "cluster": {
          "enum": [
            "eu-1",
            "ap-1"
          ],
          "default": "eu-1",
          "description": "For regional clusters, choose one."
        }
      }
    },
    {
      "url": "https://{customerid}.{domain}.com",
      "description": "Specific Observe server",
      "variables": {
        "customerid": {
          "default": "OBSERVE_CUSTOMERID",
          "description": "The customer ID for your instance."
        },
        "domain": {
          "default": "OBSERVE_DOMAIN",
          "description": "The Observe domain for your instance."
        }
      }
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Monitor",
      "description": "Manage monitors. Learn more about [monitors](https://docs.observeinc.com/en/latest/content/monitors/MonitorsIntro.html).\n"
    }
  ],
  "paths": {
    "/v1/monitors/stats": {
      "get": {
        "summary": "Get monitor attribute statistics",
        "description": "Counts monitors by one or more fields. No monitors are returned. Each\nentry in `attributes` is a field to group by, and the response carries one\nblock per entry: that field's distinct-value count, and its most frequent\nvalues with a count each. Grouping by `health` answers \"how many monitors\nare in each health state\".\n\nFields are the ones `GET /v1/monitors` lists under `filter`, written the\nsame way. An entry may also be a CEL expression over them, for buckets no\nsingle field provides: `aiTriagingMode == \"Triage\"` gives `\"true\"` and\n`\"false\"` rather than one bucket per stored mode. The expression must yield\none scalar per monitor — that value becomes the bucket key — so a list or\nobject is rejected with `400`.\n\nKeys come back as JSON strings whatever the field's type: numbers as\ndecimal digits, bools as `\"true\"` or `\"false\"`, timestamps as RFC 3339.\n\n`meta` reports `totalMonitors` (before the filter) and `filteredMonitors`\n(after).\n\nFor example, facet counts for the list's Health and Type columns:\n\n```\nGET /v1/monitors/stats?attributes=health,ruleKind&topK=10\n```\n\nThe AI column's two buckets, over enabled monitors only. Both values hold\nquotes, so both are CSV-escaped — inner `\"` doubled, the item wrapped —\nthen URL-encoded:\n\n```\nGET /v1/monitors/stats\n  ?attributes=\"aiTriagingMode == \"\"Triage\"\"\"\n  &filter=disabled == false\n```\n",
        "operationId": "GetMonitorStats",
        "tags": [
          "Monitor"
        ],
        "parameters": [
          {
            "in": "query",
            "name": "filter",
            "schema": {
              "type": "string"
            },
            "required": false,
            "description": "CEL expression restricting which monitors contribute to the\nstatistics. Must evaluate to `bool`. Must be URL-encoded. If omitted,\nstatistics cover every monitor the caller may read. See\n`GET /v1/monitors` for the field list and examples.\n"
          },
          {
            "in": "query",
            "name": "attributes",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Comma-separated list of the fields to group by — a field name from\nthe `GET /v1/monitors` `filter` table, or a CEL expression over those\nfields. One statistic is computed per entry. Maximum 20 entries; an\nempty list returns `400`.\n\nBecause an expression may itself contain a comma or a quote, the list\nis CSV: wrap an entry in `\"` if it holds either, and double any\nliteral `\"` inside a wrapped entry. CSV-escape first, URL-encode\nsecond. A bare field name needs neither, so the common case is just\n`attributes=health,ruleKind`.\n"
          },
          {
            "in": "query",
            "name": "topK",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 100
            },
            "required": true,
            "description": "Number of top values to return per attribute, sorted by count\ndescending. Range 1–100. Each attribute's total distinct count is\nreported in `distinctCount` regardless, so a caller can tell when\nvalues were left out.\n"
          }
        ],
        "responses": {
          "200": {
            "description": "Monitor statistics retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Monitor-StatsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse-400"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse-401"
          },
          "403": {
            "$ref": "#/components/responses/ErrorResponse-403"
          },
          "429": {
            "$ref": "#/components/responses/ErrorResponse-429"
          },
          "5XX": {
            "$ref": "#/components/responses/ErrorResponse-5XX"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Authorization: Bearer <customerid> <apitoken>\n"
      }
    },
    "schemas": {
      "ErrorMessage": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "A stable, machine-readable identifier for the kind of error."
          },
          "message": {
            "type": "string",
            "description": "Error message"
          }
        },
        "required": [
          "type",
          "message"
        ]
      },
      "StatValueCount": {
        "title": "StatValueCount",
        "type": "object",
        "description": "One distinct attribute value and the number of rows carrying it.",
        "required": [
          "value",
          "count"
        ],
        "properties": {
          "value": {
            "type": "string",
            "description": "The attribute value, always a JSON string regardless of the expression's\nunderlying type. Strings appear verbatim; ints as decimal digits (e.g.\n`\"41000234\"`); bools as `\"true\"` or `\"false\"`; timestamps as RFC 3339\n(e.g. `\"2024-01-01T00:00:00Z\"`).\n"
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "description": "Number of rows with this value."
          }
        }
      },
      "AttributeStats": {
        "title": "AttributeStats",
        "type": "object",
        "description": "Aggregated statistics for one requested attribute expression: how many\ndistinct values it produced, plus the most frequent value/count pairs.\n",
        "required": [
          "attribute",
          "distinctCount",
          "stats"
        ],
        "properties": {
          "attribute": {
            "type": "string",
            "description": "The attribute expression that was queried, verbatim from the request."
          },
          "distinctCount": {
            "type": "integer",
            "format": "int64",
            "description": "Total distinct values, including those outside the returned top-K."
          },
          "stats": {
            "type": "array",
            "description": "Top-K value/count pairs, sorted by count descending.",
            "items": {
              "$ref": "#/components/schemas/StatValueCount"
            }
          }
        }
      },
      "Monitor-StatsMeta": {
        "title": "MonitorStatsMeta",
        "type": "object",
        "required": [
          "totalMonitors",
          "filteredMonitors"
        ],
        "properties": {
          "totalMonitors": {
            "type": "integer",
            "format": "int64",
            "description": "Monitors the caller may read, before `filter` is applied.\n"
          },
          "filteredMonitors": {
            "type": "integer",
            "format": "int64",
            "description": "Monitors the statistics were computed over, after `filter` is applied. Equal to `totalMonitors` when no filter was given.\n"
          }
        }
      },
      "Monitor-StatsResponse": {
        "title": "MonitorStatsResponse",
        "type": "object",
        "description": "Aggregated stats for the requested monitor attributes.",
        "required": [
          "attributes",
          "meta"
        ],
        "properties": {
          "attributes": {
            "type": "array",
            "description": "One entry per requested `attributes` expression, in request order.\n",
            "items": {
              "$ref": "#/components/schemas/AttributeStats"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Monitor-StatsMeta"
          }
        }
      }
    },
    "responses": {
      "ErrorResponse-400": {
        "description": "Bad request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorMessage"
            }
          }
        }
      },
      "ErrorResponse-401": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorMessage"
            }
          }
        }
      },
      "ErrorResponse-403": {
        "description": "Forbidden",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorMessage"
            }
          }
        }
      },
      "ErrorResponse-429": {
        "description": "Rate limit reached",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorMessage"
            }
          }
        }
      },
      "ErrorResponse-5XX": {
        "description": "Internal server error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorMessage"
            }
          }
        }
      }
    }
  }
}
````