gads_remove_keyword
Google Ads write medium risk
Part of the Google Ads Manager Agent.
What it does
Permanently remove one or more keywords (ad_group_criterion remove op). PREVIEW->APPROVE->COMMIT: previews via validate_only=true listing each keyword to be removed (IRREVERSIBLE — history is retained but the criterion cannot be re-enabled, only re-added as a brand-new criterion with a new ID), waits for explicit approval, commits (with the preview_id AND confirm_irreversible=true; without the flag the commit is refused) with validate_only=false + partial_failure=true, returns removed resource_names + timestamp, logs the action/actor. Prefer gads_pause_keyword when reversibility matters. Returns {success, data, count, warnings}. 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
Permanently removing a keyword. Use only when the user explicitly wants permanent removal; otherwise recommend pausing. Always show the exact list and the irreversibility note before committing.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit CID, dashes stripped. |
keywords | array | yes | List of criterion_resource_name OR {ad_group_id, criterion_id}. Up to 10,000 ops. |
reason | string | no | Optional reason for the audit log. |
confirm_irreversible | boolean | no | Required at APPLY: must be true together with preview_id or the commit is refused. Previews run without it and carry the IRREVERSIBLE warning (a removed keyword can never be re-enabled, only added again as a new criterion). |
validate_only | boolean | no | Optional. 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_id | string | no | Omit 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
Removal is non-content-policy but irreversible; require explicit approval and log the actor. Do not remove-and-recreate keywords to evade a disapproval (Circumventing Systems = egregious).
Reminder
Removal cannot be undone (only re-added as a new criterion) — log actor/reason; never expose tokens.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
CUSTOMER_NOT_FOUND | Account not found/linked. | Verify CID/authorization. | no |
TOKEN_REVOKED | Authorization expired/revoked. | needs_reauth. | no |
CRITERION_NOT_FOUND | Keyword already removed or not found. | Treat as already-removed; report it, don't fail hard. | no |
INVALID_ARGUMENT | Malformed resource name. | Surface Google's message; correct the name. | no |
MANAGER_ACCOUNT_NOT_SUPPORTED | Cannot mutate criteria on a manager (MCC) account. | Target a child serving account. | no |
PARTIAL_FAILURE | Some removals failed while others succeeded. | Return per-op errors with index; succeeded committed. | no |
PERMISSION_DENIED | No write access / out of bearer scope. | Confirm role/scope. | no |
RESOURCE_EXHAUSTED | Rate/quota limit (HTTP 429). | Backoff 5/10/20s cap 60s; honor retryDelay. | yes |
INTERNAL_ERROR | Transient 5xx. | Retry once after backoff. | yes |
Edge cases
- Empty list -> success count:0.
- Already-removed keyword -> idempotent; report as already removed.
- validate_only clean still needs explicit approval before commit.
- Removed keyword cannot be enabled later -> must re-add as a new criterion (new ID).
- partial_failure -> report which removed and which didn't.
- Expired token -> refresh once and retry.