gads_upload_youtube_video_asset
Google Ads write medium risk
Part of the Video Campaign Agent.
What it does
Register a YouTube video as a reusable asset via AssetService.MutateAssets by referencing its YouTube video ID (no binary upload), returning the immutable asset resource name for use in Video campaigns, Demand Gen, or PMax asset groups. Input: the 11-char YouTube video ID OR a watch/share/shorts URL the tool parses, and an optional name. Returns {resource_name, asset_id, youtube_video_id, video_title}. Google VERIFIES the video at create: an unknown/invalid id fails with youtube_video_registration_error.VIDEO_NOT_FOUND (surfaces at preview); a valid but private video may register yet never serve — visibility is NOT checked beyond existence. Video assets are immutable and non-deletable (only unlinkable). Flow: preview (validate_only=true) -> show parsed video ID + name -> approval -> execute -> confirm resource_name + immutable audit log. 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 register an approved YouTube video before linking it to a Video/Demand Gen campaign or PMax asset group. Confirm the video is public (or unlisted-and-embeddable) and rights-cleared before creating, since the asset is immutable.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit CID; strip dashes. |
youtube_video_id | string | no | 11-char YouTube ID. Provide this OR youtube_url. |
youtube_url | string | no | Full watch/share/shorts URL; tool extracts the canonical 11-char ID. Exactly one of id/url required. |
name | string | no | Optional unique Asset.name. |
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
Video creative must comply with Google Ads policies (no prohibited/shocking content, no copyrighted music/characters the advertiser lacks rights to, no deepfakes of real people). AI-generated video must be disclosed. Claims must match the landing page (Misrepresentation = egregious, immediate suspension).
Reminder
Reference only videos the advertiser owns or is licensed to use; do not store video metadata beyond this request.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
MEDIA_VIDEO_ERROR_INVALID_VIDEO_ID | The supplied YouTube ID is malformed or does not resolve to a video. | Re-validate the 11-char ID/URL; request a correct video link. | no |
MEDIA_VIDEO_ERROR_VIDEO_NOT_FOUND | YouTube video not found or not accessible to the API. | Confirm the video exists and is public/unlisted; do not guess an alternate ID. | no |
INVALID_ARGUMENT | Missing both id and url, or malformed payload. | Surface the platform message; require one valid identifier. | 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 |
PLATFORM_UNAVAILABLE | Backend 5xx/INTERNAL. | Retry once after backoff. | yes |
Edge cases
- Private/unlisted/region-blocked video accepted at create but won't serve -> warn about visibility; the API does not validate embeddability.
- Same video ID already an asset -> returns existing resource name (dedupe).
- Shorts/share URL with extra query params -> parse the canonical 11-char ID before sending.
- Video asset is immutable + non-deletable — re-register a new ID and re-link to swap.
- validate_only=true returns no resource_name.