Partner API base path is /api/v1 on https://api.dcast.pro. This site documents the live surface; use the Quickstart QA curls to validate keys and routes.

Upload videos

The Partner API exposes one canonical upload flow. It is a two-step request: POST creates the video record and returns a time-limited upload target, then PUT sends the bytes to that target. The same target also accepts chunked PUTs with Content-Range for large files.

Gotcha — the PUT step returns 307 and the body MUST be re-sent. The upload target hands off to the worker that will store the file via an HTTP 307 Temporary Redirect. Your client must follow the redirect AND re-send the request body on the redirected request. With curl that means curl -L (curl re-sends the body on a 307; a plain PUT without-L stops at the 307 and uploads nothing). axios, fetch, and Pythonrequests follow PUT 307s and re-send the body by default. If your HTTP client drops the body on redirect (some do for 301/302), either switch to a client that preserves it on 307 or use the HEAD probe below to learn the worker URL first and PUT directly.

Quickstart (curl, single PUT, ≤ 500 MB)

# 1. Create the video record + obtain the upload target.
curl -sS -X POST "https://api.dcast.pro/api/v1/videos/upload" \
  -H "Authorization: Bearer {api_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "title":      "My Video",
    "fileName":   "video.mp4",
    "fileSize":   104857600,
    "visibility": "PRIVATE"
  }'

# Response:
{
  "success": true,
  "data": {
    "video":  { "id": "<videoId>", "status": "PENDING", ... },
    "upload": {
      "url":         "https://api.dcast.pro/api/v1/uploads/<token>",
      "method":      "PUT",
      "expiresAt":   "<ISO-8601 UTC>",
      "maxFileSize": 115343360,            // fileSize x 1.1, rounded
      "chunkSize":   99614720,
      "chunked":     true,                 // false for a file smaller than chunkSize: one PUT
      "instructions": "Use Content-Range header for chunked upload: bytes START-END/TOTAL"
    },
    "statusUrl": "/api/v1/videos/<videoId>/status"
  }
}

# 2. PUT the bytes to data.upload.url. Workers are discovered via 307
#    redirect — curl follows it with -L; axios, fetch, Python requests
#    follow PUT redirects by default.
curl -sS -L -X PUT --data-binary @video.mp4 \
  -H "Content-Type: video/mp4" \
  "<data.upload.url>"

# Response (on success):
{
  "success": true,
  "data": {
    "videoId":  "<videoId>",
    "fileSize": 104857600,
    "worker":   "worker-720845-de",
    "status":   "UPLOADED",
    "complete": true
  }
}

# 3. Poll processing status:
curl -sS -H "Authorization: Bearer {api_key}" \
  "https://api.dcast.pro/api/v1/videos/<videoId>/status"

Chunked uploads (large files)

For files larger than upload.chunkSize (95 MB by default), the same upload.url accepts standard HTTP Content-Range PUTs. Send each chunk with the byte range it covers; the server stitches them in order.

# Chunk 1 of N (bytes 0 – 99,614,719 of a 250 MB file):
curl -sS -L -X PUT \
  -H "Content-Range: bytes 0-99614719/262144000" \
  -H "Content-Type:  video/mp4" \
  --data-binary @chunk1.bin \
  "<data.upload.url>"

# Continue with chunks 2..N. Each chunk's Content-Range must be contiguous;
# total size in the trailing /<total> must match the original fileSize.
# The final chunk's response carries "complete": true and the worker
# advances the video to PROCESSING.

For partner integrations, the canonical upload is the two-step flow above (POST /videos/upload → PUT the bytes, chunked Content-Range supported, resumable by re-issuing the PUT from the last confirmed byte).

HEAD probe to skip the redirect re-send

Clients that prefer to know the worker URL up front (to avoid the body re-send cost of the 307) can issue a HEAD request to data.upload.url. The response is 307 with a Location header pointing at the actual worker; the client can then PUT directly to that URL without re-sending the body.

