Video Management

The Vision API provides comprehensive video management capabilities for uploading, retrieving, and organizing your video content.

Upload Videos

Upload videos using either a file upload or a URL:

You can optionally assign an uploaded video to a video group by including the group_id form field. Omit the field—or set it to default—to keep the video in the default pool.

Example with file upload

Bash

$curl -X POST https://vision-agent.api.reka.ai/videos/upload \
> -H "X-Api-Key: YOUR_API_KEY" \
> -F "file=@video.mp4" \
> -F "video_name=my_video.mp4" \
> -F "index=true" \
> -F "group_id=20f4bc2d-3ebe-4fd2-829f-9d88c79e8a37"

Python

1import requests
2import json
3
4url = f"{BASE_URL}/videos/upload"
5video_path = "/content/demo.mp4" # local video path
6
7# Video indexing request body for a local video
8data = {
9 "index": True, # boolean value indicating whether the video should be indexed for search/qa/etc
10 "enable_thumbnails": False, # boolean value indicating whether to generate thumbnails for video chunks, this will increase the indexing time but will allow for quick thumbnail loading at search time
11 "video_name": "vid16", # name of video to store in vision agent system for informative purpose. not ID
12 "video_start_absolute_timestamp": "2025-04-12T19:05:45", # (Optional) a absolute timestamp indicating video start time in ISO 8601 format
13 "group_id": "20f4bc2d-3ebe-4fd2-829f-9d88c79e8a37", # optional video group assignment
14}
15headers = {
16 "X-Api-Key": REKA_API_KEY
17}
18
19# Open the video file and send the request
20with open(video_path, "rb") as file:
21 files = {"file": (video_path[1:], file, "video/mp4")} # Send as multipart/form-data
22 response = requests.post(url, headers=headers, data=data, files=files)
23
24# Print response
25print(response.status_code, response.json())

Example with video url

Bash

$curl -X POST https://vision-agent.api.reka.ai/videos/upload \
> -H "X-Api-Key: YOUR_API_KEY" \
> -F "video_url=https://www.youtube.com/watch?v=dQw4w9WgXcQ" \
> -F "video_name=my_video.mp4" \
> -F "index=true" \
> -F "group_id=default"

Python

1import requests
2import json
3
4url = f"{BASE_URL}/videos/upload"
5video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" # video url
6
7# Video indexing request body for a video url
8data = {
9 "index": True,
10 "video_name": "vid16",
11 "video_url": video_url,
12 "video_start_absolute_timestamp": "2025-04-12T19:05:45",
13 "group_id": "default",
14}
15headers = {
16 "X-Api-Key": REKA_API_KEY
17}
18
19# Send the request
20response = requests.post(url, headers=headers, data=data)
21
22# Print response
23print(response.status_code, response.json())

Python Bulk Upload Example

1import os
2import asyncio
3import httpx
4import time
5import json
6async def bulk_upload_videos(video_paths: list[str], api_key: str, caption_mode: str = "tagging_ad_video", max_concurrency: int = 2):
7 tasks = []
8 semaphore = asyncio.Semaphore(max_concurrency)
9
10 async def limited_send_upload_request(sem: asyncio.Semaphore, video_path: str, *args, **kwargs):
11 async with sem:
12 response = await send_upload_request(video_path, *args, **kwargs)
13 return video_path, response
14
15 for video_path in video_paths:
16 task = asyncio.create_task(limited_send_upload_request(semaphore, video_path, api_key, caption_mode))
17 tasks.append(task)
18
19 results = await asyncio.gather(*tasks)
20
21 video_map = {}
22 for video_path, result in results:
23 if result and result.status_code == 200:
24 try:
25 video_id = result.json().get('video_id')
26 if video_id:
27 video_map[video_path] = video_id
28 except json.JSONDecodeError:
29 print(f"Could not decode JSON from response for {video_path}")
30 return video_map

Upload Parameters

  • file (optional): Video file to upload (mutually exclusive with video_url)
  • video_url (optional): URL of the video to upload (mutually exclusive with file)
  • video_name (required): Name for the video
  • video_absolute_start_timestamp (optional): ISO 8601 timestamp
  • index (required): Whether to index the video for search and Q&A
  • group_id (optional): Video group ID to attach the upload to. Defaults to default when omitted, and cannot be changed after upload.

Get Videos

Retrieve specific videos by their IDs:

Bash

$curl -X POST https://vision-agent.api.reka.ai/videos/get \
> -H "X-Api-Key: YOUR_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
> "video_ids": ["550e8400-e29b-41d4-a716-446655440000"]
> }'

Python

1import requests
2import json
3
4url = f"{BASE_URL}/videos/get"
5
6# Video get request body
7data = {
8 "video_ids": ["550e8400-e29b-41d4-a716-446655440000"]
9}
10headers = {
11 "X-Api-Key": REKA_API_KEY
12}
13
14# Send the request
15response = requests.post(url, headers=headers, data=data)
16
17# Print response
18print(response.status_code, response.json())

List Videos

List all your videos with optional filtering:

Bash

$curl -X POST https://vision-agent.api.reka.ai/videos/get \
> -H "X-Api-Key: YOUR_API_KEY" \
> -H "Content-Type: application/json" \

Python

1import requests
2import json
3
4url = f"{BASE_URL}/videos/get"
5
6headers = {
7 "X-Api-Key": REKA_API_KEY
8}
9
10# Send the request
11response = requests.post(url, headers=headers)
12
13# Print response
14print(response.status_code, response.json())

Delete Videos

Delete videos by their IDs:

Bash

$curl -X DELETE https://vision-agent.api.reka.ai/videos/delete \
> -H "X-Api-Key: YOUR_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
> "video_ids": ["550e8400-e29b-41d4-a716-446655440000"]
> }'

Python

1import requests
2import json
3
4url = f"{BASE_URL}/videos/delete"
5
6# Video delete request body
7data = {
8 "video_ids": ["550e8400-e29b-41d4-a716-446655440000"] # List of video ids to delete
9}
10headers = {
11 "X-Api-Key": REKA_API_KEY
12}
13
14# Send the request
15response = requests.delete(url, headers=headers, data=data)
16
17# Print response
18print(response.status_code, response.json())

Video Response Format

Each video response includes:

  • video_id: Unique identifier
  • url: Presigned S3 URL for access
  • indexing_status: Current indexing status (pending, indexing, indexed, failed)
  • metadata: Video metadata (dimensions, duration, timestamps, etc.)
  • indexing_type: Type of indexing applied
  • group_id: Video group identifier (default when no custom group is set)

Indexing Status

  • pending: Video uploaded, indexing not started
  • indexing: Video is currently being processed
  • indexed: Video has been successfully indexed and is ready for search/Q&A
  • failed: Indexing failed, video may need to be re-uploaded