Worked examples, then the query object key by key: date tokens, granularities, filters, ordering, paging, comparisons, response and caching.
A data query is a JSON object. It names the metrics to measure, the dimensions to group by, the date range, filters, sort order and paging. It’s the query in a POST /query body and the query variable of the GraphQL analyticsQuery operation (type AnalyticsQueryInput), with exactly the same JSON in both. The format is based on the open-source Cube query format; the differences are listed at the end of this page.
Every example below is the query value of a request body that also has your clientId. A data query always runs for one client; "all_clients" isn’t accepted. Field names come from that client’s data model.
{
"measures": ["unified.spend", "unified.clicks"],
"dimensions": ["unified.source"],
"timeDimensions": [
{
"dimension": "unified.date",
"dateRange": ["lastMonth"],
"granularity": "week"
}
],
"filters": [
{
"member": "unified.spend",
"operator": "gt",
"values": ["0"]
}
],
"order": [
{ "member": "unified.date", "direction": "asc" },
{ "member": "unified.spend", "direction": "desc" }
],
"limit": 1000,
"timezone": "Australia/Sydney"
}Unified fields cover every connected ad platform. unified.source labels each row with its platform.
{
"measures": ["unified.spend", "unified.clicks"],
"dimensions": ["unified.source"],
"timeDimensions": [
{
"dimension": "unified.date",
"dateRange": ["lastMonth"]
}
],
"order": [{"member": "unified.spend", "direction": "desc"}]
}{
"queryId": "qry_a1b2c3d4e5f6a7b8",
"status": "COMPLETE",
"data": [
{
"unified.source": "googleAds",
"unified.spend": 21400,
"unified.clicks": 18210
},
{
"unified.source": "facebookAds",
"unified.spend": 15320,
"unified.clicks": 9875
}
],
"total": 2
}granularity adds a row per week. Weeks start on Monday; use sunday_week for Sunday starts.
{
"measures": ["googleAds.spend", "googleAds.conversions"],
"timeDimensions": [
{
"dimension": "googleAds.date",
"dateRange": ["12WeeksAgo", "yesterday"],
"granularity": "week"
}
]
}{
"queryId": "qry_a1b2c3d4e5f6a7b8",
"status": "COMPLETE",
"data": [
{
"googleAds.date": "2026-09-07T00:00:00.000Z",
"googleAds.spend": 4210.25,
"googleAds.conversions": 96
},
{
"googleAds.date": "2026-09-14T00:00:00.000Z",
"googleAds.spend": 3980.4,
"googleAds.conversions": 104
}
],
"total": 12
}With dimensions, a granularity and an order on a metric, limit picks the top 5 campaigns by total spend and returns every week for each.
{
"measures": ["googleAds.spend"],
"dimensions": ["googleAds.campaignName"],
"timeDimensions": [
{
"dimension": "googleAds.date",
"dateRange": ["thisYear", "yesterday"],
"granularity": "week"
}
],
"order": [{"member": "googleAds.spend", "direction": "desc"}],
"limit": 5
}compareDateRange runs the query for both periods and returns two result sets.
{
"measures": ["googleAds.spend", "googleAds.conversions"],
"dimensions": ["googleAds.campaignName"],
"timeDimensions": [
{
"dimension": "googleAds.date",
"compareDateRange": [
[
"2026-11-01",
"2026-11-23"
],
[
"2026-10-01",
"2026-10-23"
]
]
}
],
"order": [{"member": "googleAds.spend", "direction": "desc"}],
"limit": 10
}{
"queryId": "qry_a1b2c3d4e5f6a7b8",
"status": "COMPLETE",
"queryType": "compareDateRangeQuery",
"results": [
{
"data": [
{
"googleAds.campaignName": "Brand | Search",
"googleAds.spend": 1520.4,
"googleAds.conversions": 41
}
],
"total": 1
},
{
"data": [
{
"googleAds.campaignName": "Brand | Search",
"googleAds.spend": 1388.1,
"googleAds.conversions": 36
}
],
"total": 1
}
]
}Dimension filters remove rows before aggregation; the metric filter keeps channels with more than 100 sessions after it.
{
"measures": [
"googleAnalytics4.sessions",
"googleAnalytics4.totalUsers"
],
"dimensions": ["googleAnalytics4.sessionDefaultChannelGroup"],
"timeDimensions": [
{
"dimension": "googleAnalytics4.date",
"dateRange": ["30DaysAgo", "yesterday"]
}
],
"filters": [
{
"member": "googleAnalytics4.sessionDefaultChannelGroup",
"operator": "notEquals",
"values": ["Direct"]
},
{
"member": "googleAnalytics4.sessions",
"operator": "gt",
"values": ["100"]
}
],
"order": [
{
"member": "googleAnalytics4.sessions",
"direction": "desc"
}
]
}contains ignores case and spaces. or groups match either condition. total: true returns the full row count for paging.
{
"measures": [
"googleSearchConsole.clicks",
"googleSearchConsole.impressions",
"googleSearchConsole.ctr",
"googleSearchConsole.position"
],
"dimensions": ["googleSearchConsole.query"],
"timeDimensions": [
{
"dimension": "googleSearchConsole.date",
"dateRange": ["last28days"]
}
],
"filters": [
{
"or": [
{
"member": "googleSearchConsole.query",
"operator": "contains",
"values": ["homers"]
},
{
"member": "googleSearchConsole.query",
"operator": "contains",
"values": ["donut"]
}
]
}
],
"order": [
{
"member": "googleSearchConsole.clicks",
"direction": "desc"
}
],
"limit": 50,
"total": true
}Page with offset. Keep everything else identical so each page comes from the same cached result.
{
"measures": ["googleAds.spend", "googleAds.clicks"],
"dimensions": ["googleAds.campaignName"],
"timeDimensions": [
{
"dimension": "googleAds.date",
"dateRange": ["lastMonth"]
}
],
"order": [{"member": "googleAds.spend", "direction": "desc"}],
"limit": 500,
"offset": 500,
"total": true
}Query a custom field by its custom_{id} name. Jepto expands its formula for you.
{
"measures": ["custom_a1b2c3d4e5f6a7b8", "unified.spend"],
"timeDimensions": [
{
"dimension": "unified.date",
"dateRange": ["thisYear"],
"granularity": "month"
}
]
}
Any other key is rejected with INVALID_QUERY. A query needs at least one measure or dimension, and a query with measures needs a date range.
| Key | Type | Default | Description |
|---|---|---|---|
measures | string[] | [] | Metric field names. Each must be a kind: "metric" field in this client’s schema. |
dimensions | string[] | [] | Dimension field names to group by. Date fields aren’t allowed here; use timeDimensions. |
timeDimensions | object[] | [] | At most one entry. Sets the date field, date range and optional time buckets. See Time dimension. |
filters | object[] | [] | Conditions every row must meet. Entries are combined with AND. See Filters. |
order | object[] | none | A list of { member, direction } objects, where direction is asc or desc. Entries apply in order, and each member must be a field in the query. With granularity and no order, rows sort by time, oldest first. |
limit | integer | 10000 | Rows to return, 1 to 10,000 |
offset | integer | 0 | Rows to skip, for paging. offset + limit can’t exceed 10,000. |
total | boolean | false | When true, total in the response is the number of matching rows before limit and offset |
timezone | string | "UTC" | IANA time zone, such as Australia/Sydney. Defines “today” for relative dates and the boundaries of time buckets for timestamp fields. |
measureAggregations | object[] | each metric’s default | A list of { member, aggregation } objects that override how a metric in measures combines rows. See Measure aggregations. |
renewQuery | boolean | false | When true, skip the cache and fetch fresh data from the platforms. See Caching. |
| Key | Type | Required | Description |
|---|---|---|---|
dimension | string | yes | The source’s date field, such as googleAds.date or unified.date (isDefaultDateField: true in the schema) |
dateRange | string[] | yes, unless compareDateRange is set | [token] or [start, end]. See Date ranges. |
granularity | string | no | Bucket rows by time: day, week, sunday_week, month, quarter or year |
compareDateRange | string[][] | no | [[start, end], [start, end]]: run the query for two periods. Replaces dateRange. See Comparing periods. |
Without granularity you get one row per combination of dimension values for the whole range, and the date field isn’t in the rows. With it, you get a row per bucket as well, and the bucket is returned under the date field’s own name:
| Value | Bucket starts | Returned as (row dated Tue 24 Nov 2026) |
|---|---|---|
day | Each day | "2026-11-24" |
week | Monday | "2026-11-23T00:00:00.000Z" |
sunday_week | Sunday | "2026-11-22T00:00:00.000Z" |
month | The 1st | "2026-11-01T00:00:00.000Z" |
quarter | 1 Jan, 1 Apr, 1 Jul, 1 Oct | "2026-10-01T00:00:00.000Z" |
year | 1 January | "2026-01-01T00:00:00.000Z" |
dateGrain can’t be bucketed finer than that grain. For example, a metric stored by month can’t use day or week.count_distinct metrics must be bucketed at their stored grain, because distinct counts can’t be added up.
dateRange is always an array. With one item, a relative token defines the whole range. With two items, [start, end], each is an ISO date (YYYY-MM-DD) or a token that resolves to one date, and both ends are inclusive. Relative tokens resolve against the current date in the query’s timezone each time the query runs.
"dateRange": ["lastMonth"] // one token: the whole of last month "dateRange": ["2026-10-01", "2026-10-31"] // ISO start and end "dateRange": ["30DaysAgo", "yesterday"] // the last 30 complete days "dateRange": ["thisYear", "today"] // year to date
| Token | As the whole range | As the start or end of [start, end] |
|---|---|---|
today | Today | Today |
yesterday | Yesterday | Yesterday |
thisWeek | The current week, first to last day | First day of the current week |
lastWeek | The previous week | First day of the previous week |
thisMonth | 1st to last day of this month | 1st of this month |
lastMonth | The previous calendar month | 1st of the previous month |
thisYear | 1 January to 31 December this year | 1 January this year |
lastYear | The previous calendar year | 1 January last year |
last{N}days | N days ending today, including today | Today minus N days |
last{N}weeks | Today minus 7×N days, to today | Today minus 7×N days |
last{N}months | Today minus N months, to today | Today minus N months |
last{N}years | Today minus N years, to today | Today minus N years |
{N}DaysAgo | That single day | That day |
{N}WeeksAgo | That single day (7×N days ago) | That day |
{N}MonthsAgo | That single day (N months ago) | That day |
{N}QuartersAgo | That single day (3×N months ago) | That day |
{N}YearsAgo | That single day (N years ago) | That day |
{N} is a positive whole number, for example last7days or 3MonthsAgo.last{N}days on its own includes today, which is usually incomplete. For complete days, use ["{N}DaysAgo", "yesterday"].thisWeek and lastWeek follow your account’s week start setting (Monday or Sunday) in Jepto.thisMonth. Days without data return no rows.
A filter is { member, operator, values }. Every entry in filters must match. To combine conditions differently, use and and or groups, which can nest:
"filters": [ { "member": "googleAds.campaignName", "operator": "notContains", "values": ["test"] }, { "or": [ { "member": "googleAds.campaignName", "operator": "startsWith", "values": ["Brand"] }, { "member": "googleAds.campaignName", "operator": "endsWith", "values": ["| Search"] } ] }, { "member": "googleAds.clicks", "operator": "gte", "values": ["100"] } ]
| Operator | values | Matches rows where the field… |
|---|---|---|
equals | 1 or more | equals any of the values |
notEquals | 1 or more | equals none of the values |
contains | exactly 1 string | contains the value, ignoring case and spaces (pitstop matches Pit Stop) |
notContains | exactly 1 string | doesn’t contain the value, ignoring case and spaces |
startsWith | exactly 1 string | starts with the value (case-sensitive) |
notStartsWith | exactly 1 string | doesn’t start with the value (case-sensitive) |
endsWith | exactly 1 string | ends with the value (case-sensitive) |
notEndsWith | exactly 1 string | doesn’t end with the value (case-sensitive) |
gt | exactly 1 number, as a string | is greater than the value |
gte | exactly 1 number, as a string | is greater than or equal to the value |
lt | exactly 1 number, as a string | is less than the value |
lte | exactly 1 number, as a string | is less than or equal to the value |
set | none | has a value: not null and, for text, not empty or only spaces |
notSet | none | is null, empty or only spaces |
inDateRange | exactly 2 ISO dates | is between the two dates, inclusive |
notInDateRange | exactly 2 ISO dates | is before the first date or after the second |
beforeDate | exactly 1 ISO date | is before the date (not on it) |
afterDate | exactly 1 ISO date | is after the date (not on it) |
member must be a field in this client’s schema. It doesn’t need to be in measures or dimensions.values is always an array of strings, as in Cube. Send numbers as strings: ["100"].timeDimensions.HAVING).or group can’t mix dimension and metric filters.set and notSet, leave out values or send [].
order is a list, and entries apply in sequence. The example at the top of this page sorts by date, then by spend within each date.order member must be a field in measures, dimensions or the time dimension.limit and offset. Send total: true on the first page to learn how many rows there are.{ "limit": 500, "offset": 500, "total": true }When a query has dimensions, granularity, a limit, an order on a metric and total isn’t true, limit counts dimension values, not rows. See Top 5 campaigns, week by week: it returns every week for the 5 campaigns with the highest total spend.
Each metric has a default aggregation in the schema. Override it per query:
{
"measures": ["googleAds.spend", "facebookAds.reach"],
"measureAggregations": [
{
"member": "facebookAds.reach",
"aggregation": "max"
}
]
}Allowed values: sum, avg, min, max, count, count_distinct. Each member must also be in measures.
Put compareDateRange in the time dimension instead of dateRange to run the same query for two periods. It takes two [start, end] pairs of ISO dates:
{
"dimension": "googleAds.date",
"compareDateRange": [
["2026-10-01", "2026-10-31"],
["2026-09-01", "2026-09-30"]
]
}The response has queryType: "compareDateRangeQuery" and a results array instead of data. results[0] is the first period and results[1] the second. Each has its own data, total and annotation. Rows aren’t merged across periods; join them yourself on the dimension values.
200 OK{
"queryId": "qry_a1b2c3d4e5f6a7b8",
"status": "COMPLETE",
"queryType": "compareDateRangeQuery",
"results": [
{
"data": [
{
"googleAds.campaignName": "Brand | Search",
"googleAds.clicks": 2210
}
],
"total": 1,
"annotation": {}
},
{
"data": [
{
"googleAds.campaignName": "Brand | Search",
"googleAds.clicks": 1964
}
],
"total": 1,
"annotation": {}
}
],
"lastRefreshTime": "2026-11-24T03:12:45.123456Z"
}With dimensions, limit and order, the second period only includes the dimension values that appear in the first, so the two periods line up.
| Field | Type | Description |
|---|---|---|
queryId | string | Identifies this run. Read the result again within one hour with POST /query/result or analyticsQueryResult. |
status | "COMPLETE", "RUNNING" or "FAILED" | RUNNING means the result isn’t ready yet; see Long-running queries |
data | object[] | The rows. Each row has one key per requested field, plus the date field when granularity is set. |
total | integer | With total: true, matching rows before limit and offset. Otherwise the number of rows in data. |
annotation | object | A label for each field in the result, for column headers |
queryType | string | "compareDateRangeQuery" for comparisons only, which return results instead of data |
lastRefreshTime | string | When this result was computed, ISO 8601 in UTC. A cached result keeps its original time. |
cacheStatus | "hit" or "computed" | Whether the result came from the cache |
error | object | Only when status is FAILED: { "code", "message" } |
1.23456 becomes 1.2345.null.data: [].{
"measures": {
"googleAds.costPerClick": {
"label": "Cost Per Click"
}
},
"dimensions": {
"googleAds.campaignName": {
"label": "Campaign Name"
}
},
"segments": {},
"timeDimensions": {
"googleAds.date": {
"label": "Date",
"granularity": "week"
}
}
}Labels are generated from the field name. For the label Jepto shows in the app, and for types and descriptions, use the schema.
lastMonth on 1 December doesn’t return November’s cached lastMonth result from October.renewQuery: true deletes the cached result, refetches the platform data for the query’s date range and caches the new result. It’s slower and more likely to return RUNNING, so use it only when you need the latest numbers.
| Topic | Jepto |
|---|---|
| Time dimensions | At most one per query |
| Bucket keys | Buckets are returned under the date field (googleAds.date), not googleAds.date.week |
| Granularities | Adds sunday_week. No hour, minute or second. |
| Date tokens | Jepto tokens such as last30days and 30DaysAgo instead of Cube’s natural-language ranges such as last 30 days |
order, measureAggregations | Lists of { member, direction } and { member, aggregation } objects, so the same JSON is a typed GraphQL input. measureAggregations is a Jepto addition. |
dateRange, compareDateRange | Always arrays, with ISO dates in compareDateRange |
| Not supported | segments, ungrouped, joinHints, beforeOrOnDate, afterOrOnDate |