Search Clips
curl --request POST \
--url https://api.usenarrative.ai/api/v1/search/query \
--header 'Content-Type: application/json' \
--data '
{
"index_id": "idx_abc123xyz",
"query": "touchdown celebrations",
"limit": 10
}
'import requests
url = "https://api.usenarrative.ai/api/v1/search/query"
payload = {
"index_id": "idx_abc123xyz",
"query": "touchdown celebrations",
"limit": 10
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({index_id: 'idx_abc123xyz', query: 'touchdown celebrations', limit: 10})
};
fetch('https://api.usenarrative.ai/api/v1/search/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.usenarrative.ai/api/v1/search/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'index_id' => 'idx_abc123xyz',
'query' => 'touchdown celebrations',
'limit' => 10
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.usenarrative.ai/api/v1/search/query"
payload := strings.NewReader("{\n \"index_id\": \"idx_abc123xyz\",\n \"query\": \"touchdown celebrations\",\n \"limit\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.usenarrative.ai/api/v1/search/query")
.header("Content-Type", "application/json")
.body("{\n \"index_id\": \"idx_abc123xyz\",\n \"query\": \"touchdown celebrations\",\n \"limit\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usenarrative.ai/api/v1/search/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"index_id\": \"idx_abc123xyz\",\n \"query\": \"touchdown celebrations\",\n \"limit\": 10\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"clip_url": "https://cdn.usenarrative.ai/clips/clip_abc123.mp4",
"start_time_sec": 145.5,
"end_time_sec": 158.2,
"relevance_score": 0.92,
"transcript_snippet": "And he's in for the touchdown! What a play!"
}
]
}{
"detail": "Invalid request parameters"
}{
"detail": "Invalid request parameters"
}{
"detail": "Invalid request parameters"
}Query
Search Clips
Search video clips using natural language queries
POST
/
api
/
v1
/
search
/
query
Search Clips
curl --request POST \
--url https://api.usenarrative.ai/api/v1/search/query \
--header 'Content-Type: application/json' \
--data '
{
"index_id": "idx_abc123xyz",
"query": "touchdown celebrations",
"limit": 10
}
'import requests
url = "https://api.usenarrative.ai/api/v1/search/query"
payload = {
"index_id": "idx_abc123xyz",
"query": "touchdown celebrations",
"limit": 10
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({index_id: 'idx_abc123xyz', query: 'touchdown celebrations', limit: 10})
};
fetch('https://api.usenarrative.ai/api/v1/search/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.usenarrative.ai/api/v1/search/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'index_id' => 'idx_abc123xyz',
'query' => 'touchdown celebrations',
'limit' => 10
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.usenarrative.ai/api/v1/search/query"
payload := strings.NewReader("{\n \"index_id\": \"idx_abc123xyz\",\n \"query\": \"touchdown celebrations\",\n \"limit\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.usenarrative.ai/api/v1/search/query")
.header("Content-Type", "application/json")
.body("{\n \"index_id\": \"idx_abc123xyz\",\n \"query\": \"touchdown celebrations\",\n \"limit\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usenarrative.ai/api/v1/search/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"index_id\": \"idx_abc123xyz\",\n \"query\": \"touchdown celebrations\",\n \"limit\": 10\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"clip_url": "https://cdn.usenarrative.ai/clips/clip_abc123.mp4",
"start_time_sec": 145.5,
"end_time_sec": 158.2,
"relevance_score": 0.92,
"transcript_snippet": "And he's in for the touchdown! What a play!"
}
]
}{
"detail": "Invalid request parameters"
}{
"detail": "Invalid request parameters"
}{
"detail": "Invalid request parameters"
}POST /api/v1/search/query
Search for video clips using natural language queries. Returns relevant clips with timestamps, relevance scores, and transcript snippets.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| index_id | string | Yes | ID of the index to search |
| query | string | Yes | Natural language search query |
| limit | integer | No | Maximum number of results (default: 10) |
Response
| Field | Description |
|---|---|
| results | Array of matching clips |
Result Object
| Field | Description |
|---|---|
| clip_url | URL to the video clip |
| start_time_sec | Start time of the clip in the source video |
| end_time_sec | End time of the clip in the source video |
| relevance_score | Relevance score from 0 to 1 |
| transcript_snippet | Transcript excerpt from the clip |
Example Request
curl -X POST https://api.usenarrative.ai/api/v1/search/query \
-H "Content-Type: application/json" \
-d '{
"index_id": "idx_abc123xyz",
"query": "touchdown celebrations",
"limit": 5
}'
Example Response
{
"results": [
{
"clip_url": "https://cdn.usenarrative.ai/clips/clip_001.mp4",
"start_time_sec": 145.5,
"end_time_sec": 158.2,
"relevance_score": 0.95,
"transcript_snippet": "And he's in for the touchdown! What a play!"
},
{
"clip_url": "https://cdn.usenarrative.ai/clips/clip_002.mp4",
"start_time_sec": 892.1,
"end_time_sec": 905.8,
"relevance_score": 0.87,
"transcript_snippet": "The team celebrates in the end zone..."
}
]
}
Notes
- Queries can be natural language (e.g., “moments where the crowd goes wild”)
- Results are ranked by relevance score
- Each clip includes a transcript snippet for context
- Clip URLs are valid for 24 hours
Body
application/json
Response
Search completed successfully
Array of matching clips
Show child attributes
Show child attributes

