gads_search_audiences
Google Ads read low risk
Part of the Google Ads Audience Agent.
What it does
Find Google's own audience segments by name, with the id to add them by: affinity, in-market and detailed demographics (e.g. 'software' finds In-market: Software, id 80276). Searches Google's audience lists (the user_interest and detailed_demographic resources) for the text anywhere in the name, case-insensitive. Life events are not listed: Google's API refuses them as campaign audiences. Each row is {type, id, name, parent_id, channels}: type is AFFINITY, IN_MARKET or DETAILED_DEMOGRAPHIC, and {type, id} is exactly what gads_add_campaign_audience takes (for one ad group, gads_attach_audience_to_ad_group takes an affinity or in-market id with audience_type=USER_INTEREST). channels lists the campaign types Google offers the segment on; an empty list means Google gave none. With campaign_id, each row also carries available_for_campaign for that campaign's type (true, false, or null when Google gave no availability). Up to `limit` rows per type (default 25, max 100). Read-only reference data: nothing is changed. Returns success with count 0 and a note when nothing matches.
When to use it
When the user names an audience in words (affinity, in-market or detailed demographic, e.g. 'people shopping for software') and you need its id before adding it with gads_add_campaign_audience or gads_attach_audience_to_ad_group: search audiences by name here rather than guessing ids.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit Google Ads CID, dashes stripped: the account the search runs in (Google's audience lists are the same for every account). |
query | string | yes | Text in the segment name, matched as one phrase anywhere in it, case-insensitive, e.g. 'software', 'travel', 'homeowners'. |
types | array<string> | no | Which kinds to search: AFFINITY, IN_MARKET, DETAILED_DEMOGRAPHIC (a list or a comma-separated string). Default: all three. |
campaign_id | string | no | Optional campaign: each row then says available_for_campaign for that campaign's type. |
limit | integer | no | Max rows per type, 1-100. Default 25. |
Safeguards
Policy
Read-only reference data about Google's audience segments; it holds no user data. Finding a segment here is not permission to target it: Google's personalized-advertising policy still applies (no sensitive categories; housing, employment and credit ads in the US and Canada can't target by age, gender, parental status, marital status or ZIP code).
Reminder
Present segments by name with their type; never invent an id the search did not return.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
INVALID_ARGUMENT | Empty query, an unknown type, or a non-numeric campaign_id. | Fix the argument the message names and retry. | no |
TOKEN_REVOKED | Authorization revoked / refresh token expired. | Trigger re-auth (needs_reauth); do not retry with the dead token. | no |
PERMISSION_DENIED | The login cannot access this account. | Report it; check the account with gads_list_accessible_customers. | no |
RESOURCE_EXHAUSTED | Rate/quota limit (HTTP 429). | Backoff 5->10->20s cap 60s, honor retryDelay; retry. | yes |
PLATFORM_UNAVAILABLE | Google Ads 5xx / INTERNAL / DEADLINE_EXCEEDED. | Idempotent retry with backoff. | yes |
Edge cases
- No match -> success with count 0 and a note; try a shorter or broader word.
- A word in many names (e.g. 'travel') -> up to limit rows per type; narrow the words or the types.
- A segment Google gives no availability for -> channels is empty and available_for_campaign is null; Google decides when the audience is added.
- Life events -> not listed: Google's API refuses them as campaign criteria (OPERATION_NOT_PERMITTED_FOR_CONTEXT on Search and Display, checked 13 Oct).
- campaign_id not found -> rows come back without available_for_campaign, with a note.
- Expired token -> refresh once, retry.