API reference
Download a video
GET /api/pub/v1/videos/{videoId}/file, the rendered clip, with range requests.
GET
https://api.dhanu.ai/api/pub/v1/videos/{videoId}/fileStreams the rendered clip as video/mp4. The route honours Range headers, so a
<video> element or a player can scrub it directly. A video that is still rendering
answers video_not_ready.
Request
curl -o clip.mp4 https://api.dhanu.ai/api/pub/v1/videos/$VIDEO_ID/file \
-H "Authorization: Bearer $DHANU_API_KEY"const { bytes } = await dhanu.videos.download(videoId);
await fs.writeFile("clip.mp4", bytes);clip = dhanu.videos.download(video_id)
with open("clip.mp4", "wb") as fh:
fh.write(clip.bytes) Response
200 OK
The MP4 body with Accept-Ranges: bytes; a Range request answers 206 Partial Content with Content-Range.
Errors
| Code | Status | Meaning |
|---|---|---|
invalid_api_key | 401 | The bearer key is missing or unknown. |
api_key_revoked | 401 | The key was revoked. |
api_key_expired | 401 | The key passed its expiry date. |
api_key_ip_not_allowed | 403 | The caller's IP is outside the key's allowlist. |
developer_access_revoked | 403 | The key's creator lost developer access in the workspace. |
api_key_project_scope | 403 | The key covers no active projects, or projectId is outside its scope. |
not_found | 404 | No such resource in the key's workspace. |
video_not_ready | 409 | The video is still rendering, or failed. |