bidsmith query
query is a thin passthrough to Google Ads Query Language (GAQL).
Pass it a query string; bidsmith authenticates, sends the query
through SearchStream, and prints the result in your chosen
format. No .bid files involved.
Useful for ad-hoc questions (“what’s the resource ID of the campaign named X?”, “list every conversion action in the account”) that don’t fit the plan/apply loop.
Synopsis
bidsmith query "QUERY" [--format table|json|tsv] [--verbose]Arguments
| Argument | Required? | Description |
|---|---|---|
QUERY | yes | A GAQL query string (e.g. SELECT campaign.id, campaign.name FROM campaign). |
Flags
| Flag | Default | Description |
|---|---|---|
--format table|json|tsv | table | Output format. table for terminals, json for piping into jq, tsv for spreadsheets. |
--verbose | — | Print the outgoing API request envelope and raw response. |
Environment variables
Same as bidsmith plan.
Exit codes
| Code | Meaning |
|---|---|
0 | Query ran successfully (zero rows is still success). |
1 | Authentication failure, malformed query, API error, or other. |
Examples
Look up a campaign ID by name
bidsmith query "SELECT campaign.id, campaign.name FROM campaign WHERE campaign.name = 'Summer 2026 — Search'"Prints a table:
campaign.id campaign.name9876543210 Summer 2026 — SearchCheck campaign performance
bidsmith query "SELECT campaign.name, metrics.clicks, metrics.cost_micros, metrics.conversions FROM campaign WHERE segments.date DURING LAST_30_DAYS ORDER BY metrics.cost_micros DESC"Money fields are micros — divide by 1,000,000 for the account currency. See the performance recipe for more reporting queries (search terms, per-keyword stats, date ranges).
List every conversion action
bidsmith query "SELECT conversion_action.id, conversion_action.name, conversion_action.category FROM conversion_action"Export to a spreadsheet
bidsmith query "SELECT ad_group.name, ad_group.cpc_bid_micros FROM ad_group" --format tsv > bids.tsvbids.tsv opens cleanly in Excel / Sheets / Numbers.
Feed another tool
bidsmith query "SELECT campaign.id FROM campaign" --format json | jq -r '.results[].campaign.id'JSON output makes jq post-processing easy.
What you can query
Every Google Ads GAQL endpoint that’s read-only. See Google’s GAQL reference for the full grammar.
A few useful starting queries:
| Question | Query |
|---|---|
| All campaign names | SELECT campaign.id, campaign.name FROM campaign |
| All ad groups in a campaign | SELECT ad_group.name FROM ad_group WHERE campaign.id = 9876543210 |
| All keywords | SELECT ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type FROM keyword_view |
| Approval status of all RSAs | SELECT ad_group_ad.policy_summary.approval_status, ad_group_ad.ad.name FROM ad_group_ad WHERE ad_group_ad.ad.type = 'RESPONSIVE_SEARCH_AD' |
| Spend + conversions per campaign, last 30 days | SELECT campaign.name, metrics.cost_micros, metrics.conversions FROM campaign WHERE segments.date DURING LAST_30_DAYS |
| What people searched before clicking | SELECT search_term_view.search_term, metrics.clicks FROM search_term_view WHERE segments.date DURING LAST_30_DAYS |
What query doesn’t do
- No write queries. GAQL is read-only by design — there’s no
way to mutate via this endpoint. For changes, use
apply. - No
.bidintegration.querydoesn’t read your.bidfiles and doesn’t help with the diff/apply loop. It’s a standalone inspection tool.
See also
- See how your campaigns are performing — reporting queries for clicks, cost, conversions, and search terms.
bidsmith plan --read-live— a per-resource-type count of what’s in the account.- Google’s GAQL grammar.