YouTube
YouTube videos and Shorts use videos.insert. A Short is a square or vertical video of at most 3 minutes, sent as a normal video. There is no separate Shorts switch, and the product does not require a #Shorts hashtag. A longer video, or a horizontal video when the size is known, is rejected as a Short before any upload.
Community posts are not in the API resource list. They are a handoff.
What the API allows
Section titled “What the API allows”| Limit | Value |
|---|---|
| Title | 100 characters. < and > are rejected. |
| Description | 5,000 UTF-8 bytes |
| Tags | 500 characters, including commas and quotes around tags that contain spaces |
| Video file | Up to 256 GB. The practical duration cap for a verified channel is 12 hours. Unverified channels are often capped at 15 minutes by YouTube. |
| Thumbnail | JPEG or PNG, up to 50 MB, sent with thumbnails.set after the video is accepted. For a Short, the thumbnail waits until processing has succeeded. |
| Daily uploads | The default quota is 100 videos.insert calls a day, in their own bucket. Other methods share 10,000 units a day. thumbnails.set costs about 50 of those units. Both reset at midnight Pacific time. |
| Privacy | A draft that does not choose a privacy is sent as private. |
Sources: Quota and compliance audits and YouTube’s Shorts help.
Scopes
Section titled “Scopes”The product requests only:
https://www.googleapis.com/auth/youtube.uploadto uploadhttps://www.googleapis.com/auth/youtube.readonlyto read the channel id after sign-in
The upload scope does not list the signed-in channel, so both are required. The flow is the web server authorization-code flow with offline access, a consent prompt, and a PKCE challenge (S256).
Set up the Google app
Section titled “Set up the Google app”Do this on the server before Connect works. Do not put the client secret in git, in a screenshot, or in this help center.
- Create or choose a project in Google Cloud Console.
- Enable YouTube Data API v3 on the API library page.
- Open the Google Auth Platform and set the consent screen. Choose External if people outside your Google Workspace organization will connect a channel. Leave publishing status on Testing while you set the product up.
- Add the two scopes above and no others.
- Create an OAuth client of type Web application on Clients. Add the redirect URI from Accounts.
- Put the client id and secret in
YOUTUBE_CLIENT_IDandYOUTUBE_CLIENT_SECRET. Restart the app.
While the app is in Testing, add every Google account that will connect a channel as a test user. Testing allows up to 100 test users, shows an unverified-app warning, and expires authorizations seven days after consent, including the refresh token. A Brand Account can connect when one of those test users manages it. See Manage App Audience.
A public audience for these scopes needs OAuth verification. Stay in Testing until that review is worth doing. Ask for a higher upload quota only when you are ready for YouTube’s compliance audit.
Sign in as the Google account that owns the channel. For a first real upload, leave privacy as private and confirm the video on YouTube before you upload another.