curl -sI "<data.upload.url>"   # → 307 + Location: <worker-url>
curl -X PUT --data-binary @video.mp4 -H "Content-Type: video/mp4" "<worker-url>"

Upload from your website (browser)

Your server creates the upload with its API key and hands only data.upload.url to the page, so the key never reaches the browser. DcastStudio.upload() from /embed/dcast.js uploads through the same resumable protocol as the dcast.tv uploader (TUS 1.0): POST {upload.url}/tus with Upload-Length opens the upload, the chunks go as PATCH to the returned Location with Authorization: Bearer {token} (the last part of upload.url), and after a dropped connection a HEAD on that address tells from which byte to continue. A second open of the same upload answers 409 UPLOAD_EXISTS with its Location; a refusal a retry cannot fix stops the upload (for example 413 UPLOAD_EXCEEDS_TICKET). Plan limits are the same as for any API upload: a limit refusal comes back from POST /videos/upload on your server.

// Your server (Node). DCAST_API_KEY is in the server's environment: the DCAST site connector writes it there (your AI agent runs it); nobody copies a key.
app.post('/my-upload', async (req, res) => {
  const r = await fetch('https://api.dcast.pro/api/v1/videos/upload', {
    method: 'POST',
    headers: { Authorization: 'Bearer ' + process.env.DCAST_API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ title: req.body.title, fileName: req.body.fileName, fileSize: req.body.fileSize, visibility: 'PUBLIC' }),
  });
  const body = await r.json();
  if (!body.success) return res.status(r.status).json(body.error);   // plan limits answer here
  res.json({ uploadUrl: body.data.upload.url, videoId: body.data.video.id });
});

<!-- Your page -->
<input type="file" id="video">
<script src="https://dcast.tv/embed/dcast.js"></script>
<script>
  document.getElementById('video').addEventListener('change', async (e) => {
    const file = e.target.files[0];
    const { uploadUrl } = await (await fetch('/my-upload', {
      method: 'POST', headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ title: file.name, fileName: file.name, fileSize: file.size }),
    })).json();
    const result = await DcastStudio.upload({
      uploadUrl, file,
      onProgress: (p) => console.log(p.percent + '%'),
    });
    console.log('uploaded', result.videoId);   // then poll /videos/{id}/status
  });
</script>

Your video library on your site

Two lines show your public videos with the player, with no key and no server. The library follows the page language (<html lang> or data-lang); data-theme takes light, dark or auto. The sites listed in your embed settings limit where it may appear, the same as for the player.

<div data-dcast-library="your-username"></div>
<script src="https://dcast.tv/embed/dcast.js" async></script>

Upload button without a server

Two lines put an upload button on your own page, with no server and no key. You sign in to DCAST in a window that opens from the button and allow the site to upload videos from your account; the file then goes from your browser straight to your account, and the sign-in never reaches the page. The button works only for the account whose username is in the attribute. The page hears three events on the element: dcast:studio:uploaded (event.detail.videoId), dcast:studio:height and dcast:studio:signed-out. The sites listed in your embed settings limit where the button may appear (an empty list means every site), you can withdraw the permission at any time on the Team page of your cabinet, and plan limits answer inside the button.

<div id="upload" data-dcast-upload="your-username"></div>
<script src="https://dcast.tv/embed/dcast.js" async></script>
<script>
  document.getElementById('upload').addEventListener('dcast:studio:uploaded', (e) => {
    console.log('uploaded', e.detail.videoId);   // then poll /videos/{id}/status
  });
</script>

Status + processing lifecycle

After the bytes land, the video moves through UPLOADED → PROCESSING → READY. Poll GET /videos/{videoId}/status, or subscribe to your partner webhook for the video.upload.completed and video.processing.completed events to avoid polling.

Quota + size limits

POST /videos/upload rejects with 403 QUOTA_EXCEEDED if the partner's plan is over its storage limit. fileSize in the init request must be exact; the worker enforces it on the body PUT and returns413 FILE_TOO_LARGE if exceeded. See limits for plan-by-plan caps.