At a glance
Capabilities
An unsupported call returns501 resource.not_supported.
The cross-platform matrix is on Platforms.
Connect an account
Connect withPOST /v1/accounts/connect and "platform": "youtube". The shared flow, request fields, and result are in Connect accounts, and the redirect parameters are in Redirect parameters.
- One account per channel. Each connected
youtubeaccount is 1 YouTube channel. When the Google login manages more than 1 channel, one authorization connects all of them, and the redirect carries their IDs inaccount_ids. Withoutbrand_id, each channel connects into its own new brand. With abrand_id, the brand takes one channel and each further channel ends witherror=account.already_linked: see Reconnect an account. - A login with no channel. A Google login that has no YouTube channel ends with
status=erroranderror=platform.youtube.no_channelson yourredirect_uri. - Reconnect. When YouTube no longer accepts the saved connection, calls return
401 platform.youtube.auth. See Reconnect an account.
Read videos and channel stats
GET /v1/posts?platform=youtube&account_ids={account_id} lists the channel’s videos with their permalink and engagement metrics: see YouTube publishing.
GET /v1/platforms/youtube/accounts/{id}/summary returns the channel’s aggregate stats:
POST /v1/platforms/youtube/accounts/{id}/sync re-reads the channel’s videos at once and returns {"success": true}. Use it after you upload a video outside SocialAPI.
Comments
YouTube comments are read per video. A video is identified by its YouTube video ID, which is the{postId} in the comment paths. For the cross-platform endpoints, see Comments. This section lists what is specific to YouTube.
YouTube-specific behavior:
- Videos with comments.
GET /v1/inbox/commentslists commented videos only when you passaccount_id. The list is 1 page with no cursor. - Comments turned off. Listing the comments of a video with comments turned off returns
422 platform.youtube.comments_disabled. Retrying does not help: stop polling the video until the channel owner turns comments back on in YouTube Studio. After that, the error can continue for up to 24 hours. - Reply or top-level comment.
POST /v1/inbox/comments/{postId}withcomment_idreplies to that comment. Withoutcomment_id, it posts a new top-level comment on the video. Each costs 1 interaction credit. - Hide.
POST /v1/inbox/comments/{postId}/{commentId}/hidesets the comment torejected, which removes it from public view.DELETEon the same path sets it back topublished. - Moderate.
POST /v1/platforms/youtube/comments/{commentId}/moderatesets the status explicitly. - Delete.
DELETE /v1/inbox/comments/{postId}/{commentId}removes a comment your channel wrote.capabilities.can_deleteistrueon every YouTube comment, including other people’s. Deleting another person’s comment returns422 platform.youtube.processing_failure. Hide it instead. - Like and private reply. Not available.
can_likeandcan_private_replyarefalse.
Moderate a comment
A missing
account_id or post_id returns 400 validation.field_required.
Edit your own comment
account_id, post_id, and text are all required. A missing one returns 400 validation.field_required. YouTube accepts the edit only on a comment your channel wrote.
Webhook events
YouTube sends nothing to SocialAPI, so it emits no comment events: read comments with the endpoints above. Everypost.* event in Webhook events is emitted for videos you publish through SocialAPI. You also receive account.connected when you connect a channel, account.disconnected when SocialAPI flags the channel, and account.updated when the account loses permissions you did not remove yourself. See Webhook events.
Suspended or closed channels
When YouTube suspends or closes the account or its channel, every call on it returns403 platform.youtube.account_suspended. The saved connection is still valid, so reconnecting changes nothing: the owner resolves the suspension with YouTube. SocialAPI sets the account’s reconnect_reason to youtube_account_suspended, and sends an account.disconnected event with that reason.
Limits
The publishing rules are in YouTube publishing.
Scopes
SocialAPI’s Google app requests this scope at connect. You apply for no Google app review. The consent screen is the same whichever permissions you select.
YouTube asks for 1 scope that covers reading and writing, so the consent screen shows it whatever you select. The account is still limited to the permissions you selected: an account connected with
comments.read alone cannot reply to comments.
A call the granted scope does not permit returns 403 platform.youtube.insufficientPermissions. Reconnect the account to grant it again.
Related
- YouTube publishing: fields, scheduling, and quirks for publishing videos
- Comments: the cross-platform comment endpoints
- Connect accounts: the shared connect flow
- Webhook events: the post and account events
- Platforms: the capability matrix
- Errors: every error code