Search Clips by Image
curl --request POST \
--url https://api.memories.ai/serve/api/v1/search_clips_by_image \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form video_no=VI625239098370850816 \
--form 'prompt=focus on the red shirt, ignore background color'import requests
url = "https://api.memories.ai/serve/api/v1/search_clips_by_image"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"video_no": "VI625239098370850816",
"prompt": "focus on the red shirt, ignore background color"
}
headers = {"Authorization": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('video_no', 'VI625239098370850816');
form.append('prompt', 'focus on the red shirt, ignore background color');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.memories.ai/serve/api/v1/search_clips_by_image', 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.memories.ai/serve/api/v1/search_clips_by_image",
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video_no\"\r\n\r\nVI625239098370850816\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nfocus on the red shirt, ignore background color\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.memories.ai/serve/api/v1/search_clips_by_image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video_no\"\r\n\r\nVI625239098370850816\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nfocus on the red shirt, ignore background color\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.memories.ai/serve/api/v1/search_clips_by_image")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video_no\"\r\n\r\nVI625239098370850816\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nfocus on the red shirt, ignore background color\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memories.ai/serve/api/v1/search_clips_by_image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video_no\"\r\n\r\nVI625239098370850816\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nfocus on the red shirt, ignore background color\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": "0000",
"msg": "success",
"data": [
{
"start_time": 12.5,
"end_time": 18.2,
"score": 0.8631,
"video_bucket": "mavi-resource",
"video_blob": "VI576925607808602112.mp4"
},
{
"start_time": 42,
"end_time": 47.8,
"score": 0.8124,
"video_bucket": "mavi-resource",
"video_blob": "VI576925607808602112.mp4"
}
],
"success": true,
"failed": false
}Private Video Library
Search by Image — Within a Video
Find matching time ranges inside one specific video using a query image and a natural-language prompt.
POST
/
serve
/
api
/
v1
/
search_clips_by_image
Search Clips by Image
curl --request POST \
--url https://api.memories.ai/serve/api/v1/search_clips_by_image \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form video_no=VI625239098370850816 \
--form 'prompt=focus on the red shirt, ignore background color'import requests
url = "https://api.memories.ai/serve/api/v1/search_clips_by_image"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"video_no": "VI625239098370850816",
"prompt": "focus on the red shirt, ignore background color"
}
headers = {"Authorization": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('video_no', 'VI625239098370850816');
form.append('prompt', 'focus on the red shirt, ignore background color');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.memories.ai/serve/api/v1/search_clips_by_image', 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.memories.ai/serve/api/v1/search_clips_by_image",
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video_no\"\r\n\r\nVI625239098370850816\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nfocus on the red shirt, ignore background color\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.memories.ai/serve/api/v1/search_clips_by_image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video_no\"\r\n\r\nVI625239098370850816\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nfocus on the red shirt, ignore background color\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.memories.ai/serve/api/v1/search_clips_by_image")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video_no\"\r\n\r\nVI625239098370850816\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nfocus on the red shirt, ignore background color\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memories.ai/serve/api/v1/search_clips_by_image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video_no\"\r\n\r\nVI625239098370850816\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nfocus on the red shirt, ignore background color\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": "0000",
"msg": "success",
"data": [
{
"start_time": 12.5,
"end_time": 18.2,
"score": 0.8631,
"video_bucket": "mavi-resource",
"video_blob": "VI576925607808602112.mp4"
},
{
"start_time": 42,
"end_time": 47.8,
"score": 0.8124,
"video_bucket": "mavi-resource",
"video_blob": "VI576925607808602112.mp4"
}
],
"success": true,
"failed": false
}Product: Visual Search
Use case: Upload videos and images, auto-index them, then search by natural language, image, or transcript phrase
Host:
https://api.memories.ai/serve/api/v1
Auth: Authorization: sk-mavi-... (no Bearer prefix)Prerequisites
- You have created a memories.ai API key.
- The target video has been uploaded and is in
PARSEstatus.
Request Example
Uses
multipart/form-data. The file part carries the query image; other parameters are sent as form fields.import requests
headers = {"Authorization": "sk-mavi-..."}
files = [("file", ("query.png", open("query.png", "rb"), "image/png"))]
data = {
"video_no": "VI625239098370850816",
"prompt": "focus on the red shirt, ignore background"
}
response = requests.post(
"https://api.memories.ai/serve/api/v1/search_clips_by_image",
headers=headers,
files=files,
data=data
)
print(response.json())
Parameters
file
required
Query image. Allowed:
.jpg, .jpeg, .png, .gif, .bmp, .webp. Maximum 20 MB.string
required
Identifier of the video to search within (e.g.
VI625239098370850816).string
required
Natural-language prompt that refines the match (e.g.
"focus on the red shirt"). Use English for best results.Response
{
"code": "0000",
"msg": "success",
"data": [
{
"start_time": 12.5,
"end_time": 18.2,
"score": 0.8631,
"video_bucket": "mavi-resource",
"video_blob": "VI576925607808602112.mp4"
},
{
"start_time": 42.0,
"end_time": 47.8,
"score": 0.8124,
"video_bucket": "mavi-resource",
"video_blob": "VI576925607808602112.mp4"
}
],
"success": true,
"failed": false
}
number
Clip start time, in seconds.
number
Clip end time, in seconds.
number
Similarity score (0 – 1).
string
GCS bucket of the target video file. Omitted when the storage location cannot be resolved.
string
GCS blob (object) path of the target video. Use it with
video_bucket at GET /serve/api/v2/download?bucket=&blob= to fetch the file directly.Notes & Limits
- Rate limiting: Exceeding the per-account rate limit returns an error. See Rate limits.
- Billing: Each successful call deducts credits from your account balance.
Authorizations
Body
multipart/form-data
Query image. Allowed extensions: .jpg/.jpeg/.png/.gif/.bmp/.webp. Content-Type must start with image/. Max 20 MB.
Unique identifier of the video to search within. Must be non-empty.
Example:
"VI625239098370850816"
Natural-language prompt that refines the visual match. Must be non-empty. English recommended.
Example:
"focus on the red shirt, ignore background color"
