SCALIX help

← All tools

gads_add_keywords

Google Ads write medium risk

Part of the Keyword Research Agent.

What it does

Add positive keywords (exact/phrase/broad) to a SEARCH ad group as ad_group_criterion resources. SCALIX SOP PRE-FLIGHT: the ad group's existing keywords are read first and any proposed keyword that already exists at the SAME match type is skipped rather than re-added; if every keyword is a duplicate the call is rejected. PREVIEW->APPROVE->COMMIT (validate_only). Returns {success, data:{applied:{created:[{keyword_text, match_type, ad_group}], skipped_duplicates:[...], resource_names}}, warnings} — warnings name the duplicates skipped, any restricted pharma terms, the BROAD match scope, and a cpc_bid the campaign's automated bidding would ignore. PREVIEW SEMANTICS: the first call (no preview_id) is sent to the Google Ads API in validation mode — field, enum, policy and permission errors surface AT PREVIEW, nothing is changed, and the response returns a preview_id. To apply, show the preview to the user, get their approval, and re-call with that preview_id and IDENTICAL arguments within 30 minutes; changed arguments or an expired token fail closed to a fresh preview. validate_only=true forces another preview; validate_only=false alone never commits.

When to use it

Ask the buyer for the match type (per keyword or for the batch) and the grouping (intent or theme) before calling. If the keywords imply several ad groups, propose the structure and get approval first — this tool writes into one ad group. Never set final_url unless the user asks for a keyword-level URL.

Inputs

NameTypeRequiredDescription
customer_idstringyesTarget Google Ads account; strip dashes to 10 digits (123-456-7890 -> 1234567890). Server derives tenant/RLS context from this; must be in the bearer's authorized accounts.
ad_group_idstringyesNumeric ad group ID the keywords attach to. Parent campaign type must be SEARCH; keywords on PMax/Display/Shopping ad groups are invalid and rejected by Google.
keywordsarrayyesList of {text, match_type, cpc_bid?}. text <=80 chars and <=10 words (Google's limits); match_type enum-normalized EXACT/PHRASE/BROAD; cpc_bid optional account-currency amount -> micros (x1e6), or cpc_bid_micros directly; the mapped bid is echoed in the preview's created[] rows. Up to 10,000 ops/request (mutate cap).
final_urlstringnoKeyword-level final URL (final_urls[]). Leave it out: landing pages belong on the ads (gads_create_responsive_search_ad / gads_update_ad final_urls). Set it only when the user explicitly asks for a keyword-level URL; when it is unclear which they mean, ask first. It overrides the ads' final URLs for clicks on these keywords and must be a valid https URL consistent with the ad (Misrepresentation risk if not).
validate_onlybooleannoOptional. true forces another preview even with a preview_id; false is DEPRECATED and no longer commits — only a valid preview_id applies the write.
preview_idstringnoOmit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview.

Safeguards

A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.

Policy

Keywords must not be used to circumvent enforcement — do not add near-duplicate keyword/URL variants to revive disapproved content or dodge a disapproval (Circumventing Systems = egregious, immediate permanent suspension). Keyword final URLs and triggered copy must be consistent with the landing page (Misrepresentation = egregious). The preview flags restricted pharma terms from a short word list (Scalix red lines GADS-RL-11 opioid painkillers, GADS-RL-12 prescription drugs without a prescription) and does not detect trademarks: only the advertiser knows whether it may use a brand name.

Reminder

Search terms triggered by these keywords can contain user PII — never log or retain them beyond the request.

Errors

Error classMeansWhat to doRetry
CUSTOMER_NOT_FOUNDAccount {customer_id} not found or not linked to this connection.Verify the 10-digit CID and that the account is authorized for this user; reconnect if needed.no
TOKEN_REVOKEDGoogle authorization expired or was revoked for this account.needs_reauth — prompt the user to reconnect the Google Ads account.no
INVALID_ARGUMENTGoogle rejected a keyword (e.g. invalid match type, text >80 chars or >10 words, malformed final URL, keywords not allowed on this ad-group/campaign type).Surface the exact Google fieldPath/error code/message; do not guess a fix — return it for user correction.no
MANAGER_ACCOUNT_NOT_SUPPORTEDCannot add keywords on a manager (MCC) account.Target a child serving account, not the MCC.no
PARTIAL_FAILURESome keywords were rejected while others succeeded.Return per-op errors[] with the offending keyword index and Google message; succeeded ops are committed.no
PERMISSION_DENIEDAuthenticated user lacks write access to this account, or the action is out of bearer scope.Confirm the account role allows edits and the OAuth/bearer scope permits writes.no
RESOURCE_EXHAUSTEDGoogle Ads rate/quota limit hit (HTTP 429).Retry with exponential backoff 5s->10s->20s (cap 60s); honor any retryDelay in the error.yes
TOO_MANY_MUTATE_OPERATIONSRequest exceeds the 10,000-operation mutate cap.Split keywords into batches <=10,000 ops.no
INTERNAL_ERRORGoogle Ads returned a 5xx/transient internal error.Retry once after backoff; if it persists, surface to the user.yes
account_inactiveThe Google Ads account is suspended or not enabled, so Google rejects every mutate - including validate_only=true previews. Reads keep working.Resolve the account status in the Google Ads UI (billing/policy). Do NOT tell the user to reconnect Google Ads; reconnecting cannot fix an account-state rejection.no

Edge cases

  • Empty keywords list -> invalid_argument ('Provide at least one keyword.'); nothing is sent.
  • validate_only preview never executes — a clean preview still requires explicit approval before the separate commit.
  • A keyword already in the ad group at the same match type is skipped and listed in skipped_duplicates (with a warning); when every keyword is a duplicate the call is refused.
  • Broad match silently widens reach -> preview surfaces a match-scope warning.
  • Keyword text >80 chars or >10 words -> rejected; surface the exact limit, don't truncate silently.
  • Expired access token -> refresh once and retry the same request transparently.
  • The commit is atomic: if Google rejects one keyword, none is added.
  • The account currency is read (once per customer) so the preview's amounts label each bid with it (e.g. 12.50 INR).
  • cpc_bid is inert if the parent campaign uses Smart/automated bidding -> note it (does not block the add).