Metadata Tagging

The Vision API supports two approaches for generating metadata tags for your videos: quick tagging and indexed tagging.

Default Output Fields

By default, both approaches can return the following fields:

  • Description: string
  • Violence: boolean
  • Profanity: boolean
  • AdultContent: boolean
  • Drugs: boolean
  • Alcohol: boolean
  • Gambling: boolean
  • Political: boolean
  • ExpectedCTR: number (0–100)
  • ViralityScore: number (0–100)
  • Keyword: array of strings
  • MoodTone: array of strings

You can add, remove, and customize output fields. Contact us to optimize outputs for your use case.

Quick Tagging

Quick tagging is suitable for short videos (e.g., under 30 seconds). Videos are processed ad-hoc and videos are not stored.

Endpoint

  • POST /qa/quicktag

Request

Bash

$curl -X POST https://vision-agent.api.reka.ai/qa/quicktag \
> -H "X-Api-Key: YOUR_API_KEY" \
> -F "video=@/path/to/your/video.mp4"

Python

1import requests
2import json
3import os
4import time
5
6def send_reka_tag_request(video_path: str, api_key: str):
7 if not video_path:
8 raise ValueError("video path is required")
9 headers = {
10 "X-API-Key": api_key,
11 }
12 endpoint_url = f"{BASE_URL}/qa/quicktag"
13 print(f"{endpoint_url=}")
14 print(f"{headers=}")
15
16 start_time = time.time()
17 with open(video_path, 'rb') as f:
18 try:
19 # The dictionary key 'file' matches the FastAPI parameter name
20 files = {'video': (os.path.basename(video_path), f, 'video/mp4')}
21 print(f"{files=}")
22
23 # Send the POST request
24 response = requests.post(endpoint_url, files=files, headers=headers, timeout=120)
25 duration = time.time() - start_time
26 print(f"Request took {duration:.2f} seconds")
27 try:
28 response.raise_for_status()
29 except requests.HTTPError as e:
30 try:
31 err_json = response.json()
32 print("Error JSON:\n", json.dumps(err_json, indent=4))
33 except ValueError:
34 print("Error Text:", response.text)
35 raise e
36 return response
37
38 except requests.exceptions.RequestException as e:
39 print(f"An error occurred during the quick tag request: {e}")
40 return None

Parameters

  • video_id (optional): ID of the video to analyze
  • video_url (optional): URL of the video to analyze (either video_id or video_url is required)
  • output_fields (optional): Subset of fields to return; defaults to standard fields

Indexed Tagging

Indexed tagging allows you to generate tags for previously uploaded and indexed videos. Indexed tagging is more suitable for longer videos.

Bash

curl -X POST https://vision-agent.api.reka.ai/qa/indexedtag \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"video_id": "550e8400-e29b-41d4-a716-446655440000",
"output_fields": ["Description", "Violence", "Keyword", "MoodTone"] # Optional,
}'

Python

1import requests
2import json
3import time
4
5def send_indexed_tag_request(video_id: str, api_key: str):
6 if not video_id:
7 raise ValueError("video_id is required")
8
9 # Form payload (NOT JSON)
10 form_data = {
11 "video_id": video_id,
12 }
13 headers = {
14 "X-API-Key": api_key,
15 }
16 endpoint_url = f"{BASE_URL}/qa/indexedtag"
17 print(f"{endpoint_url=}")
18 print(f"{headers=}")
19 print(f"{form_data=}")
20
21 start_time = time.time()
22 try:
23 # No stream=True; endpoint returns the final string
24 response = requests.post(endpoint_url, data=form_data, headers=headers, timeout=120)
25 duration = time.time() - start_time
26 print(f"Request took {duration:.2f} seconds")
27 try:
28 response.raise_for_status()
29 except requests.HTTPError as e:
30 # Try to show any error payload
31 try:
32 err_json = response.json()
33 print("Error JSON:\n", json.dumps(err_json, indent=4))
34 except ValueError:
35 print("Error Text:", response.text)
36 raise e
37 return response
38
39 except requests.exceptions.RequestException as e:
40 print(f"An error occurred during the indexed tag request: {e}")
41 return None

Prerequisites

Before using Indexed Tagging, ensure your video has been successfully indexed:

  1. Upload a video with index=true using the /videos/upload endpoint.
  2. Check indexing status - it should be "indexed"
  3. Wait for processing if status is "indexing"

Endpoint

  • POST /qa/indexedtag

Request

$curl -X POST https://vision-agent.api.reka.ai/qa/indexedtag \
> -H "X-Api-Key: YOUR_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
> "video_id": "550e8400-e29b-41d4-a716-446655440000",
> "output_fields": ["Description", "ExpectedCTR", "ViralityScore", "Keyword", "MoodTone"]
> }'

Parameters

  • video_id (required): ID of the previously indexed video
  • output_fields (optional): Subset of fields to return

Pricing

Discounted pricing is available for large-volume batch processing:

  • Quick tagging input: $0.004 per input video minute
  • Indexed tagging input: $0.03 per input video minute
  • Outputs (both): $2 per 1M output tokens