YouTube

YouTube API v2.0 – User Profiles and Accounts

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

A user profile contains information about a user, such as the user's hobbies, occupation, or favorite books, music and movies. Any personal information that appears in a user profile feed will have been entered by that user for publication on YouTube. The YouTube Data API allows you to retrieve user profiles.

In addition, API version 2.1 supports two additional operations for users who have unlinked Google Accounts. As discussed in the API versioning section, these are users who have a Google Account but who do not have a YouTube username. The username also identifies the YouTube channel associated with the user's uploaded videos. Those two operations are described below:

  • You can upgrade an unlinked Google Account to also be associated with a YouTube username. This operation also creates the YouTube channel for the user.

  • Before actually attempting to associate a user's unlinked Google Account with a new YouTube channel, you can retrieve a feed of unused YouTube usernames that are similar to a hint that you provide.

Retrieving a user's profile

This section explains how to retrieve an entry containing information about a specific user's profile.

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

    https://gdata.youtube.com/feeds/api/users/default
  • To request another user's profile, send a GET request to the following URL. Note that this request does not require authentication.

    https://gdata.youtube.com/feeds/api/users/userId

    In the URL above, you should replace the text userId with the user's YouTube user ID. For backward compatibility purposes, the API also supports having the user's YouTube username specified instead.

An API response to a request for a user profile contains a single <entry> tag. The profile entry contains the following information:

  • Several tags in the yt namespace identify personal information that the user added to his YouTube profile, such as his age, favorite books, occupation or school.

  • The <media:thumbnail> tag contains a picture that the user has uploaded to his profile or, if no such picture exists, a default image.

  • The <yt:statistics> tag contains statistics about the user, including the number of people who have viewed the user's channel, the number of videos the user has watched, the number of people who subscribe to the user's uploaded videos, and the total number of views for all of the user's videos.

  • A series of <gd:feedLink> tags provide URLs for retrieving the user's uploaded videos, favorite videos, playlists, subscriptions and contacts.

The following XML shows a sample API response containing a user profile:


<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    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'
    gd:etag='W/&quot;DkMGRX47eCp7ImA9WxRQGU0.&quot;'>
  <id>tag:youtube,2008:user:_x5XG1OV2P6uZZ5FSM9Ttw</id>
  <published>2006-10-16T00:09:45.000-07:00</published>
  <updated>2008-02-26T11:48:21.000-08:00</updated>
  <category scheme='http://schemas.google.com/g/2005#kind'
    term='http://gdata.youtube.com/schemas/2007#userProfile'/>
  <category
    scheme='http://gdata.youtube.com/schemas/2007/channeltypes.cat'
    term='Standard'/>
  <title>Google Developers Channel</title>
  <summary>This channel is the home for videos of interest to developers.</summary>
  <link rel='http://gdata.youtube.com/schemas/2007#featured-video'
    type='application/atom+xml'
    href='https://gdata.youtube.com/feeds/api/videos/PlVJ88-zqkI?v=2'/>
  <link rel='related' type='text/html'
    href='http://code.google.com'/>
  <link rel='alternate' type='text/html'
    href='https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw'/>
  <link rel='self' type='application/atom+xml'
    href='https://gdata.youtube.com/feeds/api/users/_x5XG1OV2P6uZZ5FSM9Ttw?v=2'/>
  <author>
    <name>GoogleDevelopers</name>
    <uri>https://gdata.youtube.com/feeds/api/users/GoogleDevelopers</uri>
    <yt:userId>_x5XG1OV2P6uZZ5FSM9Ttw</yt:userId>
  </author>
  <yt:firstName>33</yt:firstName>
  <yt:lastName>Jones</yt:lastName>
  <yt:aboutMe>My favorite number is 33.</yt:aboutMe>
  <yt:age>33</yt:age>
  <gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.favorites'
    href='https://gdata.youtube.com/feeds/api/users/googledevelopers/favorites?v=2' countHint='4'/>
  <gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.contacts'
    href='https://gdata.youtube.com/feeds/api/users/googledevelopers/contacts?v=2' countHint='1'/>
  <gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.inbox'
    href='https://gdata.youtube.com/feeds/api/users/googledevelopers/inbox?v=2' countHint='0'/>
  <gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.playlists'
    href='https://gdata.youtube.com/feeds/api/users/googledevelopers/playlists?v=2'/>
  <gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.watchlater'
    href='https://gdata.youtube.com/feeds/api/users/googledevelopers/watch_later?v=2'
    countHint='15'/>
  <gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.subscriptions'
    href='https://gdata.youtube.com/feeds/api/users/googledevelopers/subscriptions?v=2' countHint='4'/>
  <gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.uploads'
    href='https://gdata.youtube.com/feeds/api/users/googledevelopers/uploads?v=2' countHint='1'/>
  <gd:feedLink
    rel='http://gdata.youtube.com/schemas/2007#user.newsubscriptionvideos'
    href='https://gdata.youtube.com/feeds/api/users/googledevelopers/newsubscriptionvideos?v=2'/>
  <gd:feedLink
    rel='http://gdata.youtube.com/schemas/2007#user.recentactivity'
    href='https://gdata.youtube.com/feeds/api/users/googledevelopers/events?v=2'/>
  <yt:books>Catch-22</yt:books>
  <yt:gender>m</yt:gender>
  <yt:company>Google</yt:company>
  <yt:hobbies>Testing YouTube APIs</yt:hobbies>
  <yt:hometown>Philadelphia, PA</yt:hometown>
  <yt:location>Boston, MA 02043, US</yt:location>
  <yt:maxUploadDuration seconds='930'/>
  <yt:movies>Aqua Teen Hungerforce</yt:movies>
  <yt:music>Elliott Smith</yt:music>
  <yt:relationship>taken</yt:relationship>
  <yt:occupation>Technical Writer</yt:occupation>
  <yt:school>University of North Carolina</yt:school>
  <media:thumbnail url='http://i.ytimg.com/vi/YFbSxcdOL-w/default.jpg'/>
  <yt:statistics lastWebAccess='2008-02-25T16:03:38.000-08:00'
      viewCount='9' videoWatchCount='21' subscriberCount='1'
      totalUploadViews='124'/>
  <yt:username display="GoogleDevelopers">googledevelopers</yt:username>
</entry>

Associating an unlinked Google Account with a YouTube channel

You can upgrade an unlinked Google Account so that it is associated with a YouTube username (and channel). This process is explained in the Creating a YouTube channel document, which describes the process of spawning an Android WebView, iOS UIWebView, or similar object, to allow a user to create a YouTube channel and then return control to your application.

Note: The process explained in that document replaces an API call for upgrading an unlinked Google Account that has since been deprecated.

pagination links

« Previous
Watch History
Next »
Activity feeds

Authentication required

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

Signing you in...

Google Developers needs your permission to do that.