Query cookbook

  • This guide provides Google Ads Query Language examples to replicate data shown in the Google Ads UI and to look up geo constants.

  • You can use the Interactive Query Builder tool for validating and prototyping new Google Ads queries.

  • The provided queries can be used as is or as a starting point for creating customized queries.

  • The curl tabs demonstrate how to use the Google Ads API's REST interface directly.

  • Unless stated otherwise, all dated queries in this guide default to returning data from the last seven days.

This guide provides Google Ads Query Language (GAQL) queries that return the same data as common Google Ads UI screens and look up geo constants. Use these queries without modification or adapt them for your reporting workflows.

For a broader mapping of UI reports to API resources, see Reports in the Google Ads UI. Use the Google Ads API Reporting Extension to inspect API resources and fields in the Google Ads UI. Use the Interactive Query Builder to build and validate custom queries.

Set curl environment variables

The curl tabs send compressed streaming requests to the REST searchStream endpoint. Before you run a curl command, set the following environment variables in your shell:

  • API_VERSION: The API version number without a leading v (for example, 26).
  • CUSTOMER_ID: The 10-digit target client customer ID without hyphens.
  • MANAGER_CUSTOMER_ID: The 10-digit manager account ID without hyphens. If you authenticate directly as the target client account, set MANAGER_CUSTOMER_ID to CUSTOMER_ID or omit the login-customer-id header (see Login customer ID).
  • OAUTH2_ACCESS_TOKEN: A valid OAuth 2.0 access token.

Replicate Google Ads UI screens

This section showcases API queries that return the same data as the default screens of the Google Ads UI. If you're building an app that shows metrics and data similarly to Google Ads, these queries can help you pull analogous data from the API.

Campaigns

Retrieve data from the default Campaigns overview screen in the Google Ads UI.

GAQL

SELECT campaign.name,
  campaign_budget.amount_micros,
  campaign.status,
  campaign.optimization_score,
  campaign.advertising_channel_type,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  campaign.bidding_strategy_type
FROM campaign
WHERE segments.date DURING LAST_7_DAYS
  AND campaign.status != 'REMOVED'

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT campaign.name,
      campaign_budget.amount_micros,
      campaign.status,
      campaign.optimization_score,
      campaign.advertising_channel_type,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros,
      campaign.bidding_strategy_type
    FROM campaign
    WHERE segments.date DURING LAST_7_DAYS
      AND campaign.status != 'REMOVED'
  "
}
EOF

Ad groups

Retrieve data from the default Ad groups overview screen in the Google Ads UI.

GAQL

SELECT ad_group.name,
  campaign.name,
  ad_group.status,
  ad_group.type,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM ad_group
WHERE segments.date DURING LAST_7_DAYS
  AND ad_group.status != 'REMOVED'

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT ad_group.name,
      campaign.name,
      ad_group.status,
      ad_group.type,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros
    FROM ad_group
    WHERE segments.date DURING LAST_7_DAYS
      AND ad_group.status != 'REMOVED'
  "
}
EOF

Ads

Retrieve data from the default Ads overview screen in the Google Ads UI. This query fetches responsive search ad AdTextAsset headlines and descriptions, final URLs, and ad strength for the Ad and Ad strength columns.

GAQL

SELECT ad_group_ad.ad.responsive_search_ad.headlines,
  ad_group_ad.ad.responsive_search_ad.descriptions,
  ad_group_ad.ad.final_urls,
  campaign.name,
  ad_group.name,
  ad_group_ad.status,
  ad_group_ad.policy_summary.approval_status,
  ad_group_ad.ad.type,
  ad_group_ad.ad_strength,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM ad_group_ad
WHERE segments.date DURING LAST_7_DAYS
  AND ad_group_ad.status != 'REMOVED'

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT ad_group_ad.ad.responsive_search_ad.headlines,
      ad_group_ad.ad.responsive_search_ad.descriptions,
      ad_group_ad.ad.final_urls,
      campaign.name,
      ad_group.name,
      ad_group_ad.status,
      ad_group_ad.policy_summary.approval_status,
      ad_group_ad.ad.type,
      ad_group_ad.ad_strength,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros
    FROM ad_group_ad
    WHERE segments.date DURING LAST_7_DAYS
      AND ad_group_ad.status != 'REMOVED'
  "
}
EOF

