CoreViz
Studio API

Searching Your Media

Search across your organization's media using natural language queries

Searching Your Media

Search across all media in your organization using natural language queries. The search API uses AI-powered semantic search to find relevant content based on text descriptions, detected objects, and captions.

Endpoint

GET /api/search

Query Parameters

ParameterTypeRequiredDescription
qstringYesSearch query (natural language description)
organizationIdstringYesThe unique identifier of your organization
limitintegerNoMaximum number of results to return (default: 20)

Headers

HeaderValueRequired
x-api-keyYour API keyYes

Example Request

curl -H "x-api-key: YOUR_API_KEY" \
  "https://lab.coreviz.io/api/search?q=flower&organizationId=f4f635c4-779f-4e49-a85e-f45ccf7fbcf1"

Response

Status Code: 200 OK

Response Body:

{
  "results": [
    {
      "id": "20ef0254-6ef0-4baf-a2f7-e40df8b3a716",
      "timestamp": "0",
      "blob": "https://3vxmbaxifmu58irw.public.blob.vercel-storage.com/entities/bb59e55c-6786-4a72-93ca-4b958191abdb/media/b6b4bda5-2f71-4de0-8170-6ded7c46c48a/processed-Wgx2gmUiX4zmQxRI5tuxUJuzLdLdOd.jpg",
      "width": 1620,
      "height": 1080,
      "media": {
        "createdAt": "2025-10-03T06:52:08.780Z",
        "id": "b6b4bda5-2f71-4de0-8170-6ded7c46c48a",
        "name": "entities/bb59e55c-6786-4a72-93ca-4b958191abdb/media/2048x1365-Carols-pick-of-best-plants-for-colourful-containers-GettyImages-1185235271-0ee53ef.jpg",
        "type": "image",
        "blob": "https://3vxmbaxifmu58irw.public.blob.vercel-storage.com/entities/bb59e55c-6786-4a72-93ca-4b958191abdb/media/2048x1365-Carols-pick-of-best-plants-for-colourful-containers-GettyImages-1185235271-0ee53ef-5rZD4MHCjfenBsKHhZYvtQJjRPjn5f.jpg",
        "width": 2048,
        "height": 1365,
        "duration": null
      },
      "captions": [
        {
          "id": "25cf5f14-6d3d-45be-944f-a73d84a9d2f5",
          "text": "A close-up view of a cluster of purple flowers with light purple petals and darker purple veins. The flowers have white centers and are surrounded by green leaves. The image is slightly blurred, focusing on the flowers in the foreground."
        }
      ],
      "objects": [
        {
          "id": "67fa4cd2-4e3c-4501-b288-b3268c75bc4a",
          "type": "object",
          "label": "flower",
          "blob": "",
          "polygon": [
            { "x": 0.8100000023841858, "y": 0.5400000214576721 },
            { "x": 1619.1900634765625, "y": 0.5400000214576721 },
            { "x": 1619.1900634765625, "y": 1078.3800048828125 },
            { "x": 0.8100000023841858, "y": 1078.3800048828125 }
          ]
        }
      ],
      "rank": 0.243,
      "rankingMetrics": {
        "textRank": 0.087,
        "objectEmbeddingRank": 0.156,
        "totalRank": 0.243
      }
    }
  ],
  "query": "flower",
  "limit": 20,
  "totalResults": 20
}

Response Fields

Search Result Object

FieldTypeDescription
idstringUnique identifier for the frame result
timestampstringTimestamp within the video (or "0" for images)
blobstringURL to the processed frame image
widthintegerFrame width in pixels
heightintegerFrame height in pixels
mediaobjectThe parent media object (see Media Object below)
captionsarrayArray of caption objects describing the frame
objectsarrayArray of detected objects in the frame
ranknumberOverall relevance score (0-1, higher is more relevant)
rankingMetricsobjectBreakdown of ranking scores (see Ranking Metrics below)

Media Object

FieldTypeDescription
idstringUnique identifier for the media item
namestringFile path/name of the media
typestringMedia type: image or video
blobstringURL to the original media file
widthintegerOriginal width in pixels
heightintegerOriginal height in pixels
durationnumber | nullDuration in seconds (for videos, null for images)
createdAtstringISO 8601 timestamp of creation

