Jepto
Developer Docs
Developer docs

Data Queries

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.

Every key in one query
{
  "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"
}

Examples

Spend and clicks by platform, last month

Unified fields cover every connected ad platform. unified.source labels each row with its platform.

Query
{
  "measures": ["unified.spend", "unified.clicks"],
  "dimensions": ["unified.source"],
  "timeDimensions": [
    {
      "dimension": "unified.date",
      "dateRange": ["lastMonth"]
    }
  ],
  "order": [{"member": "unified.spend", "direction": "desc"}]
}
Response (shortened)
{
  "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
}

Weekly trend for the last 12 weeks

granularity adds a row per week. Weeks start on Monday; use sunday_week for Sunday starts.

Query
{
  "measures": ["googleAds.spend", "googleAds.conversions"],
  "timeDimensions": [
    {
      "dimension": "googleAds.date",
      "dateRange": ["12WeeksAgo", "yesterday"],
      "granularity": "week"
    }
  ]
}
Response (shortened)
{
  "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
}

Top 5 campaigns, week by week

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.

Query
{
  "measures": ["googleAds.spend"],
  "dimensions": ["googleAds.campaignName"],
  "timeDimensions": [
    {
      "dimension": "googleAds.date",
      "dateRange": ["thisYear", "yesterday"],
      "granularity": "week"
    }
  ],
  "order": [{"member": "googleAds.spend", "direction": "desc"}],
  "limit": 5
}

This month against last month

compareDateRange runs the query for both periods and returns two result sets.

Query
{
  "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
}
Response (shortened)
{
  "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
    }
  ]
}

Website sessions by channel, excluding Direct

Dimension filters remove rows before aggregation; the metric filter keeps channels with more than 100 sessions after it.

Query
{
  "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"
    }
  ]
}

Search queries that mention your brand

contains ignores case and spaces. or groups match either condition. total: true returns the full row count for paging.

Query
{
  "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
}

Next page of a large table

Page with offset. Keep everything else identical so each page comes from the same cached result.

Query
{
  "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
}

A custom field over the year, by month

Query a custom field by its custom_{id} name. Jepto expands its formula for you.

Query
{
  "measures": ["custom_a1b2c3d4e5f6a7b8", "unified.spend"],
  "timeDimensions": [
    {
      "dimension": "unified.date",
      "dateRange": ["thisYear"],
      "granularity": "month"
    }
  ]
}

‍

Query object

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.

KeyTypeDefaultDescription
measuresstring[][]Metric field names. Each must be a kind: "metric" field in this client’s schema.
dimensionsstring[][]Dimension field names to group by. Date fields aren’t allowed here; use timeDimensions.
timeDimensionsobject[][]At most one entry. Sets the date field, date range and optional time buckets. See Time dimension.
filtersobject[][]Conditions every row must meet. Entries are combined with AND. See Filters.
orderobject[]noneA 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.
limitinteger10000Rows to return, 1 to 10,000
offsetinteger0Rows to skip, for paging. offset + limit can’t exceed 10,000.
totalbooleanfalseWhen true, total in the response is the number of matching rows before limit and offset
timezonestring"UTC"IANA time zone, such as Australia/Sydney. Defines “today” for relative dates and the boundaries of time buckets for timestamp fields.
measureAggregationsobject[]each metric’s defaultA list of { member, aggregation } objects that override how a metric in measures combines rows. See Measure aggregations.
renewQuerybooleanfalseWhen true, skip the cache and fetch fresh data from the platforms. See Caching.

‍

Time dimension

KeyTypeRequiredDescription
dimensionstringyesThe source’s date field, such as googleAds.date or unified.date (isDefaultDateField: true in the schema)
dateRangestring[]yes, unless compareDateRange is set[token] or [start, end]. See Date ranges.
granularitystringnoBucket rows by time: day, week, sunday_week, month, quarter or year
compareDateRangestring[][]no[[start, end], [start, end]]: run the query for two periods. Replaces dateRange. See Comparing periods.

Granularity

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:

ValueBucket startsReturned as (row dated Tue 24 Nov 2026)
dayEach day"2026-11-24"
weekMonday"2026-11-23T00:00:00.000Z"
sunday_weekSunday"2026-11-22T00:00:00.000Z"
monthThe 1st"2026-11-01T00:00:00.000Z"
quarter1 Jan, 1 Apr, 1 Jul, 1 Oct"2026-10-01T00:00:00.000Z"
year1 January"2026-01-01T00:00:00.000Z"
  • Spell values exactly as shown, in lowercase. Hour and minute buckets aren’t available.
  • A metric with a 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.

‍

Date ranges

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.

