Upsert Chapter
curl --request PUT \
--url https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chapters": [
{
"title": "Introduction",
"start_time": 1,
"end_time": 30,
"order_index": 0
},
{
"title": "What is CDN?",
"start_time": 30,
"end_time": 60,
"order_index": 1
},
{
"title": "Next Steps",
"start_time": 60,
"end_time": 70
}
]
}
'import requests
url = "https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters"
payload = { "chapters": [
{
"title": "Introduction",
"start_time": 1,
"end_time": 30,
"order_index": 0
},
{
"title": "What is CDN?",
"start_time": 30,
"end_time": 60,
"order_index": 1
},
{
"title": "Next Steps",
"start_time": 60,
"end_time": 70
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chapters: [
{title: 'Introduction', start_time: 1, end_time: 30, order_index: 0},
{title: 'What is CDN?', start_time: 30, end_time: 60, order_index: 1},
{title: 'Next Steps', start_time: 60, end_time: 70}
]
})
};
fetch('https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters"
payload := strings.NewReader("{\n \"chapters\": [\n {\n \"title\": \"Introduction\",\n \"start_time\": 1,\n \"end_time\": 30,\n \"order_index\": 0\n },\n {\n \"title\": \"What is CDN?\",\n \"start_time\": 30,\n \"end_time\": 60,\n \"order_index\": 1\n },\n {\n \"title\": \"Next Steps\",\n \"start_time\": 60,\n \"end_time\": 70\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chapters\": [\n {\n \"title\": \"Introduction\",\n \"start_time\": 1,\n \"end_time\": 30,\n \"order_index\": 0\n },\n {\n \"title\": \"What is CDN?\",\n \"start_time\": 30,\n \"end_time\": 60,\n \"order_index\": 1\n },\n {\n \"title\": \"Next Steps\",\n \"start_time\": 60,\n \"end_time\": 70\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.put("https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chapters\": [\n {\n \"title\": \"Introduction\",\n \"start_time\": 1,\n \"end_time\": 30,\n \"order_index\": 0\n },\n {\n \"title\": \"What is CDN?\",\n \"start_time\": 30,\n \"end_time\": 60,\n \"order_index\": 1\n },\n {\n \"title\": \"Next Steps\",\n \"start_time\": 60,\n \"end_time\": 70\n }\n ]\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"chapters\": [\n {\n \"title\": \"Introduction\",\n \"start_time\": 1,\n \"end_time\": 30,\n \"order_index\": 0\n },\n {\n \"title\": \"What is CDN?\",\n \"start_time\": 30,\n \"end_time\": 60,\n \"order_index\": 1\n },\n {\n \"title\": \"Next Steps\",\n \"start_time\": 60,\n \"end_time\": 70\n }\n ]\n}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'chapters' => [
[
'title' => 'Introduction',
'start_time' => 1,
'end_time' => 30,
'order_index' => 0
],
[
'title' => 'What is CDN?',
'start_time' => 30,
'end_time' => 60,
'order_index' => 1
],
[
'title' => 'Next Steps',
'start_time' => 60,
'end_time' => 70
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": [
{
"id": "03061150-2c72-40e4-9ac5-e5cd16083292",
"video_id": "7f7a8d67-d552-4436-bc0e-1fdc62b9210a",
"title": "Introduction",
"start_time": 1,
"end_time": 30,
"order_index": 0
},
{
"id": "3fc10b86-56c6-414c-ae5e-2ae40ecb15da",
"video_id": "7f7a8d67-d552-4436-bc0e-1fdc62b9210a",
"title": "What is Vidinfra CDN?",
"start_time": 30,
"end_time": 60,
"order_index": 1
},
{
"id": "e8835784-3410-435b-b075-c8834112c6dd",
"video_id": "7f7a8d67-d552-4436-bc0e-1fdc62b9210a",
"title": "Next Steps",
"start_time": 60,
"end_time": 70,
"order_index": 2
}
],
"message": "Video Chapters Updated Successfully",
"success": true
}{
"message": "Invalid Request",
"success": false
}{
"code": "auth_type_not_found",
"message": "Could not determine authentication type from request. Please provide a valid Authorization header or X-API-Key header.",
"success": false
}{
"message": "Resource not found",
"success": false
}{
"message": "Invalid Request",
"errors": [
{
"field": "field_name",
"code": "validation_required",
"message": "This field is required"
}
],
"success": false
}{
"message": "Internal server error",
"success": false
}Video Chapter
Upsert Chapter
Create or update a chapter within a video. If the chapter exists, it will be updated; otherwise, a new one will be created.
PUT
/
libraries
/
{libraryId}
/
videos
/
{videoId}
/
chapters
Upsert Chapter
curl --request PUT \
--url https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chapters": [
{
"title": "Introduction",
"start_time": 1,
"end_time": 30,
"order_index": 0
},
{
"title": "What is CDN?",
"start_time": 30,
"end_time": 60,
"order_index": 1
},
{
"title": "Next Steps",
"start_time": 60,
"end_time": 70
}
]
}
'import requests
url = "https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters"
payload = { "chapters": [
{
"title": "Introduction",
"start_time": 1,
"end_time": 30,
"order_index": 0
},
{
"title": "What is CDN?",
"start_time": 30,
"end_time": 60,
"order_index": 1
},
{
"title": "Next Steps",
"start_time": 60,
"end_time": 70
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chapters: [
{title: 'Introduction', start_time: 1, end_time: 30, order_index: 0},
{title: 'What is CDN?', start_time: 30, end_time: 60, order_index: 1},
{title: 'Next Steps', start_time: 60, end_time: 70}
]
})
};
fetch('https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters"
payload := strings.NewReader("{\n \"chapters\": [\n {\n \"title\": \"Introduction\",\n \"start_time\": 1,\n \"end_time\": 30,\n \"order_index\": 0\n },\n {\n \"title\": \"What is CDN?\",\n \"start_time\": 30,\n \"end_time\": 60,\n \"order_index\": 1\n },\n {\n \"title\": \"Next Steps\",\n \"start_time\": 60,\n \"end_time\": 70\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chapters\": [\n {\n \"title\": \"Introduction\",\n \"start_time\": 1,\n \"end_time\": 30,\n \"order_index\": 0\n },\n {\n \"title\": \"What is CDN?\",\n \"start_time\": 30,\n \"end_time\": 60,\n \"order_index\": 1\n },\n {\n \"title\": \"Next Steps\",\n \"start_time\": 60,\n \"end_time\": 70\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.put("https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chapters\": [\n {\n \"title\": \"Introduction\",\n \"start_time\": 1,\n \"end_time\": 30,\n \"order_index\": 0\n },\n {\n \"title\": \"What is CDN?\",\n \"start_time\": 30,\n \"end_time\": 60,\n \"order_index\": 1\n },\n {\n \"title\": \"Next Steps\",\n \"start_time\": 60,\n \"end_time\": 70\n }\n ]\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"chapters\": [\n {\n \"title\": \"Introduction\",\n \"start_time\": 1,\n \"end_time\": 30,\n \"order_index\": 0\n },\n {\n \"title\": \"What is CDN?\",\n \"start_time\": 30,\n \"end_time\": 60,\n \"order_index\": 1\n },\n {\n \"title\": \"Next Steps\",\n \"start_time\": 60,\n \"end_time\": 70\n }\n ]\n}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tenbyte.io/v1/vidinfra/libraries/{libraryId}/videos/{videoId}/chapters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'chapters' => [
[
'title' => 'Introduction',
'start_time' => 1,
'end_time' => 30,
'order_index' => 0
],
[
'title' => 'What is CDN?',
'start_time' => 30,
'end_time' => 60,
'order_index' => 1
],
[
'title' => 'Next Steps',
'start_time' => 60,
'end_time' => 70
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": [
{
"id": "03061150-2c72-40e4-9ac5-e5cd16083292",
"video_id": "7f7a8d67-d552-4436-bc0e-1fdc62b9210a",
"title": "Introduction",
"start_time": 1,
"end_time": 30,
"order_index": 0
},
{
"id": "3fc10b86-56c6-414c-ae5e-2ae40ecb15da",
"video_id": "7f7a8d67-d552-4436-bc0e-1fdc62b9210a",
"title": "What is Vidinfra CDN?",
"start_time": 30,
"end_time": 60,
"order_index": 1
},
{
"id": "e8835784-3410-435b-b075-c8834112c6dd",
"video_id": "7f7a8d67-d552-4436-bc0e-1fdc62b9210a",
"title": "Next Steps",
"start_time": 60,
"end_time": 70,
"order_index": 2
}
],
"message": "Video Chapters Updated Successfully",
"success": true
}{
"message": "Invalid Request",
"success": false
}{
"code": "auth_type_not_found",
"message": "Could not determine authentication type from request. Please provide a valid Authorization header or X-API-Key header.",
"success": false
}{
"message": "Resource not found",
"success": false
}{
"message": "Invalid Request",
"errors": [
{
"field": "field_name",
"code": "validation_required",
"message": "This field is required"
}
],
"success": false
}{
"message": "Internal server error",
"success": false
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier of the library.
Unique identifier of the targeted video resource.
Body
application/json
List of chapters to create or update within the video. Each chapter defines a time range and title.
Show child attributes
Show child attributes
⌘I