Search
Find moments, pages and boxes across every video, photo and document in your workspace, by meaning, not just keywords.
Semantic search
POST /api/v1/search runs a multimodal embedding search over keyframes and scene descriptions, fused into one ranked list. On Arrow, a spoken quote also lands on the moment it was said.
curl https://api.niravi.io/api/v1/search \
-H "X-API-Key: $NIRAVI_API_KEY" -H "Content-Type: application/json" \
-d '{"query": "two people arguing in a kitchen", "limit": 10, "moments_per_video": 3}'
| Field | Type | Notes |
|---|---|---|
query | string | required: natural-language description |
limit | int | results to return (server default applies if omitted); counts moments |
moments_per_video | int | 1 to 10, default 1: up to this many moments per video, each a separate hit with its own timestamp. Moments of one video that sit close together merge into one. Ignored with video_id (a search inside one video already returns every matching moment) |
video_id | string | restrict to a single video |
search_options | object | Deprecated: accepted and ignored (Deprecations) |
rerank | bool | Deprecated: accepted and ignored, no re-ranker runs |
engine | string | Omit it: your workspace’s default (Arrow for every new workspace). classic is deprecated |
workspace_ids | string[] | search several workspaces at once (federated) |
Each hit carries video_id, timestamp, frame_url (the JPEG of that moment), source (transcript when the hit is a line of the transcript, held in text: a spoken quote, or a keyword match inside one video or when search falls back to keywords; else visual) and two scores:
| Field | Meaning |
|---|---|
score | 0..1, best first. A whole-library Arrow search normalises against the whole candidate pool, so scores compare across the videos of one result list (not across searches) and the best hit is 1.0. When a spoken quote matched, spoken hits score 0.95 to 1.0 instead, and every other hit is scaled to 0.94 or less |
raw_score | the hit’s fused score before pool normalisation (for a spoken quote, the line’s keyword rank). The weakest candidate of the pool reads 0, so rank and compare with score |
Every hit also carries place (since API 1.5.0), where it sits as one place/1 object: the span of a video hit (t0_ms, t1_ms), the page of a document hit, the box (box_n, top-left, normalized) of an image or page hit. place is null when the asset kind could not be read.
"place": { "v": "place/1", "video_id": "3f9a1c2e7b4d5a60", "kind": "video", "t0_ms": 12000, "t1_ms": 15500, "page": null, "box_n": null, "uri": "…" }
With engine: arrow a hit also says what it landed on:
| Field | Meaning |
|---|---|
asset_kind | video, image or document |
page | documents: the 1-based page |
passage | documents: the passage of the page that best matches the query |
region | photos and pages: the best-matching box, {x, y, w, h, label, source} normalized top-left |
The response’s engine and recipe say which engine answered; engine_fallback explains when another one had to. See Images & documents.
Only finished assets. An asset that is still processing (or failed) never appears in results, even when part of it is already indexed.
Speed. The first search of a library takes about 4 seconds while its index loads; after that, searches answer in under a second. A finished upload is searchable within seconds of completing (3 to 7 s measured).
import requests # the Python SDK is not on PyPI yet: plain HTTP works
BASE = "https://api.niravi.io/api/v1"
H = {"X-API-Key": "nv_..."}
r = requests.post(f"{BASE}/search", headers=H,
json={"query": "two people arguing in a kitchen", "limit": 10, "moments_per_video": 3})
for hit in r.json()["data"]["results"]:
print(hit["video_id"], hit["timestamp"], hit["score"], hit["raw_score"])
const hits = await niravi.search("two people arguing in a kitchen", { limit: 10, momentsPerVideo: 3 });
const full = await niravi.searchResponse("two people arguing in a kitchen", { engine: "arrow" }); // + engine, engine_fallback
Spoken quotes
On Arrow, a search of the whole library also looks for the query in what was said. When the query quotes speech, the moment it was said ranks first: a hit with source: "transcript", the line as transcribed in text, and timestamp where the line starts.
curl https://api.niravi.io/api/v1/search \
-H "X-API-Key: $NIRAVI_API_KEY" -H "Content-Type: application/json" \
-d '{"query": "we are raising prices in March", "limit": 5}'
{ "video_id": "…", "timestamp": 754.2, "source": "transcript",
"text": "And yes, we are raising prices in March.", "score": 1.0, … }
A quote needs two or more of the query’s words, not counting common words such as “the”, “we” or “not” (so “not raising prices” also finds “raising prices”), with endings ignored (“raising” matches “raise”). Two words must be said as the phrase; from three, they may also be said close together in one transcript segment, and from five, three quarters of them are enough (that rule reads only the first eight words that count, so it never needs more than six). A quote that runs across two segments lands at the start of the first, and text holds both. Spoken hits score 0.95 to 1.0 and rank above every other hit, which is scaled to 0.94 or less; limit and moments_per_video apply as usual. In a workspace_ids search, spoken hits rank first within their own workspace’s hits: the lists merge by score. A query with fewer than two words that count and a search inside one video (video_id) are unchanged.
Magic search
Typed search narrows to a single dimension: POST /api/v1/search/{type} where type is character, location, music, or emotion. The body takes query, limit and video_id; a character search can instead take an example face, cluster_id with its source_video_id.
curl https://api.niravi.io/api/v1/search/emotion \
-H "X-API-Key: $NIRAVI_API_KEY" -H "Content-Type: application/json" \
-d '{"query": "tense and suspenseful"}'
On an Arrow workspace each type searches these signals:
| Type | Searches | Not available |
|---|---|---|
location | shot captions + scene labels | |
emotion | shot captions + sound events + mood music | facial expression, scene mood |
music | sound events + audio segments (genre, instrument, music segments) | song title and artist identification |
character | a query that names a workspace Person (part of the name, or the exact person id) returns that person’s faces; cluster_id + source_video_id returns the faces of that cluster; shot captions answer a description |
meta.search says which legs ran, how many hits each gave, and which facets are unavailable and why:
"meta": { "search": {
"type": "emotion", "engine": "arrow",
"legs": { "dense": { "hits": 1 }, "sound_events": { "hits": 0 }, "mood_music": { "hits": 0 } },
"unavailable": { "facial_expression": "facial expression is not indexed by Arrow", "scene_mood": "scene mood is not written by Arrow" }
} }
requests.post(f"{BASE}/search/character", headers=H, json={"query": "a man in a red jacket"})
requests.post(f"{BASE}/search/character", headers=H, json={"cluster_id": 1, "source_video_id": video_id})
requests.post(f"{BASE}/search/location", headers=H, json={"query": "a rainy city street at night"})
await niravi.magicSearch("music", "upbeat synth");
await niravi.magicSearch("emotion", "joyful");
Search a single video instead of the whole corpus by passing
video_id(semantic) or scoping a guide’s per-video endpoints: see Videos & processing.