How this Helps
Add custom metadata like temperature, timestamps, and tools to images via the API. This will help you improve dataset filtering and searchability.
Overview
This guide explains how to import custom metadata to your datasets via the API. Each metadata field is user-defined and supports one of several data types. Custom metadata is associated at the image level and is immutable once uploaded. To import custom metadata in Visual Layer, you must:- Declare a metadata field (name + type)
- Upload a JSON file containing values for that field
All API requests in the Cloud environment require authentication using a valid API token.
Supported value types include:
string
float
datetime
(UTC format)enum
(single or multi-select) - each enum option is limited to 20 characterslink
(URL)
Each upload task is used to add one metadata field only.
If you want to add multiple fields, you’ll need to create a separate task for each - and make sure each field has a unique field_name.
Steps
Pre-processing
- Ensure your dataset is in a
READY
state. - Prepare a JSON file as described below.
Uploading the metadata
- Declare a new metadata attribute and receive a
task_id
. - Upload metadata values in a JSON file.
- Track the ingestion progress via the status endpoint.
- Metadata becomes available for filtering and retrieval.
Preparing the JSON File
To upload custom metadata, you’ll need to associate values with the correct media items in your dataset. Each entry must include:- A
media_id
– a unique identifier generated by Visual Layer for each image - A
value
– the metadata value for that image
How to get media_id
s:
- Export your dataset from the Visual Layer platform.
- The exported JSON file will include all image-level metadata, including the
media_id
assigned to each media item. - Use these
media_id
s to match your custom metadata with the corresponding images.
Step 1: Declare a New Metadata Field
Each declaration creates a new upload task for a single field. You can repeat the process to add more fields—just ensure eachfield_name
is unique within the dataset.
Request Body
For string
, float
, datetime
, link
For enum
is_multi = false
is_multi = true
is_multi: false
(Each image can have only one value.)is_multi: true
(Each image can have multiple values.)
Response Body:
Make sure to save the
task_id
- you’ll need it for the next steps in the flow.Step 2: Upload Metadata File
Use the receivedtask_id
to upload your metadata file. Each entry must include a valid media_id
and a value
matching the declared field type.
Upload Format
For string
, float
, datetime
, link
For enum
- when is_multi = false
For enum
- when is_multi = true
Step 3: Check Upload Status
Track progress and get visibility into errors (e.g., type mismatches).Response Example:
Error Response Example
At this stage, uploaded metadata is immutable - meaning it cannot be edited or replaced once submitted.
If any errors occur during upload, only the problematic rows will fail; all valid rows will proceed successfully.
You can always declare a new
Support for updating existing metadata will be added in the future.
If any errors occur during upload, only the problematic rows will fail; all valid rows will proceed successfully.
You can always declare a new
field_name
and reupload the data.Support for updating existing metadata will be added in the future.
Step 4: Retrieve Metadata
List Declared Metadata Fields
Get Metadata for an Image
Step 5: Search and Filter Using Custom Metadata
Once your custom metadata is uploaded successfully, the declaredfield_name
will automatically appear in the Filters section of the UI.
You can then filter dataset images using these fields — just like any other built-in filter.
Supported filter types:
- String - substring match
- Float — numeric comparisons (
>
,<
,=
) - Datetime — range queries (
BETWEEN start_date AND end_date
) - Enum — exact match (single or multi-select, depending on configuration)
- Link - substring or exact match
Filtering behavior may vary depending on the field type and the selected operator.
Notes
- Only supported at the image level (not object level—yet!).
- Metadata is immutable and cannot be updated or replaced.
- Each field must have a unique name per dataset.