Retrieve a caption

get /videos/{videoId}/captions/{language}

Retrieve a caption for a video in a specific language.

HTTP basic apiKey

videoId

string

required

The unique identifier for the video you want captions for.

Example
"vi4k0jvEUuaTdRAEjQ4Prklg"

language

string

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"

Request

// 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)
}
// First install the "@api.video/nodejs-client" npm package
// Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/CaptionsApi.md#get

const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });

const videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want captions for.
const language = 'en'; // 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).

const caption = await client.captions.get(videoId, language);
# First install the api client with "pip install api.video"
# Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/CaptionsApi.md#get

import apivideo
from apivideo.api import captions_api
from apivideo.model.not_found import NotFound
from apivideo.model.caption import Caption
from pprint import pprint

# Enter a context with an instance of the API client
with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client:
    # Create an instance of the API class
    api_instance = captions_api.CaptionsApi(api_client)
    video_id = "vi4k0jvEUuaTdRAEjQ4Prklg" # str | The unique identifier for the video you want captions for.
    language = "en" # str | 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).

    # example passing only required values which don't have defaults set
    try:
        # Show a caption
        api_response = api_instance.get(video_id, language)
        pprint(api_response)
    except apivideo.ApiException as e:
        print("Exception when calling CaptionsApi->get: %s\n" % e)
// First add the "video.api:java-api-client" maven dependency to your project
// Documentation: https://github.com/apivideo/api.video-java-client/blob/main/docs/CaptionsApi.md#get

import video.api.client.ApiVideoClient;
import video.api.client.api.ApiException;
import video.api.client.api.models.*;
import video.api.client.api.clients.CaptionsApi;
import java.util.*;

