Quick start

Quick Start

Get Your API Key

DynTube API requests are authenticated with API keys. Requests without a valid API key return an authorization error.

You can generate an API key from the DynTube dashboard at any time.

API Authentication

Authenticate requests with Bearer authentication. Send your API key in the Authorization header:

yaml

Authorization: Bearer YOUR_API_KEY

Make your first request

Send an authenticated request to the videos endpoint to list videos in your account.

GET https://api.dyntube.com/v1/videos

The response is a JSON object with pagination details and a videos array.

200: OK

json
{
    "pager": {
        "page": 1,
        "totalPages": 1,
        "totalResults": 10,
        "sort": ""
    },
    "videos": [
        {
            "id": "fFL56RU6PjvJPeE",
            "title": "My Video",
            "channelKey": "f8RMr2q4h6yNpv9",
            "status": 3,
            "created": "2024-01-15T10:30:00Z"
        }
    ]
}

Code Samples

C#

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

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

var response = await client.GetAsync("https://api.dyntube.com/v1/videos?page=1&size=20");
var body = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
    throw new Exception($"Request failed: {(int)response.StatusCode} {body}");
}

Console.WriteLine(body);

Node.js

javascript
const axios = require('axios');

async function listVideos() {
  const response = await axios.get('https://api.dyntube.com/v1/videos', {
    params: { page: 1, size: 20 },
    headers: { Authorization: 'Bearer YOUR_API_KEY' }
  });

  console.log(response.data);
}

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

Python

python
import requests

response = requests.get(
    "https://api.dyntube.com/v1/videos",
    params={"page": 1, "size": 20},
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)
response.raise_for_status()
print(response.json())

PHP

php
<?php
$query = http_build_query(['page' => 1, 'size' => 20]);

$ch = curl_init("https://api.dyntube.com/v1/videos?{$query}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY',
]);

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

if ($httpCode < 200 || $httpCode >= 300) {
    throw new Exception("Request failed with status {$httpCode}: {$response}");
}

echo $response;

Postman Collection

If you use Postman to test APIs, import the DynTube collection below to get started quickly.

Where to Go Next

  • Create project if you want to organize videos before uploading.
  • Upload video by file or upload video by URL to add video content.
  • Get video status to check when an uploaded video is ready.
  • Key concepts for plan types, region codes, and API conventions.

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