---
title: "YouTube API"
description: "Use Ayrshare's YouTube API to publish videos and shorts, schedule them, and get analytics for your users, without waiting on Google's OAuth verification."
canonical: https://www.ayrshare.com/youtube-api/
lastModified: 2026-10-30
pageType: landing
---

# YouTube API

> Use Ayrshare's YouTube API to publish videos and shorts, schedule them, and get analytics for your users, without waiting on Google's OAuth verification.

## YouTube API for Uploading, Scheduling, and Analytics

Ayrshare's YouTube API lets developers publish videos and shorts to YouTube channels via a single REST endpoint. It supports scheduled uploads, visibility control, playlists, thumbnails, subtitles, comments, and analytics across 14+ social networks through one integration.

Your users link their own YouTube channels through a Google OAuth flow inside your product, on Ayrshare's verified Google app. You don't need your own OAuth verification, quota audit, or upload code.

[Read the YouTube Docs](/docs/apis/post/social-networks/youtube)
[Get Your API Key](/pricing/)

- **>99.99%** — API uptime
- **30M+** — API calls per day
- **14+** — Social media networks
- **AI-Native** — Native MCP server for any AI agent

## What Do You Need to Use the YouTube API?

The YouTube Data API is free to call, but uploading to other people's channels takes a Google Cloud project, an OAuth consent screen, and Google's review of your app. Uploads need OAuth 2.0, since an API key only reads public data. Each project gets a small daily quota, and large files go up as resumable uploads your code has to restart after a dropped connection.

With Ayrshare, you skip OAuth verification and the quota audit: your users link their channels and you upload on the same day.

- **Access**: A Google Cloud project with the YouTube Data API turned on, OAuth 2.0 credentials, and Google's OAuth app verification before a public launch. Until then, Google shows an unverified app screen and caps the app at 100 new users.
- **Cost**: No fee per call. The cost is quota: 100 uploads a day per project by default, plus 10,000 units for other calls. More quota means an extension request and a YouTube API compliance audit.
- **Account types**: YouTube channels, linked by a Google account that owns or manages the channel. Service accounts don't work, because they have no channel.
- **Key limits**: YouTube also caps how many videos each channel uploads in 24 hours, based on country and channel history. Custom thumbnails and videos over 15 minutes need a phone-verified channel.

## Upload and Schedule to YouTube in Your Language

Each sample uploads a public video now, then schedules a short for later. Every YouTube post needs a title, so each one carries a youTubeOptions object. Same endpoint, same JSON, in Node.js, Python, PHP, Java, Go, Ruby, C#, or plain cURL. Add a Profile-Key header to post for one of your users.

[Full Post API Reference](/docs/apis/post/overview)

- **cURL**
- **Node.js**
- **Python**
- **PHP**
- **Java**
- **Go**
- **Ruby**
- **C#**

## YouTube API Limits: Post Types, Media, and Characters

YouTube's rules in one place. The full list lives in the [YouTube media guidelines](/docs/media-guidelines/youtube) and the [YouTube publishing options](/docs/apis/post/social-networks/youtube).

- **2 formats: video and short (Post types)**: Video only, published as a regular video or a short. The post text becomes the video description.
- **Owner or manager of the channel (Accounts)**: YouTube channels. The Google account that links must own or manage the channel, and the channel must be public.
- **2 MB per custom thumbnail (Images)**: Custom thumbnails only, as a JPEG or PNG under 2 MB, on a phone-verified channel. A short can't carry a custom thumbnail.
- **4 GB max file through Ayrshare (Video)**: MP4 or MOV, up to 4 GB through Ayrshare, or larger on Enterprise plans. 16:9 is standard, and H.264 video with AAC audio is recommended.
- **100 title characters (Characters)**: A title is required on every post, and the description holds up to 5,000 bytes. Neither can contain < or >.
- **3 min max short length (Shorts)**: Set shorts on a 9:16 video of 3 minutes or less, ideally 1080 x 1920 px. Ayrshare adds #shorts to the description, and YouTube decides whether it shows as a short.
- **500 tag characters (Playlists, tags, and captions)**: A playlist ID the channel owns, a category, a license, the made-for-kids flag, and an SRT or SBV caption file under 100 MB.
- **300 API calls per 5 minutes per profile (Visibility and scheduling)**: Videos are private by default. Set visibility to public, unlisted, or private at upload, or change it later with the update endpoint. Pass a scheduleDate for Ayrshare to upload later, or use publishAt. YouTube's per-channel upload cap still applies.

## What Else Can You Do With the YouTube API?

- **Publish a short**: Set the shorts flag on a vertical video of 3 minutes or less. Ayrshare appends #shorts to the description, and YouTube makes the final call on whether the video appears in the Shorts feed.
- **Choose who sees the video, and when**: Upload as private, unlisted, or public, or hand the timing to YouTube with publishAt: the video uploads private and YouTube makes it public at that UTC time. Use publishAt or Ayrshare's scheduleDate, not both. To change visibility after the video posts, send PUT /post with the Ayrshare post id and a new visibility.
- **Add a thumbnail, playlist, and tags**: The playlist ID is the value after list= in a playlist URL the channel owns, and category 24 is Entertainment. If the thumbnail fails, the video still posts with a warning, code 307.
- **Upload a caption file**: Point subTitleUrl at an SRT or SBV file served over HTTPS. Add the language code and the name viewers see in the captions menu.
- **Label altered or synthetic content**: YouTube requires a disclosure when realistic content is altered or synthetic. Set containsSyntheticMedia at upload, since it can't be added through the API afterwards.

