gads_remove_extension
Google Ads write medium risk
Part of the Ad Extensions Agent.
What it does
Remove an asset-based extension linkage (customer_asset / campaign_asset / ad_group_asset) so the extension stops serving at that scope, without deleting the underlying asset. Resolves the linkage from a link resource name (or asset + field_type + scope). Returns {success, removed_link_resource_name, asset_still_in_library:true}. Flow: preview (validate_only=true) -> diff ('Detach SITELINK asset X from campaign Y') -> approval -> execute (partial_failure=true) -> confirm + immutable audit log. Idempotent on already-removed links: success with a note (changed: false) and no preview to approve. 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 to stop a specific extension from serving at a chosen scope (e.g., retire an expired promotion link). Preview the exact linkage, confirm the asset remains in the library, and never use removal to circumvent enforcement.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit CID; strip dashes. |
link_resource_name | string | no | Exact extension linkage resource. Omit it and pass asset_resource_name + field_type + scope (+ scope_id) to have the link resolved via GAQL. |
asset_resource_name | string | no | Asset to detach (used with field_type+scope to resolve). |
field_type | string | no | Extension field type enum (SITELINK/CALLOUT/...) for resolution. |
scope | string | no | Enum CUSTOMER/CAMPAIGN/AD_GROUP. |
scope_id | string | no | Required when scope != CUSTOMER. |
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
Detaching an extension changes live ad serving. Do not strip + re-add variants to evade a disapproval (Circumventing Systems = egregious). Apply only the approved removal.
Reminder
The underlying asset is preserved (only the link is removed); confirm the scope with the user.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
INVALID_ARGUMENT | Insufficient identifiers to resolve the linkage. | Require link_resource_name or asset+field_type+scope(+scope_id). | no |
NOT_FOUND | Linkage not found (already removed/wrong scope). | Idempotent success if removal intended; else re-resolve via gads_list_extensions. | no |
TOKEN_REVOKED | Token revoked/expired. | Set needs_reauth; prompt reconnect. | no |
RESOURCE_EXHAUSTED | Quota/QPS exceeded (HTTP 429). | Backoff 5/10/20s cap 60s, retry once. | yes |
PARTIAL_FAILURE | One or more removals failed in bulk. | Return per-op errors. | no |
PLATFORM_UNAVAILABLE | Backend 5xx/INTERNAL. | Retry once after backoff. | yes |
Edge cases
- Underlying asset is never deleted — only the link.
- Already-removed link -> idempotent success.
- Removing a customer-level link does not remove campaign-level links of the same asset; handle each scope explicitly.
- Removing the only serving extension of a type may reduce eligibility/CTR; advise impact.
- validate_only=true removes nothing.
- preview TTL expiry -> re-preview.