ChannelSections: insert

Adds a channel section to the authenticated user's channel. A channel can create a maximum of 10 shelves.

Quota impact: A call to this method has a quota cost of 50 units.

Common use cases

Request

HTTP request

POST https://www.googleapis.com/youtube/v3/channelSections

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/youtubepartner
https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtube.force-ssl

Parameters

The following table lists the parameters that this query supports. All of the parameters listed are query parameters.

Parameters
Required parameters
part string
The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include.

The following list contains the part names that you can include in the parameter value:
  • contentDetails
  • id
  • snippet
Optional parameters
onBehalfOfContentOwner string
This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners.

The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.
onBehalfOfContentOwnerChannel string
This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners.

The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies.

This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel.

Request body

Provide a channelSection resource in the request body. For that resource:

  • You must specify a value for these properties:

    • snippet.type
  • You can set values for these properties:

    • snippet.type
    • snippet.title
    • snippet.position
    • contentDetails.playlists[]
    • contentDetails.channels[]

Response

If successful, this method returns a channelSection resource in the response body.

Errors

The following table identifies error messages that the API could return in response to a call to this method. Please see the error message documentation for more detail.

Error type Error detail Description
badRequest (400) notEditable This channel section cannot be created.
badRequest (400) typeRequired The channelSection resource must specify a value for the snippet.type field.
forbidden (403) channelSectionForbidden The request is not properly authenticated or is not supported for this channel.
invalidValue (400) channelNotActive At least one of the specified channels is not active.
invalidValue (400) channelsDuplicated The request failed because it specified duplicate channels.
invalidValue (400) channelsNeeded If the snippet.type property has a value of multipleChannels, then the contentDetails.channels[] property must be specified and must specify at least one channel.
invalidValue (400) channelsNotExpected The resource provided with the request specified a value for the contentDetails.channels[] property, but channels are not expected for this type of channel section.
invalidValue (400) contentDetailsNeeded The resource you are inserting must contain a contentDetails object for this type of channel section.
invalidValue (400) inValidPosition The snippet.position property contains an invalid value.
invalidValue (400) maxChannelSectionExceeded The request cannot be completed because the channel already has the maximum number of channel sections.
invalidValue (400) maxChannelsExceeded The request failed because it attempted to include too many channels in the channel section.
invalidValue (400) maxPlaylistExceeded The request failed because it attempted to include too many playlists in the channel section.
invalidValue (400) onePlaylistNeeded If the snippet.type property has a value of singlePlaylist, then the contentDetails.playlists[] property must specify exactly one playlist.
invalidValue (400) ownChannelInChannels You cannot include your own channel in a channel section that appears on that channel.
invalidValue (400) playlistIsPrivate One or more of the specified playlists are private and, therefore, cannot be included in the channel section.
invalidValue (400) playlistsDuplicated The request failed because it specified duplicate playlists.
invalidValue (400) playlistsNeeded If the snippet.type property has a value of singlePlaylist or multiplePlaylists, then the contentDetails.playlists[] property must be specified.
invalidValue (400) playlistsNotExpected The resource provided with the request specified a value for the contentDetails.playlists[] property, but playlists are not expected for this type of channel section.
invalidValue (400) snippetNeeded You must specify a snippet to create the channel section.
invalidValue (400) titleLengthExceeded The value of the snippet.title property is too long.
invalidValue (400) titleRequired If the snippet.type property has a value of multiplePlaylists or multipleChannels, then you must set the section's title by specifying a value for the snippet.title property.
notFound (404) channelNotFound One or more of the specified channels cannot be found.
notFound (404) playlistNotFound One or more of the specified playlists cannot be found.

Try it!

Use the APIs Explorer to call this API and see the API request and response.