Videos

Move Videos Between Projects

Endpoint: POST /v1/videos/change-project

This guide explains how integrations can move up to 1,000 videos per API call into a different project through the public API. The workflow mirrors the dashboard behaviour.


Prerequisites

  • Authentication: JWT token that satisfies policy (the same token used for other video‑management endpoints).
  • Project access: Team members are restricted to projects they already control; admins can move any videos within the account.
  • Video ownership: All video IDs must belong to the authenticated account.

Request

Headers

Name / Type / Description
NameTypeDescription
AuthorizationStringBearer YOUR_API_KEY
http
POST /v1/videos/change-project HTTP/1.1
Authorization: Bearer <token>
Content-Type: application/json

{
  "projectId": "proj_abc123",
  "videoIds": [
    "vid_0001",
    "vid_0002",
    "vid_0003"
  ]
}

Body Fields

Field / Type / Required / Description
FieldTypeRequiredDescription
projectIdstring✅Target project ID. Must belong to the authenticated account.
videoIdsarray\✅List of video IDs to move. Duplicates and blank entries are removed automatically. Limited to 1,000 per request.

Behaviour

  1. Validation
  2. Rejects empty payloads and requests exceeding 1,000 IDs.
  3. Managers must already have access to each source project; otherwise the call returns 403.

Response

json
{
  "ok": true
}
Field / Type / Description
FieldTypeDescription
okboolIndicates whether every batch completed successfully. A false value means one or more videos failed; inspect server logs for details.

Error Codes

Status / When it Happens
StatusWhen it Happens
400 Bad RequestInvalid JSON, missing projectId, no videoIds, more than 1,000 IDs, or the target project cannot be resolved.
403 ForbiddenManager attempted to move videos from a project outside their access list.
500 Internal Server ErrorUnexpected failure while updating. Retries are safe: the operation is idempotent.

Best Practices

  • Chunk large migrations: If you need to move more than 1,000 videos, split the job into multiple requests.
  • Validate ahead of time: Fetch the destination project first if you want to confirm its id or ensure it exists before calling the endpoint

Code Samples

C#

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

var body = new
{
  projectId = "proj_abc123",
  videoIds = new[] { "vid_0001", "vid_0002" }
};

var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "YOUR_API_KEY");
var content = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json");
var res = await client.PostAsync("https://api.dyntube.com/v1/videos/change-project", content);
res.EnsureSuccessStatusCode();

Node.js

javascript
import axios from 'axios';

const body = {
  projectId: 'proj_abc123',
  videoIds: ['vid_0001', 'vid_0002']
};

const res = await axios.post('https://api.dyntube.com/v1/videos/change-project', body, {
  headers: { Authorization: 'Bearer YOUR_API_KEY' }
});
console.log(res.data);

Python

python
import requests

body = {
    "projectId": "proj_abc123",
    "videoIds": ["vid_0001", "vid_0002"]
}

resp = requests.post(
    "https://api.dyntube.com/v1/videos/change-project",
    json=body,
    headers={"Authorization": "Bearer YOUR_API_KEY"}
)
resp.raise_for_status()
print(resp.json())

PHP

php
<?php
$body = [
  "projectId" => "proj_abc123",
  "videoIds" => ["vid_0001", "vid_0002"]
];

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

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

if ($status >= 200 && $status < 300) {
  echo $response;
} else {
  echo "Error moving videos, status: $status";
}
  • Get projects to find the target projectId.
  • Get videos to find video IDs before moving them.
  • Update a project to adjust settings on the target project before moving videos.

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