Channels

Get channel

Retrieve details for a specific channel by its ID.

http
GET /v1/channels/{id}

Authentication

This endpoint requires authentication using a Bearer token.

Path Parameters

Parameter / Type / Required / Description
ParameterTypeRequiredDescription
idstringYesThe unique channel identifier

Response

Success Response

Status Code: 200 OK

json
{
  "id": "abc123xyz",
  "key": "ch_def456",
  "name": "Product Tutorials",
  "description": "Video tutorials for our product lineup",
  "accountId": "acc_789",
  "version": 1,
  "planType": 2,
  "templateKey": "tmpl_modern",
  "status": 1,
  "created": "2024-01-15T10:30:00Z",
  "updated": "2024-01-20T14:45:00Z"
}

Response Fields

Field / Type / Description
FieldTypeDescription
idstringInternal channel identifier
keystringPublic channel key (use for embedding)
namestringChannel display name
descriptionstringChannel description
accountIdstringOwner account identifier
versionintegerChannel version number
planTypeintegerAssociated plan type
templateKeystringApplied template key
statusintegerChannel status (1 = Published)
createddatetimeCreation timestamp (ISO 8601)
updateddatetimeLast update timestamp (ISO 8601)

Error Responses

Status Code / Description
Status CodeDescription
401Unauthorized - Invalid or missing API key
404Not Found - Channel does not exist or you don't have access
500Internal Server Error

Example Error Response

json
{
  "message": "Channel not found"
}

Code Examples

cURL

bash
curl -X GET "https://api.dyntube.com/v1/channels/abc123xyz" \
  -H "Authorization: Bearer YOUR_API_KEY"

JavaScript

javascript
const channelId = 'abc123xyz';

const response = await fetch(
  `https://api.dyntube.com/v1/channels/${channelId}`,
  {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  }
);

if (response.ok) {
  const channel = await response.json();
  console.log(`Channel: ${channel.name}`);
  console.log(`Key: ${channel.key}`);
  console.log(`Description: ${channel.description}`);
} else if (response.status === 404) {
  console.log('Channel not found');
}

C#

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

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

var response = await client.GetAsync($"https://api.dyntube.com/v1/channels/{channelId}");

if (response.IsSuccessStatusCode)
{
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
else if (response.StatusCode == System.Net.HttpStatusCode.NotFound)
{
    Console.WriteLine("Channel not found");
}

Python

python
import requests

channel_id = 'abc123xyz'

response = requests.get(
    f'https://api.dyntube.com/v1/channels/{channel_id}',
    headers={'Authorization': 'Bearer YOUR_API_KEY'}
)

if response.status_code == 200:
    channel = response.json()
    print(f"Channel: {channel['name']}")
    print(f"Key: {channel['key']}")
    print(f"Description: {channel['description']}")
elif response.status_code == 404:
    print('Channel not found')

PHP

php
<?php
$channelId = 'abc123xyz';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.dyntube.com/v1/channels/{$channelId}");
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) {
    $channel = json_decode($response, true);
    echo "Channel: " . $channel['name'] . "\n";
    echo "Key: " . $channel['key'] . "\n";
    echo "Description: " . $channel['description'] . "\n";
} elseif ($httpCode === 404) {
    echo "Channel not found\n";
}

Use Cases

Verify Channel Exists Before Embedding

javascript
async function getChannelForEmbed(channelId) {
  const response = await fetch(
    `https://api.dyntube.com/v1/channels/${channelId}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  if (!response.ok) {
    throw new Error('Channel not found');
  }

  const channel = await response.json();

  return {
    embedKey: channel.key,
    title: channel.name,
    description: channel.description
  };
}

Check Channel Status

javascript
async function isChannelPublished(channelId) {
  const response = await fetch(
    `https://api.dyntube.com/v1/channels/${channelId}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  if (!response.ok) {
    return false;
  }

  const channel = await response.json();
  return channel.status === 1; // 1 = Published
}

See Also

  • List Channels - Get all channels
  • Update Channel - Modify a channel
  • Delete Channel - Remove a channel
  • Channels API Overview - API overview and authentication

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