REST Resource: captions

Resource: Caption

A caption resource represents a YouTube caption track. A caption track is associated with exactly one YouTube video.

JSON representation
{
  "kind": string,
  "etag": string,
  "id": string,
  "snippet": {
    "videoId": string,
    "lastUpdated": string,
    "trackKind": enum,
    "language": string,
    "name": string,
    "audioTrackType": enum,
    "isCC": boolean,
    "isLarge": boolean,
    "isEasyReader": boolean,
    "isDraft": boolean,
    "isAutoSynced": boolean,
    "status": enum,
    "failureReason": enum
  }
}
Fields
kind

string

Output only. Identifies what kind of resource this is. Value: the fixed string "youtube#caption".

etag

string

Etag of this resource.

id

string

The ID that YouTube uses to uniquely identify the caption track.

snippet

object

The snippet object contains basic details about the caption.

snippet.videoId

string

The ID that YouTube uses to uniquely identify the video associated with the caption track.

snippet.lastUpdated

string

The date and time when the caption track was last updated. The value is specified in ISO 8601 format. This property is read-only; setting it in a captions.insert request fails with 400 invalidMetadata.

snippet.trackKind

enum

The caption track's type. standard (the default) identifies a regular caption track; ASR identifies a track generated using automatic speech recognition; forced identifies a track that plays when no other track is selected in the player (for example, subtitles for an alien language). This property is read-only; setting it in a captions.insert request fails with 400 invalidMetadata.

Valid values of this enum field are:

  • standard
  • ASR
  • forced
snippet.language

string

The language of the caption track. The property value is a BCP-47 language tag.

snippet.name

string

The name of the caption track. The name is intended to be visible to the user as an option during playback. The maximum supported length is 150 bytes (UTF-8 encoded).

snippet.audioTrackType

enum

The type of audio track associated with the caption track. unknown is the default value; primary corresponds to the video's primary audio track; commentary corresponds to an alternate audio track with commentary, such as director's commentary; descriptive corresponds to an alternate audio track with additional descriptive audio. This property is read-only; setting it in a captions.insert request fails with 400 invalidMetadata.

Valid values of this enum field are:

  • unknown
  • primary
  • commentary
  • descriptive
snippet.isCC

boolean

Indicates whether the track contains closed captions for the deaf and hard of hearing. The default value is false. This property is read-only; setting it in a captions.insert request fails with 400 invalidMetadata.

snippet.isLarge

boolean

Indicates whether the caption track uses large text for the vision-impaired. The default value is false. This property is read-only; setting it in a captions.insert request fails with 400 invalidMetadata.

snippet.isEasyReader

boolean

Indicates whether the caption track is formatted for "easy reader," meaning it is at a third-grade level for language learners. The default value is false. This property is read-only; setting it in a captions.insert request fails with 400 invalidMetadata.

snippet.isDraft

boolean

Indicates whether the caption track is a draft. If the value is true, then the track is not publicly visible. The default value is false.

snippet.isAutoSynced

boolean

Indicates whether YouTube automatically synchronized the caption track to the video's audio track. If the value is false, YouTube uses the time codes in the uploaded caption track to determine when to display captions. This property is read-only; setting it in a captions.insert request fails with 400 invalidMetadata.

snippet.status

enum

The caption track's status. serving indicates the track has been processed and is available to serve (draft tracks remain hidden from viewers); syncing indicates the track is being processed; failed indicates YouTube failed to process the track. This property is read-only; setting it in a captions.insert request fails with 400 invalidMetadata.

Valid values of this enum field are:

  • serving
  • syncing
  • failed
snippet.failureReason

enum

The reason that YouTube failed to process the caption track. This property is only present if the snippet.status property's value is failed. unknownFormat means the track's format wasn't recognized; unsupportedFormat means the format isn't supported; processingFailed means YouTube failed to process the uploaded track. This property is read-only; setting it in a captions.insert request fails with 400 invalidMetadata.

Valid values of this enum field are:

  • unknownFormat
  • unsupportedFormat
  • processingFailed

Methods

delete

Deletes a specified caption track.

download

Downloads a caption track.

insert

Uploads a caption track.

list

Returns a list of caption tracks that are associated with a specified video.

update

Updates a caption track.