Channels
Update channel
Update an existing channel's properties and content.
http
PUT /v1/channels/{id}Authentication
This endpoint requires authentication using a Bearer token.
http
Authorization: Bearer YOUR_API_KEYRequest Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer YOUR_API_KEY | Yes |
| Content-Type | application/json | Yes |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The unique channel identifier |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Channel name (max 100 characters) |
| description | string | No | Channel description (max 250 characters) |
| templateKey | string | No | Template key to apply styling |
| videoKeys | array | No* | Array of video keys to include |
| projectKeys | array | No* | Array of project keys to include |
| privateLinkEnabled | boolean | No | Enable/disable private link access |
Request Example
json
{
"name": "Getting Started Series - Updated",
"description": "Updated beginner tutorials for 2024",
"videoKeys": [
"vid_abc123",
"vid_def456",
"vid_new789"
],
"privateLinkEnabled": false
}Response
Success Response
Status Code: 200 OK
json
{
"id": "abc123xyz",
"key": "ch_def456",
"name": "Getting Started Series - Updated",
"description": "Updated beginner tutorials for 2024",
"accountId": "acc_789",
"version": 1,
"planType": 2,
"templateKey": "tmpl_dark",
"status": 1,
"created": "2024-01-15T10:30:00Z",
"updated": "2024-01-25T14:00:00Z"
}Response Fields
| Field | Type | Description |
|---|---|---|
| id | string | Internal channel identifier |
| key | string | Public channel key (unchanged) |
| name | string | Updated channel name |
| description | string | Updated 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 | Original creation timestamp |
| updated | datetime | Updated timestamp (ISO 8601) |
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request - Validation error |
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Not Found - Channel does not exist or access denied |
| 500 | Internal Server Error |
Validation Errors
json
{
"message": "Name is required."
}json
{
"message": "Provide at least one videoKey or projectKey."
}json
{
"message": "Invalid videoKeys provided.",
"invalidVideoKeys": ["vid_invalid1"]
}Code Examples
bash
curl -X PUT "https://api.dyntube.com/v1/channels/abc123xyz" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Getting Started Series - Updated",
"description": "Updated beginner tutorials",
"videoKeys": ["vid_abc123", "vid_def456", "vid_new789"]
}'javascript
const channelId = 'abc123xyz';
const updatedChannel = {
name: 'Getting Started Series - Updated',
description: 'Updated beginner tutorials for 2024',
videoKeys: ['vid_abc123', 'vid_def456', 'vid_new789'],
privateLinkEnabled: false
};
const response = await fetch(
`https://api.dyntube.com/v1/channels/${channelId}`,
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(updatedChannel)
}
);
if (response.ok) {
const channel = await response.json();
console.log(`Updated channel: ${channel.name}`);
console.log(`Last updated: ${channel.updated}`);
} else if (response.status === 404) {
console.log('Channel not found');
} else {
const error = await response.json();
console.error(`Error: ${error.message}`);
}csharp
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
var channelId = "abc123xyz";
var payload = new
{
name = "Getting Started Series - Updated",
description = "Updated beginner tutorials",
videoKeys = new[] { "vid_abc123", "vid_def456", "vid_new789" },
privateLinkEnabled = false
};
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "YOUR_API_KEY");
var response = await client.PutAsync(
$"https://api.dyntube.com/v1/channels/{channelId}",
new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json"));
if (response.IsSuccessStatusCode)
{
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
else
{
Console.WriteLine($"Failed to update channel. Status: {response.StatusCode}");
}python
import requests
channel_id = 'abc123xyz'
updated_channel = {
'name': 'Getting Started Series - Updated',
'description': 'Updated beginner tutorials for 2024',
'videoKeys': ['vid_abc123', 'vid_def456', 'vid_new789'],
'privateLinkEnabled': False
}
response = requests.put(
f'https://api.dyntube.com/v1/channels/{channel_id}',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json=updated_channel
)
if response.status_code == 200:
channel = response.json()
print(f"Updated channel: {channel['name']}")
print(f"Last updated: {channel['updated']}")
elif response.status_code == 404:
print('Channel not found')
else:
error = response.json()
print(f"Error: {error['message']}")php
<?php
$channelId = 'abc123xyz';
$updatedChannel = [
'name' => 'Getting Started Series - Updated',
'description' => 'Updated beginner tutorials for 2024',
'videoKeys' => ['vid_abc123', 'vid_def456', 'vid_new789'],
'privateLinkEnabled' => false
];
$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_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($updatedChannel));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200) {
$channel = json_decode($response, true);
echo "Updated channel: " . $channel['name'] . "\n";
echo "Last updated: " . $channel['updated'] . "\n";
} elseif ($httpCode === 404) {
echo "Channel not found\n";
} else {
$error = json_decode($response, true);
echo "Error: " . $error['message'] . "\n";
}Use Cases
Add Videos to Existing Channel
javascript
// First, get the current channel
const getResponse = await fetch(
`https://api.dyntube.com/v1/channels/${channelId}`,
{ headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
const currentChannel = await getResponse.json();
// Get current video keys (you may need to track these separately
// or fetch from your own database)
const currentVideoKeys = ['vid_abc123', 'vid_def456'];
// Add new video to the list
const updatedVideoKeys = [...currentVideoKeys, 'vid_newvideo'];
// Update the channel
await fetch(`https://api.dyntube.com/v1/channels/${channelId}`, {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: currentChannel.name,
description: currentChannel.description,
videoKeys: updatedVideoKeys
})
});Reorder Videos in Channel
javascript
// Change the order of videos by reordering the array
await fetch(`https://api.dyntube.com/v1/channels/${channelId}`, {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'My Playlist',
videoKeys: [
'vid_episode3', // Now first
'vid_episode1', // Now second
'vid_episode2' // Now third
]
})
});Change Channel Template
javascript
await fetch(`https://api.dyntube.com/v1/channels/${channelId}`, {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'My Channel',
videoKeys: ['vid_abc123'],
templateKey: 'tmpl_new_template' // Apply new template
})
});Toggle Private Link Access
javascript
// Disable private link (make channel public only)
await fetch(`https://api.dyntube.com/v1/channels/${channelId}`, {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Public Channel',
videoKeys: ['vid_abc123'],
privateLinkEnabled: false
})
});See Also
- Get Channel - Retrieve channel details before updating
- Create Channel - Create a new channel
- Delete Channel - Remove a channel
- List Templates - Get available templates
- 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.