YouTube API
Post to YouTube with Late API - Videos, Shorts, thumbnails, and visibility settings
Quick Start
Upload a video to YouTube:
curl -X POST https://getlate.dev/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "My Latest Video\n\nIn this video, I share my thoughts on...\n\n#tutorial #howto",
"mediaItems": [
{"type": "video", "url": "https://example.com/video.mp4"}
],
"platforms": [{
"platform": "youtube",
"accountId": "YOUR_ACCOUNT_ID",
"platformSpecificData": {
"title": "My Latest Video",
"visibility": "public"
}
}],
"publishNow": true
}'const response = await fetch('https://getlate.dev/api/v1/posts', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'My Latest Video\n\nIn this video, I share my thoughts on...\n\n#tutorial #howto',
mediaItems: [
{ type: 'video', url: 'https://example.com/video.mp4' }
],
platforms: [{
platform: 'youtube',
accountId: 'YOUR_ACCOUNT_ID',
platformSpecificData: {
title: 'My Latest Video',
visibility: 'public'
}
}],
publishNow: true
})
});
const { post } = await response.json();
console.log('Uploaded to YouTube!', post._id);import requests
response = requests.post(
'https://getlate.dev/api/v1/posts',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'content': 'My Latest Video\n\nIn this video, I share my thoughts on...\n\n#tutorial #howto',
'mediaItems': [
{'type': 'video', 'url': 'https://example.com/video.mp4'}
],
'platforms': [{
'platform': 'youtube',
'accountId': 'YOUR_ACCOUNT_ID',
'platformSpecificData': {
'title': 'My Latest Video',
'visibility': 'public'
}
}],
'publishNow': True
}
)
post = response.json()['post']
print(f"Uploaded to YouTube! {post['_id']}")Video Types
YouTube automatically detects content type based on duration:
| Duration | Type | Notes |
|---|---|---|
| ≤ 3 minutes | YouTube Shorts | Vertical format, no custom thumbnails via API |
| > 3 minutes | Regular Video | Supports custom thumbnails |
Video Requirements
| Property | Shorts | Regular Video |
|---|---|---|
| Max Duration | 3 minutes | 12 hours |
| Min Duration | 1 second | 1 second |
| Max File Size | 256 GB | 256 GB |
| Formats | MP4, MOV, AVI, WMV, FLV, 3GP | MP4, MOV, AVI, WMV, FLV, 3GP |
| Aspect Ratio | 9:16 (vertical) | 16:9 (horizontal) |
| Resolution | 1080 × 1920 px | 1920 × 1080 px (1080p) |
Recommended Specs
| Property | Shorts | Regular Video |
|---|---|---|
| Resolution | 1080 × 1920 px | 3840 × 2160 px (4K) |
| Frame Rate | 30 fps | 24-60 fps |
| Codec | H.264 | H.264 or H.265 |
| Audio | AAC, 128 kbps | AAC, 384 kbps |
| Bitrate | 10 Mbps | 35-68 Mbps (4K) |
Title and Description
| Property | Limit | Notes |
|---|---|---|
| Title | 100 characters | Defaults to first line of content |
| Description | 5000 characters | Full content used |
The content field becomes the video description. The title is either:
- Specified in
platformSpecificData.title - Auto-extracted from first line of content
- "Untitled Video" as fallback
Visibility Options
Control who can see your video:
| Visibility | Description |
|---|---|
public | Anyone can search and watch (default) |
unlisted | Only people with link can watch |
private | Only you and shared users |
{
"platformSpecificData": {
"visibility": "unlisted"
}
}Custom Thumbnails
For regular videos (>3 min), add a custom thumbnail:
curl -X POST https://getlate.dev/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "My Video Description",
"mediaItems": [{
"type": "video",
"url": "https://example.com/video.mp4",
"thumbnail": {
"url": "https://example.com/thumbnail.jpg"
}
}],
"platforms": [{
"platform": "youtube",
"accountId": "YOUR_ACCOUNT_ID",
"platformSpecificData": {
"title": "My Video Title",
"visibility": "public"
}
}],
"publishNow": true
}'const response = await fetch('https://getlate.dev/api/v1/posts', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'My Video Description',
mediaItems: [{
type: 'video',
url: 'https://example.com/video.mp4',
thumbnail: {
url: 'https://example.com/thumbnail.jpg'
}
}],
platforms: [{
platform: 'youtube',
accountId: 'YOUR_ACCOUNT_ID',
platformSpecificData: {
title: 'My Video Title',
visibility: 'public'
}
}],
publishNow: true
})
});response = requests.post(
'https://getlate.dev/api/v1/posts',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'content': 'My Video Description',
'mediaItems': [{
'type': 'video',
'url': 'https://example.com/video.mp4',
'thumbnail': {
'url': 'https://example.com/thumbnail.jpg'
}
}],
'platforms': [{
'platform': 'youtube',
'accountId': 'YOUR_ACCOUNT_ID',
'platformSpecificData': {
'title': 'My Video Title',
'visibility': 'public'
}
}],
'publishNow': True
}
)Thumbnail Requirements
| Property | Requirement |
|---|---|
| Format | JPEG, PNG, GIF |
| Max Size | 2 MB |
| Resolution | 1280 × 720 px (16:9) |
| Min Width | 640 px |
Note: Custom thumbnails are not supported for Shorts via API.
Made for Kids (COPPA Compliance)
YouTube requires videos to declare whether they are made for kids (child-directed content) to comply with COPPA regulations:
curl -X POST https://getlate.dev/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Fun Educational Video for Children",
"mediaItems": [
{"type": "video", "url": "https://example.com/kids-video.mp4"}
],
"platforms": [{
"platform": "youtube",
"accountId": "YOUR_ACCOUNT_ID",
"platformSpecificData": {
"title": "Learn Colors with Animals",
"madeForKids": true
}
}],
"publishNow": true
}'const response = await fetch('https://getlate.dev/api/v1/posts', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'Fun Educational Video for Children',
mediaItems: [
{ type: 'video', url: 'https://example.com/kids-video.mp4' }
],
platforms: [{
platform: 'youtube',
accountId: 'YOUR_ACCOUNT_ID',
platformSpecificData: {
title: 'Learn Colors with Animals',
madeForKids: true
}
}],
publishNow: true
})
});response = requests.post(
'https://getlate.dev/api/v1/posts',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'content': 'Fun Educational Video for Children',
'mediaItems': [
{'type': 'video', 'url': 'https://example.com/kids-video.mp4'}
],
'platforms': [{
'platform': 'youtube',
'accountId': 'YOUR_ACCOUNT_ID',
'platformSpecificData': {
'title': 'Learn Colors with Animals',
'madeForKids': True
}
}],
'publishNow': True
}
)| Value | Description |
|---|---|
true | Video is made for kids (child-directed content) |
false | Video is NOT made for kids (default) |
Important: Videos marked as made for kids have restricted features including disabled comments, no notification bell, and limited ad targeting. If not specified, defaults to
false. YouTube may require this to be explicitly configured in YouTube Studio if not set via API.
Video Categories
Specify a category for your video to help YouTube organize and recommend it:
curl -X POST https://getlate.dev/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Learn Python programming from scratch",
"mediaItems": [
{"type": "video", "url": "https://example.com/tutorial.mp4"}
],
"platforms": [{
"platform": "youtube",
"accountId": "YOUR_ACCOUNT_ID",
"platformSpecificData": {
"title": "Python Tutorial for Beginners",
"categoryId": "27"
}
}],
"publishNow": true
}'const response = await fetch('https://getlate.dev/api/v1/posts', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'Learn Python programming from scratch',
mediaItems: [
{ type: 'video', url: 'https://example.com/tutorial.mp4' }
],
platforms: [{
platform: 'youtube',
accountId: 'YOUR_ACCOUNT_ID',
platformSpecificData: {
title: 'Python Tutorial for Beginners',
categoryId: '27'
}
}],
publishNow: true
})
});response = requests.post(
'https://getlate.dev/api/v1/posts',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'content': 'Learn Python programming from scratch',
'mediaItems': [
{'type': 'video', 'url': 'https://example.com/tutorial.mp4'}
],
'platforms': [{
'platform': 'youtube',
'accountId': 'YOUR_ACCOUNT_ID',
'platformSpecificData': {
'title': 'Python Tutorial for Beginners',
'categoryId': '27'
}
}],
'publishNow': True
}
)Available Categories
| Category ID | Name |
|---|---|
1 | Film & Animation |
2 | Autos & Vehicles |
10 | Music |
15 | Pets & Animals |
17 | Sports |
20 | Gaming |
22 | People & Blogs (default) |
23 | Comedy |
24 | Entertainment |
25 | News & Politics |
26 | Howto & Style |
27 | Education |
28 | Science & Technology |
Note: If not specified, videos default to category
22(People & Blogs).
First Comment
Add an automatic pinned comment:
{
"platformSpecificData": {
"firstComment": "Thanks for watching! Don't forget to subscribe. What topics should I cover next? 👇"
}
}- Max 10,000 characters
- Posted immediately after upload
- Can include links
Scheduled Videos
When scheduling a YouTube video:
- Video uploads immediately with specified visibility
- Stays in that state until scheduled time
- At scheduled time, may change to "public" if originally set
{
"scheduledFor": "2024-12-25T10:00:00Z",
"platforms": [
{
"platform": "youtube",
"platformSpecificData": {
"visibility": "private"
}
}
]
}Supported Formats
| Format | Extension | Notes |
|---|---|---|
| MPEG-4 | .mp4 | Recommended |
| QuickTime | .mov | Well supported |
| AVI | .avi | Supported |
| WMV | .wmv | Windows Media |
| FLV | .flv | Flash Video |
| 3GPP | .3gp | Mobile format |
| WebM | .webm | Supported |
| MPEG-PS | .mpg | Supported |
Common Issues
Video stuck processing
Large videos (>1 GB) may take 30+ minutes to process. Use scheduled posts for async handling.
Wrong video type detected
- Shorts: ≤3 min + vertical aspect ratio
- Regular: >3 min OR horizontal aspect ratio
- Ensure aspect ratio matches intent
Thumbnail rejected
- Must be exactly 16:9 aspect ratio
- Max 2 MB file size
- Min 640 px width
- Not available for Shorts
Audio issues
- Use AAC codec
- Avoid copyright-protected music
- Ensure audio bitrate is at least 128 kbps
Resolution too low
Minimum recommended:
- Shorts: 720 × 1280 px
- Regular: 1280 × 720 px (720p)
Inbox
Requires Inbox add-on — $1/social set/month
YouTube supports comments only (no DMs available on the platform).
Comments
| Feature | Supported |
|---|---|
| List comments on videos | ✅ |
| Reply to comments | ✅ |
| Delete comments | ✅ |
| Like comments | ❌ (no API available) |
Limitations
- No DMs — YouTube does not have a direct messaging system
- No comment likes — No public API endpoint available for liking comments
See Comments API Reference for endpoint details.
Related API Endpoints
- Connect YouTube Account — OAuth flow
- Create Post — Post creation and scheduling
- Upload Media — Video uploads
- YouTube Video Download — Download YouTube videos
- YouTube Transcripts — Get video transcripts
- Comments