YouTube

Options for posting via the API to YouTube

YouTube API Endpoints

Overview

YouTube posting requires your YouTube account to have at least one Channel and be an owner on the Channel. To create a YouTube Channel, click on you profile in the YouTube Dashboard and choose "Create a Channel". You may also use this direct link to create a YouTube Channel: http://m.youtube.com/create_channel

Posting to YouTube requires the youTubeOptions object with at least a title set. The title is the only required field. For example, to post a YouTube video with default settings:

{
    "post": "My Best YouTube Description",                  // required: Video description
    "platforms": ["youtube"],                               // required
    "mediaUrls": ["https://img.ayrshare.com/012/vid.mp4"], // required: URL of video, 1 allowed               
    "youTubeOptions": {
        "title": "Your Best Title"                         // required: Video Title, max 100 characters. Must be 100 characters or less.
    }
}

There are several other optional fields listed below, including the video visibility, tags, and publishAt date. Please see the comments for requirements and descriptions.

{
    "post": "My Best YouTube Description",                  // required: Video description
    "platforms": ["youtube"],                               // required
    "mediaUrls": ["https://img.ayrshare.com/012/vid.mp4"], // required: URL of video, 1 allowed               
    "youTubeOptions": {
        "title": "Your Best Title",                         // required: Video Title, max 100 characters. Must be 100 characters or less.
        "visibility": "private",                            // optional: "public", "unlisted", or "private" - default "private".
        
        // Important Thumbnail information below
        "thumbNail": "https://img.ayrshare.com/012/gb.jpg", // optional: URL of a JPEG or PNG and less than 2MB. Extension must end in png, jpg, or jpeg
        
        "playListId": "PLrav6EfwgDX5peD7Ni-pOKa7B13WjLyUB", // optional: Playlist ID to add the video.
        "tags": ["dancing", "dogs"],                        // optional: array of tags, length limit 400 characters combined. E.g. ["abc", "12"] is characters length 5. Must be at least 2 characters long.
        "madeForKids": false,                               // optional: self declared made for kids. Default false.
        "shorts": true,                                     // optional: Post the video as a "Shorts". Video duration must be 60 seconds on less. Will add the #Shorts hashtag to the description.
        "notifySubscribers": true,                          // optional: Default: true. Whether YouTube should send a notification about the new video to users who subscribe to the video's channel.
        "categoryId": 24,                                   // Optional: Specify the Category of the video. See Category endpoint below. U.S. Category 24 is Entertainment.                           
        
        // optional: You may specify a time to publish on YouTube. The video will be sent to YouTube. Visibility automatically set to "private".
        // Format: Accepts a UTC datetime. For example, use format "YYYY-MM-DDThh:mm:ssZ" and send as "2023-07-08T12:30:00Z". 
        "publishAt": "2022-10-08T21:18:36Z"                 
    }
}

The title must be 100 characters or less. The post must be 5,000 characters or less. The post and title may contain any characters except < and >.

The Playlist Id can be found by opening the playlist in a browser and copying the value after list=. The authenticated user and channel must be the owner of the playlist to add videos.

If your video doesn't end in a known video extension such as mp4, please use the isVideo parameter. See the /post endpoint for details.

YouTube Shorts

You can post a YouTube Shorts video by adding the shorts parameter to the youTubeOptions:

"shorts": true

The #Shorts hashtag will be added to the YouTube description. The video must also be 60 seconds or less and have a square or vertical aspect ration to be considered a short.

Additional information on using the API to post YouTube Shorts.

YouTube Thumbnails

Thumbnails and other features, such as uploading 15 minute videos, require verification of your phone number. A thumbNail is a URL of a JPEG or PNG and less than 2MB in size. Extension must end in png, jpg, or jpeg.

{
    "thumbNail": "https://img.ayrshare.com/012/gb.jpg"
}

Enable Thumbnails in YouTube Studio

You must be granted YouTube permissions to post thumbnails. In YouTube Studio go to Settings->Channel. Select "Feature Eligibility" and click "Features that require phone verification". Enter your phone number to enable.

YouTube may take up to 24 hours to enable thumbnails after you verify your phone number. Please note, YouTube determines eligibility for adding thumbnails. "Enabled" phone verification does not guarantee YouTube will allow thumbnail uploads. If you are still having issues, please see this video on solving the Thumbnail issue.

Video: Posting to YouTube via the API

YouTube Upload Limits

YouTube limits how many videos a channel can upload in a 24-hour period via the YouTube API.

  • Depending on a creator’s location, a channel might be able to increase their daily limit by getting access to advanced features. To learn more visit this article.

  • Limits may vary by country/region or channel history. Copyright strikes may impact channel history eligibility and Community Guidelines strikes will affect how much a channel can upload.

If you receive and upload limit error please wait and try again in 24 hours.

You must activate Advanced Features in YouTube Studio to have clickable links in the YouTube video description.

Go to YouTube Studio -> Settings -> Channel -> Feature Eligibility -> Advanced Features -> Access Features to activate the advanced features.

Retrieve YouTube Video Categories

Classify YouTube videos my categories.

Retrieve YouTube categories by region

GET https://app.ayrshare.com/api/post/youTubeCategories/:region

Retrieve the categories ids for a given region. The category ID can be set in the POST or PUT /post endpoints.

For example, GET https://app.ayrshare.com/api/youTubeCategories/US for the U.S. video categories.

Path Parameters

NameTypeDescription

region*

string

Two letter alpha-2 code of the region.

{
    "region": "US",
    "categories": [
        {
            "id": "1",
            "title": "Film & Animation"
        },
        {
            "id": "10",
            "title": "Music"
        },
        {
            "id": "15",
            "title": "Pets & Animals"
        },
        {
            "id": "17",
            "title": "Sports"
        },
        {
            "id": "18",
            "title": "Short Movies"
        },
        {
            "id": "19",
            "title": "Travel & Events"
        },
        {
            "id": "2",
            "title": "Autos & Vehicles"
        },
        {
            "id": "20",
            "title": "Gaming"
        },
        {
            "id": "21",
            "title": "Videoblogging"
        },
        {
            "id": "22",
            "title": "People & Blogs"
        },
        {
            "id": "23",
            "title": "Comedy"
        },
        {
            "id": "24",
            "title": "Entertainment"
        },
        {
            "id": "25",
            "title": "News & Politics"
        },
        {
            "id": "26",
            "title": "Howto & Style"
        },
        {
            "id": "27",
            "title": "Education"
        },
        {
            "id": "28",
            "title": "Science & Technology"
        },
        {
            "id": "29",
            "title": "Nonprofits & Activism"
        },
        {
            "id": "30",
            "title": "Movies"
        },
        {
            "id": "31",
            "title": "Anime/Animation"
        },
        {
            "id": "32",
            "title": "Action/Adventure"
        },
        {
            "id": "33",
            "title": "Classics"
        },
        {
            "id": "34",
            "title": "Comedy"
        },
        {
            "id": "35",
            "title": "Documentary"
        },
        {
            "id": "36",
            "title": "Drama"
        },
        {
            "id": "37",
            "title": "Family"
        },
        {
            "id": "38",
            "title": "Foreign"
        },
        {
            "id": "39",
            "title": "Horror"
        },
        {
            "id": "40",
            "title": "Sci-Fi/Fantasy"
        },
        {
            "id": "41",
            "title": "Thriller"
        },
        {
            "id": "42",
            "title": "Shorts"
        },
        {
            "id": "43",
            "title": "Shows"
        },
        {
            "id": "44",
            "title": "Trailers"
        }
    ]
}.
.

Last updated