My favorites | English | Sign in

More personalization in Google Friend Connect New!

YouTube APIs and Tools

YouTube logo

Developer's Guide: Data API Protocol – Updating and Deleting Videos

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:

Updating a video entry
 
Deleting a video
 

Updating a video entry

To update a video, send an HTTP PUT request to the URL identified in the video entry's <link> tag where the rel attribute value is edit:

<link rel='edit' type='application/atom+xml'
   href='http://gdata.youtube.com/feeds/api/users/andyland74/uploads/914IMX9RSTE'>

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.

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

PUT /feeds/api/users/USER_ID/uploads/VIDEO_ID HTTP/1.1
Host: gdata.youtube.com
Content-Type: application/atom+xml
Content-Length: CONTENT_LENGTH
Authorization: AuthSub token="AUTHORIZATION_TOKEN"
GData-Version: 2
X-GData-Client: CLIENT_ID
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>
</entry>

Deleting a video

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

DELETE /feeds/api/users/USER_ID/uploads/VIDEO_ID HTTP/1.1
Host: gdata.youtube.com
Content-Type: application/atom+xml
Authorization: AuthSub token="AUTHORIZATION_TOKEN"
GData-Version: 2
X-GData-Client: CLIENT_ID
X-GData-Key: key=DEVELOPER_KEY

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