Skip to content

Guide

Reading data

POST /v1/query with the query IR, and how to read the provenance that comes with every result.

POST /v1/query reads published data. It takes one body, the query IR, and reads only the workspace of the API key (query:read). The earlier GA4 body (workspaceId, propertyId, startDate, endDate, metric, dimensions) was removed: a body without a profile is refused as 400 invalid_query, like any other invalid query, and nothing is read. The route stays on /v1 with no version header, because there are no external users.

POST /v1/query
Authorization: Bearer <key>
Content-Type: application/json
{
"profile": "ga4.sessions_daily",
"connectionId": "your_connection",
"accounts": ["123456789"],
"metrics": ["sessions"],
"dimensions": ["date"],
"dateRange": { "start": "2026-08-31", "end": "2026-09-04" }
}

profile names the dataset (ga4.sessions_daily, and the Search Console profiles search-console.site_daily and search-console.page_daily). Only ga4.sessions_daily can be answered today: the Search Console profiles are accepted by the request check but have no ClickHouse view yet. The profiles’ metrics, dimensions, dimension sets and longest windows are defined centrally, and GET /v1/connectors/{connectorId}/schema lists a connector’s profiles under query (see Connector fields). GA4 users and events (ga4.users_daily, ga4.events_daily) are defined too but switched off in production, where they are answered 403 serving_disabled. Where they are on, [date] is their only dimension set, total_users is distinct per day and never summed across days, purchase_revenue is in the currency of the property, and a window that GA4 thresholds publishes no new day (flag withheld_when_thresholded): a day no run has published makes the query 409 data_incomplete (or data_not_ready when no day is published) with the missing dates, and a day published earlier keeps its earlier value. The workspace is never in the body: it is the key’s own, and a workspaceId field is refused as invalid_query. Unknown fields are rejected. Optional fields are filters (equality or membership on filterable dimensions), orderBy and limit.

To read several GA4 properties (or Search Console sites) at once, send sources instead of connectionId and accounts: 2 to 25 pairs (6 over MCP), each a connection and one of its accounts, all of the profile’s connector.

{
"profile": "ga4.sessions_daily",
"sources": [
{ "connectionId": "your_connection", "account": "123456789" },
{ "connectionId": "your_other_connection", "account": "987654321" }
],
"metrics": ["sessions"],
"dimensions": ["date", "account"],
"dateRange": { "start": "2026-08-31", "end": "2026-09-04" }
}
  • Grouped or summed. With account in dimensions, each row is one account’s, in its own time zone and currency. Without it the accounts are summed, and a ratio is recomputed from the summed parts, never averaged. account counts toward the three dimensions, and it groups a one-account request the same way.
  • What a sum refuses. A distinct count (total_users) is 400 non_additive_metric, because the same people may be counted by two properties. Accounts in two time zones are 409 timezone_conflict and money in two currencies is 409 currency_conflict. All three are refused before anything is read; group by account instead. Grouped across time zones, the result carries the flag account_local_dates: each date is that account’s own.
  • All or nothing. Every pair must be an active account of your workspace, or the request is 404 connection_unavailable. A day any pair has not published makes it 409, naming that date once. One account named under two connections is 400 invalid_query (detail invalid_sources).
  • The provenance has one accounts entry per pair, each with its own connectionId; the top-level connectionId is null, and provenance.fingerprint covers every pair.
  • POST /v1/query/search-console reads one site per request, so it refuses sources and the account dimension (invalid_sources). MCP takes at most 6 pairs, which fit one tool result over 14 days; see MCP.

The answer is the result envelope: profile, columns, rows (one object per row, keyed by column id), page, provenance and dataState, plus the gateway’s requestId. Provenance is read the way “Reading provenance” below describes it, per account, with a snapshots block that carries the fingerprint and the pinned ranges (and, for GA4, the head each date was published with). There are no totals and no row count.

A YouTube result (youtube.channel_daily, served in the private staging deployment only) also carries sourceAttribution: label (YouTube), notice (“Data from YouTube. Values exactly as the YouTube Analytics API returned them.”), the channelId, and channelUrl and analyticsUrl, the channel’s YouTube page and its YouTube Studio analytics page. Show the label with the values wherever you show them, and link a YouTube logo, if you show one, to one of those pages. No other result carries the field. It is a statement of source only, not a statement of affiliation with YouTube.

