Skip to main content
POST /count/{tenantAlias} returns one number: the count of events that match the body. It takes the same filters as POST /{tenantAlias} and no pagination. The path is relative to the base URL https://queryapis.grainql.com/v1/api/query.

Request

{tenantAlias} is the tenant alias that the dashboard shows, not the tenant UUID. Each object in filterSet has three required fields: Read Filters for the operators and property paths. An empty body {} counts every event of the tenant.

Example

Response:

Response fields

When to use count

A count is one small response. A query for the same events returns every event object, one page at a time, and each page is one request against the rate limit.

Rules for the client

  1. Send after and before on every request. A date range limits the data that the server scans.
  2. To compute a rate, send one count per number, then divide on the client. For example, count error_occurred and count every event, then divide.
  3. Cache a count that a dashboard shows often. Every request counts against the rate limit.
  4. If the API returns 429, wait Retry-After seconds, then retry one time. Read Query API for the rate limits and the error table.

Limits