Live streaming

Create a Live Stream

Create a new Live Stream

Create a new live stream.

POST https://api.dyntube.com/v1/live-streams

Send the request body as application/json. The example below shows the expected payload.

Headers

Name / Type / Description
NameTypeDescription
AuthorizationStringBearer YOUR_API_KEY
Content-TypeStringapplication/json

200: OK Returns the id of the newly created live stream.

javascript
NN8GgcLjTsbUg

Sample Request Body

Here is a sample JSON request to create a live stream.

Click here to find the appropriate "region" and "service" value for creating live stream.

json
{
  "id": "6dWVR5343889MV3lQ",
  "name": "My Stream",
  "description": "",
  "region": "euc",
  "auth": false,
  "encrypt": false,
  "record": false,
  "storageProjectId": "",
  "platforms": [
    {
      "service": 4,
      "address": "rtmp://syd03.contribute.live-video.net/app",
      "streamKey": "1211212"
    }
  ]
}

Code Samples

C#

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

var payload = new
{
    name = "My Stream",
    description = "",
    region = "euc",
    auth = false,
    encrypt = false,
    record = false,
    storageProjectId = "",
    platforms = new[] {
        new { service = 4, address = "rtmp://syd03.contribute.live-video.net/app", streamKey = "1211212" }
    }
};

var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "YOUR_API_KEY");

var response = await client.PostAsync(
    "https://api.dyntube.com/v1/live-streams",
    new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json"));

var body = await response.Content.ReadAsStringAsync();
System.Console.WriteLine(body);

Node.js

javascript
const axios = require('axios');

async function createLiveStream() {
  const payload = {
    name: 'My Stream',
    description: '',
    region: 'euc',
    auth: false,
    encrypt: false,
    record: false,
    storageProjectId: '',
    platforms: [
      {
        service: 4,
        address: 'rtmp://syd03.contribute.live-video.net/app',
        streamKey: '1211212'
      }
    ]
  };

  const res = await axios.post('https://api.dyntube.com/v1/live-streams', payload, {
    headers: { Authorization: 'Bearer YOUR_API_KEY' }
  });

  console.log(res.data);
}

createLiveStream().catch(err => {
  console.error(err.response?.data || err.message);
});

Python

python
import requests

payload = {
    "name": "My Stream",
    "description": "",
    "region": "euc",
    "auth": False,
    "encrypt": False,
    "record": False,
    "storageProjectId": "",
    "platforms": [
        {
            "service": 4,
            "address": "rtmp://syd03.contribute.live-video.net/app",
            "streamKey": "1211212"
        }
    ]
}

res = requests.post(
    "https://api.dyntube.com/v1/live-streams",
    json=payload,
    headers={"Authorization": "Bearer YOUR_API_KEY"}
)

print(res.status_code, res.text)

PHP

php
<?php

$payload = [
    "name" => "My Stream",
    "description" => "",
    "region" => "euc",
    "auth" => false,
    "encrypt" => false,
    "record" => false,
    "storageProjectId" => "",
    "platforms" => [[
        "service" => 4,
        "address" => "rtmp://syd03.contribute.live-video.net/app",
        "streamKey" => "1211212"
    ]]
];

$ch = curl_init("https://api.dyntube.com/v1/live-streams");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOUR_API_KEY",
        "Content-Type: application/json"
    ]
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "Status: {$status}\n";
echo $response;

Common Next Steps

After creating a live stream:

  • Get a live stream to retrieve stream settings and ingest details.
  • Update a live stream to change recording, authentication, or platform settings.
  • Get live streaming recording if recording is enabled.
  • Service and regions for live streams to choose valid region and service values.

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