A result is whole or it is refused.

  • limit is at most 10,000 rows (default 1,000), and a result is at most about 5 MB.
  • If the full result is bigger than a page, whether because of that cap or because your limit is smaller than the result, the answer is 413 result_too_large. You never get the first limit rows with a 200, and page.truncated is always false in a 200. Narrow the window or the filters, or raise limit. (413 request_too_large is the other 413: the request body is over 4 KiB.)
  • The message says why and what to do. When there are more rows than the limit or than one response can carry, it says so and to narrow the window or the filters or raise the limit. When the response is over about 5 MB, it says the result is too large for one response and to narrow the window or the filters or ask for fewer metrics or dimensions. A refusal the service cannot attribute to the size gets the rows text. On POST /v1/query, where the deployment serves the export routes, both end by pointing to POST /v1/query/export for a result this large as a CSV file, for a request with up to 10 sources too. Elsewhere, and for a request with more than 10 sources (an export takes at most 10), both end by pointing to scheduled exports (today, a Google Sheets destination, with its own row limits) as the way to receive data regularly in bulk. Neither is a promise to deliver the refused result, and the message never repeats your request. For a one-off CSV of a result that does not fit a response, see Exports (POST /v1/query/export, not yet available on a released environment, and with its own size limits).
  • Cursors do not exist yet, so a limit above 10,000 is 400 invalid_query and any cursor is 400 cursor_invalid.
  • A query that runs past its 20-second budget is 503 query_unavailable, with no more detail.

Errors are the same closed set as the rest of the API: 400 invalid_query, non_additive_metric (a metric that cannot be summed over those dimensions or that window), window_too_large, cursor_invalid; 403 forbidden, serving_disabled (a YouTube profile while its REST switch is off, which is the default: YouTube REST and MCP are off by default and on in the private staging deployment only, and nothing is read); history_not_entitled (the window starts before the history your plan includes; the body carries earliestDate, the first day the plan includes, and nothing is read); 404 connection_unavailable; 409 data_not_ready, data_incomplete, timezone_conflict, currency_conflict (a money metric across more than one currency: group by currency; over several summed sources, group by account), attribution_conflict (the window’s published data was attributed under more than one provider setting: narrow the window); 413 as above; 503 query_unavailable. A 400 the validator raised also carries detail, the closed name of the rule that refused it (for example unknown_metric or mixed_attribution, a ratio whose parts the profile attributes under different rules), and a distinct_dimension_set refusal carries suggestedDimensionSets, the dimension sets that metric is readable at. missingDates on data_not_ready and data_incomplete are in ascending order and at most 31; if more are missing you get the earliest 31 and missingDatesTruncated: true.

rows has exactly one entry per requested date for the GA4 profile, ascending, with no gaps — if a date could not be answered, the whole request is a 409 rather than a shorter array. dataState is zero when every metric cell is zero, observed otherwise, and no_reported_data for an empty page; none of them ever represents missing or unavailable data, which is what the 409 codes are for.

What a zero does and does not tell you. A date the provider returned no row for is filled with zero — but only when the report passed its quality gate, so a zero is never covering for a thresholded, sampled or lossy extraction. What it cannot tell you is whether the property was collecting correctly: a tag that stopped firing produces a genuine, complete report of zero sessions. Treat a zero as “the provider reported nothing for this day”, not as “nothing happened”.

GET /v1/connections lists the connections of the workspace of the API key (query:read) and the accounts selected under each, so a client can offer a picker and then put the chosen connectionId and account ids into a query. It is the same list the MCP tool list_connections returns.

{
"connections": [
{ "connectionId": "conn_example", "connector": "ga4", "status": "active", "accounts": [{ "accountId": "123456789" }] }
],
"requestId": "00000000-0000-4000-8000-000000000000"
}

Each item carries ids only: the connection id, the connector id (as GET /v1/connectors lists it), the connection’s status (active or paused) and the provider account ids. It carries no credential, no provider token, no display name, no user or email. A revoked connection, and a deselected or inactive account, are not listed; a paused connection is, so a picker can show it. The route takes no query parameter and no body, and no header can name another workspace. A list over 500 accounts is 413 result_too_large, never a cut list, and a read that fails is 503 query_unavailable, and an outage of the authorization store is 503 auth_unavailable. The route is rate-limited as a read.

