My favorites | English | Sign in

Sign up for Google I/O 2010 today!

YouTube APIs and Tools

YouTube logo

Reference Guide: Data API Protocol

Contents

Overview

This document is intended for programmers who are writing client applications that interact with YouTube. The document supplements the information in the developer's guide protocol as well as the language-specific guides for Java, PHP and Python developers.

This document lists the different types of feeds that you can retrieve using the YouTube Data API. It also provides diagrams that explain how to navigate between different feeds – for example, the diagrams show that a user's playlists feed contains URLs that reference individual playlists and data such as a user's profile. The diagrams also indicate how you would navigate from one feed to another. Finally, this document defines the parameters used in YouTube Data API requests as well as the XML tags returned in an API response. For Java, PHP and Python developers, the XML tags may correspond directly to a property of a VideoEntry, ProfileEntry or other type of object.

Expected latency for data updates

The YouTube Data API retrieves search results from a specially optimized search index. The index is designed to include new videos as quickly as possible while ensuring high performance even under heavy API server loads. Please note that there may be delays between the time that a video is uploaded or updated and the time the new information is included in video feeds. The following list provides expected data latencies for various API functions:

  • Standard feeds are updated every few minutes.
  • Uploaded videos will be included in a user's public uploaded videos feed a few minutes after the upload completes and YouTube finishes processing the video.
  • Uploaded videos will usually be available in search feeds within 30 minutes to two hours after the upload completes and YouTube finishes processing the video. However, this delay may be longer under heavy API server loads.
  • Video metadata updates are typically reflected in search feeds within 30 minutes to two hours after the upload completes. However, this delay may be longer under heavy API server loads, and updates may take up to 24 hours to show up.
  • Deleted videos will usually be removed from a user's public uploaded videos feed within 30 minutes to two hours after the upload completes. However, this delay may be longer under heavy API server loads.
  • Statistics, such as the number of times a video has been viewed or the number of comments available for a video, are typically updated within 30 minutes to two hours after the upload completes. However, this delay may be longer under heavy API server loads.
  • On an ongoing basis, statistics for a video are typically updated every 30 minutes to two hours. However, updates may occur less frequently under heavy server loads or for videos that are viewed very infrequently. In search feeds, updates to ratings and view counts could take as long as a couple of weeks for infrequently viewed videos.
  • Events that are listed in activity feeds will usually be available in those feeds within 30 minutes of the times that they occur.

Projection values

The YouTube Data API offers different views, or projections, of the data available in the API. The Developer's Guide and the examples in this document all use the api projection, which supports all of the tags defined in the XML element definitions section of this document.

All API requests must specify a projection. Most developers who are using this documentation will use the api projection. However, if you are developing applications for mobile devices, you can substitute "mobile" for "api" in any of the sample requests described in the API documentation. Similarly, if you prefer to use the base projection, which is well suited to feed readers, you can substitute "base" for "api" in any of the sample requests described in the API documentation.

The following table describes the supported projection values:

Projection Name Description
api This projection yields feeds that support all of the XML elements defined in this document, including all relevant tags in the YouTube and Media RSS schemas. All properties contain plain text, not HTML.
base This projection yields basic Atom feeds without any extension elements. Its <atom:summary> and <atom:content> properties contain entity-encoded HTML.
mobile This projection supports most of the XML elements defined in this document and should be used when by developers building applications for mobile devices.

Feed Types

You can retrieve the following types of feeds from the YouTube Data API:

Video feeds* – there are several types of video feeds
User's playlists feed
User's subscriptions feed
Video comments feed
User profile entry
User's contacts feed

The API allows you to retrieve any of these feeds without authentication. However, in some cases, an authenticated request may retrieve additional information. For example, if you submit an authenticated request for a user's own list of uploaded videos, the feed will contain private videos as well as rejected or pending videos. Private, pending and rejected videos would not appear in a response to an unauthenticated API request or a request for videos uploaded by someone other than the currently authenticated user.

To add or update videos, playlists, subscriptions, ratings, comments or any other entity, you must authenticate all requests, including GET requests, using a developer key and either AuthSub or ClientLogin authentication.

Video feeds

Video feeds return a collection of video entries. In turn, each video entry contains information about a specific video in the video feed's result set. The YouTube Data API allows you to retrieve the following types of video feeds:

Videos feed
Related videos feed
Video responses feed
Standard feeds
User favorites feed
Playlist feed

Videos feed

The API returns a videos feed in response to a request to search for videos. A videos feed contains a maximum of 999 entries. To retrieve search results, send an API request to the following URL:

http://gdata.youtube.com/feeds/projection/videos?v=2

Search requests can use any of the API's standard or custom query parameters. For example, the following URL requests all videos related to the query "skateboarding dog," starting with the 21st search result and returning 10 results:

http://gdata.youtube.com/feeds/api/videos?
     q=skateboarding+dog
     &start-index=21
     &max-results=10
     &v=2

Related videos feed

The related videos feed contains a list of videos that are related to another video. YouTube algorithmically selects the set of related videos.

Each video entry in an API response contains a series of <link> tags. The <link> tag that has a rel attribute value of http://gdata.youtube.com/schemas/2007/#video.related identifies the URL for retrieving other videos related to that video entry. (The <link> tag's href attribute identifies the URL.)

<link rel="http://gdata.youtube.com/schemas/2007#video.related"
     type="application/atom+xml"
     href="http://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/related?v=2"/>

Related videos feeds contain a maximum of 100 videos.

Video responses feed

A video responses feed contains videos that have been explicitly designated as a response to another video. A video can be designated as a video response to exactly one other video, and some videos may not have any video responses.

Each video entry in an API response contains a series of <link> tags. The <link> tag that has a rel attribute value of http://gdata.youtube.com/schemas/2007/#video.responses identifies the URL for retrieving video responses for that video entry. (The <link> tag's href attribute identifies the URL as shown in the following example.)

<link rel="http://gdata.youtube.com/schemas/2007#video.responses"
     type="application/atom+xml"
     href="http://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/responses?v=2"/>

Standard feeds

Standard feeds contain lists of videos that either reflect YouTube user behavior, such as top-rated and most viewed video feeds, or were selected by YouTube staff, such as recently featured and mobile video feeds. Many of these feeds are shown on the Videos tab of the YouTube website. Standard feeds are updated every few minutes.

To retrieve a standard feed, send an HTTP GET request to the URL associated with that feed. The following table identifies the URL associated with each standard feed:

Name Feed Id URL and Description
Top rated top_rated URL: http://gdata.youtube.com/feeds/api/standardfeeds/top_rated
Description: This feed contains the most highly rated YouTube videos.
Top favorites top_favorites URL: http://gdata.youtube.com/feeds/api/standardfeeds/top_favorites
Description: This feed contains videos most frequently flagged as favorite videos.
Most viewed most_viewed URL: http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed
Description: This feed contains the most frequently watched YouTube videos.
Most popular most_popular URL: http://gdata.youtube.com/feeds/api/standardfeeds/most_popular
Description: This feed contains the most popular YouTube videos, selected using an algorithm that combines many different signals to determine overall popularity.
Most recent most_recent URL: http://gdata.youtube.com/feeds/api/standardfeeds/most_recent
Description: This feed contains the videos most recently submitted to YouTube.
Most discussed most_discussed URL: http://gdata.youtube.com/feeds/api/standardfeeds/most_discussed
Description: This feed contains the YouTube videos that have received the most comments.
Most responded most_responded URL: http://gdata.youtube.com/feeds/api/standardfeeds/most_responded
Description: This feed contains YouTube videos that receive the most video responses.
Recently featured recently_featured URL: http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured
Description: This feed contains videos recently featured on the YouTube home page or featured videos tab.
Videos for mobile phones watch_on_mobile URL: http://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile
Description: This feed contains videos suitable for playback on mobile devices.

In addition, please note that many of these feeds support the time query parameter, which allows you to restrict the feed to only contain relevant results from the previous day, week or month. For example, to retrieve top-rated videos from the previous day, you would send an HTTP GET request to the following URL:

http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time=today

Note: The top_rated, top_favorites, most_viewed, most_discussed and most_responded standard feeds support the time parameter.

Retrieving region-specific standard feeds

The API enables you to retrieve region-specific standard feeds by inserting a region ID in the standard feed URL. The following URL demonstrates the format of the URLs that you would use to retrieve region-specific standard feeds:

http://gdata.youtube.com/feeds/api/standardfeeds/regionID/feedID?v=2

For example, to retrieve a list of the top-rated videos in Japan, you would send an HTTP GET request to the following URL:

http://gdata.youtube.com/feeds/api/standardfeeds/JP/top_rated?v=2

Note: Region-specific versions of the watch_on_mobile standard feed are not available.

The following table identifies the countries for which the YouTube Data API supports localized feeds and the regionID associated with each country:

Country Region ID
Australia AU
Brazil BR
Canada CA
Czech Republic CZ
France FR
Germany DE
Great Britain GB
Holland NL
Hong Kong HK
India IN
Ireland IE
Israel IL
Italy IT
Japan JP
Mexico MX
New Zealand NZ
Poland PL
Russia RU
South Korea KR
Spain ES
Sweden SE
Taiwan TW
United States US

Retrieving category-specific standard feeds

The API also enables you to retrieve category-specific standard feeds by appending an underscore and a category name to the standard feed URL. inserting a region ID in the standard feed URL. The following URL demonstrates the format of the URLs that you would use to retrieve region-specific standard feeds:

http://gdata.youtube.com/feeds/api/standardfeeds/regionID/feedID_CATEGORY_NAME?v=2

For example, to retrieve a list of the top-rated comedies in Japan, you would send an HTTP GET request to the following URL:

http://gdata.youtube.com/feeds/api/standardfeeds/JP/top_rated_Comedy?v=2

Please note the following guidelines when generating URLs for category-based standard feeds:

  • The Category list for uploaded videos section explains how to retrieve the categories that could be used to classify video content. That section also explains how to identify the regions where each category is browsable.

  • If you retrieve a localized category list, the category name that you append to the URL is still the English word that is the value of the <atom:category> tag's term attribute in the category list.

    Category listing:
    <atom:category term='Entertainment' label='Divertissement' xml:lang='fr-FR'>
    
    URL for feed of top-rated entertainment videos in France:
    http://gdata.youtube.com/feeds/api/standardfeeds/FR/top_rated_Entertainment
    
  • The regionID in the feed URL is optional. If you do not specify a region ID, the API response will contain a category-based standard feed that is not restricted to a particular locale.

  • If your request does specify a regionID, then the specified category must be browsable in the specified region. For example, you can request a feed of the top-rated nonprofit videos in the United States because "Nonprofit" is a browsable category in the United States. However, you cannot request the top-rated nonprofit videos in France since "Nonprofit" is not a browsable category there.

Using the time parameter with standard feeds

All standard feeds support the time query parameter, which allows you to restrict the feed to only contain relevant results from the previous day, week or month. For example, to retrieve top-rated videos from the previous day, you would send an HTTP GET request to the following URL:

http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time=today&v=2

User's favorites feed

The favorite videos feed retrieves a list of videos that a particular user has explicitly flagged as a favorite video. On YouTube's website, a user can view and edit his list of favorite videos on his account page, and a user's favorite videos are also publicly visible to other YouTube users.

  • To request a feed of the currently logged-in user's favorite videos, send an HTTP GET request to the following URL. Note: For this request, you must provide an authentication token in the Authorization HTTP request header. The authentication token enables YouTube to identify the user.

    http://gdata.youtube.com/feeds/api/users/default/favorites?v=2
  • To request a feed of another user's favorite videos, send an HTTP GET request to the following URL. Note that this request does not require authentication.

    http://gdata.youtube.com/feeds/api/users/username/favorites?v=2

    In the URL above, you must replace the text username with the user's YouTube username.

The favorites feed returns a maximum of 50 entries. We strongly recommend that you paginate the feed by using the start-index and max-results query parameters to optimize the response size and latency. The recommended value for max-results is 10, yielding a response that contains about 60KB of data.

Playlist feed

A playlist feed contains information about a collection of up to 200 videos that can be viewed sequentially. A user can view and edit his list of playlists on his account page, and a user's playlists are also publicly visible to other YouTube users. In addition, users can modify an individual playlist by adding or removing videos from the playlist.

A playlist can be public or private. The API allows you to retrieve public playlists with or without authentication. However, you can only retrieve a private playlist for a user who is properly authenticated and authorized to view the playlist.

Before retrieving a playlist feed, you will probably first retrieve a user's playlists feed, which contains a list of the playlists created by that user. Within the user's playlists feed, each entry describes a single playlist. (On the other hand, a playlist feed describes the individual videos that comprise a single playlist.) Each entry in a user's playlists feed contains a <content> tag that identifies the URL that allows you to retrieve the feed for that playlist.

<content type='application/atom+xml;type=feed'
    href='http://gdata.youtube.com/feeds/api/playlists/PLAYLIST_ID?v=2'/>

Note: The actual URL will contain an ID that uniquely identifies the playlist in place of the term PLAYLIST_ID.

User's playlists feed

A user's playlists feed contains a list of the playlists created by that user. If you are requesting the playlists feed for the currently authenticated user, the feed will contain both public and private playlists. However, if you send an unauthenticated request or request playlists created by someone other than the currently authenticated user, the feed will only contain public playlists.