Caption Object

FieldTypeDescription
idstringUnique identifier for the caption
textstringThe caption text describing the content

Object Detection Object

FieldTypeDescription
idstringUnique identifier for the detected object
typestringObject type: object, face, frame, text, etc.
labelstringThe detected label (e.g., "flower", "person", "face")
blobstringURL to cropped object image (if available, empty string otherwise)
polygonarrayArray of coordinate points defining the bounding box

Polygon Point Object

FieldTypeDescription
xnumberX coordinate in pixels
ynumberY coordinate in pixels

Ranking Metrics Object

FieldTypeDescription
textRanknumberRelevance score based on text/caption matching (0-1)
objectEmbeddingRanknumberRelevance score based on object detection and embeddings (0-1)
totalRanknumberCombined relevance score (0-1, higher is more relevant)

Response Metadata

FieldTypeDescription
querystringThe search query that was executed
limitintegerMaximum number of results requested
totalResultsintegerTotal number of results found

Error Responses

401 Unauthorized

Invalid or missing API key:

{
  "error": "Unauthorized",
  "message": "Invalid or missing API key"
}

400 Bad Request

Invalid query parameters:

{
  "error": "Bad Request",
  "message": "Invalid query parameters"
}

404 Not Found

Organization not found:

{
  "error": "Not Found",
  "message": "Organization not found"
}

Example Usage

JavaScript/TypeScript

const organizationId = 'f4f635c4-779f-4e49-a85e-f45ccf7fbcf1';
const apiKey = 'YOUR_API_KEY';
const query = 'flower';

const response = await fetch(
  `https://lab.coreviz.io/api/search?q=${encodeURIComponent(query)}&organizationId=${organizationId}`,
  {
    headers: {
      'x-api-key': apiKey,
    },
  }
);

const data = await response.json();
console.log(`Found ${data.totalResults} results for "${data.query}"`);
data.results.forEach((result, index) => {
  console.log(`Result ${index + 1}: ${result.media.name} (rank: ${result.rank})`);
});

Python

import requests

organization_id = 'f4f635c4-779f-4e49-a85e-f45ccf7fbcf1'
api_key = 'YOUR_API_KEY'
query = 'flower'

response = requests.get(
    'https://lab.coreviz.io/api/search',
    headers={'x-api-key': api_key},
    params={
        'q': query,
        'organizationId': organization_id,
        'limit': 20
    }
)

data = response.json()
print(f"Found {data['totalResults']} results for '{data['query']}'")
for idx, result in enumerate(data['results'], 1):
    print(f"Result {idx}: {result['media']['name']} (rank: {result['rank']})")

Search Tips

Effective Queries

The search API uses semantic search, meaning it understands the meaning of your query rather than just matching keywords:

Good Examples:

  • "red car in parking lot" - Descriptive and specific
  • "person wearing blue shirt" - Clear object and attribute
  • "sunset over mountains" - Scene description
  • "dog playing in water" - Action and subject

Less Effective:

  • "car" - Too generic
  • "image" - Not descriptive
  • "photo" - Too broad

Understanding Results

Ranking:

  • Results are sorted by relevance score (rank field)
  • Higher scores (closer to 1.0) indicate better matches
  • The rankingMetrics object shows how the score was calculated

Frame-Level Results:

  • Search returns frame-level results, not just media items
  • Each result includes the specific frame that matched
  • The media object contains information about the parent media item

Object Detection:

  • The objects array shows all detected objects in the frame
  • Objects with matching labels contribute to the relevance score
  • Polygon coordinates define bounding boxes for detected objects

Captions:

  • AI-generated captions describe the visual content
  • Caption text is used for text-based matching
  • Multiple captions may exist for a single frame

Notes

  • Search is performed across all datasets in the specified organization
  • Results are ranked by relevance, with the most relevant results first
  • The search combines multiple signals: text matching, object detection, and semantic embeddings
  • Frame-level results allow you to find specific moments within videos
  • Object detection polygons use pixel coordinates relative to the frame dimensions
  • The blob URLs in results are publicly accessible and can be used directly in your applications