YouTube
Social PostingPublish videos and Shorts to YouTube with the Zernio API, with custom thumbnails, visibility, playlists, COPPA and AI disclosure flags, and description edits after publishing.
Authentication details
Connecting accounts guidePermissions5 scopes
- Always requested
- Posting
- Analytics
- Comments
Pass scopes=posting,analytics to the connect endpoint to ask only for those areas. The first row comes with every connection.
Publish videos and Shorts to YouTube with POST /v1/posts and platform: "youtube". The same account serves analytics and comments.
Quick reference
| Property | Value |
|---|---|
| Title limit | 100 characters |
| Description limit | 5,000 characters |
| Tags | Top-level tags array on the create request; 100 characters per tag, 500 combined |
| Videos per post | 1 |
| Video formats | MP4, MOV, AVI, WMV, FLV, 3GP, WebM |
| Video max size | 256 GB |
| Video max duration | 15 minutes (unverified channel), 12 hours (verified) |
| Thumbnail formats | JPEG, PNG, GIF |
| Thumbnail max size | 2 MB |
| Post types | Video, Shorts |
| Scheduling | Yes (a public video is uploaded early as private and released by YouTube at the scheduled time) |
| Editing published posts | Yes (description only; title and tags through a separate endpoint) |
| Inbox (comments) | Yes |
| Comment automations | Public reply only, read by the comment poll (comment automations) |
| Inbox (DMs) | No (YouTube has no DM system) |
| Analytics | Yes |
Before you start
YouTube requires a channel owned by the Google identity you authorize, on a personal Google account or a Brand Account. See Brand Accounts and multiple channels.
Every post is exactly one video, so there are no image-only or text-only posts.
Unverified channels are limited to 15-minute videos. Verify the channel by phone at youtube.com/verify for longer uploads.
Daily upload quotas vary by channel. Shorts are detected from duration and aspect ratio, not chosen with a flag.
If a channel is suspended, every upload fails with a 403. Call Account health before scheduling posts to a channel you do not control.
Connect
Call GET /v1/connect/youtube with profileId on Get OAuth connect URL.
The connecting accounts guide covers the OAuth flow and scopes in general. Account health reports what a connected account can do with the scopes the user granted.
Brand Accounts and multiple channels
There is no channel picker. YouTube connects straight after Google's OAuth screen.
The channel Zernio connects is the one owned by the Google identity you pick in Google's account chooser. Zernio forces that chooser on every connect (prompt=select_account), so the choice is always yours to make:
- A channel on your personal Google account: pick your personal identity.
- A channel that lives on a Brand Account: pick the Brand Account entry in the chooser, not your personal identity. You need owner or manager access to the Brand Account at account.google.com/brandaccounts.
- YouTube Studio "Manage access" permissions do not grant API access. Someone added as an editor or manager only inside YouTube Studio cannot connect that channel; a Brand Account owner or manager has to do it.
No channel found. The identity you picked may own no channel: a personal identity chosen by mistake, Studio-only access, or no channel created yet. The connect then fails with:
We couldn't find a YouTube channel for the Google account you authorized...Restart the flow and pick the right entry in the chooser.
Several channels. A profile holds one YouTube channel. To connect another one:
- Create a second profile and select it.
- Start the YouTube connect again.
- Pick the other channel's identity in the chooser.
Each channel then has its own accountId.
Publish a post
This request uploads a public video to YouTube right away. platformSpecificData sets the title, visibility and category.
import Zernio from '@zernio/node';
const zernio = new Zernio();
const { data: published } = await zernio.posts.createPost({
body: {
content: 'In this tutorial, I walk through building a REST API from scratch.\n\n#programming #tutorial',
tags: ['rest api', 'node.js', 'backend tutorial'],
mediaItems: [{
type: 'video',
url: 'https://cdn.example.com/long-form-video.mp4',
thumbnail: 'https://cdn.example.com/thumbnail.jpg'
}],
platforms: [{
platform: 'youtube',
accountId: '66b2e19d8c3f5a7e9d0b1c2d',
platformSpecificData: {
title: 'Build a REST API from scratch',
visibility: 'public',
categoryId: '27',
madeForKids: false
}
}],
publishNow: true
}
});
console.log(published.post.platforms[0].platformPostUrl);Every option is on Videos & Shorts.
In this section
Videos & Shorts
Publish a video or a Short to YouTube, add it to a playlist, schedule it, edit a published video, and every platformSpecificData field.
Media requirements
Video and custom thumbnail requirements for YouTube, and the rules for media URLs.
Transcripts & captions
Read the caption track of a connected channel's own video to get its transcript.
Analytics
Which analytics metrics YouTube returns and the YouTube-only analytics endpoints.
Inbox
Comments, moderation and likes on YouTube videos in the inbox.
Limits & errors
What YouTube's API does not expose and the common errors when publishing.
Related
- Connecting accounts: the OAuth flow.
- Create post: every field of the request.
- Edit post and Update post metadata: change a published video.
- Media uploads: upload videos instead of hosting them.
- Analytics: post performance metrics.
- Comments: read and reply to comments.
- Get a YouTube video transcript: every parameter of the captions call.
- Pricing: what analytics, the inbox and outbound messages cost, and which replies count.
YouTube
17- GET
- GET
- GET
- GET
- GET
- POST
- GET
- DELETE
- GET
- GET
- GET
- POST
Publishing
24· Unified API, shared with other platforms- POST
- POST
- POST
- POST
- GET
- POST
- GET
- PUT
- DELETE
- POST
- POST
- POST
Analytics
8· Unified API, shared with other platforms- GET
- GET
- GET
- GET
- GET
- GET
- GET
- GET
Comments
15· Unified API, shared with other platforms- GET
- GET
- POST
- DELETE
- PATCH
- POST
- POST
- DELETE
- POST
- DELETE
- POST
- DELETE