SCALIX help

← All tools

gads_add_keywords_to_shared_set

Google Ads write medium risk

Part of the Search Terms Agent.

What it does

Add negative keywords (exact/phrase/broad) into an existing NEGATIVE_KEYWORDS shared set as SharedCriterion resources. PREVIEW->APPROVE->COMMIT: builds create ops referencing the shared_set, previews via validate_only=true with each keyword + normalized match type + scope warning, waits for approval, commits with validate_only=false + partial_failure=true, returns SharedCriterion resource_names + timestamp. Adding to the set affects EVERY campaign the set is currently linked to — the preview states the breadth. Match type enum-normalized; text <=80 chars / 10 words. Returns {success, data, count, warnings}. The preview shows the campaigns the set is linked to (or that it is linked to none) and a match-scope note. 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

Populating a shared negative-keyword set. Use to populate a reusable negative set that protects multiple campaigns at once. Emphasize in preview which/how many campaigns are affected. Get explicit approval before committing broad negatives.

Inputs

NameTypeRequiredDescription
customer_idstringyes10-digit CID, dashes stripped.
shared_set_idstringyesTarget SharedSet ID/resource_name (from gads_create_shared_negative_set or a list). Must be a NEGATIVE_KEYWORDS set.
negativesarrayyesList of {text, match_type}. text trimmed, <=80 chars / 10 words; match_type EXACT/PHRASE/BROAD normalized. Up to 10,000 ops.
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

Non-content-policy; require approval and log the actor. Because the set is shared, over-broad negatives can silently kill traffic across many campaigns — preview scope and breadth of impact.

Reminder

Underlying search-term sources may contain user PII — never log/retain the raw queries.

Errors

Error classMeansWhat to doRetry
CUSTOMER_NOT_FOUNDAccount not found/linked.Verify CID/authorization.no
TOKEN_REVOKEDAuthorization expired/revoked.needs_reauth.no
SHARED_SET_NOT_FOUNDReferenced shared set does not exist or is removed.Verify the shared_set_id; create or list it first.no
INVALID_ARGUMENTInvalid keyword/match type, or set-type mismatch (adding keywords to a NEGATIVE_PLACEMENTS set).Surface Google's message; correct input or target a NEGATIVE_KEYWORDS set.no
MANAGER_ACCOUNT_NOT_SUPPORTEDCannot mutate shared criteria on a manager (MCC) account.Target a child serving account.no
PARTIAL_FAILURESome keywords rejected while others succeeded.Return per-op errors with index; succeeded committed.no
PERMISSION_DENIEDNo write access / out of bearer scope.Confirm role/scope.no
RESOURCE_EXHAUSTEDRate/quota limit (HTTP 429).Backoff 5/10/20s cap 60s; honor retryDelay.yes
TOO_MANY_MUTATE_OPERATIONSRequest exceeds the 10,000-operation mutate cap.Batch the negatives into chunks <=10,000.no
INTERNAL_ERRORTransient 5xx.Retry once after backoff.yes

Edge cases

  • Empty negatives -> success count:0.
  • Set is linked to N campaigns -> preview states the broad impact across all N.
  • Duplicate criterion in the set -> Google duplicate error; report which.
  • Adding keywords to a NEGATIVE_PLACEMENTS set -> type-mismatch error.
  • validate_only clean still needs approval before commit.
  • Set capacity limits -> surface Google's limit error.
  • Expired token -> refresh once and retry.
  • shared_set.member_count is lazily maintained by Google and can read 0 while shared_criterion rows exist — count shared_criterion rows for truth, never member_count.
  • REMOVED shared sets drop out of status-filtered listings while their shared_criterion rows remain queryable — when auditing, include REMOVED status and SELECT shared_set.id on shared_criterion queries to attribute orphaned criteria.