CoreViz
SDK

Media

Browse, search, get, rename, move, tag, find similar, and upload media items

Media

The sdk.media namespace covers all operations on individual media items — browsing collections, semantic search, metadata management, and uploading new files.


sdk.media.browse(collectionId, options?)

List media items and folders inside a collection. Supports folder navigation, filtering, and pagination.

Parameters:

ParameterTypeRequiredDescription
collectionIdstringYesThe collection to browse
options.pathstringNoltree path to list (e.g. "collectionId.folderId"). Defaults to collection root
options.limitnumberNoMax items to return (default: 20)
options.offsetnumberNoPagination offset
options.typestringNoFilter: "image", "video", "folder", or "all"
options.dateFromstringNoFilter from date (YYYY-MM-DD)
options.dateTostringNoFilter to date (YYYY-MM-DD)
options.sortBystringNoSort field: name, createdAt, type
options.sortDirectionstringNo"asc" or "desc"
options.tagFiltersobjectNoFilter by tags: { color: ['red', 'blue'] }

Returns: Promise<BrowseResult>

// List root of a collection
const { media, pagination } = await sdk.media.browse('abc123');

// Navigate a subfolder
const { media } = await sdk.media.browse('abc123', {
  path: 'abc123.folder456',
  limit: 50,
  type: 'image',
});

// Filter by tags
const { media } = await sdk.media.browse('abc123', {
  tagFilters: { category: ['product'], season: ['spring'] },
});

BrowseResult

{
  media: Media[];
  pagination: {
    total: number;
    limit: number;
    offset: number;
    hasMore: boolean;
  };
}

Folder paths

Folder paths in CoreViz use the ltree format: collectionId.folderId.subFolderId. You can get these paths from the path field on items returned by browse().


sdk.media.search(query, options?)

Semantically search across all media in the organization using natural language. Powered by CLIP embeddings + text ranking.

Parameters:

ParameterTypeRequiredDescription
querystringYesNatural language search query
options.limitnumberNoMax results (default: 20)

Returns: Promise<SearchResult[]>

const results = await sdk.media.search('red shoes on white background', { limit: 10 });

for (const r of results) {
  console.log(r.mediaName, r.blobUrl, r.rank);
  // r.objects — detected objects in the media
  // r.caption — AI-generated caption
}

SearchResult

FieldTypeDescription
mediaIdstringMedia item ID
mediaNamestringFile name
mediaTypestring"image" or "video"
blobUrlstringPublic URL to the media
objectsMediaObject[]Detected objects
ranknumberRelevance score
captionstring | undefinedAI-generated caption

sdk.media.get(mediaId)

Fetch full details for a single media item, including tags, detected objects, frames, and version info.

Returns: Promise<Media>

const item = await sdk.media.get('mediaId123');

console.log(item.blob);          // Public URL
console.log(item.metadata?.tags); // { color: ['red'], category: ['product'] }
console.log(item.frames);        // Frame objects with objects[] and captions[]
console.log(item.width, item.height);

Media Object

FieldTypeDescription
idstringUnique media ID
namestringFile name
typestring"image", "video", or "folder"
blobstring | nullPublic URL
pathstringltree path
widthnumber | undefinedWidth in pixels
heightnumber | undefinedHeight in pixels
sizeBytesnumber | undefinedFile size in bytes
metadataobject | undefinedTags, moderation, and custom metadata
framesMediaFrame[] | undefinedProcessed frames with objects and captions
createdAtstring | undefinedISO 8601 creation timestamp

sdk.media.rename(mediaId, name)

Rename a media item.

Returns: Promise<Media>

const updated = await sdk.media.rename('mediaId123', 'hero-shot-final.jpg');

sdk.media.move(mediaId, destinationPath)

Move a media item or folder to a different location within the same collection.

Parameters:

ParameterTypeDescription
mediaIdstringID of the item to move
destinationPathstringltree path of the destination folder

Returns: Promise<{ id: string; newPath: string }>

const result = await sdk.media.move('mediaId123', 'collectionId.archiveFolder');
console.log(result.newPath); // 'collectionId.archiveFolder.mediaId123'

Always use real paths

Never construct ltree paths manually. Use the path field from browse() results to ensure paths are accurate.


sdk.media.addTag(mediaId, label, value) / removeTag(...)

Add or remove a tag from a media item. Tags are organized as label (group) and value pairs.

// Add a tag
await sdk.media.addTag('mediaId123', 'color', 'red');
await sdk.media.addTag('mediaId123', 'category', 'product');

// Remove a tag
await sdk.media.removeTag('mediaId123', 'color', 'red');

Each media item can have multiple values per label (e.g., color: ['red', 'blue']). Adding a duplicate value returns a 409 conflict.


sdk.media.findSimilar(collectionId, objectId, options?)

Find media items visually similar to a specific detected object. Uses the object's embedding to rank results.

Parameters:

ParameterTypeRequiredDescription
collectionIdstringYesCollection to search within
objectIdstringYesID of a detected object (from media.get() frames or search() results)
options.limitnumberNoMax results to return
options.modelstringNoSimilarity model: "faces", "objects", "shoeprints"

Returns: Promise<BrowseResult>

// First, get an object ID from a media item
const item = await sdk.media.get('mediaId123');
const objectId = item.frames?.[0]?.objects?.[0]?.id;

// Find similar items
const { media } = await sdk.media.findSimilar('collectionId', objectId, {
  limit: 20,
  model: 'faces',
});

sdk.media.upload(file, options)

Upload a photo or video file to a collection. Supports Node.js file paths, browser File objects, and Blob.

Parameters:

ParameterTypeRequiredDescription
filestring | File | BlobYesFile path (Node.js), File, or Blob
options.collectionIdstringYesTarget collection
options.pathstringNoTarget folder path (e.g. "collectionId.folderId"). Defaults to collection root
options.namestringNoCustom file name in CoreViz

Returns: Promise<UploadResult>

// Node.js — local file path
const result = await sdk.media.upload('/path/to/photo.jpg', {
  collectionId: 'abc123',
  path: 'abc123.campaignFolder',
  name: 'hero-shot.jpg',
});
console.log(result.mediaId, result.url);

// Browser — File input
const result = await sdk.media.upload(event.target.files[0], {
  collectionId: 'abc123',
});

UploadResult

FieldTypeDescription
mediaIdstringID of the newly created media item
urlstringPublic blob URL (null if blocked by moderation)
messagestringStatus message

Supported formats: JPEG, PNG, GIF, WebP, HEIC

React Native

File path strings are not supported on React Native / Expo. Pass a File or Blob object instead.


Next Steps