My favorites | English | Sign in

Sign up for Google I/O 2010 today!

YouTube APIs and Tools

YouTube logo

Frequently Asked Questions

Main Google Data FAQ

The questions below are specifically targeted for the YouTube Data API. There are, however, many questions that are applicable to all of the Data APIs. Visit the Google Data APIs FAQ if you do not find the question you are looking for below.

    Getting Started

  1. What functionality is available through the YouTube API?
  2. Do I need a developer key to use the YouTube API?
  3. Where can I go to get help with a problem I'm experiencing?
  4. What's the difference between the Data API and the Legacy API?
  5. How long will the Legacy API continue to work?
  6. Using the API

  7. What is the Developer Key? What is the Client ID?
  8. What are the limits for uploading with the API?
  9. What can I do if I'm running into quota limits?
  10. Does a ClientLogin authentication token have an expiration date?
  11. How do I get more than 1000 results from a video search?
  12. Are there any limits on the number of operations I can perform using the API?
  13. I'm building a business around the YouTube API. Are there any approvals required to do this?
  14. Can I have advertising on my site if I use the API?
  15. What are the size limits on Google/YouTube account usernames and passwords?
  16. Do you have any tips or short sample code for common issues?
  17. Player APIs

  18. How do I customize the embedded player?
  19. How can I embed a YouTube video retrieved via the API on my site?
  20. How can I test the YouTube player API locally on my computer?
  21. I'm having trouble embedding a YouTube video

Getting Started

What functionality is available through the YouTube API?

The API provides the ability to retrieve feeds related to videos, users, and playlists. It also provides the ability to manipulate these feeds, such as creating new playlists, adding videos as favorites, and sending messages. The API is also able to upload videos.

Please see the Reference Guide for a complete list of feeds.

Additionally, there is a JavaScript API and a Flash API for the video player.

Do I need a developer key to use the YouTube API?

Only to perform write or upload operations. You can sign up for a developer key if you do not have one.

If you already have an existing developer key for use with the Legacy API, you will need to get a new key for use with the Google Data API.

Where can I go to get help with a problem I'm experiencing?
If you can't find a solution in this knowledge base or the documentation, you're welcome to post your question to the discussion group. Members of the developer community, including some YouTube staff, actively read and respond to questions posed in the group.
What's the difference between the Data API and the Legacy API?
The Data API provides much more control and filtering ability on the feeds returned. It has feature parity with the Legacy API, and the Migration Guide gives a sense of the differences in operation. The Data API also permits you to perform write operations and upload new video content. This resource is not exhaustive. Please see the Reference Guide and Developer's Guide for more detailed information.
How long will the Legacy API continue to work?
We plan on having the Legacy API remain accessible until at least August 30th, 2008. However, additional features will not be added to the Legacy API and only limited development support will be offered in the discussion group. Additionally, only critical issues will receive attention. More information can be found in the Migration Guide.

Using the API

What is the Developer Key? What is the Client ID?

The Developer Key and Client ID are available via your API developer dashboard. Each applies to a single product.

The Developer Key is passed as an HTTP header and is required for using the API to perform any authenticated (write or upload) requests.

The Client ID is used for logging and is also sent as an HTTP header with every request.

Refer to the the Developer's Guide for a more detailed explanation of how these headers are included in a request.

What are the limits for uploading with the API?

The following limits exist for uploading videos through the Data API:

  • Videos can be no longer than 10 minutes.
  • Videos can be no larger than 1 gigabyte.
  • One account can have no more than 2000 videos.

If you want to aggregate user-contributed videos into searchable groups, please consider using developer tags and having the videos uploaded to the user's YouTube account.

What can I do if I'm running into quota limits?

If you are receiving quota errors, there are a couple steps you can take:

  • Have your requests include your developer key and clientID
  • Make sure the actions your code is performing is user-initiated
  • Pass the user's IP address in the restriction query parameter.
  • If you are requesting authenticated feeds, login as the user rather than a site-wide account

If you are still running into the quota limits within these guidelines and you feel the legitimate traffic from your site is being throttled, please contact us.

Does a ClientLogin authentication token have an expiration date?
A ClientLogin token currently lasts for 24 hours from the issue date.
How do I get more than 1000 results from a video search?
You cannot. Search results are limited to 1000 videos. Try a more specific search.
Are there any limits on the number of operations I can perform using the API?
Yes, there is a quota system in place to prevent abuse of the API. If you are receiving a large number of quota errors, read the section What can I do if I'm running into quota limits?
I'm building a business around the YouTube API. Are there any approvals required to do this?
Please read the commercial use section of the API Terms of Use. You must also abide by the site Terms of Use.
Can I have advertising on my site if I use the API?
Please read the commercial use section of the API Terms of Use. You must also abide by the site Terms of Use.
What are the size limits on Google/YouTube account usernames and passwords?
Character limits are as follows: 20 characters for YouTube usernames and passwords, 30 characters for Google Account usernames, and 100 characters for Google Account passwords. Also, usernames must be alphanumeric.
Do you have any tips or short sample code for common issues?
You should browse the Google Data API Tips Blog for help with both our client libraries and making raw requests. The Client Libraries and Sample Code page also lists some additional resources.

Player APIs

How do I customize the embedded player?
Look at the embedded player parameters for how to disable or enable various player features.
How can I embed a YouTube video retrieved via the API on my site?

If the video can be embedded, the link to the SWF file can be found in the media:content url.

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

Once you have the URL, you can substitute it into the standard embed template:

<object width="425" height="350">
  <param name="movie" value="http://www.youtube.com/v/VIDEO_ID"></param>
  <param name="wmode" value="transparent"></param>
  <embed src="http://www.youtube.com/v/VIDEO_ID" 
    type="application/x-shockwave-flash" wmode="transparent" 
    width="425" height="350">
  </embed>
</object>
  
How can I test the YouTube player API locally on my computer?

Due to security restrictions in Flash, the best solution is to run a local webserver on your machine and host the HTML/JS files on that. If you are not able to do this, then you can use the Adobe Flash Player Settings Manager to configure exceptions for specific files or folders.

I'm having trouble embedding a YouTube video

If you are using the YouTube Player APIs you will notice that some videos will refuse to load on your site. This is because the owner of that video has requested that embedding be disabled. You can tell on the video watch page because it will say "Embedding disabled by request" in place of the standard embed code:

http://www.youtube.com/watch?v=juPxfHO50oo

If you are retrieving videos to display using the Data API you should use the format parameter set to 5 in order to filter out non-embeddable videos:

http://gdata.youtube.com/feeds/api/videos?v=2&format=5

If you are using the Player JavaScript or AS2 API you should also handle the onError event.