Search keywords

Retrieve data from the default Search keywords overview screen in the Google Ads UI.

GAQL

SELECT ad_group_criterion.keyword.text,
  campaign.name,
  ad_group.name,
  ad_group_criterion.system_serving_status,
  ad_group_criterion.keyword.match_type,
  ad_group_criterion.approval_status,
  ad_group_criterion.final_urls,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM keyword_view
WHERE segments.date DURING LAST_7_DAYS
  AND ad_group_criterion.status != 'REMOVED'

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT ad_group_criterion.keyword.text,
      campaign.name,
      ad_group.name,
      ad_group_criterion.system_serving_status,
      ad_group_criterion.keyword.match_type,
      ad_group_criterion.approval_status,
      ad_group_criterion.final_urls,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros
    FROM keyword_view
    WHERE segments.date DURING LAST_7_DAYS
      AND ad_group_criterion.status != 'REMOVED'
  "
}
EOF

Search terms

Retrieve data from the default Search terms overview screen in the Google Ads UI.

GAQL

SELECT search_term_view.search_term,
  segments.keyword.info.match_type,
  search_term_view.status,
  campaign.name,
  ad_group.name,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  campaign.advertising_channel_type
FROM search_term_view
WHERE segments.date DURING LAST_7_DAYS

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT search_term_view.search_term,
      segments.keyword.info.match_type,
      search_term_view.status,
      campaign.name,
      ad_group.name,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros,
      campaign.advertising_channel_type
    FROM search_term_view
    WHERE segments.date DURING LAST_7_DAYS
  "
}
EOF

Audiences

Retrieve data from the default Audiences overview screen in the Google Ads UI.

GAQL

SELECT ad_group_criterion.resource_name,
  ad_group_criterion.type,
  campaign.name,
  ad_group.name,
  ad_group_criterion.system_serving_status,
  ad_group_criterion.bid_modifier,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  campaign.advertising_channel_type
FROM ad_group_audience_view
WHERE segments.date DURING LAST_7_DAYS

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT ad_group_criterion.resource_name,
      ad_group_criterion.type,
      campaign.name,
      ad_group.name,
      ad_group_criterion.system_serving_status,
      ad_group_criterion.bid_modifier,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros,
      campaign.advertising_channel_type
    FROM ad_group_audience_view
    WHERE segments.date DURING LAST_7_DAYS
  "
}
EOF

Age (Demographics)

Retrieve data from the default Age demographics overview screen in the Google Ads UI.

GAQL

SELECT ad_group_criterion.age_range.type,
  campaign.name,
  ad_group.name,
  ad_group_criterion.system_serving_status,
  ad_group_criterion.bid_modifier,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  campaign.advertising_channel_type
FROM age_range_view
WHERE segments.date DURING LAST_7_DAYS

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT ad_group_criterion.age_range.type,
      campaign.name,
      ad_group.name,
      ad_group_criterion.system_serving_status,
      ad_group_criterion.bid_modifier,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros,
      campaign.advertising_channel_type
    FROM age_range_view
    WHERE segments.date DURING LAST_7_DAYS
  "
}
EOF

Gender (Demographics)

Retrieve data from the default Gender demographics overview screen in the Google Ads UI.

GAQL

SELECT ad_group_criterion.gender.type,
  campaign.name,
  ad_group.name,
  ad_group_criterion.system_serving_status,
  ad_group_criterion.bid_modifier,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  campaign.advertising_channel_type
FROM gender_view
WHERE segments.date DURING LAST_7_DAYS

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT ad_group_criterion.gender.type,
      campaign.name,
      ad_group.name,
      ad_group_criterion.system_serving_status,
      ad_group_criterion.bid_modifier,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros,
      campaign.advertising_channel_type
    FROM gender_view
    WHERE segments.date DURING LAST_7_DAYS
  "
}
EOF

