YouTube
Upload, tag and share your videos worldwide!
Sign Up | Log In | Help
Home
Videos
Channels
Upload
Invite Friends
   
Developers
Introduction
YouTube is very excited to announce the availability of our XML APIs.

Are you a developer? Do you wish to integrate online videos into your application?

With the set of YouTube XML APIs, developers can integrate applications directly into YouTube's growing repository of videos. The API calls will allow you to conduct tag searches, fetch video details, list videos by user, etc. Furthermore, it is a fundamental belief of ours that web services and web-enabled desktop applications will be paving the road of future software. Along these beliefs, we will be putting a tremendous amount of effort into enhancing our APIs as well as assisting 3rd party developers in every possible way.
Getting Started
To get started, you will first have to create an account. After doing so, you must register for developer access through the developer profile. Upon completion of the developer registration process, you will be given a developer id. This developer id will be sent along for all your XML API requests.
Documentation and Sample Code
To make an API call, you will need to send an XML request to this URL:

http://www.youtube.com/api/ut_api
There are currently two API calls: sequence_request and get_video_details
sequence_request

The sequence request call is used to retrieve a sequence of videos. This is the typical entry point into the system. You can conduct a search by tag or username.
<ut_request>
  <request_type>get_video_details_request</request_type>
  <requester>
    <type>dev</type>
    <id>YOUR_DEVELOPER_ID</id>
  </requester>
  <request>
    <type>tag|user</type>
    <query>tag|username</query>
  </request>
</ut_request>
sequence_response

The sequence response represents a sequence of videos that meet the sequence request query. All sequence requests, regardless of request type, will have its videos encapsulated in a sequence response. With the video id that is passed back, you can hit the YouTube website at http://www.youtube.com/watch.php?v=VIDEO_ID replacing VIDEO_ID with the video id returned; this will enable you to play the video through a browser.
<ut_response>
  <response_type>sequence_response</response_type>
  <response>
      <sequence_overview>
          <title>sequence title</title>
          <length>number of items in sequence</length>
          <md5_sum>md5 sum of the sequence</md5_sum>
      </sequence_overview>
      <sequence_items>
          <sequence_item>
              <id>video id</id>
              <author>author name</author>
              <title>movie title</title>
              <keywords>video tags</keywords>
              <description>video description</description>
              <date_uploaded>upload date</date_uploaded>
              <view_count>number of times viewed</view_count>
              <comment_count>number of comments</comment_count>
          </sequence_item>
      </sequence_items>
  </response>
</ut_response>
get_video_details_request

The get video details request is used to fetch all the details about a given video id. Generally, you'd use the sequence request call to fetch the videos of interest. Then, you'd turn around and call the get video details to fetch the details of a video.
<ut_request>
  <request_type>get_video_details_request</request_type>
  <requester>
    <type>dev</type>
    <id>YOUR_DEVELOPER_ID</id>
  </requester>
  <request>
    <video_id>video id</video_id>
  </request>
</ut_request>
get_video_details_response

The get video details response will return all the public information about a given video.
<ut_response>
    <response_type>get_video_details</response_type>
    <response>
        <public></public>
        <view_count></view_count>
        <vote_count></vote_count>
        <vote_sum></vote_sum>
        <related_videos_by_author>
            <video_id>other video by author id 1</video_id>
            <video_id>other video by author id 2</video_id>
            <video_id>other video by author id 3</video_id>
        </related_videos_by_author>
        <related_tags>
            <tag>related tag 1</tag>
            <tag>related tag 2</tag>
        </related_tags>
        <author>
            <username>author username</username>
        </author>
        <video>
            <title>movie title</title>
            <length>length in seconds</length>
            <description>this is the description for the video</description>
            <time_created>July 13, 2005</time_created>
        </video>
        <comments>
            <comment>
                <time_created>July 14, 2005</time_created>
                <author>username</author>
                <comment>this is a comment</comment>
            </comment>
            <comment>
                <time_created>July 15, 2005</time_created>
                <author>username</author>
                <comment>this is a comment</comment>
            </comment>
        </comments>
    </response>
</ut_response>



Contact YouTube

If you have any questions regarding the developer program, please contact us here. Also, please contact us if you have suggestions on how to improve our API services.
What's New | About Us | Help | Developers | Terms of Use | Privacy Policy

Copyright © 2005 YouTube, LLC™ |