public class Example {
  public static void main(String[] args) {
    ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY");
    // if you rather like to use the sandbox environment:
    // ApiVideoClient client = new ApiVideoClient("YOUR_SANDBOX_API_KEY", ApiVideoClient.Environment.SANDBOX);

    CaptionsApi apiInstance = client.captions();
    
    String videoId = "vi4k0jvEUuaTdRAEjQ4Prklg"; // The unique identifier for the video you want captions for.
    String language = "en"; // 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).

    try {
      Caption result = apiInstance.get(videoId, language);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CaptionsApi#get");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getMessage());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// First add the "ApiVideo" NuGet package to your project
// Documentation: https://github.com/apivideo/api.video-csharp-client/blob/main/docs/CaptionsApi.md#get

using System.Diagnostics;
using ApiVideo.Client;

namespace Example
{
    public class getExample
    {
        public static void Main()
        {
            var basePath = ApiVideoClient.Client.Environment.SANDBOX;
            var apiKey = "YOUR_API_KEY";

            var apiInstance = new ApiVideoClient(apiKey,basePath);

            var videoId = vi4k0jvEUuaTdRAEjQ4Prklg;  // string | The unique identifier for the video you want captions for.
            var 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).
            var apiCaptionsInstance = apiInstance.Captions();
            try
            {
                // Show a caption
                Caption result = apiCaptionsInstance.get(videoId, language);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CaptionsApi.get: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}
<?php
// First install the api client: "composer require api-video/php-api-client"
// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/CaptionsApi.md#get

require __DIR__ . '/vendor/autoload.php';

$videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want captions for.
$language = 'en'; // 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).

$client->captions()->get($videoId, $language); 
// First install the api client: https://github.com/apivideo/api.video-swift-client#getting-started
// Documentation: https://github.com/apivideo/api.video-swift-client/blob/main/docs/CaptionsAPI.md#get

Response

Examples Schema

Success

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

Bad request error

{
  "type": "https://docs.api.video/reference/invalid-attribute",
  "title": "An attribute is invalid.",
  "status": 400,
  "detail": "The \"language\" attribute must contain only letters and dashes (for example \"fr\", \"fr-BE\").",
  "name": "language"
}

This error occurs when the language tag you provided contains characters other than letters and dashes.

{
  "type": "https://docs.api.video/reference/invalid-attribute",
  "title": "An attribute is invalid.",
  "status": 400,
  "detail": "The \"language\" attribute is not valid.",
  "name": "language"
}

This error occurs when the language tag you provided does not match any supported language.

Not Found

{
  "type": "string",
  "title": "string",
  "name": "string",
  "status": 123
}

uri

string

The unique resource identifier of the uploaded caption.

Example
"/videos/vi1111DinStg3oBbN79GklWS/captions/sr-Cyrl"

src

string

A direct URL to the uploaded caption file.

Example
"https://cdn.api.video/vod/vi1111DinStg3oBbN79GklWS/captions/sr-Cyrl.vtt"

srclang

string

Indicates the language of the uploaded caption file using IETF language tags.

Example
"sr-Cyrl"

languageName

string

Returns the native name of the caption language in UTF-8 encoding.

Example
"српски (ћирилица)"

default

boolean

Whether you will have subtitles or not. True for yes you will have subtitles, false for no you will not have subtitles.

Default
false
Example
false

type

string

A link to the error documentation.

title

string

A description of the error that occurred.

name

string

The name of the parameter that caused the error.

status

int

The HTTP status code.

problems

array[object (BadRequest)]

Returns any additional problems in the request in an array of objects.

BadRequest

object (BadRequest)

type

string

A link to the error documentation.

title

string

A description of the error that occurred.

name

string

The name of the parameter that caused the error.

status

int

The HTTP status code.

type

string

title

string

name

string

status

int

Upload a caption

post /videos/{videoId}/captions/{language}

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

HTTP basic apiKey

videoId

string

required

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

Example
"vi4k0jvEUuaTdRAEjQ4Prklg"

language

string

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"

file

file

required

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

Request

// 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)
}
// First install the "@api.video/nodejs-client" npm package
// Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/CaptionsApi.md#upload

const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });

const videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want to add a caption to.
const language = 'en'; // 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).
const file = './en.vtt'; // The video text track (VTT) you want to upload.

const caption = await client.captions.upload(videoId, language, file); 
# First install the api client with "pip install api.video"
# Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/CaptionsApi.md#upload

import apivideo
from apivideo.api import captions_api
from apivideo.model.bad_request import BadRequest
from apivideo.model.not_found import NotFound
from apivideo.model.caption import Caption
from pprint import pprint

# Enter a context with an instance of the API client
with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client:
    # Create an instance of the API class
    api_instance = captions_api.CaptionsApi(api_client)
    video_id = "vi4k0jvEUuaTdRAEjQ4Prklg" # str | The unique identifier for the video you want to add a caption to.
    language = "en" # str | 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 = open('/path/to/file', 'rb') # file_type | The video text track (VTT) you want to upload.

    # example passing only required values which don't have defaults set
    try:
        # Upload a caption
        api_response = api_instance.upload(video_id, language, file)
        pprint(api_response)
    except apivideo.ApiException as e:
        print("Exception when calling CaptionsApi->upload: %s\n" % e)
// First add the "video.api:java-api-client" maven dependency to your project
// Documentation: https://github.com/apivideo/api.video-java-client/blob/main/docs/CaptionsApi.md#upload

import video.api.client.ApiVideoClient;
import video.api.client.api.ApiException;
import video.api.client.api.models.*;
import video.api.client.api.clients.CaptionsApi;
import java.util.*;

public class Example {
  public static void main(String[] args) {
    ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY");
    // if you rather like to use the sandbox environment:
    // ApiVideoClient client = new ApiVideoClient("YOUR_SANDBOX_API_KEY", ApiVideoClient.Environment.SANDBOX);

    CaptionsApi apiInstance = client.captions();
    
    String videoId = "vi4k0jvEUuaTdRAEjQ4Prklg"; // The unique identifier for the video you want captions for.
    String language = "en"; // 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).

    try {
      Caption result = apiInstance.get(videoId, language);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CaptionsApi#get");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getMessage());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// First add the "ApiVideo" NuGet package to your project
// Documentation: https://github.com/apivideo/api.video-csharp-client/blob/main/docs/CaptionsApi.md#upload

using System.Diagnostics;
using ApiVideo.Client;

namespace Example
{
    public class uploadExample
    {
        public static void Main()
        {
            var basePath = ApiVideoClient.Client.Environment.SANDBOX;
            var apiKey = "YOUR_API_KEY";

            var apiInstance = new ApiVideoClient(apiKey,basePath);

            var videoId = vi4k0jvEUuaTdRAEjQ4Prklg;  // string | The unique identifier for the video you want to add a caption to.
            var 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).
            var file = BINARY_DATA_HERE;  // System.IO.Stream | The video text track (VTT) you want to upload.
            var apiCaptionsInstance = apiInstance.Captions();
            try
            {
                // Upload a caption
                Caption result = apiCaptionsInstance.upload(videoId, language, file);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CaptionsApi.upload: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}
<?php
// First install the api client: "composer require api-video/php-api-client"
// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/CaptionsApi.md#upload

require __DIR__ . '/vendor/autoload.php';

$videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want to add a caption to.
$language = 'en'; // 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 = new SplFileObject(__DIR__ . '/en.vtt'); // The video text track (VTT) you want to upload.

$caption = $client->captions()->upload($videoId, $language, $file); 
// First install the api client: https://github.com/apivideo/api.video-swift-client#getting-started
// Documentation: https://github.com/apivideo/api.video-swift-client/blob/main/docs/CaptionsAPI.md#upload

Response

Examples Schema

Success

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

Bad request error

{
  "type": "https://docs.api.video/reference/invalid-attribute",
  "title": "An attribute is invalid.",
  "status": 400,
  "detail": "The \"language\" attribute must contain only letters and dashes (for example \"fr\", \"fr-BE\").",
  "name": "language"
}

This error occurs when the language tag you provided contains characters other than letters and dashes.

{
  "type": "https://docs.api.video/reference/invalid-attribute",
  "title": "An attribute is invalid.",
  "status": 400,
  "detail": "The \"language\" attribute is not valid.",
  "name": "language"
}

This error occurs when the language tag you provided does not match any supported language.

Not Found

{
  "type": "string",
  "title": "string",
  "name": "string",
  "status": 123
}

uri

string

The unique resource identifier of the uploaded caption.

Example
"/videos/vi1111DinStg3oBbN79GklWS/captions/sr-Cyrl"

src

string

A direct URL to the uploaded caption file.

Example
"https://cdn.api.video/vod/vi1111DinStg3oBbN79GklWS/captions/sr-Cyrl.vtt"

srclang

string

Indicates the language of the uploaded caption file using IETF language tags.

Example
"sr-Cyrl"

languageName

string

Returns the native name of the caption language in UTF-8 encoding.

Example
"српски (ћирилица)"

default

boolean

Whether you will have subtitles or not. True for yes you will have subtitles, false for no you will not have subtitles.

Default
false
Example
false

type

string

A link to the error documentation.

title

string

A description of the error that occurred.

name

string

The name of the parameter that caused the error.

status

int

The HTTP status code.

problems

array[object (BadRequest)]

Returns any additional problems in the request in an array of objects.

BadRequest

object (BadRequest)

type

string

A link to the error documentation.

title

string

A description of the error that occurred.

name

string

The name of the parameter that caused the error.

status

int

The HTTP status code.

type

string

title

string

name

string

status

int

Delete a caption

delete /videos/{videoId}/captions/{language}

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

HTTP basic apiKey

videoId

string

required

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

Example
"vi4k0jvEUuaTdRAEjQ4Prklgc"

language

string

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"

Request

// 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#delete

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 := "vi4k0jvEUuaTdRAEjQ4Prklgc" // string | The unique identifier for the video you want to delete a caption from.
    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).

    
    err := client.Captions.Delete(videoId, language)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `Captions.Delete``: %v\
", err)
    }
}
// First install the "@api.video/nodejs-client" npm package
// Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/CaptionsApi.md#delete

const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });

const videoId = 'vi4k0jvEUuaTdRAEjQ4Prklgc'; // The unique identifier for the video you want to delete a caption from.
const language = 'en'; // 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).

await client.captions.delete(videoId, language);
 
# First install the api client with "pip install api.video"
# Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/CaptionsApi.md#delete

import apivideo
from apivideo.api import captions_api
from apivideo.model.not_found import NotFound
from pprint import pprint

# Enter a context with an instance of the API client
with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client:
    # Create an instance of the API class
    api_instance = captions_api.CaptionsApi(api_client)
    video_id = "vi4k0jvEUuaTdRAEjQ4Prklgc" # str | The unique identifier for the video you want to delete a caption from.
    language = "en" # str | 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).

    # example passing only required values which don't have defaults set
    try:
        # Delete a caption
        api_instance.delete(video_id, language)
    except apivideo.ApiException as e:
        print("Exception when calling CaptionsApi->delete: %s\n" % e)
// First add the "video.api:java-api-client" maven dependency to your project
// Documentation: https://github.com/apivideo/api.video-java-client/blob/main/docs/CaptionsApi.md#delete

import video.api.client.ApiVideoClient;
import video.api.client.api.ApiException;
import video.api.client.api.models.*;
import video.api.client.api.clients.CaptionsApi;
import java.util.*;

public class Example {
  public static void main(String[] args) {
    ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY");
    // if you rather like to use the sandbox environment:
    // ApiVideoClient client = new ApiVideoClient("YOUR_SANDBOX_API_KEY", ApiVideoClient.Environment.SANDBOX);

    CaptionsApi apiInstance = client.captions();
    
    String videoId = "vi4k0jvEUuaTdRAEjQ4Prklgc"; // The unique identifier for the video you want to delete a caption from.
    String language = "en"; // 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).

    try {
      apiInstance.delete(videoId, language);
    } catch (ApiException e) {
      System.err.println("Exception when calling CaptionsApi#delete");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getMessage());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// First add the "ApiVideo" NuGet package to your project
// Documentation: https://github.com/apivideo/api.video-csharp-client/blob/main/docs/CaptionsApi.md#delete

using System.Diagnostics;
using ApiVideo.Client;

namespace Example
{
    public class deleteExample
    {
        public static void Main()
        {
            var basePath = ApiVideoClient.Client.Environment.SANDBOX;
            var apiKey = "YOUR_API_KEY";

            var apiInstance = new ApiVideoClient(apiKey,basePath);

            var videoId = vi4k0jvEUuaTdRAEjQ4Prklgc;  // string | The unique identifier for the video you want to delete a caption from.
            var 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).
            var apiCaptionsInstance = apiInstance.Captions();
            try
            {
                // Delete a caption
                apiCaptionsInstance.delete(videoId, language);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CaptionsApi.delete: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}
<?php
// First install the api client: "composer require api-video/php-api-client"
// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/CaptionsApi.md#delete

require __DIR__ . '/vendor/autoload.php';

$videoId = 'vi4k0jvEUuaTdRAEjQ4Prklgc'; // The unique identifier for the video you want to delete a caption from.
$language = 'en'; // 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).

$client->captions()->delete($videoId, $language); 
// First install the api client: https://github.com/apivideo/api.video-swift-client#getting-started
// Documentation: https://github.com/apivideo/api.video-swift-client/blob/main/docs/CaptionsAPI.md#delete

Response

Examples Schema

No Content

Empty response

Bad request error

{
  "type": "https://docs.api.video/reference/invalid-attribute",
  "title": "An attribute is invalid.",
  "status": 400,
  "detail": "The \"language\" attribute must contain only letters and dashes (for example \"fr\", \"fr-BE\").",
  "name": "language"
}

This error occurs when the language tag you provided contains characters other than letters and dashes.

{
  "type": "https://docs.api.video/reference/invalid-attribute",
  "title": "An attribute is invalid.",
  "status": 400,
  "detail": "The \"language\" attribute is not valid.",
  "name": "language"
}

This error occurs when the language tag you provided does not match any supported language.

Not Found

{
  "type": "string",
  "title": "string",
  "name": "string",
  "status": 123
}

No schema

type

string

A link to the error documentation.

title

string

A description of the error that occurred.

name

string

The name of the parameter that caused the error.

status

int

The HTTP status code.

problems

array[object (BadRequest)]

Returns any additional problems in the request in an array of objects.

BadRequest

object (BadRequest)

type

string

A link to the error documentation.

title

string

A description of the error that occurred.

name

string

The name of the parameter that caused the error.

status

int

The HTTP status code.

type

string

title

string

name

string

status

int

Update a caption

patch /videos/{videoId}/captions/{language}

Update caption settings.

HTTP basic apiKey

videoId

string

required

The unique identifier for the video you want to have automatic captions for.

Example
"vi4k0jvEUuaTdRAEjQ4Prklg"

language

string

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"

default

boolean

Request

{
  "default": true
}
// 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#update

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 have automatic 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).
    captionsUpdatePayload := *apivideosdk.NewCaptionsUpdatePayload() // CaptionsUpdatePayload | 

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

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `Captions.Update``: %v\
", err)
    }
    // response from `Update`: Caption
    fmt.Fprintf(os.Stdout, "Response from `Captions.Update`: %v\
", res)
}
// First install the "@api.video/nodejs-client" npm package
// Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/CaptionsApi.md#update

const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });

const videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want to have automatic captions for.
const language = 'en'; // 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).
const captionsUpdatePayload = {
  _default: true,
}; 
 
const caption = await client.captions.update(videoId, language, captionsUpdatePayload);
        
# First install the api client with "pip install api.video"
# Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/CaptionsApi.md#update

import apivideo
from apivideo.api import captions_api
from apivideo.model.bad_request import BadRequest
from apivideo.model.captions_update_payload import CaptionsUpdatePayload
from apivideo.model.not_found import NotFound
from apivideo.model.caption import Caption
from pprint import pprint

# Enter a context with an instance of the API client
with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client:
    # Create an instance of the API class
    api_instance = captions_api.CaptionsApi(api_client)
    video_id = "vi4k0jvEUuaTdRAEjQ4Prklg" # str | The unique identifier for the video you want to have automatic captions for.
    language = "en" # str | 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).
    captions_update_payload = CaptionsUpdatePayload(
        default=True,
    ) # CaptionsUpdatePayload | 

    # example passing only required values which don't have defaults set
    try:
        # Update caption
        api_response = api_instance.update(video_id, language, captions_update_payload)
        pprint(api_response)
    except apivideo.ApiException as e:
        print("Exception when calling CaptionsApi->update: %s\
" % e)
// First add the "video.api:java-api-client" maven dependency to your project
// Documentation: https://github.com/apivideo/api.video-java-client/blob/main/docs/CaptionsApi.md#update

import video.api.client.ApiVideoClient;
import video.api.client.api.ApiException;
import video.api.client.api.models.*;
import video.api.client.api.clients.CaptionsApi;
import java.util.*;

public class Example {
  public static void main(String[] args) {
    ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY");
    // if you rather like to use the sandbox environment:
    // ApiVideoClient client = new ApiVideoClient("YOUR_SANDBOX_API_KEY", ApiVideoClient.Environment.SANDBOX);

    CaptionsApi apiInstance = client.captions();
    
    String videoId = "vi4k0jvEUuaTdRAEjQ4Prklg"; // The unique identifier for the video you want to have automatic captions for.
    String language = "en"; // 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).
    CaptionsUpdatePayload captionsUpdatePayload = new CaptionsUpdatePayload(); // 
    captionsUpdatePayload.setDefault(); // 


    try {
      Caption result = apiInstance.update(videoId, language, captionsUpdatePayload);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CaptionsApi#update");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getMessage());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// First add the "ApiVideo" NuGet package to your project
// Documentation: https://github.com/apivideo/api.video-csharp-client/blob/main/docs/CaptionsApi.md#update

using System.Diagnostics;
using ApiVideo.Client;

namespace Example
{
    public class updateExample
    {
        public static void Main()
        {
            var basePath = ApiVideoClient.Client.Environment.SANDBOX;
            var apiKey = "YOUR_API_KEY";

            var apiInstance = new ApiVideoClient(apiKey,basePath);

            var videoId = vi4k0jvEUuaTdRAEjQ4Prklg;  // string | The unique identifier for the video you want to have automatic captions for.
            var 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).
            var captionsUpdatePayload = new CaptionsUpdatePayload(); // CaptionsUpdatePayload | 
            var apiCaptionsInstance = apiInstance.Captions();
            try
            {
                // Update caption
                Caption result = apiCaptionsInstance.update(videoId, language, captionsUpdatePayload);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CaptionsApi.update: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}
<?php
// First install the api client: "composer require api-video/php-api-client"
// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/CaptionsApi.md#update

require __DIR__ . '/vendor/autoload.php';

$videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want to have automatic captions for.
$language = 'en'; // 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).

$captionsUpdatePayload = (new \ApiVideo\Client\Model\CaptionsUpdatePayload())
    ->setDefault(true);
 
$caption = $client->captions()->update($videoId, $language, $captionsUpdatePayload); 
// First install the api client: https://github.com/apivideo/api.video-swift-client#getting-started
// Documentation: https://github.com/apivideo/api.video-swift-client/blob/main/docs/CaptionsAPI.md#update

Response

Examples Schema

Success

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

Bad request error

{
  "type": "https://docs.api.video/reference/invalid-attribute",
  "title": "An attribute is invalid.",
  "status": 400,
  "detail": "The \"language\" attribute must contain only letters and dashes (for example \"fr\", \"fr-BE\").",
  "name": "language"
}

This error occurs when the language tag you provided contains characters other than letters and dashes.

{
  "type": "https://docs.api.video/reference/invalid-attribute",
  "title": "An attribute is invalid.",
  "status": 400,
  "detail": "The \"language\" attribute is not valid.",
  "name": "language"
}

This error occurs when the language tag you provided does not match any supported language.

Not Found

{
  "type": "Lorem sit culpa non",
  "title": "sunt do fugiat tempor",
  "name": "irure mollit aute",
  "status": 85925135
}

uri

string

The unique resource identifier of the uploaded caption.

Example
"/videos/vi1111DinStg3oBbN79GklWS/captions/sr-Cyrl"

src

string

A direct URL to the uploaded caption file.

Example
"https://cdn.api.video/vod/vi1111DinStg3oBbN79GklWS/captions/sr-Cyrl.vtt"

srclang

string

Indicates the language of the uploaded caption file using IETF language tags.

Example
"sr-Cyrl"

languageName

string

Returns the native name of the caption language in UTF-8 encoding.

Example
"српски (ћирилица)"

default

boolean

Whether you will have subtitles or not. True for yes you will have subtitles, false for no you will not have subtitles.

Default
false
Example
false

type

string

A link to the error documentation.

title

string

A description of the error that occurred.

name

string

The name of the parameter that caused the error.

status

int

The HTTP status code.

problems

array[object (BadRequest)]

Returns any additional problems in the request in an array of objects.

BadRequest

object (BadRequest)

type

string

A link to the error documentation.

title

string

A description of the error that occurred.

name

string

The name of the parameter that caused the error.

status

int

The HTTP status code.

type

string

title

string

name

string

status

int

List video captions

get /videos/{videoId}/captions

Retrieve a list of available captions by video id.

HTTP basic apiKey

videoId

string

required

The unique identifier for the video you want to retrieve a list of captions for.

Example
"vi4k0jvEUuaTdRAEjQ4Prklg"

currentPage

int

Choose the number of search results to return per page. Minimum value: 1

Default
1
Example
2

pageSize

int

Results per page. Allowed values 1-100, default is 25.

Default
25
Example
30

Request

// 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#list

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)
}
// First install the "@api.video/nodejs-client" npm package
// Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/CaptionsApi.md#list

const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });

const captions = await client.captions.list({
  videoId 'vi4k0jvEUuaTdRAEjQ4Prklg', // The unique identifier for the video you want to retrieve a list of captions for.
  currentPage: 2, // Choose the number of search results to return per page. Minimum value: 1
  pageSize: 30, // Results per page. Allowed values 1-100, default is 25.
); 
# First install the api client with "pip install api.video"
# Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/CaptionsApi.md#list

import apivideo
from apivideo.api import captions_api
from apivideo.model.not_found import NotFound
from apivideo.model.caption import Caption
from pprint import pprint

# Enter a context with an instance of the API client
with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client:
    # Create an instance of the API class
    api_instance = captions_api.CaptionsApi(api_client)
    video_id = "vi4k0jvEUuaTdRAEjQ4Prklg" # str | The unique identifier for the video you want captions for.
    language = "en" # str | 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).

    # example passing only required values which don't have defaults set
    try:
        # Show a caption
        api_response = api_instance.get(video_id, language)
        pprint(api_response)
    except apivideo.ApiException as e:
        print("Exception when calling CaptionsApi->get: %s\n" % e)
// First add the "video.api:java-api-client" maven dependency to your project
// Documentation: https://github.com/apivideo/api.video-java-client/blob/main/docs/CaptionsApi.md#list

import video.api.client.ApiVideoClient;
import video.api.client.api.ApiException;
import video.api.client.api.models.*;
import video.api.client.api.clients.CaptionsApi;
import java.util.*;

public class Example {
  public static void main(String[] args) {
    ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY");
    // if you rather like to use the sandbox environment:
    // ApiVideoClient client = new ApiVideoClient("YOUR_SANDBOX_API_KEY", ApiVideoClient.Environment.SANDBOX);

    CaptionsApi apiInstance = client.captions();
    
    String videoId = "vi4k0jvEUuaTdRAEjQ4Prklg"; // The unique identifier for the video you want captions for.
    String language = "en"; // 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).

    try {
      Caption result = apiInstance.get(videoId, language);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CaptionsApi#get");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getMessage());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// First add the "ApiVideo" NuGet package to your project
// Documentation: https://github.com/apivideo/api.video-csharp-client/blob/main/docs/CaptionsApi.md#list

using System.Diagnostics;
using ApiVideo.Client;

namespace Example
{
    public class getExample
    {
        public static void Main()
        {
            var basePath = ApiVideoClient.Client.Environment.SANDBOX;
            var apiKey = "YOUR_API_KEY";

            var apiInstance = new ApiVideoClient(apiKey,basePath);

            var videoId = vi4k0jvEUuaTdRAEjQ4Prklg;  // string | The unique identifier for the video you want captions for.
            var 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).
            var apiCaptionsInstance = apiInstance.Captions();
            try
            {
                // Show a caption
                Caption result = apiCaptionsInstance.get(videoId, language);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling CaptionsApi.get: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}
<?php
// First install the api client: "composer require api-video/php-api-client"
// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/CaptionsApi.md#list

require __DIR__ . '/vendor/autoload.php';

$videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for the video you want to retrieve a list of captions for.

$captions = $client->captions()->list($videoId, array(
    'currentPage' => 2, // Choose the number of search results to return per page. Minimum value: 1)
    'pageSize' => 30 // Results per page. Allowed values 1-100, default is 25.)
)); 
// First install the api client: https://github.com/apivideo/api.video-swift-client#getting-started
// Documentation: https://github.com/apivideo/api.video-swift-client/blob/main/docs/CaptionsAPI.md#list

Response

Examples Schema

Success

{
  "data": [
    {
      "uri": "/videos/vi3N6cDinStg3oBbN79GklWS/captions/en",
      "src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt",
      "srclang": "en",
      "languageName": "English",
      "default": false
    },
    {
      "uri": "/videos/vi3N6cDinStg3oBbN79GklWS/captions/fr",
      "src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/fr.vtt",
      "srclang": "fr",
      "languageName": "Française",
      "default": false
    }
  ],
  "pagination": {
    "currentPage": 1,
    "currentPageItems": 2,
    "pageSize": 25,
    "pagesTotal": 1,
    "itemsTotal": 2,
    "links": [
      {
        "rel": "self",
        "uri": "/videos/vi3N6cDinStg3oBbN79GklWS/captions?currentPage=1&pageSize=25"
      },
      {
        "rel": "first",
        "uri": "/videos/vi3N6cDinStg3oBbN79GklWS/captions?currentPage=1&pageSize=25"
      },
      {
        "rel": "last",
        "uri": "/videos/vi3N6cDinStg3oBbN79GklWS/captions?currentPage=1&pageSize=25"
      }
    ]
  }
}

Not Found

{
  "type": "string",
  "title": "string",
  "name": "string",
  "status": 123
}

data

array[object (Caption)]

required

Caption

object (Caption)

uri

string

The unique resource identifier of the uploaded caption.

Example
"/videos/vi1111DinStg3oBbN79GklWS/captions/sr-Cyrl"

src

string

A direct URL to the uploaded caption file.

Example
"https://cdn.api.video/vod/vi1111DinStg3oBbN79GklWS/captions/sr-Cyrl.vtt"

srclang

string

Indicates the language of the uploaded caption file using IETF language tags.

Example
"sr-Cyrl"

languageName

string

Returns the native name of the caption language in UTF-8 encoding.

Example
"српски (ћирилица)"

default

boolean

Whether you will have subtitles or not. True for yes you will have subtitles, false for no you will not have subtitles.

Default
false
Example
false

pagination

object (pagination)

required

Example
{ "itemsTotal": 123, "pagesTotal": 7, "pageSize": 20, "currentPage": 3, "currentPageItems": 20, "links": { "first": { "rel": "first", "uri": "/videos/search?currentPage=1&pageSize=20" }, "previous": { "rel": "previous", "uri": "/videos/search?currentPage=2&pageSize=20" }, "next": { "rel": "next", "uri": "/videos/search?currentPage=4&pageSize=20" }, "last": { "rel": "last", "uri": "/videos/search?currentPage=6&pageSize=20" } } }

itemsTotal

int

Total number of items that exist.

pagesTotal

int

Number of items listed in the current page.

pageSize

int

Maximum number of item per page.

currentPage

int

The current page index.

currentPageItems

int

The number of items on the current page.

links

array[object (PaginationLink)]

required

PaginationLink

object (PaginationLink)

rel

string

uri

string

uri

type

string

title

string

name

string

status

int

Was this page helpful?