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).
3. Create post
UsePOST /v1/posts with targets targeting a YouTube account.
textbecomes the video description.- The title comes from the top-level
titlefield, or fromplatform_data.youtube.titleas a fallback. The top-level value wins when both are present. visibilitymaps to the video’s privacy status. It defaults topublicwhen omitted, so a published video is viewable right away. Passprivateorunlistedexplicitly if you do not want that. The one exception ispublish_at(see Native scheduling), which defaultsvisibilitytoprivatebecause 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
youtubekey): inside a target’s ownplatform_dataobject. Applies only to that target.
category_id: "22" (inherited from the post level) and notify_subscribers: false (the target override wins).
Platform data fields
Pass these insideplatform_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 asprivate 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
Setfirst_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
Setplatform_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.
- Updating the snippet always requires a title and a category. SocialAPI backfills both from the current video when you omit them.
publish_atcan only be set before the first publish. It cannot be changed once the video is public.
5. Delete post
6. Retrieve posts
UseGET /v1/posts to list posts. Filter by platform or account:
targets array with per-platform status and engagement metrics:
likes,comments, andviewsare synced periodically from the YouTube Data API.sharesandsavesare not exposed by the YouTube API and are not reported.metrics_synced_atreflects 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. Settingpublish_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
Iffirst_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’serror field contains a structured error:
Recovery
- Rate limit: Retry the post via
POST /v1/posts/:pid/retryafter 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 mediapublish_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.