Sign up for free
get

Retrieve a caption

Retrieve a caption for a video in a specific language.

videoIdstring

required

The unique identifier for the video you want captions for.

Example
"vi4k0jvEUuaTdRAEjQ4Prklg"
languagestring

required

A valid language identifier using IETF language tags. You can use primary subtags like en (English), extended subtags like fr-CA (French, Canada), or region subtags like zh-Hans-CN (Simplified Chinese used in the PRC).

  • This parameter only accepts dashes for separators, for example fr-CA. If you use a different separator in your request, the API returns an error.
  • When the value in your request does not match any covered language, the API returns an error.
  • You can find the list of supported tags here.
Example
"en"

Responses

Request examples

// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/CaptionsApi.md#get

package main

import (
    "context"
    "fmt"
    "os"
    apivideosdk "github.com/apivideo/api.video-go-client"
)

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
        
    videoId := "vi4k0jvEUuaTdRAEjQ4Prklg" // string | The unique identifier for the video you want captions for.
    language := "en" // string | A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC).

    
    res, err := client.Captions.Get(videoId, language)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `Captions.Get``: %v\
", err)
    }
    // response from `Get`: Caption
    fmt.Fprintf(os.Stdout, "Response from `Captions.Get`: %v\
", res)
}

Response examples

Success

{
  "uri": "/videos/vi3N6cDinStg3oBbN79GklWS/captions/en",
  "src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt",
  "srclang": "en",
  "languageName": "English",
  "default": false
}
post

Upload a caption

Upload a VTT file to add captions to your video. More information can be found here

filefile

required

The video text track (VTT) you want to upload.

Responses

Request examples

// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/CaptionsApi.md#upload

package main

import (
    "context"
    "fmt"
    "os"
    apivideosdk "github.com/apivideo/api.video-go-client"
)

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
        
    videoId := "vi4k0jvEUuaTdRAEjQ4Prklg" // string | The unique identifier for the video you want to add a caption to.
    language := "en" // string | A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC).
    file := os.NewFile(1234, "some_file") // *os.File | The video text track (VTT) you want to upload.

    
    res, err := client.Captions.UploadFile(videoId, language, file)

    // you can also use a Reader instead of a File:
    // client.Captions.Upload(videoId, language, fileName, fileReader)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `Captions.Upload``: %v\
", err)
    }
    // response from `Upload`: Caption
    fmt.Fprintf(os.Stdout, "Response from `Captions.Upload`: %v\
", res)
}

Response examples

Success

{
  "uri": "/videos/vi3N6cDinStg3oBbN79GklWS/captions/en",
  "src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt",
  "srclang": "en",
  "languageName": "English",
  "default": false
}
delete

Delete a caption

Delete a caption in a specific language by by video id.

videoIdstring

required

The unique identifier for the video you want to delete a caption from.

Example
"vi4k0jvEUuaTdRAEjQ4Prklgc"
languagestring

required

A valid language identifier using IETF language tags. You can use primary subtags like en (English), extended subtags like fr-CA (French, Canada), or region subtags like zh-Hans-CN (Simplified Chinese used in the PRC).

  • This parameter only accepts dashes for separators, for example fr-CA. If you use a different separator in your request, the API returns an error.
  • When the value in your request does not match any covered language, the API returns an error.
  • You can find the list of supported tags here.
Example
"en"

Responses