Videos

Delete Video Captions/Subtitles/Chapters

Remove a subtitle, caption, or chapter track from an existing video.

API URL

Headers

Name / Type / Description
NameTypeDescription
AuthorizationStringBearer YOUR_API_KEY

Delete a caption, subtitle, or chapter file.

DELETE https://upload.dyntube.com/v1/videos/captions/?videoId=AA&captionsId=BB

Request Body

Name / Type / Description
NameTypeDescription
videoId*Stringid field of the video.
captionsId*StringcaptionsId field from video.captions.

200: OK

json
 {
        "ok": true
 }

Code Samples

C\#

csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;

class Program
{
    static void Main(string[] args)
    {
        string videoId = "AA";
        string captionsId = "BB";
        string bearerToken = "your_bearer_token";
        string url = $"https://upload.dyntube.com/v1/videos/captions/?videoId={videoId}&captionsId={captionsId}";

        using (var httpClient = new HttpClient())
        {
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", bearerToken);

            var response = httpClient.DeleteAsync(url).Result;

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                Console.WriteLine("Captions deleted successfully.");
            }
            else
            {
                Console.WriteLine($"Error deleting captions. Status code: {response.StatusCode}");
            }
        }
    }
}

Node.js

javascript
const axios = require('axios');

const videoId = 'AA';
const captionsId = 'BB';
const bearerToken = 'your_bearer_token';
const url = `https://upload.dyntube.com/v1/videos/captions/?videoId=${videoId}&captionsId=${captionsId}`;

axios.delete(url, {
  headers: {
    Authorization: `Bearer ${bearerToken}`
  }
})
.then(response => {
  console.log('Captions deleted successfully.');
})
.catch(error => {
  console.error(`Error deleting captions. Status code: ${error.response?.status}`);
});

Python

python
import requests

video_id = 'AA'
captions_id = 'BB'
bearer_token = 'your_bearer_token'
url = f'https://upload.dyntube.com/v1/videos/captions/?videoId={video_id}&captionsId={captions_id}'

headers = {'Authorization': f'Bearer {bearer_token}'}

response = requests.delete(url, headers=headers)

if response.status_code == 200:
    print('Captions deleted successfully.')
else:
    print(f'Error deleting captions. Status code: {response.status_code}')

PHP

php
<?php

$videoId = 'AA';
$captionsId = 'BB';
$bearerToken = 'your_bearer_token';
$url = "https://upload.dyntube.com/v1/videos/captions/?videoId={$videoId}&captionsId={$captionsId}";

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Authorization: Bearer {$bearerToken}"
));

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($httpCode == 200) {
  echo "Captions deleted successfully.\n";
} else {
  echo "Error deleting captions. Status code: {$httpCode}\n";
}

curl_close($ch);
  • Get video to find the captionsId value before deleting.
  • Add captions, subtitles, or chapters to upload a replacement text track.
  • Update video to change player behavior after captions are updated.

Something missing or wrong here? Tell us and we will correct it. New to DynTube? Start with uploading and embedding.