This service streamlines the workflow of creating video ads by handling the
YouTube upload process, ensuring that the videos are correctly associated with
your account.
Key concepts
Before you begin, it's important to understand how video uploads are managed
and the different states they can go through.
Channel ownership
When you upload a video, you can specify the destination YouTube channel using
thechannel_idfield in theYouTubeVideoUploadresource:
Advertiser-owned (brand) channel:Provide thechannel_idof a YouTube
channel owned by the advertiser. Uploading to a brand channel allows for
more control over the video's privacy and visibility.
Google-managed channel:Ifchannel_idis omitted, the video is
uploaded to a Google-managed YouTube channel associated with the Google Ads
account.
Upload states
The lifecycle of a YouTube video upload is tracked by thestatefield.
TheYouTubeVideoUploadStateenum defines the following states:
State
Description
PENDING
The video is being uploaded.
UPLOADED
The video has been successfully uploaded and is being processed by YouTube.
PROCESSED
The video has been successfully processed and is ready for use.
FAILED
The upload or processing failed and cannot be completed.
REJECTED
The video was rejected due to validation or policy reasons.
UNAVAILABLE
The video state is unavailable; it may have been removed from YouTube.
Privacy settings
Thevideo_privacyfield controls who can see the uploaded video. TheYouTubeVideoPrivacyenum supports:
PUBLIC: The video is available to anyone on YouTube. (Only allowed for
brand channels).
UNLISTED: The video is not searchable but can be viewed by anyone with
the link. This is the default and the only option for Google-managed
channels.
Upload a video
To upload a video, you must use a multi-part request to theCreateYouTubeVideoUploadmethod. The request contains both the metadata for
the upload and the video file itself.
If you are using REST, the following section describes how to manage the
video upload.
2. Upload the video
When you send a REST request to theCreateYouTubeVideoUploadmethod, the response contains the URL to be used for uploading the video bytes
in thex-goog-upload-urlHTTP response header, along with other metadata such
as the expected size of each chunk for chunked uploads.
You can also declare the size of the video you are going to upload initially,
when starting the process, with thex-goog-upload-header-content-lengthHTTP request header.
For a full description of the HTTP headers used in the video upload protocol,
refer to the following code example:
# Take the first ${CHUNK_SIZE} bytes of the video file and upload them.head-c${CHUNK_SIZE}${VIDEO_FILE_NAME}|curl-i-v-XPUT"${UPLOAD_URL}"\--header"Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}"\--header"X-Goog-Upload-Offset: 0"\--header"X-Goog-Upload-Command: upload"\--header"Content-Length: ${CHUNK_SIZE}"\--data-binary@-# Query the status of the upload.QUERY_RESPONSE=$(curl-i-s-XPOST"${UPLOAD_URL}"\--header"Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}"\--header"X-Goog-Upload-Command: query")# Extract the value of the "x-goog-upload-size-received" header from the HTTP# response.UPLOADED_BYTES=$(echo"${QUERY_RESPONSE}"\|grep-i'^x-goog-upload-size-received'\|awk'{print $2}'\|tr-d'\r')echo"Uploaded ${UPLOADED_BYTES} bytes."REMAINING_BYTES=$((FILE_SIZE-UPLOADED_BYTES))echo"${REMAINING_BYTES} bytes remaining to upload."FINALIZE_RESPONSE=$(tail-c${REMAINING_BYTES}${VIDEO_FILE_NAME}|curl-v-XPUT"${UPLOAD_URL}"\--header"Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}"\--header"X-Goog-Upload-Offset: ${UPLOADED_BYTES}"\--header"X-Goog-Upload-Command: upload, finalize"\--data-binary@-)UPLOADED_VIDEO_RESOURCE_NAME=$(echo$FINALIZE_RESPONSE|jq-r'.resourceName')
After a video upload is completed, you can use it as a video asset.
Use the uploaded video
After a video reaches thePROCESSEDstate, you can find its YouTube video ID
in thevideo_idfield of theYouTubeVideoUploadresource.
Use thisvideo_idto create aYoutubeVideoAssetwithMutateAssetsor link it directly to ad types that support YouTube videos
by referencing the video ID.
Update metadata
You can update the metadata of a video uploaded through this API using theUpdateYouTubeVideoUploadmethod. Only thevideo_title,video_description,
andvideo_privacyfields can be updated.
Remove uploads
If you need to delete videos uploaded with the Google Ads API, use theRemoveYouTubeVideoUploadmethod. This will remove the video from both the
Google Ads asset library and YouTube.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-03-25 UTC."],[],[]]