Method: captions.update

Updates a caption track. You can change the track's draft status, upload a new caption file for the track, or both.

When uploading a replacement caption file, the file 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 id to identify the track. Only snippet.isDraft is writable; other snippet properties are ignored, and omitting snippet.isDraft preserves its existing value. Uploading a replacement file for an automatic speech recognition (ASR) track fails with 403 forbidden.

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

HTTP request

  • Upload URI, for media upload requests:
    PUT https://youtube.googleapis.com/upload/youtube/v3/captions
  • Metadata URI, for metadata-only requests:
    PUT 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. Identifies both the properties that the write operation sets and the properties that the API response includes. Set the value to snippet (or id,snippet) whenever the request body includes the snippet object, such as when updating snippet.isDraft; otherwise, the request fails with 400 unexpectedPart. If the body omits snippet, set the value to id. Valid values are id and snippet.

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.