Skip to main content

How This Helps

Incrementally add new media (images or videos) to an already-indexed dataset without re-processing everything from scratch. New media is processed as an independent batch and becomes immediately visible. When ready, trigger a full reindex to re-cluster the entire dataset.
Use status_new for all status checks. The status field is being retired. See Retrieve Dataset Status.

Prerequisites

Before calling the Add Media API, ensure:
  1. Dataset status is READY or PARTIAL INDEX
  2. Dataset has an embedding config — the dataset must have been indexed at least once with an embedding model so new media uses the same model for consistency
  3. Authentication — you need a valid JWT token or session cookie (see Authentication)
You can verify your dataset status using the Retrieve Dataset Status endpoint before attempting to add media.

API Endpoint

Media Sources

Exactly one media source must be provided per request:

Optional Parameters


For production workflows, using an S3 folder is the recommended approach. Point s3_uri to a folder in your S3 bucket containing images and/or videos.

Step 1: Identify your dataset ID

Find your dataset ID from the Visual Layer UI (it’s in the browser URL when viewing a dataset: https://app.visual-layer.com/dataset/<dataset_id>/data), or list your datasets via the API:

Step 2: Verify dataset is ready

Confirm the response shows "status_new": "READY" or "status_new": "PARTIAL INDEX".

Step 3: Add media from S3

A successful request returns HTTP 202 Accepted with an empty body. The processing runs asynchronously in the background.

Working Example

The following example was tested against a live Visual Layer Cloud environment and demonstrates adding 5 TikTok videos from an S3 bucket to an existing dataset.

Add videos from S3

Response: HTTP 202 Accepted (empty body)

Poll dataset status

After submitting, the dataset transitions to UPDATING / READ ONLY while processing:
Once processing completes, the dataset moves to PARTIAL INDEX, indicating new media has been added but the dataset has not yet been re-clustered.

Add Media with Auto-Reindex

If you want the dataset to be fully re-clustered automatically after the new media is processed, set auto_reindex=true:
This runs a combined workflow: partial update (process new media) followed by reindex (re-cluster everything). The dataset returns to READY when complete.
Use auto_reindex=true when you want a single API call to handle everything. Omit it if you plan to add multiple batches before re-clustering.

Manual Reindex

If you added media without auto_reindex, the dataset enters PARTIAL INDEX status. You can trigger a manual reindex when ready:
Response: HTTP 202 Accepted
The reindex endpoint only accepts datasets in PARTIAL INDEX status. If the dataset is still processing (READ ONLY), wait for it to finish before triggering reindex.

Alternative: Direct File Upload

Upload individual files directly via multipart form. Use the files field (not files[]):

Alternative: Archive Upload

Upload a single archive file:

Cross-Account S3 Access

If your S3 data is in a different AWS account, use the assume_role parameter:

Python Example


Response Codes

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

Add Media (POST /api/v1/dataset/{dataset_id}/add_media)

Reindex (POST /api/v1/dataset/{dataset_id}/reindex)

Error Response Format

Error responses return a JSON body with a detail field:
Common error messages:

Dataset Status Flow

After calling add media, the dataset goes through these status transitions:
For a description of each status value, see Retrieve Dataset Status.
With auto_reindex=true, the flow goes directly from UPDATING through reindexing back to READY without stopping at PARTIAL INDEX.

On-Premises (Docker Compose)

For on-premises installations, use the pipeline service endpoint:
Or use the CLI tool:
On-premises add media uses local file paths instead of S3 URIs. The path parameter must be an absolute path accessible from the pipeline container.

Saved Views API

Create monitored views that automatically evaluate new media as it arrives.

Notifications API

Retrieve alerts generated when new media matches saved view filters.

Monitoring and Alerts

Understand how adding media triggers monitoring evaluation and alert delivery.

Task Manager API

Track add media and reindex tasks programmatically.