Multiple metrics with per-metric filters in a single query
Return multiple labeled metrics from a single SQL query, each with optional per-metric filters using aggregate FILTER (WHERE …) clauses. Supports all metric types (COUNT, SUM, AVG, MEDIAN, MAX) and optional dimensional grouping (group_by).
Metric param format: metric=<label>,<metric_type>
- First segment = label (lowercase alphanumeric + underscore)
- Second segment = metric type (e.g.,
count,sum:total_funding,percentage:label_a/label_b)
Percentage metrics (percentage:numerator/denominator): Computes ROUND(numerator * 100.0 / NULLIF(denominator, 0), 2).
- Both referenced labels must be defined as non-percentage metrics in the same request.
- Percentage metrics cannot have per-metric filters (apply filters to the referenced metrics instead).
- Example:
metric=filtered,count&metric=total,count&metric=pct,percentage:filtered/total
Per-metric filters (metric_filter param): metric_filter=<label>:<filter_expression>
- Uses the same AST filter syntax as the shared
filterparam - Example:
metric_filter=unicorns:is_unicorn[eq]:true - Compound:
metric_filter=funded:and(total_funding[gte]:100000,is_vc_backed[eq]:true)
group_by (optional): Dimension(s) to group by, comma-separated.
sort (optional): Sort by metric label or dimension. Prefix - for descending (default).
limit (optional): Max results when grouped (1-500, default 25).
Post-aggregation filter (metric_having param): Filter grouped rows by metric values.
- Format:
metric_having=<label>[op]:<value>where op is gt, gte, lt, lte, eq, neq - Repeatable for multiple conditions (AND semantics)
- Only valid when
group_byis present - Example:
metric_having=percentage[gt]:25&metric_having=filtered[gte]:5
Shared filters (filter param): Uses structured AST syntax, same as /api/aggregate/:source.
- Single filter:
filter=tag_id[eq]:42 - AND:
filter=and(tag_id[eq]:42,launch_year[gte]:2020) - OR:
filter=or(location[eq]:133,location[eq]:75)
Example — mixed metrics with group_by:
GET /api/aggregate/companies/multi-metric
?metric=total,count
&metric=unicorns,count
&metric=unicorn_funding,sum:total_funding
&metric_filter=unicorns:is_unicorn[eq]:true
&metric_filter=unicorn_funding:is_unicorn[eq]:true
&group_by=hq_country
&sort=-total
&limit=10
&filter=launch_year[gte]:2015
Example — flat (no group_by):
GET /api/aggregate/companies/multi-metric
?metric=total,count
&metric=unicorns,count
&metric=unicorn_funding,sum:total_funding
&metric_filter=unicorns:is_unicorn[eq]:true
&metric_filter=unicorn_funding:is_unicorn[eq]:true
Returns: { data: [{ total: 52341, unicorns: 1287, unicorn_funding: 3400000000000 }], query_info: { source: "companies", metrics: [...] } } — note that data is a single-element array even for the flat (no-group_by) variant, for shape consistency with the grouped response.
Documentation Index
Fetch the complete documentation index at: https://developers.beta.dealroom.co/llms.txt
Use this file to discover all available pages before exploring further.
Authorizations
Auth0 JWT access token. Paste a token obtained from your preferred OAuth2 flow. For machine-to-machine use, the OAuth2 client_credentials scheme below can mint a token directly from your client_id / client_secret inside the Swagger UI Authorize dialog.
Path Parameters
The source to aggregate
founders, investors, companies, funding-rounds, valuations, entities, fundings "companies"
Query Parameters
ISO 4217 currency code for monetary metric conversion. Defaults to USD.
"EUR"
Metric definition: label,metric_type. Repeat for multiple metrics. Types: count, count_distinct:field, sum:field, avg:field, median:field, p25:field, p75:field, percentage:numerator_label/denominator_label. Example: metric=total,count&metric=unicorns,count&metric=pct,percentage:unicorns/total
1"total,count"
Per-metric filter expression: :<filter_expression>. Example: metric_filter=unicorns:is_unicorn[eq]:true
1"unicorns:is_unicorn[eq]:true"
Post-aggregation filter: [op]:. Operators: gt, gte, lt, lte, eq, neq. Only valid with group_by. Example: metric_having=percentage[gt]:25
1"percentage[gt]:25"
Dimension(s) to group by, comma-separated. Omit for flat aggregation
1^[a-z][a-z0-9_.]*(?:,[a-z][a-z0-9_.]*)*$"hq_country"
Filter expression: and(key[op]:value,...), or(...). Example: and(tag_id[eq]:42,launch_year[gte]:2020)
"and(tag_id[eq]:42,launch_year[gte]:2020)"
Sort by metric label or 'dimension'. Prefix with - for descending
^-?[a-z][a-z0-9_]*$"-total"
Number of results to return (1-500, default 25)
"25"