GET /v1/connections/{connectionId} (query:read) reads one connection of the key’s workspace and returns the same item the list would, as { "connection": { … }, "requestId": "…" }. A connection is returned here exactly when the list returns it. The id is matched exactly, case included. A connection of another workspace, a revoked connection and an id that never existed are the same 404 connection_not_found, so the answer does not say which. The path takes an id of at most 128 characters from A-Z, a-z, 0-9, _ and -; any other segment matches no route and is 404 not_found. Because the read is the list’s, a workspace over 500 accounts is 413 result_too_large here too, and the 503 codes are the list’s. It is rate-limited as a read.

A client may name itself in a SignalBraid-Client request header, for example SignalBraid-Client: looker-studio/1.0.0, optionally followed by ; sample for a sample query. The value is closed: only looker-studio/ and a three-part version, nothing else. The header is attribution, not access control. It never changes what your key may read or what a result contains. The gateway uses it only to label its own operator log line and, on POST /v1/query, to refuse a Looker client with serving_disabled only for a connector with a serving policy whose Looker Studio switch is off. A connector without such a policy is not affected by the header. Anything that does not match the form is ignored.

This is the part worth building against. provenance names the workspace and connection, then one entry per account (abbreviated; the identifiers are placeholders):

{
"workspaceId": "your_workspace",
"connectionId": "your_connection",
"accounts": [{
"accountId": "123456789",
"timezone": "Europe/Oslo",
"dataThrough": "2026-09-04",
"coverage": "totals",
"freshness": { "oldestExtractedAt": "2026-09-07T04:20:09.494Z", "newestExtractedAt": "2026-09-07T04:20:09.494Z", "stale": false, "thresholdHours": 2 },
"snapshots": {
"publication": "daily_heads",
"dates": { "start": "2026-08-31", "end": "2026-09-04" },
"ranges": [{ "start": "2026-08-31", "end": "2026-09-04", "run": "78d95c71-2f6e-4b35-8729-6d8d4b6ecc86", "seq": 9 }],
"fingerprint": "…",
"heads": [{ "date": "2026-08-31", "runId": "78d95c71-2f6e-4b35-8729-6d8d4b6ecc86", "extractionSeq": 9, "publishedAt": "2026-09-07T04:20:11.781Z", "extractedAt": "2026-09-07T04:20:09.494Z" }]
}
}],
"definitions": [{ "metric": "sessions", "version": 1 }],
"flags": ["bounded_to_sessions_by_date", "provider_may_revise_recent_data", "not_independently_reconciled"],
"completeness": "complete",
"reconciliation": "not_independently_reconciled"
}

definitions names the metric and its definition version. The definition itself is published at GET /v1/metrics/ga4.sessions. It is the provider metric — it will not match a session_start count.

timezone (per account) is the property’s own. Dates are that property’s calendar dates and are never shifted to UTC. A day here is the day your analytics team means. If a window’s published dates carry different timezones, the query fails before reading analytics storage with 409 timezone_conflict. Re-sync all requested dates using the property’s current timezone, then retry. That error does not add missingDates.

snapshots (heads, ranges and fingerprint) is how you establish that two outputs read the same data. Matching totals prove very little — two different snapshots of a stable week produce the same total. Matching runId and extractionSeq for a date proves the same publication. If you are checking that a dashboard, a spreadsheet and an AI answer agree, compare snapshots, not totals.

freshness.stale turns true when the oldest snapshot in the window is more than thresholdHours old, and a stale_source_snapshot flag is added. Stale does not mean wrong; it means nothing has re-extracted this window recently. thresholdHours is two of the workspace’s effective refresh cadences plus the source’s finality lag: for example 2 for an hourly GA4 schedule on a plan with an hourly floor, and 48 for a daily one.

flags should reach whoever reads the number. provider_may_revise_recent_data means a recent day can legitimately change value later. not_independently_reconciled means the product has not re-derived the number from a second source. Both are true of every result today.

completeness is always complete on a 200. You do not need to check it — an incomplete window is a 409. It is present so that a stored result is self-describing.

A window is answered only when every date in it has a published snapshot.

  • 409 data_not_ready — nothing in the window is published.
  • 409 data_incomplete — some dates are.

Both name the dates:

{
"error": {
"code": "data_incomplete",
"message": "Complete data is not available for every requested day.",
"missingDates": ["2026-09-03", "2026-09-04"]
}
}

Narrow the window to the published dates, or run a sync and retry. Both are expected states, not faults.

The closed interval must contain 1 to 31 days. Queries are not gated on UTC: publication decides what can be returned. Sync now checks completed dates in the property’s returned timezone, so a completed Oslo day is accepted immediately after local midnight even when UTC has not changed dates.