Skip to main content

1. Overview

YouTube publishing uploads a single video through the YouTube Data API v3 resumable upload protocol. SocialAPI streams the media from its store directly to YouTube, sets the video metadata (title, description, privacy, tags, category), and returns the published video. Unlike the Meta and TikTok connectors, YouTube supports editing a video’s metadata after publish and scheduling a future publish natively.

2. Supported media

YouTube publishing takes exactly one video. Image posts and carousels are not supported: images surface only as thumbnails when you retrieve posts. Accepted media is video/*, uploaded via the resumable protocol, up to 256 GB. Title is required (max 100 characters). If you publish or schedule without a title, validation returns an error. Description limit: 5000 bytes (maps from the text field).
Attach the video through the media array, as either a media_id source (a file uploaded to SocialAPI) or a url source (a public http(s) URL we fetch at publish time). There is no separate video_url or media_url field. To upload first, use POST /v1/media/upload (multipart) or the presigned-URL flow (GET /v1/media/upload-urlPUT the file → POST /v1/media/:id/verify); the verify step is required, without it the media stays pending and publishing fails. YouTube does not support platform_attachment_id.

3. Create post

Use POST /v1/posts with targets targeting a YouTube account.
  • text becomes the video description.
  • The title comes from the top-level title field, or from platform_data.youtube.title as a fallback. The top-level value wins when both are present.
  • visibility maps to the video’s privacy status. It defaults to public when omitted, so a published video is viewable right away. Pass private or unlisted explicitly if you do not want that. The one exception is publish_at (see Native scheduling), which defaults visibility to private because YouTube only schedules private videos.

Where to put platform data

You can pass the YouTube fields below in either of two places:
  • Post level, keyed by platform: platform_data.youtube. Applies to every YouTube target in the post.
  • Target level, flat (no youtube key): inside a target’s own platform_data object. Applies only to that target.
When both set the same field, the target-level value wins, so you can set channel-wide defaults at the post level and override per account:
Here the target publishes with category_id: "22" (inherited from the post level) and notify_subscribers: false (the target override wins).

Platform data fields

Pass these inside platform_data.youtube (post level) or directly in a target’s platform_data (target level):

Native scheduling

YouTube schedules a publish natively: you upload the video as private with a publish_at timestamp, and YouTube flips it to public automatically at that time. This is different from the platform-agnostic scheduled_at deferred publish (which YouTube does not use).
publish_at with any visibility other than private returns a validation error on the publish_at field. Leaving visibility unset is allowed: uploads normally default to public, but setting publish_at switches that default to private so the schedule is honored.

First comment

Set first_comment to a string to post a top-level comment on the video immediately after publish. This is best-effort: if the comment fails, the post is still considered published.

Add to playlist

Set platform_data.youtube.playlist_id to add the newly published video to one of your playlists. This runs after publish and is best-effort: a failure here does not change the post status.

4. Update post

YouTube supports editing a video’s metadata after publish. PATCH /v1/posts/:pid updates the title, description, tags, category, privacy, and status flags.
Partial edits are safe: fields you do not provide are preserved. SocialAPI fetches the current video and backfills any unspecified snippet field, so an omitted field is never wiped. Notes:
  • Updating the snippet always requires a title and a category. SocialAPI backfills both from the current video when you omit them.
  • publish_at can only be set before the first publish. It cannot be changed once the video is public.

5. Delete post

Or, to delete only the YouTube target of a cross-platform post:
Deletion removes the video from YouTube. If the video no longer exists, the API reports success.

6. Retrieve posts

Use GET /v1/posts to list posts. Filter by platform or account:
Listing is a two-step process internally (the channel’s uploads playlist is read, then each video is enriched with statistics), transparent to the caller. Each post includes a targets array with per-platform status and engagement metrics:
Metrics notes:
  • likes, comments, and views are synced periodically from the YouTube Data API.
  • shares and saves are not exposed by the YouTube API and are not reported.
  • metrics_synced_at reflects when SocialAPI last refreshed the metrics from YouTube.

7. Quirks, errors, and recovery

Title is required, with length limits

A title is required to publish. Titles are capped at 100 characters and descriptions at 5000 bytes. Exceeding these limits returns an error from YouTube.

publish_at requires private visibility

Native scheduling only works on private videos. Setting publish_at alongside a public or unlisted visibility returns a validation error on the publish_at field before the request reaches YouTube.

First comment and playlist add are non-blocking

If first_comment or playlist_id is set and the follow-up call fails after a successful upload, the post remains published. The failure is logged but does not roll back or change the post status.

Error shapes

When a publish fails, the post target’s error field contains a structured error:

Recovery

  • Rate limit: Retry the post via POST /v1/posts/:pid/retry after waiting. SocialAPI applies exponential backoff for scheduled retries.
  • Auth error: Disconnect and reconnect the YouTube account through the OAuth flow to obtain a fresh token.

8. Full worked example

The following example uploads a video, then publishes it with a title, description, tags, and a scheduled publish time. Step 1: Upload media
Response:
Upload the file, then verify:
Step 2: Publish the video (scheduled)
Step 3: Check status
Response once uploaded:
The video is uploaded as private and goes public automatically at the publish_at time.

9. Required OAuth scopes

SocialAPI’s managed Google App requests the following scope on your behalf during the OAuth flow. This is informational: you do not register a Google project or configure anything. To verify which scopes your connected account has granted, call GET /v1/accounts/:id/limits.