Skip to content

Download video

GET/v1/videos/{video_id}/contentHEAD

Download a completed task’s video. Usually you can use metadata.url from the task directly; when it points to this endpoint, request it from your server with your API key.

The response is either the video bytes (video/mp4, with Range support) or a 307 redirect to storage. Follow redirects, and do not forward your API key to the redirected host.

Headers

  • AuthorizationstringRequired

    Bearer <API_KEY> of the user who owns the task.

  • RangestringOptional

    Optional byte range such as bytes=0-1048575.

Path parameters

  • video_idstringRequired

    The id returned at creation (starts with task_). Only tasks owned by the key’s user can be read.

Returns

HTTP 200 / 206 with video bytes, or HTTP 307 to a short-lived download URL. Save videos you need to keep in your own storage.

  • Content-TypeheaderOptional

    Usually video/mp4.

Errors

HTTPcodeCause and action
400invalid_request_errorThe task is not completed yet; keep polling the retrieve endpoint.
404invalid_request_errorThe task does not exist or belongs to another user.
410artifact_goneThe video has expired and can no longer be retrieved.
502server_errorStorage or the provider is temporarily unavailable; retry later.
401—The API key is invalid, expired or disabled.
Download the video to a file
curl -L https://ling-light.com/v1/videos/task_xxxxxxxxxxxxxxxx/content \
  -H "Authorization: Bearer $LINGLIGHT_API_KEY" \
  -o video.mp4
import { writeFile } from 'node:fs/promises'

const response = await fetch('https://ling-light.com/v1/videos/task_xxxxxxxxxxxxxxxx/content', {
  headers: {
    Authorization: `Bearer ${process.env.LINGLIGHT_API_KEY}`,
  },
})
if (!response.ok) throw new Error(`HTTP ${response.status}`)
await writeFile('video.mp4', Buffer.from(await response.arrayBuffer()))
import os

import requests

response = requests.get(
    "https://ling-light.com/v1/videos/task_xxxxxxxxxxxxxxxx/content",
    headers={
        "Authorization": f"Bearer {os.environ['LINGLIGHT_API_KEY']}",
    },
    timeout=300,
)
response.raise_for_status()
with open("video.mp4", "wb") as file:
    file.write(response.content)
Response
HTTP/1.1 200 OK
Content-Type: video/mp4

<video bytes>
API reference overview
Authentication, media URLs, idempotency and errors.
Integration guide
The full flow from API key to downloaded result.
Last updated