API reference
Export a query as a file
POST /v1/query/export
Plans the export and answers 202 with its status. The body is the query of POST /v1/query (the workspace is the key’s own and is
never in the body) plus the file options. The query is validated, authorized and pinned to the published snapshots it reads before
the answer: a window that is not fully published is refused data_not_ready or data_incomplete with the missing dates, exactly as
the query route does. The file never gets a snapshot that
lands after this call.
Idempotency-Key is optional. Sent again with the same request, it returns the same export: 202 when this call created it, 200 with
the export’s current status, whatever its state, when it already existed. Changed intent needs a new key (idempotency_conflict). A workspace may have one export running and three pending; a further create is refused
export_limit_reached.
The published limits of a file are 5,000,000 rows and 2 GiB, and a result beyond them ends failed with export_too_large. This version does not
deliver that size: the reader stops earlier, at about 5,000,000 source rows scanned per statement (about half that for a profile that also checks
completeness) and 20 seconds per statement under the query role. A result it cannot read ends failed with export_too_large, or query_unavailable
when a read runs out of time.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters ”8–128 characters from A-Za-z0-9._:-. Identifies one logical export.
Request Body required
Section titled “Request Body required ”object
Example
{ "query": { "profile": "ga4.sessions_daily", "connectionId": "your_connection", "accounts": [ "123456789" ], "metrics": [ "sessions" ], "dimensions": [ "date" ], "dateRange": { "start": "2026-08-31", "end": "2026-09-04" } }, "format": "csv", "csv": { "bom": true }}Responses
Section titled “ Responses ”The Idempotency-Key was used before with the same request. This is the export’s current status, in any state: a replay
after the export failed, expired or was erased reads that state and does not start a second export.
The export row as a caller may see it. Closed, so a field not listed here is not returned.
object
pending and running are in progress. succeeded has a file. failed has none and names errorCode. expired is a file
removed after 7 days. erased is a file removed because a field it carries was switched off for output.
The X-Request-Id of the create call.
When the file is removed. null until the export succeeds.
Rows written, header excluded. null until the export succeeds. Equal to the rows the pinned query returns, or the export fails.
Digest of the file, as written.
Why a failed export failed; null in every other state.
The field ids of the file’s columns, in order. They are the header row.
From the extraction instants of the pinned snapshots, copied from the query result at plan time; null when the publication carries none. Over several sources
one record spans them: the oldest and newest extraction of any source, stale when any source is stale by its own threshold, and the smallest of their thresholds.
object
True when the oldest snapshot is older than thresholdHours.
Hours after which the oldest snapshot is stale: two effective refresh cadences plus the source finality lag.
The profile’s limitations, then the pinned generation’s history limitations (Shopify
commerce, sorted), then, over several sources, account_local_dates when the accounts’
time zones differ, then stale_source_snapshot when the pinned snapshot is stale (for any
source). Surface them wherever the number is shown.
Present on an export of a YouTube profile only, copied from the query result at plan time. The CSV has no room for it (its first line is the header row), so show it with the file wherever the file is offered.
object
The channel the values were read from (the request’s account).
The channel’s public YouTube page.
The channel’s analytics page in YouTube Studio.
The CSV options of a CSV export; null for a Parquet export.
object
Text columns only; a value starting with =, +, -, @, a tab or a carriage return is prefixed with a single quote.
The export is planned. Poll GET /v1/exports/{exportId}.
object
pending and running are in progress. succeeded has a file. failed has none and names errorCode. expired is a file
removed after 7 days. erased is a file removed because a field it carries was switched off for output.
The X-Request-Id of the create call.
When the file is removed. null until the export succeeds.
Rows written, header excluded. null until the export succeeds. Equal to the rows the pinned query returns, or the export fails.
Digest of the file, as written.
Why a failed export failed; null in every other state.
The field ids of the file’s columns, in order. They are the header row.
From the extraction instants of the pinned snapshots, copied from the query result at plan time; null when the publication carries none. Over several sources
one record spans them: the oldest and newest extraction of any source, stale when any source is stale by its own threshold, and the smallest of their thresholds.
object
True when the oldest snapshot is older than thresholdHours.
Hours after which the oldest snapshot is stale: two effective refresh cadences plus the source finality lag.
The profile’s limitations, then the pinned generation’s history limitations (Shopify
commerce, sorted), then, over several sources, account_local_dates when the accounts’
time zones differ, then stale_source_snapshot when the pinned snapshot is stale (for any
source). Surface them wherever the number is shown.
Present on an export of a YouTube profile only, copied from the query result at plan time. The CSV has no room for it (its first line is the header row), so show it with the file wherever the file is offered.
object
The channel the values were read from (the request’s account).
The channel’s public YouTube page.
The channel’s analytics page in YouTube Studio.
The CSV options of a CSV export; null for a Parquet export.
object
Text columns only; a value starting with =, +, -, @, a tab or a carriage return is prefixed with a single quote.
Example
{ "exportId": "exp_8d2c41f0a6", "state": "pending", "format": "csv", "requestId": "7b6b8f4e-3d0b-4f64-9a43-2f8f5f1d2a10", "createdAt": "2026-10-26T09:30:00.000Z", "expiresAt": null, "rows": null, "bytes": null, "sha256": null, "errorCode": null, "fields": [ "date", "sessions" ], "freshness": { "oldestExtractedAt": "2026-09-05T01:02:03.000Z", "newestExtractedAt": "2026-09-05T01:02:03.000Z", "stale": false, "thresholdHours": 26 }, "flags": [ "provider_may_revise_recent_data", "not_independently_reconciled" ], "csv": { "bom": true, "formulaNeutralization": "text-columns-single-quote" }}Headers
Section titled “Headers ”The status resource of the new export.
invalid_json — the body is absent, not valid JSON, or not valid UTF-8.
invalid_query — the query is not supported by POST /v1/query (a sources list over the export’s 10 pairs included, fewer than the 25 of POST /v1/query; this envelope carries no detail), or the URL carried a query delimiter.
invalid_export_request — the file options are not supported: an unknown field, a format other than csv or parquet, a csv.bom that is not a boolean, or csv options with the format parquet.
invalid_idempotency_key — the header, when sent, is not 8–128 characters from A-Za-z0-9._:-.
object
object
object
unauthorized — missing, unknown, expired or revoked key.
object
object
object
Headers
Section titled “Headers ”forbidden — the key lacks query:read, the profile is not served for this workspace, or the workspace has no entitlement to export.
A connection that is not the key’s workspace’s is 404 connection_unavailable, as for one that does not exist.
workspace_paused — reserved: a workspace an operator paused is refused at authentication (401) before this route runs, and a trial or
subscription pause still allows creating and downloading exports. This version does not return it.
field_not_enabled — reserved: this version serves the same fields as POST /v1/query and does not return it.
history_not_entitled — reserved: the contract lists it for a window that reaches back further than the plan’s history. This version does not return it.
object
object
object
connection_unavailable — the connection does not exist for this workspace, or is not available to query.
object
object
object
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, data_incomplete when some days are; both name the missing dates,
in ascending order (at most 31; missingDatesTruncated is true when there are more). Never a short file.
timezone_conflict — published dates use different source timezones, or several sources summed by date are in
different time zones (then the message says to group by account, as on POST /v1/query). It carries no missing dates.
currency_conflict — a money metric over several sources summed by date spans more than one currency; group by account.
idempotency_conflict — the Idempotency-Key was used for a different request.
export_limit_reached — the workspace already has one export running and three pending.
The two missing-publication 409 forms; timezone_conflict, currency_conflict and attribution_conflict have no missingDates. This is a separate closed object because composing Error with allOf would reject missingDates under Error.properties.error.additionalProperties.
object
object
The dates with no published snapshot, in ascending order, so a truncated list is the earliest 31. Never empty: a list the gateway cannot vouch for is a 503.
Present, and true, only when more than 31 dates are missing and missingDates lists the earliest 31.
object
object
object
Examples
{ "error": { "code": "data_incomplete", "message": "The window is not fully published.", "missingDates": [ "2026-09-03", "2026-09-04" ] }}{ "error": { "code": "export_limit_reached", "message": "The workspace already has the exports it may run and queue." }}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
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 ”export_unavailable — the export could not be planned. Retry with backoff.