# How to Automate YouTube Video Uploads using the API

- Tool: API Automations
- Difficulty: Advanced
- Fix time: 60–120 minutes
- Compatibility: YouTube Data API v3, google-api-python-client 2.x, googleapis npm 144.x
- Last updated: May 2026

## TL;DR

YouTube videos.insert requires resumable upload: POST for a session URI, then PUT video chunks in multiples of 256 KB. The critical gotcha since July 28, 2020: ALL videos uploaded via unaudited API projects are FORCED to private and cannot be made public — you must pass the YouTube API Compliance Audit first. The youtube.upload scope is Restricted and also requires the audit. Quota cost is disputed (100 vs 1,600 units) — verify in Cloud Console. With 10,000 units/day, you may only get 6–100 uploads per day.

## Best practices

- Submit the YouTube API Compliance Audit before building any upload automation — without it, every uploaded video is permanently locked as private regardless of your privacyStatus setting
- Always use resumable upload (uploadType=resumable) for video files — simple upload (uploadType=media) is limited to 5 MB and will fail for any real video
- Use chunk sizes that are exact multiples of 256 KB (262,144 bytes) — the last chunk can be any size, but all intermediate chunks must be multiples
- Start uploads with privacyStatus='private' and change to public after review — even for automated pipelines, a review step reduces policy violation risk
- Set selfDeclaredMadeForKids accurately — this is a legal requirement under COPPA/GDPR for child-directed content
- Store resumable upload session URIs in a database with creation timestamps — valid for 1 week, allowing you to resume interrupted uploads rather than starting over
- Verify the actual videos.insert quota cost in Cloud Console — the disputed 100 vs 1,600 unit cost makes a major difference in your upload capacity planning
- Use categoryId from videoCategories.list with your regionCode — categories vary by region, and some category IDs are not assignable (assignable=false)

## Frequently asked questions

### Why are all my uploaded videos locked as private even though I set privacyStatus='public'?

Your GCP project has not passed the YouTube API Compliance Audit. Since July 28, 2020, all videos uploaded via the API from unaudited projects are automatically forced to private status. This applies regardless of what privacyStatus you send. Submit the YouTube API Services Compliance Audit form at console.cloud.google.com. Until your project is audited and approved, you cannot make API-uploaded videos public — not via the API and not via YouTube Studio.

### How many videos can I upload per day with the YouTube Data API?

It depends on the disputed quota cost for videos.insert. If the cost is 100 units, you can upload 100 videos/day on the 10,000 unit free quota. If it's 1,600 units (which many sources report), you can only upload 6 videos/day. Check your actual consumption in Cloud Console > APIs & Services > Quotas after a test upload. For more than 10,000 units/day, submit the YouTube API Services Audit and Quota Extension Form.

### What is resumable upload and why is it required?

Resumable upload is a two-phase protocol: Phase 1 sends video metadata and gets a session URI. Phase 2 sends the actual video bytes in chunks to that URI. It's required because video files are too large for simple HTTP POST requests, and it allows you to resume a failed upload from where it stopped rather than starting over. Session URIs are valid for 1 week. Chunk sizes must be multiples of 256 KB (262,144 bytes).

### Can I use a service account to upload videos on behalf of multiple YouTube channels?

No. Service accounts are not supported by any YouTube API — they return NoLinkedYouTubeAccount because a service account has no YouTube channel. For multi-channel upload automation, each channel's owner must authorize your app via OAuth, and you must store separate refresh tokens for each channel. There is no workaround for this limitation.

### What categoryId should I use for my videos?

Call videoCategories.list with your target regionCode to get the list of valid categories and their assignable status. Common IDs: 22 = People & Blogs, 10 = Music, 20 = Gaming, 28 = Science & Technology, 27 = Education, 24 = Entertainment. Not all categories are assignable (assignable=false) and some categories vary by region.

### Can RapidDev help build a video upload pipeline for my platform?

Yes. If you need to automate video publishing to YouTube as part of a content workflow — pulling from Google Drive, applying consistent metadata templates, setting thumbnails, and tracking processing status — RapidDev can build that pipeline. We also help navigate the Compliance Audit requirements so your videos can actually go public.

### What happens if my upload is interrupted halfway through?

For resumable uploads, you can recover. Send a PUT to the session URI with Content-Range: bytes */TOTAL_SIZE and Content-Length: 0 to get a 308 Resume Incomplete response with a Range header showing how many bytes the server received. Then resume the upload from byte (Range end + 1). Session URIs are valid for 1 week from creation — after that you must start over.

---

Source: https://www.rapidevelopers.com/api-automations/how-to-automate-youtube-video-uploads-using-the-api
© RapidDev — https://www.rapidevelopers.com/api-automations/how-to-automate-youtube-video-uploads-using-the-api
