PlaylistItems: insert

Adds a resource to a playlist. Try it now.

Quota impact: A call to this method has a quota cost of approximately 50 units in addition to the costs of the specified resource parts.

Request

HTTP request

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

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

Parameters

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

Parameter name Value Description
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 list below contains the part names that you can include in the parameter value and the quota cost for each part:
  • contentDetails: 2
  • id: 0
  • snippet: 2
  • status: 2
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.

Request body

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

  • You must specify a value for these properties:

    • snippet.playlistId
    • snippet.resourceId

  • You can set values for these properties:

    • snippet.playlistId
    • snippet.position
    • snippet.resourceId
    • contentDetails.note
    • contentDetails.startAt
    • contentDetails.endAt

Response

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

Errors

The table below 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
duplicate videoAlreadyInPlaylist The video that you are trying to add to the playlist is already in the playlist.
forbidden (403) playlistContainsMaximumNumberOfVideos The playlist already contains the maximum allowed number of items.
invalidValue (400) invalidPlaylistItemPosition The request attempts to set the playlist item's position to an invalid or unsupported value. Check the value of the position property in the resource's snippet.
invalidValue (400) invalidResourceType The type specified for the resource ID is not supported for this operation. The resource ID identifies the item being added to the playlist – e.g. youtube#video.
notFound (404) playlistNotFound The playlist identified with the request's playlistId parameter cannot be found.
notFound (404) videoNotFound The video that you are trying to add to the playlist cannot be found. Check the value of the videoId property to ensure that it is correct.
required (400) channelIdRequired The request does not specify a value for the required channelId property.
required (400) playlistIdRequired The request does not specify a value for the required playlistId property.
required (400) resourceIdRequired The request must contain a resource in which the snippet object specifies a resourceId.

Try it!

Use the API Explorer to call this method on live data and see the API request and response.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.