Aggregate counts — group by dimension(s) with filters
Returns COUNT(*) bucketed by one or two categorical dimensions with optional column filters and an optional date range. No search scoring — pure SQL GROUP BY.
Use cases: NACE distribution by country, org size breakdown, top keywords for a sector, monthly registration trends.
Dimensions (group_by / group_by_secondary): continent, country, country_code, state, state_code, region, region_code, district, district_code, municipality, municipality_code, nace_code, organization_type, organization_size, employee_class, revenue_class, summary_keywords (unnested), company_register_date, created_at.
summary_keywords is automatically unnested — each keyword in the array counts as its own bucket.
Date dimensions use DATE_TRUNC and are ordered chronologically (ASC). All other dimensions are ordered by count DESC.
Monthly request quotas apply by API key tier.
Authorizations
Your GOI API key. Create one on the GOI dashboard under API keys.
Body
Primary dimension to group by. Omit for a single total COUNT(*). Allowed values — Geographic: continent, country, country_code, state, state_code, region, region_code, district, district_code, municipality, municipality_code. Classification: nace_code, organization_type, organization_size, employee_class, revenue_class. Source: source. Array (unnested per keyword): summary_keywords. Registrations (unnested per registration via the registries jsonb): company_register_court, company_register_date. A company with multiple registrations contributes one row per registration. Date (requires date_trunc): company_register_date, created_at.
Optional second dimension — produces a 2D breakdown. Requires group_by to be set. Allowed values — Geographic: continent, country, country_code, state, state_code, region, region_code, district, district_code, municipality, municipality_code. Classification: nace_code, organization_type, organization_size, employee_class, revenue_class. Source: source. Array (unnested per keyword): summary_keywords. Registrations (unnested per registration via the registries jsonb): company_register_court, company_register_date. A company with multiple registrations contributes one row per registration. Date (requires date_trunc): company_register_date, created_at.
Truncation unit applied when group_by or group_by_secondary is a date column (company_register_date or created_at). Ignored for non-date columns. Results are ordered chronologically (ASC) when a date dimension is active.
year, month, week Column filters to narrow the counted population — same fields as /v1/search filters. text_keywords is not supported here (no BM25 in aggregation queries).
Optional date range filter on company_register_date or created_at. Can be combined with filters and with a date group_by dimension simultaneously.
Maximum number of buckets to return, ordered by count DESC (or ASC for date dimensions). Default 100, max 500.
1 <= x <= 500Return EXPLAIN ANALYZE plan in metadata. Sets a 120s statement timeout. Not available for customer API keys.
Response
Aggregation buckets with count per group, plus query metadata.
List of aggregation buckets. Each bucket contains the grouping column value(s) and a 'count' key. Ordered by count DESC, or chronologically ASC when a date dimension is active. Null values in grouping columns appear as null in the bucket.
Query execution time in milliseconds.