Skip to content

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.

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
workspaceId
required

Must equal the API key’s own workspace.

string
/^[A-Za-z0-9_-]{1,128}$/
accounts
required

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.

Array<object>
>= 1 items <= 50 items
object
connector
required

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.

string
Allowed values: google-ads microsoft-ads meta-ads
connectionId
required
string
/^[A-Za-z0-9_-]{1,128}$/
accountId
required

The provider’s own account id; for Google Ads the ten-digit customer id, without dashes.

string
/^[A-Za-z0-9_-]{1,128}$/
metrics
required
Array<string>
>= 1 items <= 15 items unique items
Allowed values: spend_micros impressions clicks conversions conversion_value all_conversions all_conversion_value view_through_conversions reach ctr cpc cpm cpa conversion_rate roas
grain
required

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.

string
Allowed values: account_day campaign_day
rollup

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.

string
default: account
Allowed values: account provider_currency currency all
startDate
required

Account-local calendar date.

string format: date
endDate
required

Inclusive. The closed interval holds 1 to 93 days.

string format: date
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"
}

Every requested account has a published head for every date of the window.

object
requestId
required

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.

string
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/
grain
required
string
Allowed values: account_day campaign_day
rollup
required
string
Allowed values: account provider_currency currency all
window
required
object
startDate
required
string format: date
endDate
required
string format: date
metrics
required

The requested metrics with their definitions, in the order requested.

Array<object>
>= 1 items <= 15 items
object
id
required

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.

string
Allowed values: spend_micros impressions clicks conversions conversion_value all_conversions all_conversion_value view_through_conversions reach ctr cpc cpm cpa conversion_rate roas
kind
required
string
Allowed values: money count conversions ratio distinct
definition
required
string
groups
required

How the requested accounts were combined. A group never holds two currencies.

Array<object>
>= 1 items <= 50 items
object
key
required

Stable, for labelling the rows that belong to the group.

string
>= 1 characters <= 400 characters
connectors
required
Array<string>
>= 1 items <= 3 items
Allowed values: google-ads microsoft-ads meta-ads
currencyCodes
required
Array<string>
>= 1 items <= 1 items
timeZones
required
Array<string>
>= 1 items <= 50 items
accounts
required
Array<object>
>= 1 items <= 50 items
object
connector
required

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.

string
Allowed values: google-ads microsoft-ads meta-ads
connectionId
required
string
/^[A-Za-z0-9_-]{1,128}$/
accountId
required

The provider’s own account id; for Google Ads the ten-digit customer id, without dashes.

string
/^[A-Za-z0-9_-]{1,128}$/
accounts
required

One entry per requested account, in the order requested.

Array<object>
>= 1 items <= 50 items
object
connector
required

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.

string
Allowed values: google-ads microsoft-ads meta-ads
connectionId
required
string
/^[A-Za-z0-9_-]{1,128}$/
accountId
required
string
/^[A-Za-z0-9_-]{1,128}$/
currencyCode
required

The account’s currency

string
/^[A-Z]{3}$/
timeZone
required

The account’s IANA time zone; every date is in it.

string
>= 1 characters <= 100 characters
dataThrough
required

The latest account-local date published for the account, which can be after the window.

string format: date
restatingFrom
required

The first date of the window the provider may still revise, or null when every date of the window is settled.

string | null format: date
restatingUntil

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.

string format: date
apiVersions
required

The API versions of the runs that produced the window; one entry unless a version migration fell inside it.

Array<string>
>= 1 items <= 4 items unique items
refreshMode
required

Refresh is limited by the provider’s quota, not by the plan (analysis 6.7).

string
Allowed value: source_limited
stale
required

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

string | null
Allowed values: budget
limitations
required

Always includes not_independently_reconciled; adds provider_may_revise_recent_data when restatingFrom is set. Surface these wherever the number is shown.

Array<string>
>= 1 items <= 2 items unique items
Allowed values: provider_may_revise_recent_data not_independently_reconciled
rows
required

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.

Array<object>
<= 2000 items
object
group
required

The key of the groups entry the row belongs to.

string
>= 1 characters <= 400 characters
date
required

Account-local.

string format: date
connector
required

Set on campaign rows and on account rows under rollup account; null where the row sums several accounts.

