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 |
|---|---|---|---|
| id | string | Yes | The 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 |
|---|---|---|
| id | string | Internal channel identifier |
| key | string | Public channel key (use for embedding) |
| name | string | Channel display name |
| description | string | Channel description |
| accountId | string | Owner account identifier |
| version | integer | Channel version number |
| planType | integer | Associated plan type |
| templateKey | string | Applied template key |
| status | integer | Channel status (1 = Published) |
| created | datetime | Creation timestamp (ISO 8601) |
| updated | datetime | Last update timestamp (ISO 8601) |
Error Responses
| Status Code | Description |
|---|---|
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Not Found - Channel does not exist or you don't have access |
| 500 | Internal 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.