YouTube

Upload videos and Shorts to YouTube via the PostPeer API.

Overview

Upload videos and Shorts to YouTube with full metadata control — titles, descriptions, tags, privacy settings, and categories. PostPeer handles YouTube's chunked upload process and OAuth.

Quick Start

1. Connect a YouTube Account

curl https://api.postpeer.dev/v1/connect/youtube \
  -H "x-access-key: YOUR_API_KEY"

Returns a Google OAuth URL. The user authorizes video upload permissions.

2. Get the Account ID

curl https://api.postpeer.dev/v1/connect/integrations \
  -H "x-access-key: YOUR_API_KEY"

Find the integration with "platform": "youtube" and note the id.

3. Upload a Video

curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "How to build a social media scheduler",
    "platforms": [
      {
        "platform": "youtube",
        "accountId": "yt_789",
        "platformSpecificData": {
          "title": "How to Build a Social Media Scheduler",
          "privacyStatus": "public",
          "tags": ["tutorial", "api", "social media"]
        }
      }
    ],
    "mediaItems": [
      { "type": "video", "url": "https://cdn.example.com/video.mp4" }
    ],
    "publishNow": true
  }'

Response:

{
  "success": true,
  "status": "published",
  "postId": "post_ghi789",
  "platforms": [
    {
      "platform": "youtube",
      "success": true,
      "platformPostUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ]
}

Platform-Specific Data

FieldTypeDescription
titlestringVideo title (required)
descriptionstringVideo description
privacyStatusstring"public", "unlisted", or "private"
tagsstring[]Tags for discoverability
categoryIdstringYouTube category ID

Shorts

Upload vertical videos (9:16, up to 60 seconds) and they'll be published as YouTube Shorts:

curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Quick API tip! #shorts",
    "platforms": [
      {
        "platform": "youtube",
        "accountId": "yt_789",
        "platformSpecificData": {
          "title": "Quick API Tip",
          "privacyStatus": "public"
        }
      }
    ],
    "mediaItems": [
      { "type": "video", "url": "https://cdn.example.com/short.mp4" }
    ],
    "publishNow": true
  }'

Supported Formats

TypeFormatsMax SizeMax Duration
VideoMP4, MOV, AVI, WMV256 GB12 hours
ShortsMP4, MOV256 GB60 seconds
ThumbnailJPG, PNG2 MB

Pass a thumbnail URL in mediaItems with "thumbnail" field to set a custom thumbnail.

On this page