Upload to Index
curl --request POST \
--url https://api.usenarrative.ai/api/v1/search/indexes/{index_id}/upload \
--header 'Content-Type: multipart/form-data' \
--form 'files=<string>' \
--form files.items='@example-file'import requests
url = "https://api.usenarrative.ai/api/v1/search/indexes/{index_id}/upload"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = { "files": "<string>" }
response = requests.post(url, data=payload, files=files)
print(response.text)const form = new FormData();
form.append('files', '<string>');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.usenarrative.ai/api/v1/search/indexes/{index_id}/upload', 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/{index_id}/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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/{index_id}/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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/{index_id}/upload")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usenarrative.ai/api/v1/search/indexes/{index_id}/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"index_id": "idx_abc123xyz",
"files_processed": 5,
"clips_indexed": 127
}{
"detail": "Invalid request parameters"
}{
"detail": "Invalid request parameters"
}{
"detail": "Invalid request parameters"
}Items
Upload to Index
Upload video files to a search index
POST
/
api
/
v1
/
search
/
indexes
/
{index_id}
/
upload
Upload to Index
curl --request POST \
--url https://api.usenarrative.ai/api/v1/search/indexes/{index_id}/upload \
--header 'Content-Type: multipart/form-data' \
--form 'files=<string>' \
--form files.items='@example-file'import requests
url = "https://api.usenarrative.ai/api/v1/search/indexes/{index_id}/upload"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = { "files": "<string>" }
response = requests.post(url, data=payload, files=files)
print(response.text)const form = new FormData();
form.append('files', '<string>');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.usenarrative.ai/api/v1/search/indexes/{index_id}/upload', 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/{index_id}/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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/{index_id}/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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/{index_id}/upload")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usenarrative.ai/api/v1/search/indexes/{index_id}/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"index_id": "idx_abc123xyz",
"files_processed": 5,
"clips_indexed": 127
}{
"detail": "Invalid request parameters"
}{
"detail": "Invalid request parameters"
}{
"detail": "Invalid request parameters"
}POST /api/v1/search/indexes//upload
Upload video files to an existing search index. Files are processed, transcribed, and indexed for semantic search. Each video is automatically segmented into searchable clips.Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| index_id | string | Yes | The ID of the index to upload to |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| files | File[] | Yes | Video files to upload and index |
Response
| Field | Description |
|---|---|
| index_id | ID of the index that was updated |
| files_processed | Number of files that were processed |
| clips_indexed | Total number of searchable clips created |
Example Request
curl -X POST https://api.usenarrative.ai/api/v1/search/indexes/idx_abc123xyz/upload \
-H "Content-Type: multipart/form-data" \
-F "files=@highlight1.mp4" \
-F "files=@highlight2.mp4" \
-F "files=@highlight3.mp4"
Example Response
{
"index_id": "idx_abc123xyz",
"files_processed": 3,
"clips_indexed": 127
}
Notes
- Processing time depends on total video duration
- Videos are transcribed and semantically indexed
- Each video is automatically segmented into clips based on content
- Clips are searchable immediately after processing completes
- Supported formats: mp4, mov, avi, mkv, webm
Path Parameters
The ID of the index to upload to
Body
multipart/form-data
Video files to upload and index

