Grain logomark

Query API

Extract insights with simple REST queries. Build custom dashboards, export data, and power workflows—no SQL required.

POST /v1/api/query/count/{tenantId}

{
  "event": "page_viewed",
  "after": "2025-10-01",
  "before": "2025-10-22",
  "filterSet": [{
    "property": "page_path",
    "comparison": "equals",
    "value": "/pricing"
  }]
}

→ Returns: { "count": 4821 }

Key Capabilities

Everything you need to succeed

Fast Queries

ClickHouse-powered backend with millisecond response times.

Flexible Queries

Query, count, and list events with multi-operator filtering.

Advanced Filters

Filter by any property with AND/OR logic and date ranges.

Enterprise Security

API key authentication with rate limiting and audit logs.

Pagination

Cursor-based pagination for efficient large dataset handling.

Time Filtering

Precise date range queries with before/after parameters.

Why it matters

No SQL Required

Simple REST API with JSON. Start querying in minutes.

Powerful Filtering

Multiple comparison operators and chained filter conditions.

Analytics-Optimized

Built for aggregations with count endpoint optimization.

API Features

Query events with flexible filtering
Count events matching criteria
Filter by properties and user attributes
Date range filtering (after/before)
Pagination for large result sets
List distinct event names
Multiple comparison operators
API key authentication

Perfect For

Custom Dashboards

Build internal dashboards with your tools. Fetch and visualize data in real-time.

ProductEngineering

Data Warehousing

Export to BigQuery, Snowflake, or your database for deep analysis.

Data EngineeringBI

Automated Reports

Generate and distribute reports automatically without manual work.

MarketingOperations

Embedded Analytics

Power customer-facing analytics in your SaaS application.

SaaSB2B

Query your analytics data

API access on Builder plan and above.

No credit card required