---
title: "Clickhouse Org Analytics"
method: POST
path: "/clickhouse/org-analytics"
tags: ["ClickHouse"]
---

# Clickhouse Org Analytics

`POST /clickhouse/org-analytics`

## Request

- Base URL: `https://be.graph8.com/api/v1`
- URL: `https://be.graph8.com/api/v1/clickhouse/org-analytics`
- Auth: HTTP bearer

Per-org visitor + intent analytics from ch3.

The database name is always derived from the authenticated user's
``organization.id`` (lower-cased) — the request body never carries
an org_id. The agent cannot reach another org's data even if it
tries.

## Headers

- `Authorization` string, nullable
- `X-Target-Org-Id` string, nullable

## Request body

- ClickhouseOrgAnalyticsRequest
  - `dataset` 'people_visitors' | 'company_visitors' | '5x5_visitors' | 'intent_resolved', required: Which per-org table to read.
  - `since` string, required: ISO date or datetime (inclusive lower bound).
  - `until` string, nullable: ISO date or datetime (exclusive upper bound). Defaults to now.
  - `filters` object: Optional equality filters. Keys must match dataset columns; unknown columns are silently dropped so an LLM guess can't produce a SQL error.
  - `aggregation` 'raw' | 'daily_counts' | 'top_n': 'raw' returns the matching rows (capped). 'daily_counts' returns {day, count}. 'top_n' returns {value, count} grouped by the dataset's primary group key (contact_id, company_id, keyword_id).
  - `limit` integer

## Response `200`

Successful Response

- ApiResponseClickhouseOrgAnalyticsResponse
  - `data` ClickhouseOrgAnalyticsResponse, required
    - `dataset` string, required
    - `aggregation` string, required
    - `rows` object[]
    - `total` integer
    - `window` object
  - `pagination` PaginationMeta
    - `page` integer, required: Current page number (1-indexed)
    - `limit` integer, required: Items per page
    - `total` integer, required: Total number of items
    - `has_next` boolean, required: Whether there are more pages
    - `next_cursor` string, nullable: Opaque cursor for the next page; null when there are no more items. Pass it back as the `cursor` query param to fetch the following page without computing page numbers.
    - `total_available` integer, nullable: Search endpoints only: how many records really match, when known. Can be larger than `total`, which is capped at the 10,000 results that can be paged. For company search this is a distinct-company estimate. Null when unknown; absent outside search.
    - `total_is_lower_bound` boolean, nullable: Search endpoints only: true when more records match than `total` shows (the result set is larger than the 10,000 results that can be paged). Absent outside search.
    - `notes` string[], nullable: Search endpoints only: plain-language notes about the result, e.g. that more records match than can be paged, or that a reversed `between` range was put in order.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/graph8/apis/graph8-developer-api.md) · [All operations](https://skmtc.dev/graph8/apis/graph8-developer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/graph8/apis/graph8-developer-api/revisions/2e7cfa0ca921?raw)