In a playlists feed, each entry contains information about a single playlist, including the playlist title, description and author. The <gd:feedLink> tag in the entry identifies the URL that allows you to retrieve the playlist feed, which specifies information about the videos in the playlist.

  • To request a feed of the currently logged-in user's playlists, send an HTTP GET request to the following URL. Note: For this request, you must provide an authentication token in the Authorization HTTP request header. The authentication token enables YouTube to identify the user.

    http://gdata.youtube.com/feeds/api/users/default/playlists?v=2
  • To request a feed of another user's playlists, send an HTTP GET request to the following URL. Note that this request does not require authentication.

    http://gdata.youtube.com/feeds/api/users/username/playlists?v=2

    In the URL above, you must replace the text username with the user's YouTube username.

User's subscriptions feed

A user's subscriptions feed contains a list of the channels, favorite video lists and search queries to which the user has subscribed.

  • To request a feed of the currently logged-in user's subscriptions, send an HTTP GET request to the following URL. Note: For this request, you must provide an authentication token in the Authorization HTTP request header. The authentication token enables YouTube to identify the user.

    http://gdata.youtube.com/feeds/api/users/default/subscriptions?v=2
  • To request a feed of another user's subscriptions, send an HTTP GET request to the following URL. Note that this request does not require authentication.

    http://gdata.youtube.com/feeds/api/users/username/subscriptions?v=2

    In the URL above, you must replace the text username with the user's YouTube username.

In a subscriptions feed, each entry contains information about a single subscription. Each entry contains the following key tags:

  • The <content> tag in the entry identifies the URL that allows you to retrieve videos for the subscription.

  • For one of the <category> tags in the entry, the scheme attribute value will be http://gdata.youtube.com/schemas/2007/subscriptiontypes.cat. That tag's term attribute indicates whether the entry describes a subscription to a channel (term="channel"), another user's favorite videos list (term="favorites"), or to videos that match specific keywords (term="query").

  • If the subscription is to another user's channel or list of favorite videos, the <yt:username> tag will identify the user who owns the channel or favorite video list.

    If the subscription is to a keyword query, the <yt:queryString> element will contain the subscribed-to query term.

Video comments feed

Each video entry contains a <gd:comments> tag, which encapsulates the URL to which you will send API requests to retrieve or append to the list of comments for the video. The sample XML below shows how this URL appears in a video feed:

<feed>
  <entry>
    ...
    <media:group>
      ...
    </media:group>
    <gd:comments>
      <gd:feedLink href='http://gdata.youtube.com/feeds/api/videos/VIDEO_ID/comments'/>
    </gd:comments>
  </entry>
</feed>

Each entry in the comments feed contains information about a single comment. Each comment has an author, a title, content, and an in-reply-to link.

User profile entry

A user profile contains information that the user lists on his YouTube profile page.

  • To request the currently logged-in user's profile, send an HTTP GET request to the following URL. Note: For this request, you must provide an authentication token in the Authorization HTTP request header. The authentication token enables YouTube to identify the user.

    http://gdata.youtube.com/feeds/api/users/default?v=2
  • To request another user's profile, send an HTTP GET request to the following URL. Note that this request does not require authentication.

    http://gdata.youtube.com/feeds/api/users/username?v=2

    In the URL above, you must replace the text username with the user's YouTube username. Depending on the type of YouTube API response you are working with, usernames will appear in either the <name> tag or the <yt:username> tag.

Note: Whereas many API responses contain information about the response feed and a list of entries, the request to retrieve a profile only contains a single entry. As such, the root tag in the API response for this request is <entry>.

User's contacts feed

A user's contacts feed lists all of the contacts for a specified user.

  • To request the currently logged-in user's contact list, send an HTTP GET request to the following URL. Note: For this request, you must provide an authentication token in the Authorization HTTP request header. The authentication token enables YouTube to identify the user.

    http://gdata.youtube.com/feeds/api/users/default/contacts?v=2
  • To request another user's contact list, send an HTTP GET request to the following URL. Note that this request does not require authentication.

    http://gdata.youtube.com/feeds/api/users/username/contacts?v=2

    In the URL above, you must replace the text username with the user's YouTube username.

Contacts can be classified as either Friends or Family.

Navigating between feeds

Every feed and entry contains <link rel="relationshipID">, <content> and <gd:feedLink rel="relationshipID"> elements that specify links to related feeds or entries. These tags identify URLs that enable you to implement API functionality without hardcoding URLs into your application.

  • A <link> tag identifies a relationship between related, but not nested, feeds. For example, the following <link> element, which might appear in a video entry, provides a link to a feed that contains video responses for that entry.

    <link rel="http://gdata.youtube.com/schemas/2007#video.responses" 
        type="application/atom+xml" 
        href="http://gdata.youtube.com/feeds/api/videos/UwOA8H5Vaak/responses?v=2"/>
    

  • A <content> tag specifies the feed URL that corresponds to an entry in a subscriptions feed or a playlists feed – i.e. the tag specifies the feed URL for an individual subscription or playlist. For example, the following <content> element might appear in an entry in a subscriptions feed. This tag identifies the URL from which you would retrieve a feed of videos for the subscription.

    <content type='application/atom+xml'
      src='http://gdata.youtube.com/feeds/api/users/nbc/uploads?v=2'/>
    

  • A <gd:feedLink> tag identifies a feed that might otherwise be nested within the original response except for the fact that actually nesting the feeds would make the feed too large. For example, the following <gd:feedLink> element might appear in a user profile entry. This tag identifies the URL from which you would retrieve a feed of that user's contacts.

    <gd:feedLink 
        rel="http://gdata.youtube.com/schemas/2007#user.contacts" 
        href="http://gdata.youtube.com/feeds/api/users/liz/contacts?v=2"/>
    

The use cases in the Developer's Guide attempt to explain how to navigate between the different feeds.

Paging through results

API responses use <link> tags to identify pagination links for the previous and/or next page of entries in a feed. To avoid pagination problems, we recommend that you use these links to enable users to link to different pages of API results.

  • If a feed contains a previous page of results, the API response will contain a <link> tag with a rel attribute value of previous.
  • If a feed contains a next page of results, the API response will contain a <link> tag with a rel attribute value of next.

The API uses the start-index and max-results request parameters to determine which results to include in an API response. In addition, API responses use the <openSearch:totalResults> tag to approximate the total number of entries in a feed, and the <openSearch:startIndex> and <openSearch:itemsPerPage> tags to specify the particular entries in the API response. For example, the following tags indicate that an API response contains the 26th to 50th entries of a total result set of 107 items. (The response starts with item 26 and contains 25 items.)

<openSearch:startIndex>26</openSearch:startIndex>
<openSearch:itemsPerPage>25</openSearch:itemsPerPage>
<openSearch:totalResults>107</openSearch:totalResults>

In this example, the response would also contain two <link> tags, one for the previous page of 25 results (entries 1-25) and another for the next page of 25 results (entries 51-75). Each <link> tag specifies a feed URL with the correct values for the start-index and max-results request parameters.

<link rel='previous' type='application/atom+xml'
  href='http://gdata.youtube.com/feeds/api/videos?start-index=1&max-results=25...'/>
<link rel='next' type='application/atom+xml'
  href='http://gdata.youtube.com/feeds/api/videos?start-index=51&max-results=25...'/>

HTTP response codes for YouTube Data API requests

This section explains the HTTP response codes that YouTube returns for different types of API requests.

Retrieving feeds

  • A 200 response code indicates that YouTube successfully handled an HTTP GET request to retrieve a feed.

  • A 400 response code identifies a bad request. For example, you will receive a 400 response code if you submit a request to the wrong URL or include an unsupported or nonexistent parameter in your request. The API response content will explain the reason wny the API returned a 400 response code.

Uploading a video

  • Browser-based uploading

    • 200 - The API returns a 200 response code in two cases:

      • You successfully upload a video's metadata. The Uploading video metadata section of the developer's guide explains this process in more detail.

      • Your request to upload the video file does not actually specify the file being uploaded. In this case, the API directs you to a page that says "No file found in upload request." To avoid this error case, your application should require the user to select a file before allowing the user to submit the form to upload the video as described in the instructions for uploading a video file for browser-based uploads.

    • 301 - When the user uploads his actual video file directly to YouTube via the form on your site, YouTube will send a 301 redirect to the user's browser, causing the browser to request and load the URL that you had specified with the nexturl parameter in your upload form. (Learn more about the upload form.) YouTube will append the following variables to that URL, and you need to extract those variables to provide the appropriate user experience:

      • id - This request parameter identifies the video ID of a newly created video.
      • status - This request parameter indicates whether the user successfully uploaded the video. The value will be 200 if the video was uploaded successfully and a 4xx or 5xx (e.g. 400, 403, 503, etc.) if the upload was unsuccessful.
      • code - This request parameter provides additional detail about why an upload failed. Possible values for this parameter include "INVALID_TOKEN", "MISSING_TOKEN", "DUPLICATE" and "TOKEN_EXPIRED".

  • Direct uploading

    • 201 - The API returns a 201 response code if your video uploads successfully.

    • 400 (Bad request) - A 400 response code indicates that a request was poorly formed or contained invalid data. For example, the API would return a 400 response code if your request contained poorly formed XML or if you tried to submit keywords containing invalid characters.

Adding information via HTTP POST

The API returns the following response codes for requests to add resources such as ratings, comments, video responses, complaints, favorite videos, playlists, playlist entries, subscriptions and contacts.

  • 201 (Created) - A 201 response code indicates that an HTTP POST request to add a rating, comment, complaint, video response, subscription, playlist or contact was successfully handled.

  • 400 (Bad request) - A 400 response code indicates that a request was poorly formed or contained invalid data. For example, the API would return a 400 response code if your request contained poorly formed XML or if you tried to submit a rating of "16" for a video since the rating must be between 1 and 5. The API response content will explain the reason wny the API returned a 400 response code.

Updating information via HTTP PUT

The API returns the following response codes for requests to update resources such as videos, playlists, playlist entries and contacts:

  • 200 (OK) - A 200 response code indicates that YouTube successfully handled an HTTP PUT request to update a resource.

  • 400 (Bad request) - A 400 response code indicates that a request was poorly formed or contained invalid data. The API response content will explain the reason wny the API returned a 400 response code.

Deleting resources via HTTP DELETE

The API returns the following response codes for requests to delete resources such as videos, video responses, favorite videos, playlists, playlist entries, subscriptions and contacts.

  • 200 (OK) - A 200 response code indicates that YouTube successfully handled an HTTP DELETE request to delete a resource.

  • 401 (Not authorized) - A 401 response code indicates that a request did not contain an Authorization header, that the format of the Authorization header was invalid, or that the authentication token supplied in the header was invalid.

  • 403 (Forbidden) - A 403 response code indicates that you have submitted a request that is not properly authenticated for the requested operation.

  • 404 (Not found) - A 404 response code indicates that you have tried to modify a resource that does not exist. For example, you would receive a 404 response code if you tried to delete a subscription but you specified the wrong URL for the subscription.

Additional response codes for unsuccessful requests

The API may also return the following response codes:

  • 401 (Not authorized) - A 401 response code indicates that a request did not contain an Authorization header, that the format of the Authorization header was invalid, or that the authentication token supplied in the header was invalid.

  • 403 (Forbidden) - A 403 response code indicates that you have submitted a request that is not properly authenticated for the requested operation.

  • 500 (Internal error) - A 500 response code indicates that YouTube experienced an error handling a request. You could retry the request at a later time.

  • 501 (Not implemented) - A 501 response code indicates that you have tried to execute an unsupported operation, such as retrieving a list of ratings or updating a complaint.

  • 503 (Service unavailable) - A 503 response code indicates that the YouTube Data API service can not be reached. You could retry your request at a later time.

Searching for videos

This section explains how to use the API to retrieve a list of videos matching a user-specified search term. To search for videos, submit an HTTP GET request to the following URL, appending the appropriate query parameters to your request:

http://gdata.youtube.com/feeds/api/videos

For example, a request to the following URL searches for the second set of 10 recently uploaded videos matching the query term "football" but not matching the query term "soccer":

http://gdata.youtube.com/feeds/api/videos?
    q=football+-soccer
    &orderby=published
    &start-index=11
    &max-results=10
    &v=2

Query parameter definitions

Standard Google Data API parameters

The YouTube Data API supports the following standard Google Data query parameters.

Name Definition
alt The alt parameter specifies the format of the feed to be returned. Valid values for this parameter are atom, rss, json, and json-in-script. The default value is atom and this document only explains the format of Atom responses. For more information about using API responses in JavaScript, please see Using JSON with Google Data APIs.

If you set the parameter value to json-in-script, then you must also set the callback parameter value to identify the callback function to which the API response will be sent.
author In a search request, the author parameter restricts the search to videos uploaded by a particular YouTube user. Note that if you use this parameter when requesting a standard feed, then YouTube will retrieve the standard feed and then filter the response to only include videos uploaded by the specified author. For example, if you request the "Top Rated" feed for user GoogleDevelopers, the API will retrieve the top-rated feed and return a response containing videos in that feed uploaded by user GoogleDevelopers. The API will not return a list of that user's videos ordered by rating.