string | null
Allowed values: google-ads microsoft-ads meta-ads
connectionId
required
string | null
/^[A-Za-z0-9_-]{1,128}$/
accountId
required
string | null
/^[A-Za-z0-9_-]{1,128}$/
campaignId
required
string | null
/^[A-Za-z0-9_-]{1,128}$/
finality
required

The least final class of the published heads the row sums.

string
Allowed values: preliminary restating settled
values
required

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
spend_micros
string
/^(0|[1-9][0-9]{0,38})$/
impressions
string
/^(0|[1-9][0-9]{0,38})$/
clicks
string
/^(0|[1-9][0-9]{0,38})$/
conversions
string
/^(0|[1-9][0-9]{0,28})(\.[0-9]{1,9})?$/
conversion_value
string
/^(0|[1-9][0-9]{0,28})(\.[0-9]{1,9})?$/
all_conversions
string
/^(0|[1-9][0-9]{0,28})(\.[0-9]{1,9})?$/
all_conversion_value
string
/^(0|[1-9][0-9]{0,28})(\.[0-9]{1,9})?$/
view_through_conversions
string
/^(0|[1-9][0-9]{0,28})(\.[0-9]{1,9})?$/
ctr
number | null
cpc
number | null
cpm
number | null
cpa
number | null
conversion_rate
number | null
roas
number | null
dataState
required

zero when every sum in the window is zero, observed otherwise. Missing data is a 409, never a zero.

string
Allowed values: observed zero
limitations
required

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.

Array<string>
<= 1 items
completeness
required

Always complete in a 200: an incomplete window is a 409.

string
Allowed value: complete
reconciliation
required

The product does not re-derive these numbers from a second source (reconciliation is a later slice).

string
Allowed value: not_independently_reconciled

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
error
required
object
code
required
string
message
required
string
suggestedRollups

Rollups the caller may ask for instead, when the refusal is about a sum.

Array<string>
>= 1 items <= 4 items unique items
Allowed values: account provider_currency currency all
metrics

The metrics the refusal is about, in the order the query listed them.

Array<string>
>= 1 items <= 14 items
Allowed values: spend_micros impressions clicks conversions conversion_value all_conversions all_conversion_value view_through_conversions reach ctr cpc cpm cpa conversion_rate roas
connectors
Array<string>
>= 1 items <= 3 items unique items
Allowed values: google-ads microsoft-ads meta-ads
currencyCodes
Array<string>
>= 1 items <= 50 items
timeZones
Array<string>
>= 1 items <= 50 items
missingDates

Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.

Array<string>
>= 1 items <= 93 items unique items
earliestDate

The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.

string
/^\d{4}-\d{2}-01$/
error

unauthorized — missing, unknown, expired or revoked key.

object
error
required
object
code
required
string
message
required
string
error
object
code
Allowed value: unauthorized
WWW-Authenticate
required
string
Allowed value: Bearer

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
error
required
object
code
required
string
message
required
string
suggestedRollups

Rollups the caller may ask for instead, when the refusal is about a sum.

Array<string>
>= 1 items <= 4 items unique items
Allowed values: account provider_currency currency all
metrics

The metrics the refusal is about, in the order the query listed them.

Array<string>
>= 1 items <= 14 items
Allowed values: spend_micros impressions clicks conversions conversion_value all_conversions all_conversion_value view_through_conversions reach ctr cpc cpm cpa conversion_rate roas
connectors
Array<string>
>= 1 items <= 3 items unique items
Allowed values: google-ads microsoft-ads meta-ads
currencyCodes
Array<string>
>= 1 items <= 50 items
timeZones
Array<string>
>= 1 items <= 50 items
missingDates

Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.

Array<string>
>= 1 items <= 93 items unique items
earliestDate

The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.

string
/^\d{4}-\d{2}-01$/
error

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
error
required
object
code
required
string
message
required
string
suggestedRollups

Rollups the caller may ask for instead, when the refusal is about a sum.

Array<string>
>= 1 items <= 4 items unique items
Allowed values: account provider_currency currency all
metrics

The metrics the refusal is about, in the order the query listed them.

