Skip to main content

How Visual Search Works

Visual Search finds images that look like your query image. Upload any image—even one not in your dataset—and Visual Layer returns the most visually similar media, ranked by similarity score.

Prerequisites

  • A dataset in READY status with at least one indexed embedding model.
  • A valid JWT token. See Authentication.
  • A dataset ID (visible in the browser URL when viewing a dataset: https://app.visual-layer.com/dataset/<dataset_id>/data).
Visual search requires the dataset to have been indexed with a visual embedding model. Datasets created through the standard upload workflow include this automatically.

How It Works

Visual search is a two-step process.
  1. Upload your query image to register it as a search anchor — the API returns an anchor_media_id.
  2. Pass that anchor_media_id to the Explore endpoint to retrieve ranked results.

Step 1: Upload a Query Image

Upload an image to use as the search reference.

Parameters

Example

Response

Save both anchor_media_id and anchor_type — you need them in Step 2.

Step 2: Retrieve Results

Pass the anchor values to the Explore endpoint to get ranked results.

Parameters

Example

Response

Understanding relevance_score

When relevance_score_type is cosine_distance, a lower score means more similar to your query image.
  • 0.0 — identical
  • ~0.1–0.3 — highly similar
  • ~0.5+ — loosely related

Search by Region (Bounding Box)

Focus the search on a specific area of the query image using bounding_box. Values are fractions of the image dimensions (0.0–1.0).

Search by Existing Media ID

To find images similar to one already in your dataset, skip Step 1 and use anchor_type=MEDIA directly. The media_id is returned in the media_id field of any Explore endpoint response — for example, from a previous visual or semantic search result.

Python Example

The following example runs a full visual search workflow.

Response Codes

See Error Handling for the error response format and Python handling patterns.

Semantic Search

Search using natural language text queries.

Explore API

Browse and filter all dataset media.