Skip to main content
GET
/
v1
/
videos
/
generations
/
{id}
curl "https://api.lemondata.cc/v1/videos/generations/video_abc123" \
  -H "Authorization: Bearer sk-your-api-key"
{
  "task_id": "video_abc123",
  "status": "pending",
  "progress": 0,
  "model": "kling-v2.6-pro",
  "created_at": 1706000000
}

Path Parameters

task_id
string
required
The task ID returned from the create video request.

Response

task_id
string
Task identifier.
status
string
Task status: pending, processing, completed, failed.
progress
number
Progress percentage (0-100).
video_url
string
URL of the generated video (when completed).
error
string
Error message (if failed).
created_at
integer
Creation timestamp.
completed_at
integer
Completion timestamp (when done).
curl "https://api.lemondata.cc/v1/videos/generations/video_abc123" \
  -H "Authorization: Bearer sk-your-api-key"
{
  "task_id": "video_abc123",
  "status": "pending",
  "progress": 0,
  "model": "kling-v2.6-pro",
  "created_at": 1706000000
}

Polling Best Practices

  • Poll every 5-10 seconds
  • Implement exponential backoff for long tasks
  • Set a maximum timeout (e.g., 10 minutes)
  • Handle failed status gracefully
import time

def wait_for_video(task_id, max_wait=600, interval=5):
    """Wait for video with timeout."""
    start = time.time()

    while time.time() - start < max_wait:
        response = requests.get(
            f"https://api.lemondata.cc/v1/videos/generations/{task_id}",
            headers={"Authorization": "Bearer sk-your-api-key"}
        )
        data = response.json()

        if data["status"] == "completed":
            return data["video_url"]
        elif data["status"] == "failed":
            raise Exception(data.get("error", "Video generation failed"))

        time.sleep(interval)

    raise TimeoutError("Video generation timed out")