Locations

Retrieve data from the default Locations overview screen in the Google Ads UI.

GAQL

SELECT campaign_criterion.location.geo_target_constant,
  campaign.name,
  campaign_criterion.bid_modifier,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM location_view
WHERE segments.date DURING LAST_7_DAYS
  AND campaign_criterion.status != 'REMOVED'

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT campaign_criterion.location.geo_target_constant,
      campaign.name,
      campaign_criterion.bid_modifier,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros
    FROM location_view
    WHERE segments.date DURING LAST_7_DAYS
      AND campaign_criterion.status != 'REMOVED'
  "
}
EOF

Placements

Retrieve data for explicitly targeted placements from the Content > Placements screen in the Google Ads UI by querying the managed_placement_view resource.

GAQL

SELECT ad_group_criterion.placement.url,
  campaign.name,
  ad_group.name,
  ad_group_criterion.status,
  ad_group_criterion.bid_modifier,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM managed_placement_view
WHERE segments.date DURING LAST_7_DAYS
  AND ad_group_criterion.status != 'REMOVED'

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT ad_group_criterion.placement.url,
      campaign.name,
      ad_group.name,
      ad_group_criterion.status,
      ad_group_criterion.bid_modifier,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros
    FROM managed_placement_view
    WHERE segments.date DURING LAST_7_DAYS
      AND ad_group_criterion.status != 'REMOVED'
  "
}
EOF

Where ads showed

Retrieve domain, mobile app, and YouTube channel placement data from the Content > Where ads showed screen in the Google Ads UI by querying the group_placement_view resource.

GAQL

SELECT group_placement_view.display_name,
  group_placement_view.target_url,
  group_placement_view.placement_type,
  campaign.name,
  ad_group.name,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM group_placement_view
WHERE segments.date DURING LAST_7_DAYS

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT group_placement_view.display_name,
      group_placement_view.target_url,
      group_placement_view.placement_type,
      campaign.name,
      ad_group.name,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros
    FROM group_placement_view
    WHERE segments.date DURING LAST_7_DAYS
  "
}
EOF

Placement details

Retrieve URL-level and video-level placement metrics from Content > Where ads showed > View details in the Google Ads UI by querying the detail_placement_view resource.

GAQL

SELECT detail_placement_view.display_name,
  detail_placement_view.target_url,
  detail_placement_view.group_placement_target_url,
  detail_placement_view.placement_type,
  campaign.name,
  ad_group.name,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM detail_placement_view
WHERE segments.date DURING LAST_7_DAYS

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT detail_placement_view.display_name,
      detail_placement_view.target_url,
      detail_placement_view.group_placement_target_url,
      detail_placement_view.placement_type,
      campaign.name,
      ad_group.name,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros
    FROM detail_placement_view
    WHERE segments.date DURING LAST_7_DAYS
  "
}
EOF

Performance Max placements

Retrieve placement impressions from the Performance Max campaigns placement predefined report in Insights and reports > Report editor by querying the performance_max_placement_view resource.

GAQL

SELECT performance_max_placement_view.display_name,
  performance_max_placement_view.target_url,
  performance_max_placement_view.placement_type,
  campaign.name,
  metrics.impressions
FROM performance_max_placement_view
WHERE segments.date DURING LAST_7_DAYS

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT performance_max_placement_view.display_name,
      performance_max_placement_view.target_url,
      performance_max_placement_view.placement_type,
      campaign.name,
      metrics.impressions
    FROM performance_max_placement_view
    WHERE segments.date DURING LAST_7_DAYS
  "
}
EOF

Landing pages

Retrieve data from the default Landing pages screen in the Google Ads UI by querying the landing_page_view resource.

GAQL

SELECT landing_page_view.unexpanded_final_url,
  campaign.name,
  metrics.mobile_friendly_clicks_percentage,
  metrics.speed_score,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM landing_page_view
