Video APIv1 Home OpenAPI spec

Docs › Quickstart

Quickstart

Upload a video, wait for it to process, and download the MP4. Set two environment variables first:

export VIDEO_API="https://api.videopiper.dev/v1"
export VIDEO_API_KEY="vpk_..."   # your key
# Uses jq to read JSON. Files up to 64 MiB are a single part (see Python/JavaScript for any size).
AUTH="Authorization: Bearer $VIDEO_API_KEY"; JSON="Content-Type: application/json"

# 1. Create the video
SIZE=$(wc -c < lesson.mp4 | tr -d ' ')
VIDEO_ID=$(curl -s -X POST "$VIDEO_API/videos" -H "$AUTH" -H "$JSON" \
  -d "{\"fileName\":\"lesson.mp4\",\"sizeBytes\":$SIZE}" | jq -r .videoId)

# 2. Get an upload URL for part 1, and PUT the bytes to it (no Authorization header)
PART_URL=$(curl -s -X POST "$VIDEO_API/videos/$VIDEO_ID/parts" -H "$AUTH" -H "$JSON" \
  -d '{"partNumbers":[1]}' | jq -r '.parts[0].url')
curl -s -T lesson.mp4 "$PART_URL"

# 3. Start processing
curl -s -X POST "$VIDEO_API/videos/$VIDEO_ID/complete" -H "$AUTH" -H "$JSON" -d '{}'

# 4. Wait for SUCCEEDED, then download
until [ "$(curl -s "$VIDEO_API/videos/$VIDEO_ID" -H "$AUTH" | jq -r .status)" != "RUNNING" ]; do sleep 10; done
curl -s "$VIDEO_API/videos/$VIDEO_ID" -H "$AUTH" | jq -r .status          # expect SUCCEEDED
curl -s -o lesson-processed.mp4 "$(curl -s "$VIDEO_API/videos/$VIDEO_ID" -H "$AUTH" | jq -r .downloadUrl)"

Short videos are usually ready within a minute or two of complete; long videos are processed in parallel chunks.