Skip to main content
Before importing your custom metadata, we recommend importing a metadata schema. Schemas help Encord validate your custom metadata and instruct Curate and Project Explorer how to display it.
To manage custom metadata across multiple teams, we recommend using namespaced keys in your schema. This helps avoid conflicts—for example, one team might use video.description, while another uses audio.description or TeamName.MetadataKey. It keeps things organized and clear across departments.

Benefits of Using a Metadata Schema

Using a metadata schema provides several benefits:
  • Validation: Ensures that all custom metadata conforms to predefined data types, reducing errors during data registration and processing.
  • Consistency: Maintains uniformity in data types across different datasets and projects, which simplifies data management and analysis.
  • Filtering and Sorting: Enhances the ability to filter and sort data efficiently in the Encord platform, enabling more accurate and quick data retrieval.

Metadata Schema Table

  • Metadata Schema keys support letters (a-z, A-Z), numbers (0-9), and blank spaces ( ), hyphens (-), underscores (_), and periods (.). Metadata schema keys are case sensitive.
  • If you are unsure about the type to assign to a metadata key, we recommend using varchar as a versatile default.
Use .add_scalar() to add a scalar key to your metadata schema. You can pass the data type as a string (for example "varchar") or as a MetadataSchemaScalarType value from encord.metadata_schema. Use .add_enum() to add an enum to your metadata schema, and .add_enum_options() to add options to an existing enum. An enum can have up to 255 options. Use .add_embedding() to add an embedding to your metadata schema. Use .add_geospatial() to add a new geospatial type to the metadata schema.
  • Geospatial custom metadata is supported only in Curate.
  • Geospatial custom metadata can be applied to all data unit types and on individual frames in videos.
Incorrectly specifying a data type in the schema can cause errors when filtering in Curate or Project Explorer. To fix this, check your schema, correct any issues, re-import it, and re-sync your Project.
While still supported, we STRONGLY RECOMMEND that you use the latest metadata schema instructions.
Incorrectly specifying a data type in the schema can cause errors when filtering your data in Curate or Project Explorer. If you encounter errors while filtering, verify your schema is correct. If your schema has errors, correct the errors, re-import the schema, and then re-sync your Project.

Import Your Metadata Schema to Encord

Importing a schema adds keys to your current schema. It does not remove keys that are not in your code. If you run the import code again, scalar keys are updated, but add_enum, add_embedding, and add_geospatial raise MetadataSchemaError for keys that already exist. To change existing keys, see Add Enum Options, Edit Schema Keys, and Delete Schema Keys.

This is supported, as is, we STRONGLY RECOMMEND that you use the most current method of creating your custom metadata schema.

Verify Your Schema

After importing your schema to Encord we recommend that you verify that the import is successful. Run the following code to verify your metadata schema imported and that the schema is correct.

This is supported, as is, we STRONGLY RECOMMEND that you use the most current method of creating your custom metadata schema.

Inspect Schema Keys

Use the following methods to check individual keys in your schema: keys() lists all keys, has_key() checks whether a key is defined, is_key_deleted() checks whether a key has been deleted, get_key_type() returns a key’s data type (or None for a deleted key), and get_enum_options() and get_embedding_size() return the values of an enum key and the size of an embedding key.
Inspect schema keys

Add Enum Options

Use .add_enum_options() to add options to an existing enum key. The existing options are kept. The following example adds two options to the Fruit enum.
Add Enum Options

Edit Schema Keys

You can change the data type of scalar schema keys (boolean, datetime, number, uuid, varchar, and text) using the .set_scalar() method. You cannot change an enum, embedding, or geospatial key into another type. The example below shows how to update the data type for multiple metadata fields.
Edit Schema Keys

Delete Schema Keys

Schema key options cannot be deleted. Instead, we recommend creating new schema key options to meet your needs and phasing out any that are no longer required.
You can delete schema keys using the .delete_key() method. There are two types of deletion: hard delete and soft delete. A hard delete permanently removes the key, making it impossible to restore. A soft delete allows you to restore the key later using the .restore_key() method. The following examples show hard delete and soft deletion of a schema key called Fruit.

Restore Schema Keys

Keys that have been soft deleted can be restored using the .restore_key() method. The following example restores a schema key called Fruit.
Restore Schema Key