All docs

ClickHouse

Read-only enrichment and per-org visitor analytics against graph8's ClickHouse instances


Bulk Enrichment Lookup

POST /clickhouse/mashup

Bulk enrichment lookup against the ClickHouse Cloud mashup.* tables:

  • fivexfive_b2b — 251 million rows
  • fivexfive_b2c — 424 million rows
  • upid_hem — 1.95 billion-row HEM to UP_ID resolver
  • default.mashup_new — denormalized view

Requires an active subscription. The handler refuses to run without a primary-key filter — a single call cannot trigger a full-cluster scan.

Request Body

FieldTypeRequiredDescription
modestringYesLookup key type. One of: by_upid, by_hem, by_domain
valuesarray of stringsYesPrimary key values to look up. 1–100 items.
profilestringNoDataset profile. One of: b2b (default), b2c, joined
limitintegerNoMaximum rows to return. 1–1000. Default 1000.

Example

cURL

curl -X POST "https://be.graph8.com/api/v1/clickhouse/mashup" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "by_upid",
    "values": ["UPID1", "UPID2"],
    "profile": "b2b",
    "limit": 1000
  }'

Response

{
  "data": {
    "mode": "by_upid",
    "profile": "b2b",
    "records": [
      {
        "UP_ID": "u1",
        "COMPANY_DOMAIN": "acme.com",
        "...": "..."
      }
    ],
    "matched": 1,
    "requested": 2
  }
}
FieldTypeDescription
modestringThe lookup mode used for this request
profilestringThe dataset profile used
recordsarrayMatched enrichment rows. Column names vary by profile.
matchedintegerNumber of input values that returned at least one record
requestedintegerTotal number of values submitted

Per-Org Visitor Analytics

POST /clickhouse/org-analytics

Per-org visitor and intent-resolved analytics from your org’s dedicated ClickHouse visitor instance. The ClickHouse database name is derived from the authenticated user’s organization.id (lower-cased) — the request body never carries an org_id. Cross-tenant queries are physically unreachable. A 90-day window cap applies to all requests.

Request Body

FieldTypeRequiredDescription
datasetstringYesWhich visitor table to query. One of: people_visitors, company_visitors, 5x5_visitors, intent_resolved
sincestringYesStart of the time window (inclusive). ISO date or datetime, e.g. "2026-05-01"
untilstringNoEnd of the time window (exclusive). ISO date or datetime. Defaults to now.
filtersobjectNoKey-value pairs to filter rows. Unknown column keys are silently dropped. Example: {"contact_id": 12345}
aggregationstringNoHow to aggregate results. One of: raw (default), daily_counts, top_n
limitintegerNoMaximum rows to return. 1–1000. Default 100.

Aggregation modes

ModeReturns
rawMatching rows ordered by the dataset’s timestamp descending
daily_counts[{"day": "2026-05-01", "cnt": 12}, ...]
top_n[{"value": "<group_key>", "cnt": N}, ...] grouped by the dataset’s primary key (contact_id for people_visitors, company_id for company_visitors, hem for 5x5_visitors, keyword_id for intent_resolved)

Example

cURL

# Raw rows — people visitors in May 2026
curl -X POST "https://be.graph8.com/api/v1/clickhouse/org-analytics" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dataset": "people_visitors",
    "since": "2026-05-01",
    "until": "2026-05-30",
    "aggregation": "raw",
    "limit": 100
  }'

# Daily visit counts with a contact filter
curl -X POST "https://be.graph8.com/api/v1/clickhouse/org-analytics" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dataset": "people_visitors",
    "since": "2026-05-01",
    "filters": {"contact_id": 12345},
    "aggregation": "daily_counts"
  }'

# Top companies by visit count
curl -X POST "https://be.graph8.com/api/v1/clickhouse/org-analytics" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dataset": "company_visitors",
    "since": "2026-05-01",
    "aggregation": "top_n",
    "limit": 20
  }'

Response

{
  "data": {
    "dataset": "people_visitors",
    "aggregation": "raw",
    "rows": [
      {
        "contact_id": 1,
        "visited_at": "2026-05-30T10:00:00Z"
      }
    ],
    "total": 1,
    "window": {
      "since": "2026-05-01T00:00:00+00:00",
      "until": "2026-05-30T00:00:00+00:00"
    }
  }
}
FieldTypeDescription
datasetstringThe dataset queried
aggregationstringThe aggregation mode applied
rowsarrayResult rows. Shape depends on dataset and aggregation.
totalintegerNumber of rows returned
window.sincestringResolved start of the query window (UTC ISO datetime)
window.untilstringResolved end of the query window (UTC ISO datetime)
Build with graph8