Method: videos.insert

Uploads a video to YouTube and optionally sets the video's metadata.

This method requires a media upload using the Upload URI; metadata-only requests fail with 400 badRequest. Uploaded files must conform to these constraints:

  • Maximum file size: 256 GiB (about 275 GB)
  • Accepted media MIME types: video/*, application/octet-stream

Every part included in the Video request body must also appear in the part query parameter. No request body properties are required: omitted snippet.title defaults to the Slug HTTP header or "unknown", omitted snippet.categoryId uses the default category, and omitted status.privacyStatus defaults to public.

Writable parts are brandPartner, localizations, paidProductPlacementDetails, recordingDetails, snippet, and status. Within those parts, fields marked Output only. on the Video resource can't be set.

Quota impact: A call to this method uses the dedicated Video Uploads quota bucket (1 unit per call, with default limits of 100 uploads per day and 100 per minute per project).

For method-specific error responses, see videos.insert errors. For code examples, see videos.insert code snippets.

HTTP request

  • Upload URI, for media upload requests:
    POST https://youtube.googleapis.com/upload/youtube/v3/videos
  • Metadata URI, for metadata-only requests:
    POST https://youtube.googleapis.com/youtube/v3/videos

The URL uses gRPC Transcoding syntax.

Query parameters

Parameters
notifySubscribers

boolean

Indicates whether YouTube should notify channel subscribers about the new video. Set to true (default) to notify subscribers, or false to suppress notifications.

part[]

string

Required. Serves two purposes in this operation: it identifies the properties that the write operation sets as well as the properties that the API response includes.

Accepted values are brandPartner, contentDetails, id, liveStreamingDetails, localizations, paidProductPlacementDetails, player, recordingDetails, snippet, statistics, and status. Parts that don't contain writable values (such as statistics) are still included in the API response when specified. Passing fileDetails, processingDetails, suggestions, or topicDetails returns 400 unexpectedPart.

onBehalfOfContentOwner

string

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 can only be used in a properly authorized request and is intended exclusively for YouTube content partners.

You must also specify onBehalfOfContentOwnerChannel when using this parameter with videos.insert. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.

onBehalfOfContentOwnerChannel

string

Specifies the YouTube channel ID of the channel to which a video is being added. This parameter can only be used in a properly authorized request and is intended exclusively for YouTube content partners.

This parameter is required when onBehalfOfContentOwner is set, and can only be used in conjunction with that parameter. The request must be authorized using a CMS account linked to the content owner specified by onBehalfOfContentOwner, and the channel specified by onBehalfOfContentOwnerChannel must also be linked to that content owner.

Request body

The request body contains an instance of Video.

Response body

If successful, the response body contains an instance of Video.

Authorization scopes

Requires one of the following OAuth scopes:

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

For more information, see the OAuth 2.0 Overview.