upstack query-ads lists the ads from your connected ad accounts as flat rows, one row per
ad, with its campaign, ad set, status, and budget. Add --measures to attach a daily spend or
performance series per ad, and a compare period for week-over-week questions. It wraps
List ads with metrics, which
has the full request and response reference.
Compared with upstack query-channel-details (accounts,
campaigns, or ad sets with totals) and upstack query (nested result blocks),
query-ads always returns a flat { rows, pagination } shape, so it’s the easiest one to
script against. It reports what the ad platforms say about each ad. For which ad gets credit
for orders, use upstack query-attribution.
Usage
Listing or metrics
- Listing: without
--measures, each row has the ad’s IDs, names, andbasicDetails, and nodatakey. - Metrics: with
--measuresand a date range, each row getsdata.primary, one entry per day the ad has data. An ad that didn’t run in the range has an emptydata.primary. - Compare: add
--compare-date-startand--compare-date-endto getdata.comparefor that period. A compare period that overlaps the main range is dropped without an error.
channel.* and per-platform ids such as meta.spend or
google.spend. Run upstack measures for ids. Other measures fail with
Validation error: measures not supported for query-ads.
Flags
query-ads has no interactive mode. Runs are logged, so
upstack history --rerun <id> repeats one. Saved queries
don’t support query-ads yet.
Filters
Every fieldquery-ads accepts narrows the list of ads, so it also changes
pagination.total. Run upstack filters --detail and look for the
query_ads context.
orders.* and attribution.* fields don’t apply here:
From-file schema
--from-file takes a JSON file of parameter-style keys, the same names as the flags, not
the API request body. Flags override file values.
measures takes an array of { "measure": "<id>" } objects or a comma-separated string. The
API body keys dateRange and compareDateRange are ignored here, so a file that uses them
with measures fails with "dateRange" is required.
Response shape
A real metrics row with a compare period, trimmed to two days and a fewbasicDetails fields:
adId,adName,accountId,accountName,campaignId,campaignName,adsetId,adsetName, andresourceSourceare on every row.basicDetailsholds the platform snapshot:resourceName,resourceSource,accountName,status,configuredStatus,effectiveStatus,objective,dailyBudget,budgetRemaining,amountSpent,currency,nativeCurrency,timezone,bidStrategy,optimizationGoal,sourceCreatedAt, andsourceUpdatedAt. Fields the platform doesn’t report arenull.- Measure values are numeric strings.
- Keep paging with
--offsetwhilepagination.hasMoreistrue.
Examples
Errors
See also
- List ads with metrics: the API this command wraps.
upstack query-channel-details: accounts, campaigns, or ad sets with basic details.upstack query-attribution: which campaign, ad set, or ad gets credit for orders.upstack filtersandupstack measures: field and measure ids.- AI agent workflow: using the CLI from an AI agent.