SCALIX help

← All tools

gads_add_negatives_from_search_terms

Google Ads write medium risk

Part of the Search Terms Agent.

What it does

Block specific SEARCH QUERIES (copied from gads_get_search_terms_report) as campaign-level negative keywords. SOP pre-flight: terms already blocked at the campaign are skipped; terms clashing with the campaign's positive keywords are refused unless confirm_keyword_conflicts=true. PREVIEW->APPROVE->COMMIT: builds create ops (campaign_criterion.keyword + negative=true) at the given match_type (default EXACT, since search terms are literal queries), previews via validate_only=true showing each term + normalized match type + a match-scope warning, waits for explicit user approval, then commits (validate_only=false) and writes an immutable audit-log entry. EXACT blocks only that exact query; PHRASE/BROAD block wider and can silently cut traffic. Returns {success, data, count, warnings}. The preview shows a match-scope note for the match type used. 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

Use right after gads_get_search_terms_report — once the user approves which wasteful queries to block — to add them as campaign negative keywords.

Inputs

NameTypeRequiredDescription
customer_idstringyes10-digit CID, dashes stripped.
campaign_idstringyesCampaign to add the negatives to (campaign-level negatives).
search_termsarrayyesRaw search-query strings to block (e.g. copied from gads_get_search_terms_report). Each trimmed; empties dropped.
match_typestringnoEXACT (default) / PHRASE / BROAD, enum-normalized. EXACT blocks only that exact query; PHRASE/BROAD block wider.
confirm_keyword_conflictsbooleannoDefault false: terms closely matching keywords you BID on are refused (keyword_conflict) so you don't block your own traffic. true adds them anyway.
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

Negatives silently kill traffic when too broad — default to EXACT and preview the match scope before committing. Never use negatives to mask a disapproval instead of fixing the ad. Search terms may contain user PII — never log or retain the raw query text.

Reminder

Preview before committing; prefer EXACT for literal search terms; do not retain the underlying user queries beyond this request.

Errors

Error classMeansWhat to doRetry
CUSTOMER_NOT_FOUNDAccount not found or not linked.Verify the CID and authorization.no
needs_reauthAuthorization expired or revoked.Reconnect Google Ads in the Scalix dashboard.no
INVALID_ARGUMENTNo search terms provided, or a term exceeds 80 chars / 10 words.Fix the input and retry.no
PERMISSION_DENIEDThe user lacks write access to this account.Check account access/role.no
PARTIAL_FAILURESome negatives failed (e.g. duplicates); others applied.Review the per-op errors returned.no
RESOURCE_EXHAUSTEDRate/quota limit hit.Back off and retry.yes

Edge cases

  • Empty/whitespace-only list -> invalid_argument.
  • Duplicate of an existing negative -> duplicate error on that op (partial_failure); others still apply.
  • A clean validate_only preview STILL requires explicit approval before commit.
  • PHRASE/BROAD match_type blocks more than the exact query — preview the scope.