Ontology

Rules & constraints

Troubleshoot errors and understand how Ontology behaves when you hit a limit.

This page covers constraints enforced by the Ontology API, organized by the problem you're trying to solve. If your request failed or something behaved unexpectedly, find your scenario below.

My concept type won't create

You're calling POST /api/v1/ontologies/{id}/concept-types and getting an error.

What you triedWhy it failedError
Reused a key already on this ontologyKeys must be unique per ontology409
Used a template ontology IDTemplates are read-only; adopt first400
Wrote to an archived ontologyOnly status=active ontologies accept writes400
Ontology belongs to another org/workspaceNot visible to your principal404

Good to know:

  • Concept types are flat. parent_id is only for attribute inheritance, not a 4-level display tree.
  • Live ontologies are workspace-scoped after adopt. Templates have workspace_id = null.

My attribute won't validate

You're creating or updating a concept and getting 422.

What you triedWhy it failedCode
Omitted a required attributeRequired fields must be presentattribute_required
Sent an unknown attribute keyMust match the concept type definitionattribute_unknown
Wrong shape for data_type (e.g. string for number)Values are type-checkedattribute_type
Select value not in select_optionsChoices are closedattribute_choice
multi_select not an arrayMust be a list of stringsattribute_type

Supported data_type values: text, number, boolean, date, select, multi_select.

My relation won't create

You're calling POST /api/v1/ontology/relations.

What you triedWhy it failedError
Set both or neither source fieldsExactly one of source_document_id / source_concept_id422
Document source on a concept-sourced relation typesource_concept_type_id must be null for documents422
Target concept type ≠ relation type targetTypes must match422
File workspace ≠ ontology workspaceEdges stay inside the adopted workspace400
Second edge under one_to_one / one_to_many from same sourceCardinality violated409

I can't delete a type or concept

What you triedWhy it failedError
DELETE concept type with live conceptsBlocked; response includes concept_count409
DELETE relation type with live relationsBlocked; response includes relation_count409
DELETE concept still used as relation endpointBlocked; response includes relation_count409

There is no silent cascade. Clear instances first, then delete the type.

Versioning and audit trail

BehaviourDetail
POST …/new-versionArchives current ontology, clones types into version+1, status=active
document_ontology_versionWritten once when a document gets its first relation under that ontology; never mutated
After version bumpNew classifications use the new ontology ID; old docs keep pointing at the prior version

Relation filter limits

What you triedWhy it failedError
relation_depth outside 1–3Hard cap on graph traversal hops when filtering or walking relations — not a limit on how many concept types or instances you can define422
More hops in the filter string than relation_depthPath longer than allowed depth422
Malformed relation= stringMust match rel.Type or rel.Type(attrs) chains422

Unbounded / variable-length path queries are out of scope. Traversal is capped at 3 hops. Your ontology schema (types, concepts, relations) is otherwise unbounded.

Explicitly out of scope

  • Entity deduplication / merge tooling
  • Formal inference / reasoning rules
  • Graph canvas visualization (list endpoints are enough for a grouped UI)

See the overview for how Ontology composes with workspaces and tags.

On this page