API reference
Read published advertising performance
POST /v1/query/ads
Returns published advertising performance (spend, impressions, clicks, conversions and
the ratios built from them) for up to 50 accounts and a window of at most 93 days, by
account and day or by campaign and day, with the provenance of every account.
Google Ads is the one provider whose published data this route reads; the contract is the
shared ads contract, so another provider adds data, not a route. The Google Ads connector
is not generally available, so a workspace has accounts to query only once one has been
selected for it. One query reads one provider: a query naming accounts of two providers is
422 cross_provider_query_unsupported, a permanent refusal; send one query per provider.
Only published data is answered. Every requested account must have a published head
for every date of the window, or the answer is 409 data_incomplete (some dates) or
409 data_not_ready (none), naming the dates; a partial window is never a short answer.
A date that was fetched and had no activity is a published zero, not a gap.
Sums are exact and refused when they would mean nothing. Money is spend_micros, an
integer count of millionths of the account currency, as text; a total across accounts is
an exact integer sum. Ratios are computed from the sums, never averaged, and are null
when the denominator is zero. A total across currencies is refused (cross_currency_sum)
for money and for counts alike, a conversion is a provider’s own attribution and is never
summed across providers (cross_provider_conversion_sum), and a total across providers
needs one currency and one time-zone class (cross_provider_class_mismatch). The error
names the metrics and, where one exists, the rollups that would be allowed. Each refusal
is 422, a well-formed request the rules decline.
Every account says how fresh and how final its numbers are. dataThrough is the
latest published account-local date; restatingFrom is the first date of the window the
provider may still revise, restatingUntil (present only while one is) is the earliest date on which
a revisable date of the window counts as settled, and each row carries the least final class of the heads it sums
(preliminary, restating, settled). Dates are each account-local and are never
shifted; a group that spans time zones carries the account_local_dates limitation.
The workspaceId in the body must equal the key’s own workspace; a mismatch is 403.
Accounts are read from the workspace’s own selection, never from the request, and an
account that is not selected is 404 unknown_account. Authorization is checked before
every read and again before the response is released.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”The ads query request body. Unknown fields are rejected. There is no filter, no segment and no free-form SQL, and currency, time zone and every other fact about an account come from the workspace’s own records, never from this body.
object
Must equal the API key’s own workspace.
One to 50 provider accounts. The same provider account named twice, under the same or two
connections, is duplicate_account. The 4 KiB body cap applies, which bounds the list below
50 when the identifiers are long.
object
The ads providers that share the canonical model. Google Ads and Microsoft Advertising are mapped to a fact table the query service reads; Meta Ads is not mapped yet and cannot be read. When no requested account has a published day in the window the answer is data_not_ready; when some days are published and others are not it is data_incomplete, naming the missing dates.
The provider’s own account id; for Google Ads the ten-digit customer id, without dashes.
One row per account and day, or per campaign and day. Campaign rows always name their connector, connection, account and campaign, so a campaign id that two accounts share is two rows.
How accounts combine. account keeps every account apart and always answers. provider_currency
sums within one provider and currency. currency sums across providers within a currency.
all is one total. Every refusal for a sum that would mean nothing is a 422.
Account-local calendar date.
Inclusive. The closed interval holds 1 to 93 days.
Example
{ "workspaceId": "your_workspace", "accounts": [ { "connector": "google-ads", "connectionId": "your_connection", "accountId": "1234567890" } ], "metrics": [ "spend_micros", "impressions", "clicks", "ctr", "cpc" ], "grain": "account_day", "rollup": "account", "startDate": "2026-08-31", "endDate": "2026-09-04"}Responses
Section titled “ Responses ”Every requested account has a published head for every date of the window.
object
The gateway-generated id of this request, the same value as the X-Request-Id response
header. Quote it when asking support about an answer.
object
The requested metrics with their definitions, in the order requested.
object
A metric of the ads catalogue. spend_micros is cost in millionths of the account currency, an
integer. The ratios (ctr, cpc, cpm, cpa, conversion_rate, roas) are computed from
sums and are null when their denominator is zero. conversions is the provider’s own
attribution and is never summed with all_conversions or with another provider’s.
How the requested accounts were combined. A group never holds two currencies.
object
Stable, for labelling the rows that belong to the group.
object
The ads providers that share the canonical model. Google Ads and Microsoft Advertising are mapped to a fact table the query service reads; Meta Ads is not mapped yet and cannot be read. When no requested account has a published day in the window the answer is data_not_ready; when some days are published and others are not it is data_incomplete, naming the missing dates.
The provider’s own account id; for Google Ads the ten-digit customer id, without dashes.
One entry per requested account, in the order requested.
object
The ads providers that share the canonical model. Google Ads and Microsoft Advertising are mapped to a fact table the query service reads; Meta Ads is not mapped yet and cannot be read. When no requested account has a published day in the window the answer is data_not_ready; when some days are published and others are not it is data_incomplete, naming the missing dates.
The account’s currency
The account’s IANA time zone; every date is in it.
The latest account-local date published for the account, which can be after the window.
The first date of the window the provider may still revise, or null when every date of the window is settled.
The earliest date, among the window’s dates the provider may still revise, on which the store expects
that date to count as settled. Absent, never null, when every date of the window is settled or none
of the revisable dates records one. Present only when restatingFrom is set. Applies to Google Ads
and Microsoft Advertising alike.
The API versions of the runs that produced the window; one entry unless a version migration fell inside it.
Refresh is limited by the provider’s quota, not by the plan (analysis 6.7).
budget when a scheduled refresh was skipped for quota. Nothing records that yet, so this is
always null; null means “not recorded”, not “no refresh was skipped”.
Always includes not_independently_reconciled; adds provider_may_revise_recent_data when
restatingFrom is set. Surface these wherever the number is shown.
Ascending by group, then date; at campaign grain then by connection, account and campaign. An account and day that was fetched with no activity is a row of zeros at account grain and no row at campaign grain.
object
The key of the groups entry the row belongs to.
Account-local.
Set on campaign rows and on account rows under rollup account; null where the row sums several accounts.
The least final class of the published heads the row sums.
One entry per requested metric. Money, counts and conversions are exact text (a 64-bit count does not fit a JSON number); a total across accounts is an exact sum and can pass 64 bits, so money and counts alike are up to 39 digits; conversions are decimals of up to nine places. A ratio is a number, or null when its denominator is zero.
object
zero when every sum in the window is zero, observed otherwise. Missing data is a 409, never a zero.
account_local_dates when a group holds accounts of one provider in more than one time zone: dates are each account-local and are never shifted.
Always complete in a 200: an incomplete window is a 409.
The product does not re-derive these numbers from a second source (reconciliation is a later slice).
invalid_json — the body is absent, not valid JSON, or not valid UTF-8.
invalid_query — the body is not an ads metric query (an unknown field, a missing or
empty list, a malformed identifier), or the URL carried a query delimiter, including a
bare ?.
unknown_metric, unknown_grain, unknown_rollup and unknown_provider — a value
outside the catalogue. invalid_window — the dates are not real calendar dates, or the
end is before the start. window_too_long — more than 93 days. duplicate_account —
one provider account named twice (under any connection), which a sum would count twice.
invalid_value — a value is not in canonical form; the route reports a malformed
stored value as query_unavailable, so this is reserved.
object
object
Rollups the caller may ask for instead, when the refusal is about a sum.
The metrics the refusal is about, in the order the query listed them.
Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.
The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.
unauthorized — missing, unknown, expired or revoked key.
object
object
object
Headers
Section titled “Headers ”forbidden — the body’s workspaceId is not the key’s workspace, or the key lacks
query:read.
history_not_entitled — startDate is before the first day of the oldest month the
workspace’s plan includes. Nothing was read, and the check comes before any account is
looked up. earliestDate is that first day (YYYY-MM-01); it is absent for a custom
allowance, which is set per workspace. Narrow the window to start on or after it, or
change plan.
object
object
Rollups the caller may ask for instead, when the refusal is about a sum.
The metrics the refusal is about, in the order the query listed them.
Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.
The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.
unknown_account — an account in the query is not selected in this workspace, was
deselected, or was deselected while the read was in flight.
object
object
Rollups the caller may ask for instead, when the refusal is about a sum.
The metrics the refusal is about, in the order the query listed them.
Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.
The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.
method_not_allowed — Allow names the method this route accepts.
object
object
object
Headers
Section titled “Headers ”data_not_ready when nothing in the window is published for any requested account,
data_incomplete when some account-dates are; both always carry missingDates, the
account-local dates some account has no head for, so a caller can narrow the window or
wait. (The schema cannot require it here: the document test needs every error response
to admit a bare envelope; the conformance test serves both codes and requires the field.)
object
object
Rollups the caller may ask for instead, when the refusal is about a sum.
The metrics the refusal is about, in the order the query listed them.
Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.
The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.
object
Examples
{ "error": { "code": "data_incomplete", "message": "Complete data is not available for every requested account and day.", "missingDates": [ "2026-09-03", "2026-09-04" ] }}request_too_large — REST bodies are capped at 4 KiB.
object
object
object
unsupported_media_type unless the body is application/json, or
unsupported_encoding for any Content-Encoding other than identity.
object
object
object
A well-formed request the rules decline. cross_currency_sum — a total over more than
one currency, for money and for counts and ratios alike; currencyCodes names them and
suggestedRollups the rollups that keep each currency apart.
cross_provider_conversion_sum — a conversion-attributed metric summed across
providers. cross_provider_class_mismatch — a total across providers of more than one
time-zone class. non_additive_metric — a distinct count summed across accounts.
metric_unavailable_for_provider — a provider in the query does not report a metric.
metric_unavailable_at_grain — a metric that exists only at another grain.
result_too_large — a cap of 2,000 rows was passed, either on the rows read from the
store (account-days, or campaign-days at campaign grain, before any rollup) or on the rows
of the answer (one per group and date, or one per campaign-day); a rollup does not lower
the first, and published days with no activity count towards the second. Narrow the window
or the accounts. cross_provider_query_unsupported — the accounts belong to more than one
provider (connectors names them); one query reads one provider. A mixed query the rules
above decline gets their code instead.
object
object
Rollups the caller may ask for instead, when the refusal is about a sum.
The metrics the refusal is about, in the order the query listed them.
Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.
The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.
Examples
{ "error": { "code": "cross_currency_sum", "message": "Totals cannot be summed across currencies: there is no currency conversion, and counts are not combined across currencies either.", "metrics": [ "spend_micros" ], "currencyCodes": [ "EUR", "USD" ], "suggestedRollups": [ "currency", "provider_currency", "account" ] }}rate_limited — the key’s or its workspace’s per-plan request allowance for this route’s class is used up.
It is answered after authentication, on every API-key operation in this document and on MCP, and never on /health. A download link is
limited the same way, after its lookup, by the key that issued it and the export’s workspace.
Retry-After is the window in seconds and RateLimit-Limit is the limit of the bucket that refused. No remaining
count is returned. The limits themselves are not published here.
object
object
object
Headers
Section titled “Headers ”query_unavailable — a backend is unreachable, a published head or a stored row failed
an integrity check (a run that is not loaded, an account whose currency or time zone
changed after the run, a row that is not a published head), or the window is too
fragmented to read. The boundary fails closed rather than returning a result it cannot
vouch for, and never passes a database or provider message through.
auth_unavailable — the authorization store could not be reached.
object
object
Rollups the caller may ask for instead, when the refusal is about a sum.
The metrics the refusal is about, in the order the query listed them.
Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.
The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.