WHERE segments.date DURING LAST_7_DAYS

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT landing_page_view.unexpanded_final_url,
      campaign.name,
      metrics.mobile_friendly_clicks_percentage,
      metrics.speed_score,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros
    FROM landing_page_view
    WHERE segments.date DURING LAST_7_DAYS
  "
}
EOF

Asset groups

Retrieve data from the Asset groups screen for Performance Max campaigns in the Google Ads UI by querying the asset_group resource.

GAQL

SELECT asset_group.name,
  campaign.name,
  asset_group.status,
  asset_group.ad_strength,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  metrics.conversions
FROM asset_group
WHERE segments.date DURING LAST_7_DAYS
  AND asset_group.status != 'REMOVED'

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT asset_group.name,
      campaign.name,
      asset_group.status,
      asset_group.ad_strength,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros,
      metrics.conversions
    FROM asset_group
    WHERE segments.date DURING LAST_7_DAYS
      AND asset_group.status != 'REMOVED'
  "
}
EOF

Products

Retrieve product-level metrics from the Products screen for Shopping and Performance Max campaigns in the Google Ads UI by querying the shopping_performance_view resource.

GAQL

SELECT segments.product_item_id,
  segments.product_title,
  segments.product_brand,
  campaign.name,
  campaign.advertising_channel_type,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  metrics.conversions
FROM shopping_performance_view
WHERE segments.date DURING LAST_7_DAYS

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT segments.product_item_id,
      segments.product_title,
      segments.product_brand,
      campaign.name,
      campaign.advertising_channel_type,
      metrics.clicks,
      metrics.impressions,
      metrics.ctr,
      metrics.average_cpc,
      metrics.cost_micros,
      metrics.conversions
    FROM shopping_performance_view
    WHERE segments.date DURING LAST_7_DAYS
  "
}
EOF

Look up geo constants

The Codes and formats page provides reference tables for most constants used in the API. However, you can also dynamically look up some constants using the Google Ads Query Language.

This sample shows how to look up a location by its resource name or by its display name.

By resource name

Look up Mountain View, CA, by its resource name geoTargetConstants/1014044.

GAQL

SELECT geo_target_constant.canonical_name,
  geo_target_constant.country_code,
  geo_target_constant.id,
  geo_target_constant.name,
  geo_target_constant.status,
  geo_target_constant.target_type
FROM geo_target_constant
WHERE geo_target_constant.resource_name = 'geoTargetConstants/1014044'

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT geo_target_constant.canonical_name,
      geo_target_constant.country_code,
      geo_target_constant.id,
      geo_target_constant.name,
      geo_target_constant.status,
      geo_target_constant.target_type
    FROM geo_target_constant
    WHERE geo_target_constant.resource_name = 'geoTargetConstants/1014044'
  "
}
EOF

By display name

Look up "Mountain View" as a city name in the United States.

GAQL

SELECT geo_target_constant.canonical_name,
  geo_target_constant.country_code,
  geo_target_constant.id,
  geo_target_constant.name,
  geo_target_constant.status,
  geo_target_constant.target_type
FROM geo_target_constant
WHERE geo_target_constant.country_code = 'US'
  AND geo_target_constant.target_type = 'City'
  AND geo_target_constant.name = 'Mountain View'
  AND geo_target_constant.status = 'ENABLED'

curl

curl --compressed --fail-with-body --request POST \
  "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:searchStream" \
  --header "Content-Type: application/json" \
  --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
  --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
  --data @- <<'EOF'
{
  "query": "
    SELECT geo_target_constant.canonical_name,
      geo_target_constant.country_code,
      geo_target_constant.id,
      geo_target_constant.name,
      geo_target_constant.status,
      geo_target_constant.target_type
    FROM geo_target_constant
    WHERE geo_target_constant.country_code = 'US'
      AND geo_target_constant.target_type = 'City'
      AND geo_target_constant.name = 'Mountain View'
      AND geo_target_constant.status = 'ENABLED'
  "
}
EOF