Method: captions.insert

Uploads a caption track.

This method requires a media upload. Send the request to the upload URI; metadata-only requests to the metadata URI fail with 400 contentRequired. Uploaded files must include timing information and conform to these constraints:

  • Maximum file size: 20 MiB (files over 20 MiB up to the 100 MiB upload endpoint limit fail with 503 backendError; files over 100 MiB fail with 413 uploadTooLarge)
  • Accepted media MIME types: text/xml, application/octet-stream, */*

In the Caption request body, specify values for snippet.videoId, snippet.language, and snippet.name (up to 150 UTF-8 bytes). You can optionally set snippet.isDraft. Setting any other snippet property fails with 400 invalidMetadata.

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

HTTP request

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

The URL uses gRPC Transcoding syntax.

Query parameters

Parameters
sync
(deprecated)

boolean

Deprecated: Auto-syncing through the API is no longer supported; uploaded caption files must include timing information.

part[]

string

Required. Specifies the caption resource parts that the API response includes. Set the value to snippet (or id,snippet); snippet is required because the request body includes the snippet object.

onBehalfOfContentOwner

string

Intended exclusively for YouTube content partners and valid only in an authorized request. Indicates that the request's authorization credentials identify a YouTube CMS user acting on behalf of the specified content owner, allowing partners that manage multiple channels to authenticate once and access data for linked channels.

Request body

The request body contains an instance of Caption.

Response body

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

Authorization scopes

Requires one of the following OAuth scopes:

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

For more information, see the OAuth 2.0 Overview.