In a request for a user activity feed, the author parameter contains a comma-separated list of up to 20 YouTube usernames. The API response will contain activities performed by any of those users.
callback The callback parameter, which is only used if the value of the alt parameter is json-in-script, identifies the callback function to which the API response will be sent.
max-results The max-results parameter specifies the maximum number of results that should be included in the result set. This parameter works in conjunction with the start-index parameter to determine which results to return. For example, to request the second set of 10 results – i.e. results 11-20 – set the max-results parameter to 10 and the start-index parameter to 11. The default value of this parameter is 25, and the maximum value is 50. However, for displaying lists of videos, we recommend that you set the max-results parameter to 10.
prettyprint The prettyprint parameter lets you request an XML response formatted with indentations and line breaks. Set the parameter's value to true to have the response formatted as such. The default parameter value is false.
start-index The start-index parameter specifies the index of the first matching result that should be included in the result set. This parameter uses a one-based index, meaning the first result is 1, the second result is 2 and so forth. This parameter works in conjunction with the max-results parameter to determine which results to return. For example, to request the second set of 10 results – i.e. results 11-20 – set the start-index parameter to 11 and the max-results parameter to 10.
strict The strict parameter can be used to instruct YouTube to reject an API request if the request contains invalid request parameters. The default API behavior is to ignore invalid request parameters. If you want YouTube to reject API requests that contain invalid parameters, set the strict parameter value to true. For example, YouTube would reject the following request because "foo" is not a valid request parameter.
http://gdata.youtube.com/feeds/api/videos?foo=nonono&strict=true
v The v parameter specifies the version of the API that YouTube should use to handle the API request. Your request can specify the desired API version using either the v parameter or the GData-Version HTTP request header. All Google-provided client libraries always select a major API version. If your request does not specify an API version, YouTube will handle your request using API version 1. Please see the API versioning section for more information about specifying an API version.

Please see the Google Data APIs Protocol Reference for more information about standard Google Data API functionality or about these specific parameters.

Custom parameters for the YouTube Data API

In addition to the standard Google Data query parameters, the YouTube Data API defines the following API-specific query parameters:

Parameters for all API requests:
client
key

Search parameters:
caption
category
format
location
location-radius
lr
orderby
q
safeSearch
time
uploader
Additional parameters for all video feeds:
restriction

In general, parameters that are used for filtering and ordering results are only supported for search requests. However, the API also supports the time parameter for many standard feeds, the author parameter for user activity feeds, and the restriction parameter for video feeds. Please see the Testing and troubleshooting section for tips on how to filter API response feeds that do not support these parameters.

The following table defines each of these parameters:

Name Definition
caption The caption parameter, which is specified without a value, restricts the search to videos that have caption tracks. The example below shows how to request videos that have captions and that match the search term "surfing":
http://gdata.youtube.com/feeds/api/videos?q=surfing&caption&v=2

The API will return an HTTP 400 response if you specify the parameter with a value.
category The category parameter enables you to retrieve videos that are in a particular category or are tagged with a particular keyword or developer tag. You can also insert category names, keywords and developer tags into the request URL as described in the Category search in video feeds section. That section provides instructions for formatting the category parameter value for a variety of different types of queries.

YouTube supports this parameter for video search requests.
client The client parameter is an alphanumeric string that identifies your application. The client parameter is an alternate way of specifying your client ID. You can also use the X-GData-Client request header to specify your client ID. Your application does not need to specify your client ID twice by using both the client parameter and the X-GData-Client request header, but it should provide your client ID using at least one of those two methods.
format The format parameter specifies that videos must be available in a particular video format. Your request can specify any of the following formats:

Value Video Format
1 RTSP streaming URL for mobile video playback. H.263 video (up to 176x144) and AMR audio.
5 HTTP URL to the embeddable player (SWF) for this video. This format is not available for a video that is not embeddable. Developers commonly add &format=5 to their queries to restrict results to videos that can be embedded on their sites.
6 RTSP streaming URL for mobile video playback. MPEG-4 SP video (up to 176x144) and AAC audio.


YouTube supports this parameter for video search requests.
key The key parameter specifies your developer key, an alphanumeric string that identifies the developer or company making an API request. You can also use the X-GData-Key request header to specify your developer key. Your application does not need to specify your developer key twice by using both the key parameter and the X-GData-Key request header, but it should provide your developer key using at least one of those two methods.
location The location parameter restricts the search to videos that have a geographical location specified in their metadata. The parameter can be used in either of the following contexts:

  • The parameter value can specify geographic coordinates (latitude,longitude) that identify a particular location. In this context, the location parameter operates in conjunction with the location-radius parameter to define a geographic area. The API response will then contain videos that are associated with a geographical location within that area.

    Note that when a user uploads a video to YouTube, the user can associate a location with the video by either specifying geographic coordinates (-122.08427,37.42307) or by providing a descriptive address (Munich, Germany). As such, some videos may be associated with a location within the area specified in a search query even though those videos are not associated with specific coordinates that can be plotted on a map.

    To exclude videos from the API response if those videos are associated with a descriptive address but not with specific geographic coordinates, append an exclamation point ("!") to the end of the parameter value. This practice effectively ensures that all videos in the API response can be plotted on a map.

    The following examples show sample uses of this parameter:

    location=37.42307,-122.08427&location-radius=100km
    location=37.42307,-122.08427!&location-radius=100km
    

    In an API response, feed entries that are associated with specific coordinates will contain the <georss:where> tag and may also contain the <yt:location> tag. Feed entries that are associated with a descriptive address but not with specific geographic cooordinates specify the address using the <yt:location> tag.

  • The parameter value can be empty or a single exclamation point. In this context, the parameter does not require a value and its presence serves to restrict the search results to videos that have a geographical location, but it does not enable you to find videos with a specific geographical location. This parameter can be used with all video feeds. A video that has a geographical location will have a <georss:where> tag in its metadata.


YouTube supports this parameter for video search requests.
location-radius The location-radius parameter, in conjunction with the location parameter, defines a geographic area. If the geographic coordinates associated with a video fall within that area, then the video may be included in search results.

The location-radius parameter value must be a floating point number followed by a measurement unit. Valid measurement units are m, km, ft and mi. For example, valid parameter values include "1500m", "5km", "10000ft" and "0.75mi". The API will return an error if the radius is greater than 1000 kilometers.

YouTube supports this parameter for video search requests.
lr In a video search request, the lr parameter restricts the search to videos that have a title, description or keywords in a specific language. This parameter can be used when requesting any video feeds other than standard feeds.

In a request to retrieve a list of the caption tracks available for a video, the lr parameter filters the list of caption tracks to only include the specified language.

Valid values for the lr parameter are ISO 639-1 two-letter language codes. You can also use the values zh-Hans for simplified Chinese and zh-Hant for traditional Chinese.
orderby The orderby parameter, which is only supported for video feeds, specifies the value that will be used to sort videos in the search result set. Valid values for this parameter are relevance, published, viewCount and rating. In addition, you can request results that are most relevant to a specific language by setting the parameter value to relevance_lang_languageCode, where languageCode is an ISO 639-1 two-letter language code. (Use the values zh-Hans for simplified Chinese and zh-Hant for traditional Chinese.) In addition, please note that results in other languages will still be returned if they are highly relevant to the search query term.

The default value for this parameter is relevance for a search results feed.

Note: For a playlist feed, the default ordering is based on the position of each video in the playlist. For a user's playlists or subscriptions feed, the default ordering is arbitrary.

YouTube supports this parameter for video search requests.
q The q parameter specifies a search query term. YouTube will search all video metadata for videos matching the term. Video metadata includes titles, keywords, descriptions, authors' usernames, and categories.

Note that any spaces, quotes or other punctuation in the parameter value must be URL-escaped.

To search for an exact phrase, enclose the phrase in quotation marks. For example, to search for videos matching the phrase "spy plane", set the q parameter to %22spy+plane%22.

Your request can also use the Boolean NOT (-) and OR (|) operators to exclude videos or to find videos that are associated with one of several search terms. For example, to search for videos matching either "boating" or "sailing", set the q parameter to boating%7Csailing. (Note that the pipe character must be URL-escaped.) Similarly, to search for videos matching either "boating" or "sailing" but not "fishing", set the q parameter to "boating&7Csailing+-fishing".
restriction The restriction parameter identifies the IP address that should be used to filter videos that can only be played in specific countries. We recommend that you always use this parameter to specify the end user's IP address. (By default, the API filters out videos that cannot be played in the country from which you send API requests. This restriction is based on your client application's IP address.)

To request videos playable from a specific computer, include the restriction parameter in your request and set the parameter value to the IP address of the computer where the videos will be played – e.g. restriction=255.255.255.255.

To request videos that are playable in a specific country, include the restriction parameter in your request and set the parameter value to the ISO 3166 two-letter country code of the country where the videos will be played – e.g. restriction=DE.

You should include this parameter in any request to retrieve a list of videos, including search results, playlists, favorite videos, video responses and so forth. If a video in the API response is not playable in the location that you're using to restrict availability of the content, the <entry> for that tag will not contain a <media:content> tag. However, it will contain a <yt:state> tag that indicates that the video is restricted.
safeSearch The safeSearch parameter indicates whether the search results should include restricted content as well as standard content. YouTube will determine whether content is restricted based on the user's IP address or location, which you specify in your API request using the restriction parameter. If you do request restricted content, then feed entries for videos that contain restricted content will contain the <media:rating> element.

The following values are valid for this parameter:
Value Description
none YouTube will not perform any filtering on the search result set.
moderate YouTube will filter some content from search results and, at the least, will filter content that is restricted in your locale. Based on their content, search results could be removed from search results or demoted in search results. Note: The default value for the safeSearch parameter is moderate.
strict YouTube will try to exclude all restricted content from the search result set. Based on their content, search results could be removed from search results or demoted in search results.
SafeSearch filtering for the YouTube Data API is designed to function similarly to SafeSearch Filtering for Google WebSearch results. Please note that YouTube makes every effort to remove restricted content from search results in accordance with the SafeSearch setting that you specify. However, filters may not be 100% accurate and restricted videos may occasionally appear in search results even if you have specified strict SafeSearch filtering. If this happens, please flag the video by filing a complaint, which will help us to better identify restricted content.

Note: The safeSearch parameter was introduced in version 2 of the YouTube Data API and replaced the racy parameter, which was used in version 1.

YouTube supports this parameter for video search requests.
time The time parameter restricts the search to videos uploaded within the specified time. Valid values for this parameter are today (1 day), this_week (7 days), this_month (1 month) and all_time. The default value for this parameter is all_time.

This parameter is supported for search feeds as well as for the top_rated, top_favorites, most_viewed, most_popular, most_discussed and most_responded standard feeds.
uploader The uploader parameter, which is only supported for search requests, lets you restrict a query to YouTube partner videos. A YouTube partner is a person or organization that has been accepted into and participates in the YouTube Partner Program. The uploader parameter's value must be partner.

In an API response, a feed entry contains a partner video if the entry contains a <media:credit> tag for which the value of the yt:type attribute is partner.
<media:credit role="uploader" scheme="urn:youtube
  yt:type="partner">partner_name</media:credit>

YouTube supports this parameter for video search requests.

Category search in video feeds

YouTube videos can be categorized in the following ways:

  • Each video can be associated with one predefined YouTube category, such as Comedy, Music, News or Sports. A video's category is identified by the <media:category> tag and by the <category> tag for which the value of the scheme attribute is http://gdata.youtube.com/schemas/2007/categories.cat.

  • Each video can be associated with an arbitrary number of keywords, which are also known as tags. A video's tags are identified using the <media:keywords> tag in API requests and responses. Keyword tags are also identified by <category> tags for which the value of the scheme attribute is http://gdata.youtube.com/schemas/2007/keywords.cat.

  • Each video can also be associated with an arbitrary number of developer tags. You can search for videos using developer tags. However, developer tags are not displayed on YouTube's website and you should not display them in your application. A video's developer tags are identified in <media:category> and <category> tags for which the value of the scheme attribute is http://gdata.youtube.com/schemas/2007/developertags.cat.

    Please see the developer's guide for more information about assigning developer tags.

The YouTube Data API supports two different methods for retrieving videos that are in a particular category or that are labeled with a specific keyword or developer tag.

  • Use the following URL to retrieve videos that are in a specific category or that are labeled with a specific keyword or developer tag. The hyphen (-) in the URL is a standard Google Data API notation that indicates that the rest of the URL consists of a series of one or more tags.

    http://gdata.youtube.com/feeds/api/videos/-/category_or_tag?v=2
    

    The following example shows the URL that you would use to request videos in the "Comedy" category:

    http://gdata.youtube.com/feeds/api/videos/-/Comedy?v=2
  • Specify the category, keyword or developer tags using the category parameter in the request URL. The following example shows the URL that you would use to request videos in the "Comedy" category:

    http://gdata.youtube.com/feeds/api/videos?category=Comedy&v=2

