Create RTStream
curl --request POST \
--url https://api.videodb.io/rtstream/ \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"url": "rtsp://example.com:8554/stream",
"name": "My Stream",
"collection_id": "default",
"sample_rate": 30,
"media_types": [
"video",
"audio"
],
"store": false,
"enable_transcript": true,
"ws_connection_id": "conn-123"
}
'const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'rtsp://example.com:8554/stream',
name: 'My Stream',
collection_id: 'default',
sample_rate: 30,
media_types: ['video', 'audio'],
store: false,
enable_transcript: true,
ws_connection_id: 'conn-123'
})
};
fetch('https://api.videodb.io/rtstream/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.videodb.io/rtstream/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'rtsp://example.com:8554/stream',
'name' => 'My Stream',
'collection_id' => 'default',
'sample_rate' => 30,
'media_types' => [
'video',
'audio'
],
'store' => false,
'enable_transcript' => true,
'ws_connection_id' => 'conn-123'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.videodb.io/rtstream/"
payload := strings.NewReader("{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.videodb.io/rtstream/")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.videodb.io/rtstream/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("x-access-token", "<api-key>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.videodb.io/rtstream/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": "rtsp://example.com:8554/stream",
"name": "My Stream",
"collection_id": "default",
"sample_rate": 30,
"media_types": [
"video",
"audio"
],
"store": false,
"enable_transcript": true,
"ws_connection_id": "conn-123"
}'import Foundation
let parameters = [
"url": "rtsp://example.com:8554/stream",
"name": "My Stream",
"collection_id": "default",
"sample_rate": 30,
"media_types": ["video", "audio"],
"store": false,
"enable_transcript": true,
"ws_connection_id": "conn-123"
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.videodb.io/rtstream/")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"x-access-token": "<api-key>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/rtstream/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/rtstream/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'rtsp://example.com:8554/stream',
name: 'My Stream',
collection_id: 'default',
sample_rate: 30,
media_types: ['video', 'audio'],
store: false,
enable_transcript: true,
ws_connection_id: 'conn-123'
})
};
fetch('https://api.videodb.io/rtstream/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/rtstream/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/rtstream/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}")
val request = Request.Builder()
.url("https://api.videodb.io/rtstream/")
.post(body)
.addHeader("x-access-token", "<api-key>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute(){
"success": true,
"data": {
"id": "rts-12345",
"name": "My Stream",
"status": "connected",
"sample_rate": 30,
"media_types": [
"video",
"audio"
],
"collection_id": "default",
"store": false,
"created_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"message": "Error message",
"error_code": "ERROR_CODE"
}{
"success": false,
"message": "Error message",
"error_code": "ERROR_CODE"
}Create RTStream
Create a new real-time stream connection
POST
/
rtstream
/
Create RTStream
curl --request POST \
--url https://api.videodb.io/rtstream/ \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"url": "rtsp://example.com:8554/stream",
"name": "My Stream",
"collection_id": "default",
"sample_rate": 30,
"media_types": [
"video",
"audio"
],
"store": false,
"enable_transcript": true,
"ws_connection_id": "conn-123"
}
'const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'rtsp://example.com:8554/stream',
name: 'My Stream',
collection_id: 'default',
sample_rate: 30,
media_types: ['video', 'audio'],
store: false,
enable_transcript: true,
ws_connection_id: 'conn-123'
})
};
fetch('https://api.videodb.io/rtstream/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.videodb.io/rtstream/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'rtsp://example.com:8554/stream',
'name' => 'My Stream',
'collection_id' => 'default',
'sample_rate' => 30,
'media_types' => [
'video',
'audio'
],
'store' => false,
'enable_transcript' => true,
'ws_connection_id' => 'conn-123'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.videodb.io/rtstream/"
payload := strings.NewReader("{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.videodb.io/rtstream/")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.videodb.io/rtstream/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("x-access-token", "<api-key>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.videodb.io/rtstream/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": "rtsp://example.com:8554/stream",
"name": "My Stream",
"collection_id": "default",
"sample_rate": 30,
"media_types": [
"video",
"audio"
],
"store": false,
"enable_transcript": true,
"ws_connection_id": "conn-123"
}'import Foundation
let parameters = [
"url": "rtsp://example.com:8554/stream",
"name": "My Stream",
"collection_id": "default",
"sample_rate": 30,
"media_types": ["video", "audio"],
"store": false,
"enable_transcript": true,
"ws_connection_id": "conn-123"
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.videodb.io/rtstream/")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"x-access-token": "<api-key>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/rtstream/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/rtstream/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'rtsp://example.com:8554/stream',
name: 'My Stream',
collection_id: 'default',
sample_rate: 30,
media_types: ['video', 'audio'],
store: false,
enable_transcript: true,
ws_connection_id: 'conn-123'
})
};
fetch('https://api.videodb.io/rtstream/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/rtstream/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/rtstream/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"url\": \"rtsp://example.com:8554/stream\",\n \"name\": \"My Stream\",\n \"collection_id\": \"default\",\n \"sample_rate\": 30,\n \"media_types\": [\n \"video\",\n \"audio\"\n ],\n \"store\": false,\n \"enable_transcript\": true,\n \"ws_connection_id\": \"conn-123\"\n}")
val request = Request.Builder()
.url("https://api.videodb.io/rtstream/")
.post(body)
.addHeader("x-access-token", "<api-key>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute(){
"success": true,
"data": {
"id": "rts-12345",
"name": "My Stream",
"status": "connected",
"sample_rate": 30,
"media_types": [
"video",
"audio"
],
"collection_id": "default",
"store": false,
"created_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"message": "Error message",
"error_code": "ERROR_CODE"
}{
"success": false,
"message": "Error message",
"error_code": "ERROR_CODE"
}Create a new real-time stream by connecting to an RTSP or YouTube stream URL. The stream begins processing immediately.
urlis required and must be a valid RTSP or YouTube stream URLsample_ratecontrols the frame sampling rate (default: 30)media_typesspecifies which media to capture:video,audio, or both- Set
storetotrueto persist stream recordings - Enable
enable_transcriptfor automatic speech transcription
RTSP Ingest Guide
Learn about RTSP stream ingestion
Stream Lifecycle
Understand stream states
Authorizations
API key for authentication (sk-xxx format)
Body
application/json
RTSP or YouTube stream URL
Example:
"rtsp://example.com:8554/stream"
Example:
"My Stream"
Example:
"default"
Example:
30
Available options:
video, audio Example:
["video", "audio"]
Example:
false
Example:
true
Example:
"conn-123"
⌘I