Network API

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.

One integration, 14+ networks, 30M+ API calls a day.

X
Facebook
Instagram
TikTok
Bluesky
YouTube
LinkedIn
Pinterest
Telegram
Reddit
Threads
Snapchat
Google Business
WhatsApp

>99.99%

API uptime

30M+

API calls per day

14+

Social media networks

AI-Native

Native MCP server for any AI agent

>99.99%

API uptime

30M+

API calls per day

14+

Social media networks

AI-Native

Native MCP server for any AI agent

Before you build

What Do You Need to Know 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.

Linking YouTube channels through Ayrshare's Google OAuth connect screen, with a viewer account that has no channel access, next to the steps of going direct: OAuth verification, a 100 uploads a day quota, a compliance audit, and resumable upload code

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.

# 1. Publish now: a public video with a titlecurl -X POST https://api.ayrshare.com/api/post \  -H "Authorization: Bearer $AYRSHARE_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "post": "A tour of the new analytics dashboard, start to finish.",    "platforms": ["youtube"],    "mediaUrls": ["https://example.com/dashboard-tour.mp4"],    "youTubeOptions": {      "title": "Analytics dashboard tour",      "visibility": "public"    }  }'
# 2. Schedule for later (ISO 8601, UTC)curl -X POST https://api.ayrshare.com/api/post \  -H "Authorization: Bearer $AYRSHARE_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "post": "Three shortcuts most people miss.",    "platforms": ["youtube"],    "mediaUrls": ["https://example.com/shortcuts.mp4"],    "youTubeOptions": {      "title": "Three shortcuts",      "shorts": true,      "visibility": "public"    },    "scheduleDate": "2026-11-06T17:00:00Z"  }'
The fine print

YouTube API Limits: Post Types, Media, and Characters

YouTube's rules in one place. The full list lives in the YouTube media guidelines and the YouTube publishing options.

Post types

2formats: video and short

Video only, published as a regular video or a short. The post text becomes the video description.

Accounts

Owneror manager of the channel

YouTube channels. The Google account that links must own or manage the channel, and the channel must be public.

Images

2 MBper custom thumbnail

Custom thumbnails only, as a JPEG or PNG under 2 MB, on a phone-verified channel. A short can't carry a custom thumbnail.

Video

4 GBmax file through Ayrshare

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.

Characters

100title characters

A title is required on every post, and the description holds up to 5,000 bytes. Neither can contain < or >.

Shorts

3 minmax short length

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.

Playlists, tags, and captions

500tag characters

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.

Visibility and scheduling

300API calls per 5 minutes per profile

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.

Beyond the basic post

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.

Skip the setup

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.

See the YouTube Publishing Options
  1. Step 1

    Your app sends one request

    POST /post with the video URL, a title in youTubeOptions, and the user's Profile-Key.

  2. Step 2

    Ayrshare runs the Google flow

    Channel linking, the resumable upload, and the thumbnail, playlist, tags, and captions.

  3. Live

    The live video comes back

    The YouTube video ID and postUrl. The same Ayrshare id works for analytics, comments, visibility changes, and deletion.

After you publish

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.

YouTube channel analytics from GET /analytics/social (subscribers 124K, views 2.4M, watch time 38K hours, likes 71K) beside the comments on a video with a creator reply, a visibility setting changed with PUT /post, and a reply box

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

Comments

Read comments and replies on a video, post a comment, reply, and delete, including on videos published outside Ayrshare.

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

History

Pull a channel's past videos with metrics, including videos uploaded outside Ayrshare, filtered by date.

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

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.

Common questions

FAQs About the YouTube 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.

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.

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 shows the one request you need.

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 shows a first upload.

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 for the full video rules.

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 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.