The following guidelines provide more detail about requesting videos associated with particular categories or tags:

  • If your request specifies a category and one or more keywords or if your request does not specify a category but does specify multiple keywords, separate each individual category and keyword name with a forward slash. (If you are using the category parameter, separate the different category and tag names with a comma. (The comma must be URL-encoded in your request.) For example, you could use either of the following URLs to request videos related to the keywords "bass" and "fishing":

    URL notation:
    http://gdata.youtube.com/feeds/api/videos/-/bass/fishing?v=2
    
    category parameter:
    http://gdata.youtube.com/feeds/api/videos?category=bass%2Cfishing&v=2
    
  • Your request can use the Boolean NOT (-) and OR (|) operators to exclude videos or to find videos that are associated with one of several keywords or categories. For example, if you wanted to display videos related to "bass" and "music", the most effective search might be for videos associated with the keyword "bass" but not associated with the keywords "fish" or "fishing" as shown in the example below. (Searching for videos associated with the "Music" category and the keyword "bass" might exclude instructional videos about how to play bass.)

    URL notation:
    http://gdata.youtube.com/feeds/api/videos/-/bass/-fish/-fishing?v=2
    
    category parameter:
    http://gdata.youtube.com/feeds/api/videos?category=bass%2C%2Dfish%2Dfishing&v=2
    

    The following example shows how to search for videos that are tagged with the keywords "Jesse" and "Ventura" and that are in either the "News" or "Sports" categories. The category names are separated by the value "%7C", which represents a URL-encoded pipe (|) character specifying that the video must be associated with one of the two categories:

    URL notation:
    http://gdata.youtube.com/feeds/api/videos/-/jesse/ventura/News%7CSports?v=2
    
    category parameter:
    http://gdata.youtube.com/feeds/api/videos?category=jesse%2Cventura%2CNews%7CSports&v=2
    
  • Capitalize the names of categories and lowercase the names of keywords. For example, the following query identifies videos associated with the keyword "comedy" that are not in the "Comedy" category:

    URL notation:
    http://gdata.youtube.com/feeds/api/videos/-/comedy/-Comedy?v=2
    
    category parameter:
    http://gdata.youtube.com/feeds/api/videos?category=comedy%2C%2DComedy&v=2
    
  • If you are generating category or keyword searches automatically based on the information in an API response, specify the schema as part of the category name to clearly differentiate YouTube categories from keyword tags or developer tags. The following URLs demonstrate how to specify the schema in the category name. (Note that each URL should actually appear on one line but has been split into multiple lines for printing purposes.)

    Categories:
      URL notation:
      http://gdata.youtube.com/feeds/api/videos/-/
        %7Bhttp%3A%2F%2Fgdata.youtube.com%2Fschemas%2F2007
        %2Fcategories.cat%7DNews?v=2
    
      category parameter:
      http://gdata.youtube.com/feeds/api/videos?category=
        %7Bhttp%3A%2F%2Fgdata.youtube.com%2Fschemas%2F2007
        %2Fcategories.cat%7DNews&v=2
    
    Keywords:
      URL notation:
      http://gdata.youtube.com/feeds/api/videos/-/
        %7Bhttp%3A%2F%2Fgdata.youtube.com%2Fschemas%2F2007
        %2Fkeywords.cat%7Ddog?v=2
    
      category parameter:
      http://gdata.youtube.com/feeds/api/videos?category=
        %7Bhttp%3A%2F%2Fgdata.youtube.com%2Fschemas%2F2007
        %2Fkeywords.cat%7Ddog&v=2
    
    Developer tags:
      URL notation:
      http://gdata.youtube.com/feeds/api/videos/-/
        %7Bhttp%3A%2F%2Fgdata.youtube.com%2Fschemas%2F2007
        %2Fdevelopertags.cat%7Dexample.com?v=2
    
      category parameter:
      http://gdata.youtube.com/feeds/api/videos?category=
        %7Bhttp%3A%2F%2Fgdata.youtube.com%2Fschemas%2F2007
        %2Fdevelopertags.cat%7Dexample.com&v=2
    
  • Always specify the schema, as explained in the previous item, if you are requesting videos associated with a particular developer tag.

Spelling suggestions in API responses

API responses may contain suggested alternate spellings for the search query term specified in your request. For example, a user who entered the search term flowrs – note the missing "e" in the word – might actually be looking for videos matching the term flowers. By displaying a link to search results matching the spelling suggestion, you can enable users (and particularly users who are not the best spellers) to more easily locate relevant videos.

If YouTube identifies a suggested alternate spelling for a query term, the corresponding API response will contain a <link> tag for which the rel attribute value is http://schemas.google.com/g/2006#spellcorrection. The value of that tag's title attribute will be the suggested alternate spelling for the search query term. For example, the tag below shows a suggested alternate spelling for the term flowrs.

<link rel='http://schemas.google.com/g/2006#spellcorrection'
  type='application/atom+xml'
  href='http://gdata.youtube.com/feeds/api/videos?q=flowers&amp;oi=spell&amp;spell=1&amp;v=2'
  title='flowers'/>

XML element definitions

The YouTube Data API uses tags from multiple XML schemas. The following table identifies the different schemas that the API uses, the namespace prefix associated with each schema, and the namespace URL for each schema.

Schema Namespace Prefix Schema URL
Atom Syndication Format [None] - this is the default namespace http://www.w3.org/2005/Atom
Open Search Schema openSearch http://a9.com/-/spec/opensearch/1.1/
Media RSS media http://search.yahoo.com/mrss/
YouTube XML Schema yt http://gdata.youtube.com/schemas/2007
Google Data Schema gd http://schemas.google.com/g/2005
GeoRSS georss http://www.georss.org/georss
Geography Markup Language gml http://www.opengis.net/gml
Atom Publishing Protocol app http://www.w3.org/2007/app
Google Data API Batch Processing batch http://schemas.google.com/gdata/batch

The following tables define the XML tags from each of these schemas that appear in YouTube Data API requests and responses. Each table contains the definition for a single tag, and tags are listed in alphabetical order by schema.

Atom elements reference
 
OpenSearch elements reference
 
YouTube elements reference
 
Media RSS elements reference
 
GData elements reference
 
GeoRSS elements reference
 
GML elements reference
 
Atom Publishing Protocol element reference
 
Browser-based upload API response elements reference
 
Batch processing element reference
 
Error response element reference
 

Certain symbols may be displayed next to some child tags in the definitions below. These symbols, and their meanings, are:

? = optional child tag
* = zero or more instances of the child tag
+ = one or more instances of the child tag

Atom elements reference

author

The <author> tag usually contains information about the YouTube user who owns a piece of video content, a subscription, a list of favorite videos, a contact or other entity. However, the <author> tag has a different meaning in the following feeds:

  • In a favorite videos feed entry, the <author> tag identifies the user who marked the video as a favorite.
  • In a playlist feed entry, the <author> tag contains information about the YouTube user who created the playlist entry.
  • In an inbox feed entry, the <author> contains information about the YouTube user who sent the inbox entry.
In all of these cases, the <media:credit> tag identifies the video owner.

Example

<author>

Child of

feed, entry

Children

name, uri?

category

The <category> tag specifies the category to which the entry belongs.

  • When the <category> tag appears as a subtag of either <feed> or <entry>, the tag can identify the type of item described in each feed entry. The value of the scheme attribute is http://schemas.google.com/g/2005#kind and the value of the term attribute indicates whether feed entries describe videos, playlist links, subscriptions, contacts or another entity type.

  • When the <category> tag appears as a subtag of <entry> and the entry describes a video, the tag can also specify a particular keyword or category associated with that video. In this case, the scheme attribute indicates whether the term attribute value refers to a keyword or a category.


The <category> tag is required in requests to add a subscription or to add or update a contact:
  • In a request to add a subscription, the <category> tag indicates whether the user is subscribing to a channel, another user's list of favorites, a playlist or a keyword tag.

  • In a request to add or update a contact, the <category> tag indicates whether the contact is a friend or family.

Attributes

NameFormatDescription
scheme Text (URI) The scheme attribute specifies a URI that identifies the categorization scheme associated with the label.
  • In a request to add a subscription, the value of the scheme attribute must be http://gdata.youtube.com/schemas/2007/subscriptiontypes.cat.
  • In a request to add a contact, the value of the scheme attribute must be http://gdata.youtube.com/schemas/2007/contact.cat.
  • If the <category> tag identifies the YouTube category associated with the video, the value of the scheme attribute must be http://gdata.youtube.com/schemas/2007/categories.cat.
term Text The term attribute identifies the type of entity contained in a feed entry or a category or keyword associated with a video.
  • In a request to add a subscription, the value of the term attribute may be channel, favorites, playlist or query.
  • In a friend activity feed, the value of the term attribute may be user_favorited, user_rated, user_shared or user_uploaded.
label Text The label attribute specifies the entity-escaped name of the YouTube category to which the video belongs. This attribute is only included in <category> tags that refer to a category (and not a keyword or entity type). Please refer to the Category list for uploaded videos section for more information.

Example

<category scheme='http://gdata.youtube.com/schemas/2007/subscriptiontypes.cat' term='channel'/>

Child of

feed, entry

content

The <content> tag contains the text of a comment or a description of a video or playlist. When the <content> tag appears in a video entry or playlist entry, it may contain the same description as the <media:description> tag.

The <content> tag is required in a request to add a comment.

Example

<content type="text">Video comments are cool.</content>

Child of

entry

entry

The <entry> tag encapsulates information about a video, playlist, subscription, contact or other entity. The <entry> tag is the root tag in all YouTube Data API requests to add (POST) or update (PUT) data.

Example

<entry>

Child of

feed

Children

The lists below identify possible subtags of the <entry> tag for different retrieve (GET), create (POST) and update (PUT) API operations. For example, when you retrieve a playlist feed, each entry contains many different fields. However, when you create or update a playlist entry, you only need to provide the title, description and playlist position for the entry.

GET operations

POST and PUT operations

If the <entry> tag appears in a batch processing request, then it might also include the <batch:operation> <batch:id> tags.

If the <entry> tag appears in a response to a batch processing request, then it will also include the <batch:operation> and <batch:status> tags and it may also include the <batch:id> and <batch:interrupted> tags.

feed

The <feed> tag is the root tag for several types of YouTube Data API feeds, including video feeds, subscription feeds, playlist feeds, favorite video feeds and contact feeds. A feed contains a series of <entry> elements, each of which contains information about a single video, playlist, subscription or other entity.

Example

<feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:gml='http://www.opengis.net/gml' xmlns:georss='http://www.georss.org/georss xmlns:media='http://search.yahoo.com/mrss/' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:yt='http://gdata.youtube.com/schemas/2007' xmlns:gd='http://schemas.google.com/g/2005'>

Children

id, updated, category*, title, subtitle?, logo?, link*, author?, generator?, openSearch:itemsPerPage?, openSearch:startIndex?, openSearch:totalResults?, batch:operation?, entry*

generator

The <generator> tag identifies the software used to create the feed. This information might be used for debugging purposes.

Attributes

NameFormatDescription
version Text The version attribute specifies the version of the software application used to generate the feed.
uri Text (URI) The uri attribute specifies a URI related to the feed-generating software.

Example

<generator version='beta' uri='http://gdata.youtube.com/'>YouTube data API</generator>

Child of

feed

id

The <id> tag specifies a URN that uniquely and permanently identifies a feed or video entry.

Example

<id>tag:youtube,2008:video:24Ryj1ywosw</id>

Child of

feed, entry

link

The <link> tag contains an IRI reference that is relevant to a feed or a feed entry.

Attributes

NameFormatDescription
rel Text The rel attribute indicates how the URI specified in the href attribute is related to the current result set:

  • If the rel attribute value is self, then the link identifies the URL that you would use to retrieve information about the feed or a particular entry in the feed.

  • If the rel attribute value is edit, then the link identifies the URL that you would use to modify a feed entry.

  • If the rel attribute value is alternate, then the link identifies a URL that presents a different representation of the feed, such as a link to the HTML representation of that feed entry.

  • If the rel attribute value is previous, then the link points to the previous page of the feed's result set.

  • If the rel attribute value is next, then the link points to the next page of the feed's result set.

  • If the rel attribute value is related, then the link identifies another feed that is related to the current feed. For example, if the feed contains a list of contact entries, then the related link for a contact might point to the feed for that contact's profile.

  • The rel attribute may also contain a link to a schema that identifies the type of entity related to the corresponding link. For example, a video entry contains <link> tags that point to caption tracks, responses, ratings, complaints and related videos for that video. Some of these <link> tags can be used to retrieve additional feeds, such as related videos and video responses, while others can be used to post data, such as a rating or complaint.

type Text The type attribute specifies the media type of the resource at the associated URL. The links in a YouTube Data API response typically refer to either an HTML page or another API response (Atom feed). As such, the most common values for the type attribute are text/html and application/atom+xml.
href Text (URI) The href attribute specifies a URI that identifies the resource identified in the <link> tag.
yt:hasEntries Boolean The yt:hasEntries attribute indicates whether the feed identified in the <link> tag is an empty feed. The feed is empty if the yt:hasEntries attribute value is false.

Example

<link rel='http://gdata.youtube.com/schemas/2007#video.related' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/AlPqL7IUT6M/related'/>

Child of

feed, entry

logo

The <logo> tag specifies an image that provides visual identification for the feed. The logo in a YouTube Data API feed is the YouTube logo.

Example

<logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo>

Child of

feed

name

The <name> tag contains the author's YouTube username.

Example

<name>andyland74</name>

Child of

author

published

The <published> tag specifies the time that a feed entry was created. Times are specified in UTC.

Example

<published>2007-10-15T15:39:34.000-07:00</published>

Child of

entry

subtitle

The <subtitle> tag contains a description of a playlist.

Example

<subtitle>My playlist description</subtitle>

Child of

feed

summary

The <summary> tag contains either the description that a user entered for a playlist, a custom description that a user entered for a video in a playlist, or the text of a complaint.

Example

<summary>Dan is getting ready for the game.</summary>

Child of

entry

title

The <title> tag provides a human-readable title for a feed or an entry in a feed. This tag is also required in a request to add a playlist, in which it specifies the title of the playlist to be added.

Example

<title>andyland74's Subscriptions</title>

Child of

feed, entry

updated

The <updated> tag specifies the time that a feed or feed entry was last updated.

Example

<updated>2007-10-15T15:39:34.000-07:00</updated>

Child of

feed, entry

uri

The <uri> tag contains a URL related to the author.

Example

<uri>http://gdata.youtube.com/feeds/api/users/andyland74</uri>

Child of

author

OpenSearch elements reference

openSearch:itemsPerPage

The <openSearch:itemsPerPage> tag indicates how many entries are in an API response.

Example

<openSearch:itemsPerPage>25</openSearch:itemsPerPage>

Child of

feed

openSearch:startIndex

The <openSearch:startIndex> tag identifies the one-based index of the first item returned in the feed.

Example

<openSearch:startIndex>1</openSearch:startIndex>

Child of

feed

openSearch:totalResults

The <openSearch:totalResults> tag identifies the number of items in the result set for the feed. Please note that the tag value is an approximation and may not represent an exact value. In addition, the maximum value for this tag is 1,000,000. You should not use this value to create pagination links. Use the <link rel="next"> and <link rel="prev"> tags to determine whether to show pagination links:

<link rel="next" type="application/atom+xml" href="http://gdata.youtube.com/feeds/videos?start-index=26&max-results=25"/>


If the feed contains a <link> tag for which the rel attribute value is next, then there is another page of results. Otherwise, the current page is the last page in the result set. Similarly, if the feed contains a <link> tag for which the rel attribute value is prev, then there is a previous page of results. Otherwise, the current page is the first page in the result set.

Example

<openSearch:totalResults>36</openSearch:totalResults>

Child of

feed

YouTube elements reference

yt:aboutMe

The <yt:aboutMe> tag contains whatever content the user entered in the "About Me" field of the user's YouTube profile. This tag appears in a user profile entry.

Example

<yt:aboutMe>I am very funny.</yt:aboutMe>

Child of

entry

yt:age

The <yt:age> tag specifies the user's age, which is calculated based on the birthdate provided for the user's YouTube profile. This tag appears in a user profile entry.

Example

<yt:age>33</yt:age>

Child of

entry

yt:aspectratio

The <yt:aspectratio> tag identifies the aspect ratio of a video. The only valid value for this tag is widescreen, which indicates that the video has an aspect ratio of, or very close to, 16:9. YouTube's standard video player has a 16:9 aspect ratio, and the player will frame a video with vertical bars (pillarboxing) or horizontal bars (letterboxing) when playing a non-widescreen video.

Note: At the time of this documentation change in June 2009, YouTube had recently begun to generate this tag, as appropriate, for newly uploaded videos. However, feed entries for older videos in the YouTube library may not include this tag even if those videos are widescreen. As such, the presence of this tag in a feed entry indicates that the video is a widescreen video, but the absence of the tag does not decisively indicate that the video is not a widescreen video.

Example

<yt:aspectratio>widescreen</yt:aspectratio>

Child of

media:group

yt:books

The <yt:books> tag identifies the user's favorite books as entered in the user's YouTube public profile. This tag appears in a user profile entry.

Example

<yt:books>Catch-22</yt:books>

Child of

entry

yt:company

The <yt:company> tag identifies the company that the user works for as entered by the user in the user's public YouTube profile. This tag appears in a user profile entry.

Example

<yt:company>Google</yt:company>

Child of

entry

yt:countHint

The <yt:countHint> specifies the number of entries in a playlist feed. The <yt:countHint> tag appears in the entries in a playlists feed, where each entry contains information about a single playlist.

Example

<yt:countHint>9</yt:countHint>

Child of

entry

yt:duration

The <yt:duration> tag specifies the duration of a video in seconds.

Attributes

NameFormatDescription
seconds Integer The seconds attribute indicates the duration, in seconds, of a video.

Example

<yt:duration seconds='344'/>

Child of

media:group

yt:firstName

The <yt:firstName> tag specifies the user's first name. This tag appears in a user profile entry.

Example

<yt:firstName>John</yt:firstName>

Child of

entry

yt:gender

The <yt:gender> tag specifies the user's gender as entered in the user's public YouTube profile. This tag appears in a user profile entry.

Example

<yt:gender>m</yt:gender>

Child of

entry

yt:hobbies

The <yt:hobbies> tag identifies the user's hobbies as entered in the user's YouTube public profile. This tag appears in a user profile entry.

Example

<yt:hobbies>Testing YouTube APIs</yt:hobbies>

Child of

entry

yt:hometown

The <yt:hometown> tag identifies the user's hometown as entered in the user's YouTube public profile. This tag appears in a user profile entry.

Example

<yt:hometown>Albany, GA</yt:hometown>

Child of

entry

yt:lastName

The <yt:lastName> tag specifies the user's last name. This tag appears in a user profile entry.

Example

<yt:lastName>Smith</yt:lastName>

Child of

entry

yt:location

In a video entry, the <yt:location> tag contains descriptive text about the location where the video was taken. In a user profile entry, the <yt:location> tag identifies the user's location as entered in the user's YouTube public profile.

Example

<yt:location>US</yt:location>

Child of

entry

yt:movies

The <yt:movies> tag identifies the user's favorite movies as entered in the user's YouTube public profile. This tag appears in a user profile entry.

Example

<yt:movies>Aqua Teen Hungerforce</yt:movies>

Child of

entry

yt:music

The <yt:music> tag identifies the user's favorite music as entered in the user's YouTube public profile. This tag appears in a user profile entry.

Example

<yt:music>Elliott Smith, the Kooks</yt:music>

Child of

entry

yt:noembed

The <yt:noembed> tag specifies that a video may not be embedded on other websites. This tag may be included in a request to upload or update a video's metadata. By default, videos can be embedded on other sites unless they are private videos. If a request does not include either the <yt:noembed> tag or the <yt:private> tag, a video will be embeddable on other websites.

Example

<yt:noembed/>

Child of

entry

yt:occupation

The <yt:occupation> tag identifies the user's occupation as entered in the user's public YouTube profile. This tag appears in a user profile entry.

Example

<yt:occupation>Technical writer</yt:occupation>

Child of

entry

yt:playlistId

The <yt:playlistId> tag identifies the value that YouTube uses to uniquely identify a playlist. This tag appears in a subscription feed entry that describes a playlist subscription.

Example

<yt:playlistId>C344114E1E41B2FA</yt:playlistId>

Child of

entry

yt:playlistTitle

The <yt:playlistTitle> tag identifies the title given to a playlist. This tag appears in a subscription feed entry that describes a playlist subscription.

Example

<yt:playlistTitle>Doritos You Make It We Play It</yt:playlistTitle>

Child of

entry

yt:position

The <yt:position> tag specifies the order in which a video appears in a playlist.

Example

<yt:position>4</yt:position>

Child of

entry

yt:private

The <yt:private> tag indicates that a video is private, meaning that the video will not be publicly visible on YouTube's website. A private video can only be viewed by people personally selected by the video's owner. This tag may be included in a request to upload or update a video's metadata. The tag should not specify a value. The tag's presence indicates that the video is private. The tag's absence indicates that the video will be visible to all YouTube users. By default, videos are publicly visible on YouTube. The tag's absence indicates that the video will be visible to all YouTube users. (By default, videos are visible to all YouTube users, and you must include the <yt:private> tag in all requests to upload or update a video to indicate that the video is private.)

Example

<yt:private/>

Child of

media:group

yt:queryString

The <yt:queryString> tag specifies the keyword(s), or query string, associated with a subscription.

Example

<yt:queryString>Dog skateboarding</yt:queryString>

Child of

entry

yt:recorded

The <yt:recorded> tag specifies the date that a video was recorded.

Example

<yt:recorded>2003-08-03</yt:recorded>

Child of

entry

yt:relationship

The <yt:relationship> tag indicates whether the user is in a relationship according to the information in the user's public YouTube profile.

Example

<yt:relationship>taken</yt:relationship>

Child of

entry

yt:school

The <yt:school> tag identifies the school that the user attended according to the information in the user's public YouTube profile. This tag appears in a user profile entry.

Example

<yt:school>University of North Carolina</yt:school>

Child of

entry

yt:state

The <yt:state> tag contains information that describes the status of a video that cannot be played. Video entries that contain a <yt:state> tag are not playable. The name and reasonCode attributes and the tag value provide insight into the reason why the video is not playable.

Attributes

NameFormatDescription
name Text The name attribute identifies the status of an unpublished video. Valid values for this tag are processing, restricted, deleted, rejected and failed.
reasonCode Text The reasonCode attribute provides information about a video's state. For example, the reasonCode could explain why a video upload request failed or how access to view a video is restricted. The <yt:state> tag will not include a reasonCode attribute if the value of the name attribute is processing. The following list identifies possible reasonCode values for restricted, rejected or failed uploads:

  • restricted

    • requesterRegion - The video is not available in the user's region.
    • limitedSyndication - The video is not and, based on the content owner's current preferences, will not be available to play in non-browser devices, such as mobile phones.
      • If a video entry contains a <yt:state> tag that specifies this code, then the video's owner has specified that the video should not be syndicated to mobile phones or other non-browser devices.
      • If a video entry does not contain either a <yt:state> tag with this code or a <media:content> tag that has a video object in the format needed for the user's device, then YouTube is still transcoding the video to be available in that format.
    • private - The video owner has restricted access to the video. This reasonCode signals that a video in a feed, such as a playlist or favorite videos feed, has been made a private video by the video's owner and is therefore unavailable.

  • rejected

    • copyright - The video commits a copyright infringement.
    • inappropriate - The video contains inappropriate content.
    • duplicate - The video is a duplicate of another uploaded video.
    • termsOfUse - The video commits a terms of use violate.
    • suspended - The account associated with the video has been suspended.
    • tooLong - The video exceeds the maximum duration of 10 minutes.
    • blocked - The video has been blocked by the content owner.

  • failed

    • cantProcess - YouTube is unable to convert the video file.
    • invalidFormat - The uploaded video is in an invalid file format.
    • unsupportedCodec - The video uses an unsupported codec.
    • empty - The uploaded file is empty.
    • tooSmall - The uploaded file is too small.

helpUrl Text The helpUrl parameter contains a link to a YouTube Help Center page that may help the developer or the video owner to find additional information about the video's state.

Example

<yt:state name="rejected" reasonCode="tooLong" helpUrl="http://www.youtube.com/t/community_guidelines">Video is too long</yt:state>

Child of

app:control

yt:statistics

The <yt:statistics> tag provides statistics about a video or a user. The <yt:statistics> tag is not provided in a video entry if the value of the viewCount attribute is 0. This tag appears in video, playlist and user profile entries.

Attributes

NameFormatDescription
viewCount Integer When the viewCount attribute refers to a video entry, the attribute specifies the number of times that the video has been viewed. When the viewCount attribute refers to a user profile, the attribute specifies the number of times that the user's profile has been viewed.
videoWatchCount Integer The videoWatchCount attribute specifies the number of videos that a user has watched on YouTube. The videoWatchCount attribute is only specified when the <yt:statistics> tag appears within a user profile entry.
subscriberCount Integer The subscriberCount attribute specifies the number of YouTube users who have subscribed to a particular user's YouTube channel. The subscriberCount attribute is only specified when the <yt:statistics> tag appears within a user profile entry.
lastWebAccess DateTime The lastWebAccess attribute indicates the most recent time that a particular user used YouTube.
favoriteCount Integer The favoriteCount attribute specifies the number of YouTube users who have added a video to their list of favorite videos. The favoriteCount attribute is only specified when the <yt:statistics> tag appears within a video entry.

Example

<yt:statistics viewCount='9' videoWatchCount='24' subscriberCount='1' lastWebAccess='2008-02-29T13:09:48.000-08:00'/>

Child of

entry

yt:status

The <yt:status> tag identifies the status of a contact. This tag only appears when you are retrieving contacts of the currently authenticated user. The following list identifies valid values for this tag:

  • The tag's value will be accepted if the authenticated user and the contact have marked each other as friends.
  • The tag's value will be requested if the contact has asked to be added to the authenticated user's contact list, but the request has not yet been accepted (or rejected).
  • The tag's value will be pending if the authenticated user has asked to be added to the contact's contact list, but the request has not yet been accepted or rejected.

Example

<yt:status>accepted</yt:status>

Child of

entry

yt:uploaded

The <yt:uploaded> tag specifies the time that a playlist entry was originally uploaded to YouTube.

Example

<yt:uploaded>2007-10-15T15:39:34.000-07:00</yt:uploaded>

Child of

media:group

yt:username

The <yt:username> tag specifies a YouTube username.

  • In a subscriptions feed or a request to add a subscription, the <yt:username> tag identifies the owner of the YouTube channel, the creator of the playlist or the owner of the favorites list that is being subscribed to.
  • In a profile entry, the <yt:username> tag identifies the user associated with the profile.
  • In a user contact entry, the <yt:username> tag identifies the contact of the logged-in user.
  • In an activity feed entry that describes a user adding another user as a friend or a user subscribing to another user's channel, the <yt:username> tag identifies the user who was added as a friend or the channel that was subscribed to.

Example

<yt:username>andyland74</yt:username>

Child of

entry

yt:videoid

The <yt:videoid> tag specifies a unique ID that YouTube uses to identify a video. In an activity feed entry, the <yt:videoid> tag identifies the video that was rated, shared, commented on, uploaded, or marked as a favorite.

Example

<yt:videoid>QbEwKcs-8Hc</yt:videoid>

Child of

media:group

Media RSS elements reference

media:category

The <media:category> tag specifies a genre or developer tag that describes a video resource. The Category List for Uploaded Videos section identifies YouTube video categories that may be associated with a video, and you may assign each video to one category in that list.

In addition, you may associate each video with one or more private categories or keywords using the category scheme http://gdata.youtube.com/schemas/2007/developertags.cat. Please see the Assigning Developer Tags section of the protocol document for more information about developer tags.

Attributes

NameFormatDescription
label Text The label attribute specifies the entity-escaped name of the YouTube category to which the video belongs.
scheme Text (URI) The scheme attribute specifies a URI that identifies the categorization scheme associated with the label.

Example

<media:category label='Sports' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>Sports</media:category>

Child of

media:group

media:content

The <media:content> tag provides a URL and various other types of information about a video.

Attributes

NameFormatDescription
url Text (URL) The url attribute specifies the URL for the media object.
type Text The type attribute specifies the MIME type of the media object.
isDefault Boolean The isDefault attribute indicates whether the corresponding <media:content> tag identifies the default media resource for the media group. In a YouTube Data API response, the default media resource is the URL for the embeddable player (SWF) for the video.
expression Text The expression attribute indicates whether the video object represents a sample of the video, the complete version of the video, or a live video stream. The corresponding (and only) valid values for this attribute are sample, full and nonstop.
duration Integer The duration attribute specifies the length of the video in seconds.
yt:format Text The yt:format attribute specifies the video format of the video object described by the <media:content> element. The following list identifies the valid values for this attribute:

  • 1 - RTSP streaming URL for mobile video playback. H.263 video (up to 176x144) and AMR audio.
  • 5 - HTTP URL to the embeddable player (SWF) for this video. This format is not available for a video that is not embeddable. Developers commonly add &format=5 to their queries to restrict results to videos that can be embedded on their sites.
  • 6 - RTSP streaming URL for mobile video playback. MPEG-4 SP video (up to 176x144) and AAC audio.

Example

<media:content url='http://www.youtube.com/v/8aYQ_wjmriQ' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='166' yt:format='5'/>

Child of

media:group

media:credit

The <media:credit> tag identifies the owner of a video. This tag appears in entries in video, playlist and inbox feeds. In playlist and inbox feed entries, the <media:credit> tag identifies a different user than the <author> tag. (The <author> tag in those feeds identifies a user other than the video owner.)

Attributes

NameFormatDescription
role Text The role attribute specifies the way that a YouTube user is associated with a particular video. Currently, the only value for this tag is uploader, which indicates that the tag value identifies the YouTube user who uploaded the video.
yt:type Text The yt:type attribute indicates that a video was uploaded by a YouTube partner. When present, the value of this attribute will be partner.

Example

<media:credit role="uploader" scheme="urn:youtube">scenarioIAM</media:credit>

Child of

media:group

media:description

The <media:description> tag contains a summary or description of a video. This field is required in requests to upload or update a video's metadata. The description should be sentence-based, rather than a list of keywords, and may be displayed in search results. The description has a maximum length of 5000 characters and may contain all valid UTF-8 characters except < and >.

In API response feeds, descriptions are truncated to 500 characters unless one of the following conditions is true:

  • You submitted an authenticated request for a single video entry on behalf of the video owner. In this case, you submitted the API request to the following URL:

    http://gdata.youtube.com/feeds/api/users/default/uploads/VIDEO_ID

  • You submitted an authenticated request for the currently authenticated user's uploaded videos and your request did not specify search parameters other than start-index or max-results. In this case, you submitted the API request to the following URL:

    http://gdata.youtube.com/feeds/api/users/default/uploads

Attributes

NameFormatDescription
type Text The type attribute specifies the type of text provided in the tag's value. YouTube content feeds require plain text (type=plain) format.

Example

<media:description type="plain">Granny takes crocheting to the extreme during a rodeo and while surfing.</media:description>

Child of

media:group

media:group

The <media:group> tag encapsulates metadata about a video resource.

Example

<media:group>

Child of

entry

Children

media:title?, media:description?, media:keywords?, media:category, media:content*, media:credit?, media:player?, media:rating?, media:restriction?, media:thumbnail*, yt:aspectratio?, yt:duration?, yt:private?, yt:uploaded?, yt:videoid?, yt:noembed?

media:keywords

The <media:keywords> tag contains a comma-separated list of words associated with a video. You must provide at least one keyword for each video in your feed. This field has a maximum length of 120 characters, including commas, and may contain all valid UTF-8 characters except < and >. In addition, each keyword must be at least two characters long and may not be longer than 25 characters.

Keywords may contain spaces, meaning an individual keyword can actually be more than one word long. For example, crazy,surfing,stunts and crazy, surfing stunts are both valid values for this tag, but the former value contains three keywords and the latter value contains only two ("crazy" and "surfing stunts").

Example

<media:keywords>winter, snowball fight, snowman, corncob pipe</media:keywords>

Child of

media:group

media:player

The <media:player> tag specifies a URL where the full-length video is available through a media player that runs inside a web browser. In a YouTube Data API response, the <media:player> tag specifies the URL for the page on YouTube's website that plays the video.

Attributes

NameFormatDescription
url Text (URL) The url attribute identifies a URL that uses a video player to show the video in a browser window.

Example

<media:player url='http://www.youtube.com/watch?v=8aYQ_wjmriQ'/>

Child of

media:group

media:rating

The <media:rating> tag indicates that a video contains restricted content. This tag will only be included in a video entry if the video contains restricted content. However, even if the <media:rating> tag is included in a video entry, the video content may not be restricted in the country where the user watching the video is located. Your application can check the value of the tag's country parameter to determine where the video content is considered to be restricted.

Note: A feed will only include content that is restricted in all countries if your API request included the safeSearch parameter with a value of none (safeSearch=none). The <media:rating> tag replaced the <yt:racy> tag, which was deprecated with the release of version 2 of the API.

Attributes

NameFormatDescription
scheme Text The scheme attribute specifies a URI that identifies the categorization scheme associated with the rating.
country Text The country attribute identifies the country or countries where a video is considered to contain restricted content. The attribute value will either be the word all, which indicates that the video contains content that is considered restricted everywhere, or a comma-delimited list of ISO 3166 two-letter country codes identifying particular countries where the video content is restricted.

Example

<media:rating scheme="http://gdata.youtube.com/schemas/2007#mediarating" country="HK,TW">1</media:rating>

Child of

media:group

media:restriction

The <media:restriction> tag identifies the country or countries where a video may or may not be played. The attribute value is a space-delimited list of ISO 3166 two-letter country codes. The <media:restriction> tag only appears in a feed entry if the corresponding video cannot be played in all countries. (Note that a video will only be included in an API response if it is allowed to be played at the location specified by the restriction parameter.)

Attributes

NameFormatDescription
type Text The type attribute specifies the type of information conveyed by the tag's value. The value of this attribute will be country, indicating that the tag value contains a list of country codes.
relationship Text The relationship attribute indicates whether the video is allowed to be played in the specified countries. If the tag's value is allow, then the video can be played in the specified countries. If the tag's value is deny, then the video cannot be played in the specified countries.

Example

<media:restriction type='country' relationship='deny'>US</media:restriction>

Child of

media:group

media:thumbnail

The <media:thumbnail> tag specifies the location of an image that can be used to represent a video or playlist in a list of results. A videos feed may reference multiple thumbnail images and multiple sizes of those images. A best practice is to use the height and width attribute values to select the thumbnail size that is most appropriate for your UI.

One of the thumbnail images referenced for a video is a high-quality thumbnail. The high-quality image does not have a timestamp, which enables you to distinguish it from the remaining thumbnails in the entry. The high-quality thumbnail could be from any point in the video and may also be larger than the other thumbnails referenced in the entry.

Attributes

NameFormatDescription
url Text (URL) The url attribute specifies the URL for the thumbnail image.
height Integer The height attribute specifies the height of the thumbnail image.
width Integer The width attribute specifies the width of the thumbnail image.
time Time The time attribute specifies the time offset at which the frame shown in the thumbnail image appears in the video. The attribute value is expressed in DSM-CC's Normal Play Time (NTP) as used in RTSP.

The time value enables you to display a sequence of screenshots from a video. Note that if your application does display a series of screenshots, you may want to check the values of the height and width attributes to ensure that each screenshot is the same size.

The time attribute does not appear on the <media:thumbnail> tag that identifies the high-quality (HQ) thumbnail image.

Example

<media:thumbnail url='http://img.youtube.com/vi/8aYQ_wjmriQ/2.jpg' height='97' width='130' time='00:01:23'/>

Child of

entry, media:group

media:title

The <media:title> tag identifies the title of the video. This field has a maximum length of 60 characters or 100 bytes, whichever is reached first. The title may contain all valid UTF-8 characters except < and >.

Attributes

NameFormatDescription
type Text The type attribute specifies the type of text provided in the tag's value. YouTube content feeds require plain text (type=plain) format.

Example

<media:title type="plain">Extreme crocheting in high surf, rodeo</media:title>

Child of

media:group

GData elements reference

gd:comments

The <gd:comments> tag encapsulates a link to the comments feed for a video.

Example

<gd:comments>

Child of

entry

Children

gd:feedLink

gd:feedLink

The <gd:feedLink> tag identifies a logically nested feed. For example, a comments feed is logically nested beneath a video entry. Similarly, the feed for a single playlist is logically nested within a playlist entry in a user's playlists feed.

Attributes

NameFormatDescription
rel Text The rel attribute contains the name of the related feed linked to in the href attribute.
href Text (URL) The href attribute contains the absolute URL of the related feed.
gd:countHint Integer The gd:countHint specifies the number of entries in the related feed. For example, if the <gd:feedLink> tag specifies a link to the comments feed for a video, the gd:countHint attribute indicates how many comments exist for the video.

Example

<gd:feedLink href='http://gdata.youtube.com/feeds/api/videos/8aYQ_wjmxiQ/comments' countHint='0'/>

Child of

entry, gd:comments

gd:rating

The <gd:rating> tag specifies the rating that you are assigning to a video (in a request to add a rating) or the current average rating of the video based on aggregated YouTube user ratings.

Attributes

NameFormatDescription
min Integer The min attribute specifies the minimum rating that can be assigned to a video. This value must be 1.
max Integer The max attribute specifies the maximum rating that can be assigned to a video. This value must be 5.
numRaters Integer The numRaters attribute indicates how many people have rated the video. This attribute is not used in a request to add a rating.
average Double The average attribute indicates the average rating given to the video. This attribute is not used in a request to add a rating.
value Integer The value attribute specifies the rating that the logged-in user is giving to a video. This attribute is only specified in a request to add a rating. The value must be between 1 and 5 inclusive.

Example

Rating information in an API response:
<gd:rating min='1' max='5' numRaters='7773' average='4.75'/>

Assigning a rating to a video:
<gd:rating value="4" min="1" max="5"/>

Child of

entry

GeoRSS elements reference

georss:where

The <georss:where> tag encapsulates information about a geographic location. Note that if there is already a geographic location associated with a video, you must include that location information in subsequent requests to update that video's information or the geographic location will be deleted.

Example

<georss:where>

Child of

entry

Children

gml:Point

GML elements reference

gml:Point

The <gml:Point> tag contains information about a specific geographic location. Geographic point locations are defined in two dimensions using WGS 84. You can specify the geographic location where a video was taken in requests to upload or update that video's metadata. Note that if there is already a geographic location associated with a video, you must include that location information in subsequent requests to update that video's information or the geographic location will be deleted.

Example

<gml:Point>

Child of

georss:where

Children

gml:pos

gml:pos

The <gml:pos> tag specifies the coordinate for a geographic point. Geographic point locations are defined in two dimensions using WGS 84. Note that if there is already a geographic location associated with a video, you must include that location information in subsequent requests to update that video's information or the geographic location will be deleted.

Example

<gml:pos>47.367 8.55</gml:pos>

Child of

gml:Point

Atom Publishing Protocol element reference

app:control

The <app:control> tag contains information about the publication state of a video. The tag's presence indicates that one of the following statements applies to a video:

  • The video has not yet been published.
  • The video is no longer publicly available.
  • Access to view the video is restricted.
  • The video is not available in the region where the user trying to watch the video is located.
  • YouTube rejected the video during the video upload process.
  • The request to upload the video failed.

Example

<app:control>

Child of

entry

Children

app:draft, yt:state

app:draft

The <app:draft> tag indicates whether a video is in draft, or unpublished, status. Since this tag is only included for unpublished videos, it always has a value of yes.

Example

<app:draft>yes</app:draft>

Child of

app:control

app:edited

The <app:edited> tag specifies the time that a feed or feed entry was last updated.

Example

<app:edited>2007-10-15T15:39:34.000-07:00</app:edited>

Child of

entry

Browser-based upload API response elements reference

response

The <response> tag encapsulates the API response that YouTube returns to an API request to upload metadata for a new video using browser-based uploading.

Example

<response>

Children

url, token

token

The <token> tag appears in the API response that YouTube returns to an API request to upload metadata for a new video using browser-based uploading. The token must be included on the page that allows the user to upload the new video directly to YouTube.

Example

<token>AEwbFAQEvf3xox...</token>

Child of

response

url

The <url> tag appears in the API response that YouTube returns to an API request to upload metadata for a new video using browser-based uploading. The form on your web page that lets the user upload the actual video file to YouTube will submit to this URL.

Example

<url>http://uploads.gdata.youtube.com/action/FormUpload/AEF3087AUD</url>

Child of

response

Batch processing element reference

batch:id

The <batch:id> tag contains a value that you define to uniquely identify an entry in a batch processing request. This tag is typically used for entries that correspond to insert operations. The API response to your batch processing request will echo the <batch:id> tag for each entry, enabling your application to correlate the entry in the response to the original request.

Note that the <batch:id> tag is different than the <id> tag.

  • The <id> specifies a value that the YouTube server assigns when creating a resource. This identifier is returned in the API response and permanently identifies the corresponding resource.

  • The <batch:id> tag is an identifier that you choose when creating a batch processing request. The identifier will be returned in the API response but will not be stored for future use.

When you submit a batch processing request to query (GET), update (PUT) or delete (DELETE) information, each entry in the request will contain an <id> element that identifies the resource that you are retrieving, updating or deleting. In the API response, each entry will contain an <id> tag, which will be the same as the <id> value in your request, and a <batch:status> tag, which indicates whether the operation was successful.

However, when you insert (POST) information, you are creating a new resource, which will be assigned its own unique ID. (For example, if you submit a batch processing request to add several videos to a playlist, YouTube will assign a unique playlist entry ID to each video that you add.) In the API response to your batch processing request, each entry for an insert operation will also include an <id> tag and a <batch:status>. Since the <id> tag contains a new value that did not exist when you made your API request, you may need to use the <batch:id> tag value to correlate the entry in the API response to the entry in your batch processing request. Please see the Developer's Guide for more information about insert operations in a batch processing request.

Example

<batch:id>PlaylistEntry3</batch:id>

Child of

entry

batch:interrupted

The <batch:interrupted> tag indicates that processing of your API request was interrupted. This tag is returned if the XML of an entry is invalid. If the API response to your batch processing request contains this tag, then some entries in your request may have been successfully executed while other entries either failed or were not processed at all.

Attributes

NameFormatDescription
reason Text The reason attribute contains an explanation of the error that caused the batch processing request to be interrupted.
parsed Integer The parsed attribute identifies the number of entries in the batch processing request that were attempted. The number of parsed entries equals the number of successful entries plus the number of error entries.
success Integer The success attribute identifies the number of entries in the batch processing request that were successfully processed.
error Integer The error attribute identifies the number of entries in the batch processing request that were attempted but that failed to process successfully.
unprocessed Integer The unprocessed attribute identifies the number of entries that are known to exist in the batch processing request that were not processed.
content-type Text The content-type attribute specifies the MIME type of the data returned in the element. This attribute is only returned if the element contains a text description.

Example

<batch:interrupted reason="[Line 14, Column 34, element entry] Invalid type for batch:operation: 'PUT'" success="8" failures="3" parsed="14"/>

Child of

entry

batch:operation

The <batch:operation> tag specifies the type of operation requested for a batch processing job.

In a batch processing request, the <batch:operation> tag can appear as a subtag of either <feed> or <entry>. If neither a feed nor an entry in that feed contain a <batch:operation> tag, then the default operation for that entry will be insert.

  • As a subtag of <feed>, the <batch:operation> tag specifies the default type of operation (query, insert, update or delete) that you are requesting for each entry in the feed. You can override this default value for specific entries by including the <batch:operation> tag in those entries.

  • As a subtag of <entry>, the <batch:operation> tag specifies the type of operation (query, insert, update or delete) that you want to perform on that entry in the batch feed.

In a response to a batch processing request, the <batch:operation> tag appears as a subtag of <entry> and specifies the type of operation performed on that entry.

Attributes

NameFormatDescription
type Text The type attribute specifies the type of operation being performed in a batch processing API request. Valid values for this attribute are query, insert, update and delete.

Example

<batch:operation type="insert"/>

Child of

feed, entry

batch:status

The <batch:status> tag appears in the API response to a batch processing request. This tag indicates whether a specific operation in a batch processing request was successfully executed. The tag's attributes identify the HTTP response code that the API server returned when the specific operation was executed and a short description explaining the response code.

Attributes

NameFormatDescription
code Integer The code attribute specifies the HTTP response code for the entry.
reason Text The reason attribute contains a text description that describes the HTTP response code.
content-type Text The content-type attribute specifies the MIME type of the data returned in the element. This attribute is only returned if the element contains a text description.

Example

<batch:status code="201" reason="Created"/>

Child of

entry

Error response element reference

code

The <code> tag explains the reason that the API request failed. The following lists identify the possible values for the <code> tag based on the value of the corresponding <domain> tag:

  • yt:validation:

    • required - This code indicates that a required field is missing or has an empty value.
    • deprecated - This code indicates that an element's value has been deprecated and is no longer valid. For example, a video category name that has been retired may not be associated with newly added or updated videos.
    • invalid_format - This code indicates that an XML element's value does not match an expected format. For example, you could receive this error if you specify invalid coordinates in the <gml:pos> tag.
    • invalid_value - This code indicates that an XML field value contains an invalid value. This error code occurs when an element has an enumerated list of values and the element's value does not match one of the enumerated values. For example, the category list for uploaded videos identifies valid values for the <media:category> tag.
    • invalid_character - This code indicates that an XML field value contains an invalid character. For example, video titles may not contain a less than (<) character.
    • too_long - This code indicates that an XML element's value exceeds the maximum allowable length. For example, video titles must be 60 characters or less.
    • too_short - This code indicates that an XML element's value is shorter than the minimum allowable length. For example, keywords must be at least two characters long.

  • yt:quota:

    • too_many_recent_calls - This code indicates that the API servers have received too many calls from the same caller in a short amount of time. This error will not specify a location.
    • too_many_entries - This code indicates that the user is attempting to exceed a storage limit on his account and must delete existing entries before inserting new entries.

  • yt:authentication:

    • InvalidToken - This code indicates that the authentication token specified in the Authorization header is invalid.
    • TokenExpired - This code indicates that the authentication token specified in the Authorization header has expired.

  • yt:service:

    • disabled_in_maintenance_mode - This code indicates that POST, PUT and DELETE operations cannot be executed because the site is temporarily in maintenance mode. If you receive this error, wait a few minutes and try your request again.

Example

<code>required</code>

Child of

error

domain

The <domain> tag identifies the error that caused an API request to fail. The following list identifies the possible values of the <domain> tag:

  • A yt:validation error reports a problem related to an XML element value in a request to insert or update an entry. API functions that insert or update videos or other data can report yt:validation errors. Validation errors are typically reported with an HTTP 400 response code.

  • A yt:quota error identifies a problem related to irregular API usage.

  • A yt:authentication error identifies a problem related to an improperly authenticated request to execute an API function requiring user authentication. Authentication errors could be identified with HTTP 401 or 403 response codes.

  • A yt:service error identifies an authentication error that occurs when the YouTube site is undergoing temporary maintenance. A service error may occur if you are trying to execute insert (POST), update (PUT) or delete (DELETE) operations, but will not occur for read (GET) operations. Service errors are typically reported with an HTTP 503 response code.

Example

<domain>yt:validation</domain>

Child of

error

error

The <error> tag contains information about a single error that caused an API request to fail.

Example

<error>

Child of

errors

Children

domain, code, location

errors

The <errors> tag encapsulates an API response explaining the errors that caused the corresponding API request to fail.

Example

<errors>

Children

error+

location

The <location> tag provides information about the element in the request that failed.

  • If the value of the <domain> tag is yt:validation, then the <location> tag defines the error location as an Xpath pointing to the XML tag that caused the request to fail. The Xpath location is specified relative to the <entry> tag in the request.

  • If the value of the <domain> tag is yt:quota and the <code> tag value is too_many_recent_calls, then the API response will not include a <location> tag.

  • If the value of the <domain> tag is yt:quota and the <code> tag value is too_many_entries, then the <location> tag identifies the feed that caused the error.

  • If the value of the <domain> tag is yt:authentication, then the <location> tag, if present, will identify causing the authentication error.

Attributes

NameFormatDescription
type Text The type attribute provides context for the <location> tag's value. The type attribute can have any of the following values:
  • xpath - The XML request contains an error at the specified path, which is relative to the <entry> tag in the request.
  • parameter - The API request contains an error in the parameter specified in the <location> tag.
  • header - The API request contains an error in the specified HTTP request header.
  • other - The API request contains another type of error. This value is used to identify quota errors that have a code of too_many_entries.

Example

<location type='xpath'>media:group/media:title/text()</location>

Child of

error

Appendixes

Category list for uploaded videos

The YouTube category document, which can be downloaded from http://gdata.youtube.com/schemas/2007/categories.cat, identifies the categories that you can use to classify video content. The category document is an XML file that identifies the categories and indicates whether new videos can be assigned to each category. The document also identifies the countries where each category is browsable on YouTube.

The excerpt below shows the entries for the "Entertainment" and "Nonprofit & Activism" categories as they appear in the YouTube category document as of August 13, 2008. Please note that videos could be assigned to both categories. In addition, the document lists many countries where the "Entertainment" category is browsable but indicates that the "Nonprofit & Activism" category was only browsable in the United States at that time.

As shown in the example, the presence of the <yt:assignable> tag indicates that new videos may be assigned to that category. (New videos cannot be assigned to categories that are not marked as assignable using the <yt:assignable> tag.) In addition, the presence of the <yt:browsable> tag indicates that the corresponding category is browsable on YouTube in one or more countries. The <yt:browsable> tag's regions attribute contains a space-delimited list of two-letter regionIDs that identify the particular countries where the category is browsable. The Retrieving region-specific standard feeds section contains a list of countries for which YouTube supports localized feeds and the regionID associated with each country. Categories that are neither assignable or browsable are deprecated and are identified as such using the <yt:deprecated> tag.

<atom:category term='Entertainment' label='Entertainment' xml:lang='en-US'>
  <yt:browsable regions='AU BR CA FR DE GB NL HK IN IE IT JP MX NZ PL RU KR ES TW US'/>
  <yt:assignable/>
</atom:category>
<atom:category term='Nonprofit' label='Nonprofit &amp; Activism' xml:lang='en-US'>
  <yt:assignable/>
  <yt:browsable regions='US'/>
</atom:category>
<atom:category term='Videoblog' label='Videoblogging' xml:lang='en-US'>
  <yt:deprecated/>
</atom:category>

In your Upload API request, the value of the <media:category> tag must be set to the value of the <atom:category> tag's term attribute for the corresponding category. The following example demonstrates how you would use the <media:category> tag to assign a new video to the Nonprofit & Activism category, which appears in the schema excerpt above.

<media:category
  scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Nonprofit</media:category>

Localized category lists

You can also retrieve localized category lists that specify category labels for classifying video content in particular languages. You can download these lists from http://gdata.youtube.com/schemas/2007/categories.cat?hl=<LANGUAGE>, where you replace the term LANGUAGE in the URL with the appropriate language value from the following list. (Instead of appending the hl parameter value to the schema URL, you can also set the Accept-Language HTTP request header to the appropriate language value.)

Language/Locale hl Parameter Value
Chinese (Traditional)zh-TW
Czechcs-CZ
Dutchnl-NL
English (Great Britain, Ireland, Australia and New Zealand)en-GB
English (United States and Canada)
* default value
en-US
Frenchfr-FR
Germande-DE
Italianit-IT
Language/Locale hl Parameter Value
Japaneseja-JP
Koreanko-KR
Polishpl-PL
Portuguese (Brazil)pt-BR
Russianru-RU
Spanish (Spain)es-ES
Spanish (Mexico)es-MX
Swedishsv-SE

The XML excerpt below shows the entries for the "Entertainment" and "Nonprofit & Activism" categories as they appear in the YouTube category document for the French language as of May 5, 2008:

<atom:category term='Entertainment' label='Divertissement' xml:lang='fr-FR'>
  <yt:assignable/>
  <yt:browsable/>
</atom:category>
<atom:category term='Nonprofit' label='Associations et organismes' xml:lang='fr-FR'>
  <yt:assignable/>
</atom:category>

In your Upload API request, the value of the <media:category> tag must still be set to the value of the <atom:category> tag's term attribute for the corresponding category. (Note that the term attribute value may still be in English. However, you can modify the value of the <media:category> tag's scheme attribute to identify the language associated with category. The following example demonstrates how you would use the <media:category> tag to assign a new video to the Divertissement (Entertainment) category, which appears in the schema excerpt above.

<media:category
  scheme="http://gdata.youtube.com/schemas/2007/categories.cat?hl=fr-FR">Entertainment</media:category>

URL Escaping

To make an HTTP search request, you must follow certain conventions so that Google can correctly translate your HTTP request and generate an appropriate response.

The HTTP URL schema specifies that an HTTP URL request may only contain certain characters:

  • Alphanumeric characters: [a-z][A-Z][0-9]
  • Special characters: $ - _ . | + ! * ' ( )
  • Reserved characters: ; / ? : @ = & %

Google uses reserved characters to decode URLs and uses some special characters to request search features. Consequently, you should URL escape all nonalphanumeric characters that occur in search parameter values.

To URL escape a string, convert each sequence of whitespace characters to a single "+" (plus sign) and replace any other nonalphanumeric characters with the hexadecimal encoding that represents the value of that character. The hexadecimal encodings for the special and reserved characters listed above are shown in the following table. Each of these characters should be URL escaped in request parameter values.

Character Hexadecimal
Encoding
$ %24
- %2D
_ %5F
. %2E
+ %2B
! %21
* %2A
% %25
" %22
' %27
( %28
) %29
; %3B
/ %2F
? %3F
: %3A
@ %40
= %3D
& %26
| %7C

Examples

Original String URL Escaped String
punch&judy punch%26judy
O'Reilly O%27Reilly

You can find additional information on URL escaping at RFC 2396 and W3C.

Revision History

November 5, 2009

This update contains the following changes:

  • The new caption parameter lets you restrict a search result set to only include videos that have caption tracks. The parameter is specified without a value, and its presence indicates that all videos in the result set must have captions.

  • The prettyprint parameter, which is a standard Google Data API parameter, is now documented for the YouTube Data API. This parameter, which was already supported, may be useful for testing and debugging your application.

  • The HTTP response codes for YouTube Data API requests section has been updated to note that the FILE_MISSING error code is no longer returned to identify a failed upload. As such, your application should require the user to select a file before allowing the user to submit the form to upload the video. Please see the instructions for uploading a video file for browser-based uploads.

August 31, 2009

This update contains the following changes:

  • The time parameter is now supported for search queries as well as for standard feeds.

  • The definition of the author parameter has been updated to explain how this parameter functions in a request for a standard feed.

  • The definition of the <yt:state> tag's reasonCode attribute has been updated to better describe the meaning of the limitedSyndication code for a restricted video.

  • The sortorder parameter, which had enabled comments to be sorted in ascending or descending order, has been deprecated.

  • The most_linked standard feed has been deprecated. Queries for this feed will now return an empty feed.

July 21, 2009

This document contains the following changes:

  • The lr parameter definition has been updated to explain how that parameter affects requests to retrieve caption tracks for a video.

  • The link tag definition now explains the new yt:hasEntries attribute, which indicates whether there are caption tracks associated with a video entry. This attribute is only included in link tags for which the rel attribute value is http://gdata.youtube.com/schemas/2007#video.captionTracks. A value of true indicates that caption tracks are available for the video.

June 25, 2009

This document contains the following changes:

  • The new <yt:aspectratio> tag could be included in a video entry to identify the video's aspect ratio. The only valid value for this tag is currently widescreen, which indicates that the video has a 16:9 aspect ratio.

    At the time of this documentation change, YouTube has recently begun to generate this tag, as appropriate, for newly uploaded videos. However, feed entries for older videos in the YouTube library may not include this tag even if those videos are widescreen. As such, the presence of this tag in a feed entry indicates that the video is a widescreen video, but the absence of the tag does not decisively indicate that the video is not a widescreen video.

  • The <app:control> tag definition has been updated to reflect the fact that that tag now appears within entries for any unpublished videos. For example, the tag could appear in playlist entries if the video was deleted or if the owner made the video private.

  • The definition of the <yt:state> tag's reasonCode attribute has been updated to reflect the introduction of two new codes for restricted videos:

    • If the attribute value is limitedSyndication, then the video is not and will not be available to play on mobile devices or other devices.

      • If a video entry contains a <yt:state> tag that specifies this code, then the video's owner has specified that the video should not be syndicated outside of the YouTube website.
      • If a video entry does not contain either a <yt:state> tag with this code or a <media:content> tag that has a video object in the format needed for the user's device, then YouTube is still transcoding the video to be available in that format.

    • If the attribute value is private, then the video has been made a private video by the video owner and is therefore unavailable.

April 8, 2009

This document contains the following changes:

  • The <media:keywords> tag definition has been updated to note that keywords may now contain spaces, meaning an individual keyword may actually contain more than one word. Prior to this change, you could have entered keywords like <media:keywords>winter, snowball, fight</media:keywords>. As a result of this change, you could make "snowball fight" a single keyword (<media:keywords>winter, snowball fight</media:keywords>).

  • The Custom parameters for the YouTube Data API section has been updated to contain a list of parameters used to request any type of feed. The section also now lists parameters that are only used to request a particular type of feed, such as video search results, standard feeds, video feeds or comment feeds. Finally, the API parameter definitions have been updated to highlight cases where a parameter is only supported for search requests.

  • The restriction parameter definition has been updated to note that you should include this parameter in any request to retrieve a list of videos, including search results, playlists, favorite videos, video responses and so forth. If a video in the API response is not playable in the location that you're using to restrict availability of the content, the entry for that tag will not contain a <media:content> tag. However, it will contain a <yt:state> tag that indicates that the video is restricted.

  • The definitions of the <yt:state> tag's name attribute has been updated to reflect the addition of restricted as a video status. In addition, the reasonCode attribute definition has been updated to note the possible reasonCode values for restricted videos.

March 10, 2009

This document contains the following changes:

  • The <media:description> tag definition has been updated to note that in API responses, the description is truncated to 500 characters unless one of the following conditions is true:

    • You submitted an authenticated request for a single video entry on behalf of the video owner. In this case, you submitted the API request to the following URL:

      http://gdata.youtube.com/feeds/api/users/default/uploads/VIDEO_ID

    • You submitted an authenticated request for the currently authenticated user's uploaded videos and your request did not specify search parameters other than start-index or max-results. In this case, you submitted the API request to the following URL:

      http://gdata.youtube.com/feeds/api/users/default/uploads

February 24, 2009

This document contains the following changes:

  • The Expected latency for data updates section has been updated to note the expected delay before an event appears in an activity feed.

  • The definition of the author parameter has been updated to explain how the parameter is used in a request to retrieve a user activity feed.

  • The definitions of the <yt:username> and <yt:videoid> tags have been updated to explain how those tags are used in activity feeds.

January 27, 2009

This document contains the following changes:

  • The definition of the <media:thumbnail> tag has been updated to provide more detailed information about the high-quality thumbnail image that is returned in a feed entry that identifies a video. The <media:thumbnail> tag does not specify a timestamp for the high-quality thumbnail image, which enables you to distinguish the high-quality thumbnail from the other thumbnail images. In addition, the high-quality thumbnail image may be larger than the other thumbnails returned for a video.

  • The definitions of the <code> and <domain> tags have been updated to include information about service errors. Service errors were documented in the Developer's Guide in July 2008, so this update does not reflect a change in functionality.

January 13, 2009

This document contains the following changes:

  • The new <yt:uploaded> tag, which appears in a playlist feed entry, specifies the time that the entry was added to the playlist.

  • The <media:title> tag definition has been updated to note that the tag has a maximum length of 60 characters or 100 bytes, whichever is reached first. Previously, the tag stated a maximum length of 60 characters.

December 10, 2008

This document contains the following changes:

  • The new <yt:playlistId> and <yt:playlistTitle> tags are both associated with playlist subscriptions, which are now described in the developer's guide.

  • The <category> tag definition has been updated to note additional valid values for the tag's scheme and term attributes. These new, valid values are associated with two new features, friend activity feeds and playlist subscriptions.

  • The Retrieving region-specific standard feeds section has been updated to note that region-specific standard feeds are now available for the Czech Republic, India, Israel and Sweden.

  • The Localized category lists section has been updated to note the availability of category lists for Czech and Swedish. In addition, the following localized category lists have been retired:

    • The list for Canada (hl=en-CA) has been retired. Please use the U.S. list (hl=en-US) as an alternative.
    • The lists for Ireland (hl=en-IE, Australia (hl=en-AU) and New Zealand (hl=en-NZ) have been retired. Please use the Great Britain list (en-GB) as an alternative.
    • The Chinese list for Hong Kong (hl=zh-HK) has been retired. Please use the list for traditional Chinese (hl=zh-TW) as an alternative.

November 13, 2008

This document contains the following changes:

  • The new Paging through results section explains how the API uses <link> tags to specify links to the previous and/or next pages of entries in an API response feed.

October 20, 2008

This update contains changes associated with the release of version 2 of the YouTube Data API. YouTube still supports API version 1. (See documentation for API version 1).

  • The values of <id> tags in feed entries no longer specify a URI. In API version 2, the <id> tag value is a URN in a format like tag:youtube,2008:videos or tag:youtube,2008:video:24Ryj1ywoqw or tag:youtube,2008:favorite:24Ryj1ywoqwji5_MqicxSo.

  • The Projection values section has been updated to note that all API requests must specify a projection. Prior to the release of API version 2, API requests did not need to specify a projection. Since the YouTube Data API documentation has always specified a projection for each sample request, none of the sample requests required an update due to this particular change.

  • The Navigating between feeds section has been updated to reflect the fact that the <link>, <content> and <gd:feedLink> tags are all used to navigate between feeds.

  • The following API parameters have been added or updated:

    • The new v parameter can be used to specify the API version that YouTube will use to handle the API request.
    • The new safeSearch parameter indicates whether YouTube should include restricted content as well as standard content. The safeSearch parameter replaces the racy parameter, which has been deprecated with this API release.
    • The location parameter definition now explains how that parameter, in conjunction with the new location-radius parameter, can be used to request videos associated with a particular geographic area.
    • The new strict parameter can be used to instruct YouTube to reject API requests that contain invalid request parameters.
    • The new uploader parameter can be used to restrict search results to only contain partner videos.
    • The name of the vq parameter has changed to q.

  • API responses specify that they use OpenSearch version 1.1, which has a different URI than OpenSearch version 1.0, which was used in previous API releases.

  • The <summary> tag is a new tag that replaces the <yt:description> tag, which has been deprecated with this API release.

  • The <content> tag has replaced the <gd:feedLink> tag in playlists feeds and subscriptions feeds.

  • The new <yt:videoid> tag appears in any feed entry that describes a video. The tag value specifies a unique ID that YouTube uses to identify that video.

  • The new <yt:countHint> tag, which appears in a playlists feed entry, identifies the number of videos in the corresponding playlist.

  • The new <yt:aboutMe> tag appears in a user profile and contains whatever information the user has entered in the "About Me" field of the user's YouTube personal profile.

  • The type attribute has been removed from the <title> and <content> tags.

  • The <media:credit> tag is a new tag in playlist and inbox feed entries that identifies the YouTube user who uploaded a video. The <author> tag definition has been updated to reflect the fact that in playlist and inbox feed entries, the <author> tag does not identify the user who uploaded the video.

  • The <media:rating> tag definition has been updated to explain the newly added country parameter, which identifies the country or countries where a video is considered to contain restricted content. The tag's definition has also been updated to explain how the safeSearch parameter value in an API request affects the <media:rating> tag in the API response.

  • The <yt:state> tag definition has been updated to note video entries that contain that tag are not playable. In addition, the definition now indicates that playlist and inbox feed entries that link to deleted or claimed videos will now include the <yt:state> tag, which will have a name attribute value of deleted. In these cases, the <yt:state> tag is only visible to the feed owner.

  • The value of the <openSearch:totalResults> tag has been capped at 1,000,000.

  • The value of the <published> tag is now always specified in UTC rather than PST.

  • The new <app:edited> tag identifies the date and time when a resource was last updated.

  • The Category list for uploaded videos section has been updated to note that categories that are neither assignable nor browsable are deprecated and identified as such by the <yt:deprecated> tag.

  • The <yt:racy> element has been deprecated with this API release.

October 3, 2008

This update contains the following changes:

  • The new sortorder parameter, which is only valid for comments feeds, lets you specify whether the API will return comments in ascending order (oldest to newest) or descending order (newest to oldest).

  • The new <media:restriction> tag identifies the country or countries where a video may or may not be played. The tag only appears in a feed entry if the corresponding video cannot be played in all countries.

August 18, 2008

This update contains the following changes:

  • The new Retrieving category-specific standard feeds section explains how to retrieve standard feeds for particular categories, such as the top-rated comedies or most popular sports videos.

  • The Category list for uploaded videos section has been updated to explain the <yt:browsable> tag's new regions attribute, which identifies the countries where a category is browsable. Note that the Retrieving region-specific standard feeds section already includes a table that lists the countries for which YouTube supports localized feeds and the regionID associated with each country.

  • The category parameter now provides an alternate way to search for videos that are in certain categories or are tagged with particular keywords or developer tags. The examples in the Category search in video feeds section have all been updated to demonstrate how to use either the category parameter or the standard URL notation for searching by category, keyword or developer tag.

  • India (regionID = "IN") has been added to the list of countries for which the YouTube Data API supports localized feeds.

  • The new Spelling suggestions in API responses section explains how YouTube identifies alternate suggested spellings for search query terms.

  • The definition of the <yt:state> tag has been updated to note that video entries that contain that tag are not playable. This change clarifies existing functionality and does not reflect any API changes.

July 16, 2008

This document contains the following changes:

  • The Batch processing element reference section, which was added in this update, defines XML elements that support the API's batch processing functions.

  • The definition of the <media:rating> tag has been updated to explain the meanings of the different tag values. A tag value of 1 identifies content that is restricted in all countries. A tag value of 2 identifies content that is only restricted in Hong Kong, Korea and Taiwan.

  • The time parameter is now supported for the most_popular standard feed.

June 11, 2008

This document contains the following changes:

  • The Standard feeds section has been updated to reflect the addition of a new feed, which is for YouTube's most popular videos. The section also now includes a short description of each feed.

  • The list of custom parameters for the YouTube Data API has been updated to reflect the addition of the location query parameter. This parameter lets you request videos that have a geographic location specified in their metadata. You do not need to specify a parameter value for this parameter.

  • The <media:keywords> tag definition has been updated to note that all keywords must be at least two characters long.

May 6, 2008

May 2, 2008

This update contains the following changes:

  • The vq and orderby parameter definitions have been updated to clarify that these parameters are only supported for API requests for video feeds. [Note: The name of the vq parameter changed to q with the release of version 2 of the YouTube Data API.] Playlist feeds do not support the orderby parameter because playlist feed entries are always ordered based on the position of each entry in the playlist.

  • The racy parameter definition has been updated to note that feed entries for videos that contain restricted content will contain the <media:rating> element.

  • The restriction parameter definition has been updated with a recommendation that you always include this parameter in API requests, setting the parameter value to the end user's IP address.

  • The <media:rating> tag, a new subtag of <media:group>, replaces the <yt:racy> tag as the standard way to identify videos that contain restricted content. In addition, the <yt:racy> tag definition has been updated to note that this tag has been deprecated. [Note: The definition of this tag was removed from the API's version 2 documentation.] Although the tag may still be included in API responses to ensure backward compatibility with legacy applications, your application should check for the presence of the <media:rating> tag to determine whether a video contains restricted content.

April 7, 2008

This document contains the following changes:

  • The newly added Revision History highlights important changes to this document. The revision history will not mention minor changes such as spelling corrections.

  • The API now supports the client parameter, which provides an alternate way of identifying your application. You can also use the X-GData-Client header to identify your application.

  • The definition of the <media:keywords> tag has been updated to note that in the tag value, individual keywords may be separated by spaces but may not contain spaces.