The Platform API

Flow: Upload & Process Video

Manage your videos, ask questions, and build applications with the Platform API. Explore the operations below for request details, responses, and examples.

Flow: Upload & Process Video

1

Upload video

POST /projects/:projectId/videos/upload (multipart)

2

Poll status until completed

GET /projects/:projectId/videos/:videoId/status every 3-5s

3

Trigger processing (if not auto-started)

Start an Overview scan with POST /projects/:projectId/videos/:videoId/smart-scan, or use .../process to apply the project's processing settings.

4

Ready for analysis

Use agent or Q&A endpoints once status is completed

import requests, time

API_KEY = "svk_..."
BASE = "https://platform.endlessai.com/api/v1"
PROJECT_ID = "your-project-id"

# Step 1: Upload
with open("video.mp4", "rb") as f:
    resp = requests.post(
        f"{BASE}/projects/{PROJECT_ID}/videos/upload",
        headers={"X-Api-Key": API_KEY},
        files={"video": ("video.mp4", f, "video/mp4")},
    )
video = resp.json()
video_id = video["id"]
print(f"Uploaded: {video_id}")

# Step 2: Poll until complete
while True:
    status = requests.get(
        f"{BASE}/projects/{PROJECT_ID}/videos/{video_id}/status",
        headers={"X-Api-Key": API_KEY},
    ).json()
    print(f"Status: {status['status']}")
    if status["status"] == "completed":
        break
    if status["status"] == "error":
        raise RuntimeError("Processing failed")
    time.sleep(5)

# Step 3: Ask a question
result = requests.post(
    f"{BASE}/projects/{PROJECT_ID}/agent/process",
    headers={"X-Api-Key": API_KEY, "Content-Type": "application/json"},
    json={"message": "Describe what happens in this video", "sessionId": "s1"},
    timeout=300,
).json()
print(result)