## Why Use Ayrshare Instead of the YouTube API Directly?

Ayrshare runs the verified Google app and its upload quota, so your product sends one request with a title and a video URL and gets back the YouTube video ID and URL. Ayrshare handles the channel linking flow, the resumable upload, and the thumbnail, playlist, tags, and captions. If the thumbnail can't be applied, the video still posts and the response says why. Upload timeouts come back with a retryAvailable flag, so your code knows when to retry with backoff. When Google changes the Data API or its quota rules, the fix ships on our side, not in your sprint.

For a step-by-step walkthrough, read [How to Upload YouTube Shorts with an API](/blog/post-youtube-shorts-with-an-api/).

[See the YouTube Publishing Options](/docs/apis/post/social-networks/youtube)

- **Your app sends one request**: POST /post with the video URL, a title in youTubeOptions, and the user's Profile-Key.
- **Ayrshare runs the Google flow**: Channel linking, the resumable upload, and the thumbnail, playlist, tags, and captions.
- **The live video comes back**: The YouTube video ID and postUrl. The same Ayrshare id works for analytics, comments, visibility changes, and deletion.

## Beyond Posting: The Rest of the YouTube Lifecycle

Analytics, comments, history, and visibility changes all run through the same channel connection as the upload. No second vendor, no second auth flow.

Not available on YouTube: direct messages, which YouTube doesn't offer through its API, plus reviews and ads. See every network you can reach with the same integration on the [supported networks page](/supported-networks/).

- **Analytics**: Views, likes, comments, watch time, and subscriber changes per video and per channel. Videos with few views can take 24 to 48 hours to report.
  - [Analytics API](/social-media-analytics-api/)
- **Comments**: Read comments and replies on a video, post a comment, reply, and delete, including on videos published outside Ayrshare.
  - [Engagement API](/social-media-engagement-api/)
- **Visibility updates**: Move a posted video between private, unlisted, and public, or change its title, description, or category, with the same Ayrshare post id.
  - [Update post docs](/docs/apis/post/update-post)
- **History**: Pull a channel's past videos with metrics, including videos uploaded outside Ayrshare, filtered by date.
  - [History API](/history-api/)
- **Pre-publish checks**: Check the title, description, and media before you post, so a long title never turns into a failed upload.
  - [Validate docs](/docs/apis/validate/overview)

## FAQs About the YouTube API

### Can I upload videos to YouTube through an API?

Yes, you can upload videos to YouTube through an API. Ayrshare's YouTube API lets developers publish videos and shorts to YouTube channels via a single REST endpoint. It supports scheduled uploads, visibility control, playlists, thumbnails, subtitles, comments, and analytics across 14+ social networks through one integration. Start with the [YouTube publishing options](/docs/apis/post/social-networks/youtube).
### Is the YouTube API free?

The YouTube API is free to call, since Google charges nothing per request for the Data API. You pay in quota instead: 100 uploads a day per project by default, and more only after an extension request and a compliance audit. Ayrshare's plans include uploads on Ayrshare's verified Google app, so you don't manage quota yourself. [Compare Ayrshare plans](/pricing/).
### How do I get a YouTube API key?

To get a YouTube API key, create a Google Cloud project, turn on the YouTube Data API, and create credentials. An API key only reads public data, so uploads need OAuth 2.0 credentials and, for a public app, Google's OAuth verification. With Ayrshare, your users link channels through Ayrshare's app, and the [Post API reference](/docs/apis/post/overview) shows the one request you need.
### How do I upload a video with the YouTube API?

To upload a video with the YouTube API through Ayrshare, send a POST /post request with "platforms": ["youtube"], a video URL in mediaUrls, the description as post, and a title in youTubeOptions. Add scheduleDate to upload later. Ayrshare runs the resumable upload and returns the video ID and URL. The tutorial [How to Upload YouTube Shorts with an API](/blog/post-youtube-shorts-with-an-api/) shows a first upload.
### Can I publish shorts programmatically?

Yes, you can publish shorts programmatically. Add "shorts": true to youTubeOptions on a vertical 9:16 video of 3 minutes or less, ideally 1080 x 1920 px. Ayrshare adds #shorts to the description, and YouTube decides whether the video shows in the Shorts feed. A short doesn't take a custom thumbnail. See the [YouTube media guidelines](/docs/media-guidelines/youtube) for the full video rules.
### What are the YouTube API quota and upload limits?

The YouTube API quota gives each Google project 100 uploads a day by default, plus 10,000 units for other calls, and YouTube also caps uploads per channel in 24 hours. Through Ayrshare, files go up to 4 GB, titles to 100 characters, and descriptions to 5,000 bytes. If a channel hits its cap, wait 24 hours and retry. The [YouTube publishing options](/docs/apis/post/social-networks/youtube) list every field.

## Your Users Are on YouTube. Your Product Can Be Too.

Get an API key, upload your first video to a YouTube channel, and turn on the other networks with the same call when you need them.

[Get Your API Key](/pricing/)
[Read the YouTube Docs](/docs/apis/post/social-networks/youtube)
