Raw schema
{
"type": "object",
"properties": {
"from": {
"type": "string",
"enum": [
"attributes",
"citations",
"competitors",
"contents",
"prompts",
"response_mentions",
"responses",
"source_mentions",
"sources",
"topics",
"websites"
],
"description": "Dataset to query."
},
"schedule": {
"description": "One schedule from the catalog (\"default\" or a custom/archived UUID), or an array of them to combine their data. Omit to use the caller default. The retired \"manual\" token is accepted as a deprecated alias of \"default\". Website-level cubes are unaffected.",
"anyOf": [
{
"anyOf": [
{
"type": "string",
"enum": [
"default",
"manual"
]
},
{
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
}
]
},
{
"minItems": 1,
"maxItems": 50,
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"enum": [
"default",
"manual"
]
},
{
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
}
]
}
}
]
},
"measures": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "object",
"properties": {
"fn": {
"type": "string",
"enum": [
"count",
"count_distinct",
"avg",
"sum",
"min",
"max"
],
"description": "Aggregate function."
},
"of": {
"description": "Dimension to aggregate. Required for all functions except count. Bare `count` (no `of`) counts distinct facts (responses, mentions, citations...) on fact cubes. It throws on pre-aggregated tables (MVs) where rows are groups, not facts — use `{ fn: 'count_distinct', of: '<id-dim>' }` instead (e.g. `of: 'response_id'` on mentions/citations) to hit the MV's pre-computed aggregate.",
"type": "string"
},
"where": {
"description": "Per-measure conditional filter (compiles to countIf, avgIf, etc.).",
"allOf": [
{
"$ref": "#/definitions/Filter"
}
]
}
},
"required": [
"fn"
],
"description": "Aggregate expression."
},
{
"type": "object",
"properties": {
"expr": {
"$ref": "#/definitions/Expr"
}
},
"required": [
"expr"
],
"description": "Derived measure — an s-expression computed over other measures. Refs resolve to other measure aliases in the same query. Example: { expr: [\"/\", \"brand\", [\"nullIf\", \"total\", 0]] }"
}
]
},
"description": "Aggregate expressions keyed by output column name. Example: { total: { fn: 'count_distinct', of: 'response_id' } }"
},
"by": {
"description": "GROUP BY dimensions. Omit for scalar result.",
"type": "array",
"items": {
"type": "string"
}
},
"alsoSelect": {
"description": "Label dimensions carried via any(). Must be determined by a by dim (cube's dependentDims). Example: entity_name when entity_id is in by.",
"type": "array",
"items": {
"type": "string"
}
},
"where": {
"description": "WHERE filter (before grouping).",
"allOf": [
{
"$ref": "#/definitions/Filter"
}
]
},
"having": {
"description": "HAVING filter (after grouping). References measure aliases and by dims.",
"allOf": [
{
"$ref": "#/definitions/Filter"
}
]
},
"orderBy": {
"description": "ORDER BY. Measure aliases and by dims allowed.",
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"description": "Dim or measure name, ascending."
},
{
"type": "object",
"properties": {
"dim": {
"type": "string"
},
"desc": {
"type": "boolean"
}
},
"required": [
"dim"
]
},
{
"type": "object",
"properties": {
"measure": {
"type": "string"
},
"desc": {
"type": "boolean"
}
},
"required": [
"measure"
]
}
]
}
},
"limit": {
"description": "Max rows to return.",
"type": "integer",
"minimum": 1,
"maximum": 9007199254740991
},
"compare": {
"description": "Compare the same measures across two slices. Each base measure `m` expands to `m_<baseline.label>` and `m_<current.label>`; the result also gets `m_delta` (= current − baseline) and `m_pct_change` (= (current − baseline) / baseline, null when baseline = 0). Default labels are 'baseline' and 'current'; override per side for non-temporal compares (e.g. brand vs competitors). One scan; orderBy on `m_delta` works push-down.",
"type": "object",
"properties": {
"baseline": {
"$ref": "#/definitions/CompareSlice"
},
"current": {
"$ref": "#/definitions/CompareSlice"
}
},
"required": [
"baseline",
"current"
]
},
"website_id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
"description": "The website to query. Must be a website your credentials can access."
}
},
"required": [
"from",
"measures",
"website_id"
],
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"definitions": {
"Filter": {
"type": "object",
"properties": {
"AND": {
"anyOf": [
{
"$ref": "#/definitions/Filter"
},
{
"minItems": 1,
"type": "array",
"items": {
"$ref": "#/definitions/Filter"
}
}
]
},
"OR": {
"minItems": 1,
"type": "array",
"items": {
"$ref": "#/definitions/Filter"
}
},
"NOT": {
"allOf": [
{
"$ref": "#/definitions/Filter"
}
]
}
},
"additionalProperties": {},
"description": "Prisma-style filter. A bare scalar value on a dim is shorthand for `eq` (e.g. `{ is_website: true }`); bare arrays and op-less objects throw — use `{ in: [...] }` / `{ hasSome: [...] }` explicitly. Operators: eq, neq, in, notIn, gt, gte, lt, lte, isNull, like, ilike, startsWith, hasSome, hasEvery, hasNone. Combinators: AND, OR, NOT. On semi-join dims (e.g. `response_mentions_entity`, `prompt_tag_ids`), `hasSome`/`in` emit `IN (SELECT …)` and `hasNone`/`notIn` emit `NOT IN (SELECT …)`; combine both on one dim to express \"includes any of A but none of B\". Empty `AND: []` / `OR: []` throw (the math identities are asymmetric — drop the clause before passing). Empty list operators (`hasSome: []` / `hasNone: []` / `hasEvery: []`) also throw — drop the predicate or supply at least one value. NOT accepts a single Filter only — for arrays use `NOT: { AND: [...] }` (`not all`) or `NOT: { OR: [...] }` (`none`). NOT keeps rows whose value is NULL: `NOT { sentiment: { eq: \"positive\" } }` returns unanalyzed responses as well as negative and neutral ones, because \"not positive\" is true of a row with no sentiment. Exclude them explicitly with `AND: [{ NOT: {...} }, { sentiment: { isNull: false } }]`."
},
"Expr": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"minItems": 1,
"type": "array",
"items": {
"$ref": "#/definitions/Expr"
}
}
],
"description": "S-expression. Strings are refs (to a measure alias or by-dim). Numbers/booleans/null are literals. Arrays are [op, ...args] where op is a binary operator (+ - * / % = != < <= > >= AND OR) or one of the allowed scalar functions: nullIf, coalesce, ifNull, if, multiIf, abs, round, floor, ceil, sqrt, pow, least, greatest, log, exp, sign. Examples: [\"-\", \"n_current\", \"n_baseline\"], [\"/\", \"num\", [\"nullIf\", \"denom\", 0]], [\"coalesce\", \"value\", 0]."
},
"CompareSlice": {
"type": "object",
"properties": {
"where": {
"$ref": "#/definitions/Filter"
},
"label": {
"type": "string"
}
},
"required": [
"where"
],
"description": "One side of a compare. `where` is the filter that scopes this slice (non-empty — empty means 'all rows', which trivializes the comparison). `label` defaults to 'baseline' / 'current' and forms the suffix on expanded column names; override for non-temporal compares."
}
}
}