resolve_google_locations

Google Ads Read

๐Ÿšจ **IF THIS TOOL RETURNS A QUOTA ERROR:** - The error message will include a clickable upgrade link - Show the FULL error message to the user (it contains the upgrade link) - DO NOT attempt to work ar

Endpoint

POST https://api.adspirer.ai/api/v1/tools/resolve_google_locations/execute

Headers

Description

๐Ÿšจ **IF THIS TOOL RETURNS A QUOTA ERROR:** - The error message will include a clickable upgrade link - Show the FULL error message to the user (it contains the upgrade link) - DO NOT attempt to work around the error or use alternative data - DO NOT create campaigns or perform actions without valid tool data - STOP and direct the user to upgrade via the provided link Resolve free-text location queries (country, state/province, city, district, postal code) into Google's exact `geoTargetConstants/<id>` resource names. **WHEN TO USE:** Call this tool BEFORE `create_display_campaign`, `create_search_campaign`, `create_pmax_campaign`, or `create_demandgen_campaign` whenever the user requests targeting by location. This gets you the precise geoTargetConstants/<id> values the Google Ads API accepts โ€” eliminating ambiguity (e.g., "London" could be London UK, Londonderry, or London Ontario). **INPUT:** JSON array of free-text queries, optional locale + country_code filter. **OUTPUT:** For each query, up to N candidate geoTargetConstants with canonical_name, target_type (Country/State/City/District/etc.), country_code, reach estimate. The AI client picks the right ID and passes it to the campaign-creation tool. **WORKFLOW EXAMPLE:** 1. User says "target London and California" 2. Call `resolve_google_locations` with `queries: ["London","California"]` 3. Disambiguate with the user if multiple candidates exist (e.g., London UK vs London Ontario) 4. Pass chosen resource names (e.g., `["geoTargetConstants/1006886","geoTargetConstants/21137"]`) as `target_locations` to the campaign-creation tool. Display campaign creation accepts BOTH formats (free-text OR resource names / bare IDs) but the API is most reliable with pre-resolved IDs. **Execution time:** 1-3 seconds. Redis-cached 5 minutes.

Request body

All tool arguments are wrapped in an arguments object.

FieldTypeDescription
queriesarray requiredJSON ARRAY of free-text location queries. Can be country, state/province, city, district, postal code, etc. Examples: ["London", "California", "90210", "South Delhi"]. Max 25 queries per call.
localestring optionalISO locale for match results (e.g., 'en', 'es', 'fr'). Default 'en'. default: "en"
country_codestring optionalOptional ISO country code (e.g., 'US', 'IN', 'GB') to CONSTRAIN suggestions. Leave null for GLOBAL matching (recommended when user hasn't specified a country).
max_suggestions_per_queryinteger optionalMax suggestions returned per query. Default 10, max 20. default: 10
customer_idstring optionalRequired for multi-account users.

Example request

{
  "arguments": {
    "queries": [
      "string"
    ],
    "locale": "en",
    "country_code": "string",
    "max_suggestions_per_query": 10,
    "customer_id": "string"
  }
}

Example responses

200 โ€” Success

{
  "success": true,
  "data": {
    "text": "(tool-specific textual output for resolve_google_locations)",
    "quota": {
      "used": 42,
      "limit": 150,
      "tier": "plus",
      "period_end": "2026-05-01"
    }
  },
  "tool": "resolve_google_locations"
}

400 โ€” Tool-level error (bad arguments / multi-account selection)

{
  "success": false,
  "error": "You have 25 meta_ads accounts connected. Please specify which account to use by passing the ad_account_id parameter:\n  - Acme Holdings (ad_account_id=\"act_123456789\")\n  - Acme EU (ad_account_id=\"act_987654321\")",
  "is_error": true,
  "tool": "resolve_google_locations"
}

402 โ€” Quota exhausted

{
  "success": false,
  "error": "\ud83d\udea8 Monthly limit reached (150/150 tool calls on Plus tier).\nUpgrade to Pro at https://adspirer.ai to keep building.",
  "is_error": true,
  "tool": "resolve_google_locations",
  "quota": {
    "used": 150,
    "limit": 150,
    "tier": "plus",
    "period_end": "2026-05-01",
    "upgrade_url": "https://adspirer.ai"
  }
}

Try it live


Adspirer REST API โ€” get an API key at adspirer.ai/keys ยท adspirer.ai