Update an option in an Ontology's Option inside a Classification

the upsert_feature_schema updates a Classification or Tool object. Is there a way using featureSchemaId to upsert an Option inside a classification.

Hello @harshita.arya! Unfortunately, as of the latest version of the Labelbox Python SDK, there is no direct way to upsert or update an individual Option (e.g., RadioOption, CheckboxOption) using just its featureSchemaId.

The SDK’s upsert_feature_schema and create_ontology_from_feature_schemas methods are built to work with the top-level feature schemas only (e.g., entire radio question, checklist, etc.). Options are considered nested, and must be managed within the classification schema object.

If you need to update/add/remove options in a RadioQuestion, you need to:

  1. Fetch the full Classification feature schema
  2. Modify the options list
  3. Use upsert_feature_schema() to replace the full classification

Here is the doc to all the APIs in the SDK: Client — Python SDK reference 6.9.0 documentation

Hey @nsheth ! thanks for your reply. Another question that I had was how do I specify the featureSchemaID for the new Options or further nesting that I might add in the classification. If I am giving a JSON input for the featureSchema

Hello Harshita!

Each feature in the ontology (tools, classifications, options) has a featureSchemaId. You can:

  1. Use existing featureSchemaIds (e.g., from a previous ontology or via exporting an ontology).

  2. Let Labelbox auto-generate them if you omit them when using Client.create_ontology_from_feature_schemas().

If you’re building a new ontology from scratch, your input JSON should look something like this:

[
  {
    "name": "Category",
    "tool": "radio",
    "required": false,
    "featureSchemaId": "random_CUID",    // Optional, can omit
    "options": [
      {
        "value": "Dog",
        "featureSchemaId": "random_CUID2" // Optional, can omit
      },
      {
        "value": "Cat",
        "featureSchemaId": "random_CUID2" // Optional, can omit
      }
    ]
  }
]

You can omit the featureSchemaId and Labelbox will generate them for you. But if you plan to reference or update a specific classification or option later, you may want to control or retrieve these IDs.

TL;DR – How to specify or get featureSchemaId():

• You can specify it manually in your JSON input.

• If omitted, Labelbox auto-generates them.

• Export ontology to get current schema IDs.

• To reuse or clone existing structures, pull IDs from your existing ontology and plug them into your new JSON.

Hope that helps!