AI-generated Key Takeaways
-
YouTube deprecated the
syncparameter for thecaptions.insertandcaptions.updateAPI endpoints on March 13, 2024, but auto-syncing remains available in YouTube Creator Studio. -
A caption resource represents a YouTube caption track, which is associated with one specific YouTube video, and the API provides methods to list, insert, update, download, and delete these tracks.
-
The
captionsresource includes asnippetobject that contains details like the associatedvideoId, thelanguage, thetrackKind, and whether it's a draft, among others. -
The caption track's
snippet.isAutoSyncedboolean property indicates if YouTube synchronized the caption track to the audio, with afalsevalue indicating that YouTube used the time codes in the uploaded track. -
Caption track properties include status indicators such as
serving,syncing, orfailed, withfailureReasonproviding the specific reason for any failures, such asprocessingFailedorunsupportedFormat.
sync parameter for the
captions.insert and
captions.update API endpoints.
Captions auto-syncing is still available in YouTube Creator Studio. See the
API revision history for
more details.A caption resource represents a YouTube caption track. A caption track is associated with exactly one YouTube video.
Methods
The API supports the following methods for captions resources:
- list
- Retrieve a list of caption tracks that are associated with a specified video. Note that the API response does not contain the actual captions and that the
captions.downloadmethod provides the ability to retrieve a caption track. Try it now. - insert
- Upload a caption track. Try it now.
- update
- Update a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both. Try it now.
- download
- Download a caption track. The caption track is returned to its original format unless the request specifies a value for the
tfmtparameter and to its original language unless the request specifies a value for thetlangparameter. Try it now. - delete
- Delete a specified caption track. Try it now.
Resource representation
The following JSON structure shows the format of a captions resource:
{
"kind": "youtube#caption",
"etag": etag,
"id": string,
"snippet": {
"videoId": string,
"lastUpdated": datetime,
"trackKind": string,
"language": string,
"name": string,
"audioTrackType": string,
"isCC": boolean,
"isLarge": boolean,
"isEasyReader": boolean,
"isDraft": boolean,
"isAutoSynced": boolean,
"status": string,
"failureReason": string
}
}Properties
The following table defines the properties that appear in this resource:
| Properties | |
|---|---|
kind |
stringIdentifies the API resource's type. The value will be youtube#caption. |
etag |
etagThe Etag of this resource. |
id |
stringThe ID that YouTube uses to uniquely identify the caption track. |
snippet |
objectThe snippet object contains basic details about the caption. |
snippet.videoId |
stringThe ID that YouTube uses to uniquely identify the video associated with the caption track. |
snippet.lastUpdated |
datetimeThe date and time when the caption track was last updated. The value is specified in ISO 8601 format. |
snippet.trackKind |
stringThe caption track's type. Valid values for this property are:
|
snippet.language |
stringThe language of the caption track. The property value is a BCP-47 language tag. |
snippet.name |
stringThe name of the caption track. The name is intended to be visible to the user as an option during playback. The maximum name length supported is 150 characters. |
snippet.audioTrackType |
stringThe type of audio track associated with the caption track. Valid values for this property are:
|
snippet.isCC |
booleanIndicates whether the track contains closed captions for the deaf and hard of hearing. The default value is false. |
snippet.isLarge |
booleanIndicates whether the caption track uses large text for the vision-impaired. The default value is false. |
snippet.isEasyReader |
booleanIndicates whether caption track is formatted for "easy reader," meaning it is at a third-grade level for language learners. The default value is false. |
snippet.isDraft |
booleanIndicates 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 |
booleanIndicates whether YouTube synchronized the caption track to the audio track in the video. The value will be true if a sync was explicitly requested when the caption track was uploaded. For example, when calling the captions.insert or captions.update methods, you can set the sync parameter to true to instruct YouTube to sync the uploaded track to the video. If the value is false, YouTube uses the time codes in the uploaded caption track to determine when to display captions. |
snippet.status |
stringThe caption track's status. Valid values for this property are:
|
snippet.failureReason |
stringThe reason that YouTube failed to process the caption track. This property is only present if the state property's value is failed.Valid values for this property are:
|