Array<string>
>= 1 items <= 14 items
Allowed values: spend_micros impressions clicks conversions conversion_value all_conversions all_conversion_value view_through_conversions reach ctr cpc cpm cpa conversion_rate roas
connectors
Array<string>
>= 1 items <= 3 items unique items
Allowed values: google-ads microsoft-ads meta-ads
currencyCodes
Array<string>
>= 1 items <= 50 items
timeZones
Array<string>
>= 1 items <= 50 items
missingDates

Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.

Array<string>
>= 1 items <= 93 items unique items
earliestDate

The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.

string
/^\d{4}-\d{2}-01$/
error

method_not_allowed — Allow names the method this route accepts.

object
error
required
object
code
required
string
message
required
string
error
object
code
Allowed value: method_not_allowed
Allow
required
string
Allowed value: POST

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
error
required
object
code
required
string
message
required
string
suggestedRollups

Rollups the caller may ask for instead, when the refusal is about a sum.

Array<string>
>= 1 items <= 4 items unique items
Allowed values: account provider_currency currency all
metrics

The metrics the refusal is about, in the order the query listed them.

Array<string>
>= 1 items <= 14 items
Allowed values: spend_micros impressions clicks conversions conversion_value all_conversions all_conversion_value view_through_conversions reach ctr cpc cpm cpa conversion_rate roas
connectors
Array<string>
>= 1 items <= 3 items unique items
Allowed values: google-ads microsoft-ads meta-ads
currencyCodes
Array<string>
>= 1 items <= 50 items
timeZones
Array<string>
>= 1 items <= 50 items
missingDates

Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.

Array<string>
>= 1 items <= 93 items unique items
earliestDate

The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.

string
/^\d{4}-\d{2}-01$/
error
object
code
Allowed values: data_not_ready data_incomplete
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
error
required
object
code
required
string
message
required
string
error
object
code
Allowed value: request_too_large

unsupported_media_type unless the body is application/json, or unsupported_encoding for any Content-Encoding other than identity.

object
error
required
object
code
required
string
message
required
string
error
object
code
Allowed values: unsupported_media_type unsupported_encoding

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
error
required
object
code
required
string
message
required
string
suggestedRollups

Rollups the caller may ask for instead, when the refusal is about a sum.

Array<string>
>= 1 items <= 4 items unique items
Allowed values: account provider_currency currency all
metrics

The metrics the refusal is about, in the order the query listed them.

Array<string>
>= 1 items <= 14 items
Allowed values: spend_micros impressions clicks conversions conversion_value all_conversions all_conversion_value view_through_conversions reach ctr cpc cpm cpa conversion_rate roas
connectors
Array<string>
>= 1 items <= 3 items unique items
Allowed values: google-ads microsoft-ads meta-ads
currencyCodes
Array<string>
>= 1 items <= 50 items
timeZones
Array<string>
>= 1 items <= 50 items
missingDates

Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.

Array<string>
>= 1 items <= 93 items unique items
earliestDate

The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.

string
/^\d{4}-\d{2}-01$/
error
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
error
required
object
code
required
string
message
required
string
error
object
code
Allowed value: rate_limited
Retry-After
required
string
/^[1-9][0-9]*$/
RateLimit-Limit
required
string
/^[1-9][0-9]*$/

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
error
required
object
code
required
string
message
required
string
suggestedRollups

Rollups the caller may ask for instead, when the refusal is about a sum.

Array<string>
>= 1 items <= 4 items unique items
Allowed values: account provider_currency currency all
metrics

The metrics the refusal is about, in the order the query listed them.

Array<string>
>= 1 items <= 14 items
Allowed values: spend_micros impressions clicks conversions conversion_value all_conversions all_conversion_value view_through_conversions reach ctr cpc cpm cpa conversion_rate roas
connectors
Array<string>
>= 1 items <= 3 items unique items
Allowed values: google-ads microsoft-ads meta-ads
currencyCodes
Array<string>
>= 1 items <= 50 items
timeZones
Array<string>
>= 1 items <= 50 items
missingDates

Account-local dates some requested account has no published head for. Only on data_not_ready and data_incomplete.

Array<string>
>= 1 items <= 93 items unique items
earliestDate

The first day of the oldest month the plan includes. Only on history_not_entitled; absent for a custom allowance.

string
/^\d{4}-\d{2}-01$/
error