YouTube

YouTube API v2.0 – Updating and Deleting Videos

Note: The YouTube Data API (v2) has been officially deprecated as of March 4, 2014. Please refer to our deprecation policy for more information.

This page explains how to enable your application to let users update information about their uploaded videos or delete their videos. Typically, developers who implement this functionality also incorporate either browser-based uploading or direct uploading functionality.

This page contains the following sections:

  1. Updating a video entry
  2. Deleting a video

Updating a video entry

To update a video, retrieve the video entry from the video owner's uploaded videos feed and send a PUT request to the entry's edit URL:

<link rel='edit' type='application/atom+xml'
   href='https://gdata.youtube.com/feeds/api/users/default/uploads/VIDEO_ID'>

The body of the PUT request is an Atom XML entry that contains information about the video. You can include any of the following elements and their subtags in your request. Required elements are marked with an asterisk (*).

Note that excluding an element will delete the information that already exists for that video. For example, if a video is marked as private and your request does not include the <yt:private> tag, the video will become public. Similarly, if you do not specify access control settings when updating a video, YouTube will restore the default access control settings for that video. If you only specify some access control settings in an update, the unspecified controls will be restored to their default settings.

The following XML shows a sample request to update a video:

PUT /feeds/api/users/default/uploads/VIDEO_ID HTTP/1.1
Host: gdata.youtube.com
Content-Type: application/atom+xml
Content-Length: CONTENT_LENGTH
Authorization: Bearer ACCESS_TOKEN
GData-Version: 2
X-GData-Key: key=DEVELOPER_KEY

<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
  xmlns:media="http://search.yahoo.com/mrss/"
  xmlns:yt="http://gdata.youtube.com/schemas/2007">
  <media:group>
    <media:title type="plain">Yippee Skippy</media:title>
    <media:description type="plain">I am updating this video.</media:description>
    <media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People</media:category>
    <media:keywords>blastoff,rodeo,whiteboards</media:keywords>
  </media:group>
  <yt:accessControl action="comment" permission="allowed"/>
  <yt:accessControl action="commentVote" permission="allowed"/>
  <yt:accessControl action="rate" permission="allowed"/>
  <yt:accessControl action="list" permission="allowed"/>
  <yt:accessControl action="embed" permission="allowed"/>
  <yt:accessControl action="syndicate" permission="allowed"/>
</entry>

Note: You can also submit a partial update using a PATCH request to only update specific metadata fields for an entry.

Updating a video with incomplete metadata

If a video entry contains a <yt:incomplete> element, you must remove that element before updating the entry. The element's presence indicates that when the video was uploaded, it was flagged as having incomplete metadata. Consequently, YouTube may have automatically generated some of the video's metadata values, such as its title, category, or keywords.

A video that was uploaded with incomplete metadata will not be included in YouTube's search index and, therefore, will not appear in search results. After the video's metadata has been updated, and the <yt:incomplete> element has been removed, the video will subsequently be eligible to be included in YouTube's search index.

Deleting a video

To delete a video, send a DELETE request to the edit URL for that video as shown in the following example:

DELETE /feeds/api/users/default/uploads/VIDEO_ID HTTP/1.1
Host: gdata.youtube.com
Content-Type: application/atom+xml
Authorization: Bearer ACCESS_TOKEN
GData-Version: 2
X-GData-Key: key=DEVELOPER_KEY

Deleted videos are typically removed from a user's public uploaded videos feed within a couple of hours.

pagination links

« Previous
Checking a Video's Status
Next »
Providing Captions for a Video

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.