Skip to main content
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

No flag is required. A bare call lists 50 ads, most recently updated first.

Listing or metrics

  • Listing: without --measures, each row has the ad’s IDs, names, and basicDetails, and no data key.
  • Metrics: with --measures and a date range, each row gets data.primary, one entry per day the ad has data. An ad that didn’t run in the range has an empty data.primary.
  • Compare: add --compare-date-start and --compare-date-end to get data.compare for that period. A compare period that overlaps the main range is dropped without an error.
Only ad-platform measures work: 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 field query-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 few basicDetails fields:
  • adId, adName, accountId, accountName, campaignId, campaignName, adsetId, adsetName, and resourceSource are on every row.
  • basicDetails holds the platform snapshot: resourceName, resourceSource, accountName, status, configuredStatus, effectiveStatus, objective, dailyBudget, budgetRemaining, amountSpent, currency, nativeCurrency, timezone, bidStrategy, optimizationGoal, sourceCreatedAt, and sourceUpdatedAt. Fields the platform doesn’t report are null.
  • Measure values are numeric strings.
  • Keep paging with --offset while pagination.hasMore is true.

Examples

Errors

See also