gads_remove_asset
Google Ads write medium risk
Part of the Ad Extensions Agent.
What it does
Detach (unlink) an asset from a customer/campaign/ad-group/asset-group by removing the linkage row (CustomerAsset / CampaignAsset / AdGroupAsset / AssetGroupAsset), NOT delete the library asset itself — Google Ads assets are immutable and cannot be programmatically deleted. The tool resolves the correct linkage resource from the asset + its attachment scope and removes it. Returns {success, removed_link_resource_name, asset_still_in_library:true}. Flow: preview (validate_only=true) -> plain-English diff ('Detach asset X (field SITELINK) from campaign Y; asset remains in library') -> approval -> execute (partial_failure=true) -> confirm + immutable audit log. Idempotent: removing an already-removed link returns 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 serving a specific asset on a customer/campaign/ad-group/asset-group (e.g., an underperforming sitelink or a paused promotion). Preview the exact linkage and confirm the asset stays in the library; do not use to delete assets (impossible) or to circumvent a disapproval.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit CID; strip dashes. |
link_resource_name | string | no | Exact linkage resource (e.g. customers/X/campaignAssets/CAMPAIGN~ASSET~FIELDTYPE). Omit it and pass asset_resource_name + scope (+ scope_id) to have the link resolved via GAQL. |
asset_resource_name | string | no | Library asset resource to unlink, used with scope fields to resolve the linkage. |
scope | string | no | Enum CUSTOMER/CAMPAIGN/AD_GROUP/ASSET_GROUP — which linkage table to remove from. |
scope_id | string | no | ID of the campaign/ad_group/asset_group the asset is linked to (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 asset is a content change to live ads. Do not remove assets to mass-strip disapproved content and re-add variants to dodge review (Circumventing Systems = egregious). Apply only the removal the user approved.
Reminder
The library asset is never deleted, only its linkage; confirm the user understands removal affects only the chosen scope.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
INVALID_ARGUMENT | Neither link_resource_name nor a complete asset+scope+scope_id triple supplied, or malformed resource name. | Surface the message; require a resolvable linkage. | no |
NOT_FOUND | The linkage resource does not exist (already removed or wrong scope). | Treat as idempotent success if intent was removal; else re-resolve via gads_list_extensions/gads_list_asset_groups. | no |
REQUIRED_ASSET_CANNOT_BE_REMOVED | Removing this link would drop a required asset (e.g., last LOGO/BUSINESS_NAME on a brand-guidelines PMax campaign, or below RSA/asset-group minimums). | Block; inform the user a replacement must be added first. | 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 link removals failed in a bulk request. | Return per-op errors array; report which links were removed vs failed. | no |
PLATFORM_UNAVAILABLE | Backend 5xx/INTERNAL. | Retry once after backoff. | yes |
Edge cases
- Asset is NEVER deleted — only the linkage; explicitly tell the user the library asset remains.
- Already-removed link -> idempotent success with note.
- Removing the last required brand/RSA/asset-group asset is blocked by the API; surface as REQUIRED_ASSET_CANNOT_BE_REMOVED.
- Same asset linked at multiple scopes -> only the specified scope's link is removed; others keep serving.
- validate_only=true does not remove anything.
- preview TTL expiry -> re-preview before execute.