Create Index
curl --request POST \
--url https://api.usenarrative.ai/api/v1/search/indexes \
--header 'Content-Type: application/json' \
--data '
{
"name": "Sports Highlights Q4 2024",
"description": "Collection of NFL game highlights from Q4 2024"
}
'import requests
url = "https://api.usenarrative.ai/api/v1/search/indexes"
payload = {
"name": "Sports Highlights Q4 2024",
"description": "Collection of NFL game highlights from Q4 2024"
}
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({
name: 'Sports Highlights Q4 2024',
description: 'Collection of NFL game highlights from Q4 2024'
})
};
fetch('https://api.usenarrative.ai/api/v1/search/indexes', 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/indexes",
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([
'name' => 'Sports Highlights Q4 2024',
'description' => 'Collection of NFL game highlights from Q4 2024'
]),
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/indexes"
payload := strings.NewReader("{\n \"name\": \"Sports Highlights Q4 2024\",\n \"description\": \"Collection of NFL game highlights from Q4 2024\"\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/indexes")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sports Highlights Q4 2024\",\n \"description\": \"Collection of NFL game highlights from Q4 2024\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usenarrative.ai/api/v1/search/indexes")
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 \"name\": \"Sports Highlights Q4 2024\",\n \"description\": \"Collection of NFL game highlights from Q4 2024\"\n}"
response = http.request(request)
puts response.read_body{
"index_id": "idx_abc123xyz",
"name": "Sports Highlights Q4 2024",
"created_at": "2024-01-15T10:30:00Z"
}{
"detail": "Invalid request parameters"
}{
"detail": "Invalid request parameters"
}Indexes
Create Index
Create a new search index for video clips
POST
/
api
/
v1
/
search
/
indexes
Create Index
curl --request POST \
--url https://api.usenarrative.ai/api/v1/search/indexes \
--header 'Content-Type: application/json' \
--data '
{
"name": "Sports Highlights Q4 2024",
"description": "Collection of NFL game highlights from Q4 2024"
}
'import requests
url = "https://api.usenarrative.ai/api/v1/search/indexes"
payload = {
"name": "Sports Highlights Q4 2024",
"description": "Collection of NFL game highlights from Q4 2024"
}
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({
name: 'Sports Highlights Q4 2024',
description: 'Collection of NFL game highlights from Q4 2024'
})
};
fetch('https://api.usenarrative.ai/api/v1/search/indexes', 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/indexes",
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([
'name' => 'Sports Highlights Q4 2024',
'description' => 'Collection of NFL game highlights from Q4 2024'
]),
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/indexes"
payload := strings.NewReader("{\n \"name\": \"Sports Highlights Q4 2024\",\n \"description\": \"Collection of NFL game highlights from Q4 2024\"\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/indexes")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sports Highlights Q4 2024\",\n \"description\": \"Collection of NFL game highlights from Q4 2024\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usenarrative.ai/api/v1/search/indexes")
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 \"name\": \"Sports Highlights Q4 2024\",\n \"description\": \"Collection of NFL game highlights from Q4 2024\"\n}"
response = http.request(request)
puts response.read_body{
"index_id": "idx_abc123xyz",
"name": "Sports Highlights Q4 2024",
"created_at": "2024-01-15T10:30:00Z"
}{
"detail": "Invalid request parameters"
}{
"detail": "Invalid request parameters"
}POST /api/v1/search/indexes
Create a new search index for organizing and searching video clips. Indexes allow you to group related videos and search across them with natural language queries.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Name for the search index |
| description | string | No | Optional description of the index |
Response
| Field | Description |
|---|---|
| index_id | Unique identifier for the index |
| name | Name of the index |
| created_at | ISO timestamp of when the index was created |
Example Request
curl -X POST https://api.usenarrative.ai/api/v1/search/indexes \
-H "Content-Type: application/json" \
-d '{
"name": "Sports Highlights Q4 2024",
"description": "Collection of NFL game highlights from Q4 2024"
}'
Example Response
{
"index_id": "idx_abc123xyz",
"name": "Sports Highlights Q4 2024",
"created_at": "2024-01-15T10:30:00Z"
}
Notes
- Index names should be descriptive for easy organization
- Use the returned
index_idfor uploading files and searching - There is no limit to the number of indexes you can create
Body
application/json