Forms
"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
TokenAs the whole rangeAs the start or end of [start, end]
todayTodayToday
yesterdayYesterdayYesterday
thisWeekThe current week, first to last dayFirst day of the current week
lastWeekThe previous weekFirst day of the previous week
thisMonth1st to last day of this month1st of this month
lastMonthThe previous calendar month1st of the previous month
thisYear1 January to 31 December this year1 January this year
lastYearThe previous calendar year1 January last year
last{N}daysN days ending today, including todayToday minus N days
last{N}weeksToday minus 7×N days, to todayToday minus 7×N days
last{N}monthsToday minus N months, to todayToday minus N months
last{N}yearsToday minus N years, to todayToday minus N years
{N}DaysAgoThat single dayThat day
{N}WeeksAgoThat single day (7×N days ago)That day
{N}MonthsAgoThat single day (N months ago)That day
{N}QuartersAgoThat single day (3×N months ago)That day
{N}YearsAgoThat single day (N years ago)That day
  • Tokens are case-sensitive. Spell them exactly as shown.
  • {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.
  • A month that has fewer days is clamped: 31 March minus one month is 28 or 29 February.
  • Ranges can include future dates, such as thisMonth. Days without data return no rows.

‍

Filters

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
"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"] }
]
OperatorvaluesMatches rows where the field…
equals1 or moreequals any of the values
notEquals1 or moreequals none of the values
containsexactly 1 stringcontains the value, ignoring case and spaces (pitstop matches Pit Stop)
notContainsexactly 1 stringdoesn’t contain the value, ignoring case and spaces
startsWithexactly 1 stringstarts with the value (case-sensitive)
notStartsWithexactly 1 stringdoesn’t start with the value (case-sensitive)
endsWithexactly 1 stringends with the value (case-sensitive)
notEndsWithexactly 1 stringdoesn’t end with the value (case-sensitive)
gtexactly 1 number, as a stringis greater than the value
gteexactly 1 number, as a stringis greater than or equal to the value
ltexactly 1 number, as a stringis less than the value
lteexactly 1 number, as a stringis less than or equal to the value
setnonehas a value: not null and, for text, not empty or only spaces
notSetnoneis null, empty or only spaces
inDateRangeexactly 2 ISO datesis between the two dates, inclusive
notInDateRangeexactly 2 ISO datesis before the first date or after the second
beforeDateexactly 1 ISO dateis before the date (not on it)
afterDateexactly 1 ISO dateis 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"].
  • Date operators take ISO dates only. Relative tokens aren’t resolved inside filters; to limit the reporting period, use timeDimensions.
  • Filters on dimensions apply before aggregation. Filters on metrics apply after it, to the aggregated value (like SQL HAVING).
  • An or group can’t mix dimension and metric filters.
  • For set and notSet, leave out values or send [].

‍

Ordering and paging

  • 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.
  • Each order member must be a field in measures, dimensions or the time dimension.
  • Page with limit and offset. Send total: true on the first page to learn how many rows there are.
  • A query can return at most 10,000 rows in total, across all pages. Narrow larger queries with filters or a shorter date range.
Page 2 of 500-row pages
{ "limit": 500, "offset": 500, "total": true }

Top-N for charts

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.

‍

Measure aggregations

Each metric has a default aggregation in the schema. Override it per query:

Override
{
  "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.

‍

Comparing periods

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:

compareDateRange
{
  "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.

Response200 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.

‍

Response

FieldTypeDescription
queryIdstringIdentifies 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
dataobject[]The rows. Each row has one key per requested field, plus the date field when granularity is set.
totalintegerWith total: true, matching rows before limit and offset. Otherwise the number of rows in data.
annotationobjectA label for each field in the result, for column headers
queryTypestring"compareDateRangeQuery" for comparisons only, which return results instead of data
lastRefreshTimestringWhen 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
errorobjectOnly when status is FAILED: { "code", "message" }

Row values

  • Metric values are JSON numbers. Decimals are truncated, not rounded, to 4 decimal places: 1.23456 becomes 1.2345.
  • A value that can’t be calculated, such as a ratio with a zero denominator, is null.
  • Dimension values are strings, as the platform reports them.
  • A metric with no data in the range is absent from the rows. A query whose filters match nothing returns data: [].

Annotation

annotation
{
  "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.

‍

Caching

  • Results are cached for up to 12 hours. An identical query from anyone in your account, or from any part of Jepto, returns the cached result.
  • Relative dates resolve before the cache is checked, so lastMonth on 1 December doesn’t return November’s cached lastMonth result from October.
  • Empty results aren’t cached.
  • 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.

‍

Differences from Cube

TopicJepto
Time dimensionsAt most one per query
Bucket keysBuckets are returned under the date field (googleAds.date), not googleAds.date.week
GranularitiesAdds sunday_week. No hour, minute or second.
Date tokensJepto tokens such as last30days and 30DaysAgo instead of Cube’s natural-language ranges such as last 30 days
order, measureAggregationsLists of { member, direction } and { member, aggregation } objects, so the same JSON is a typed GraphQL input. measureAggregations is a Jepto addition.
dateRange, compareDateRangeAlways arrays, with ISO dates in compareDateRange
Not supportedsegments, ungrouped, joinHints, beforeOrOnDate, afterOrOnDate