Insert or update a taxonomy (schema/hierarchy) in the database.
| Field | Type | Description |
|---|---|---|
taxonomy_name | str | Name of the taxonomy to upsert. |
new_taxonomy_name | Optional[str] | New name for the taxonomy (when updating). |
taxonomy_description | Optional[str] | Description of the taxonomy. |
taxonomy_data | Optional[Dict] | The taxonomy/hierarchy data structure. |
{ "taxonomy_name": str }{
"taxonomy_name": "document-categories",
"taxonomy_description": "Main document classification taxonomy",
"taxonomy_data": {
"invoice": ["purchase_invoice", "sales_invoice"],
"receipt": ["expense_receipt", "payment_receipt"]
}
}
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
A node/edge style graph representation of a taxonomy.
Example (simple case - single condition per edge): graph = TaxonomyGraph( nodes=[ TaxonomyNode(node_id="1", name="Document Type", active_values=["Contract", "Invoice"]), TaxonomyNode(node_id="2", name="Contract Type", active_values=["NDA", "Employment"]), ], edges=[ TaxonomyEdge( target_node_ids=["1"], conditions=[EdgeCondition(node_id="root", tag_value_name="Contract")], ), TaxonomyEdge( target_node_ids=["2"], conditions=[EdgeCondition(node_id="1", tag_value_name="NDA")], ), ] )
Example (AND case - multiple conditions): # Edge only followed when Document Type = Contract AND Region = US TaxonomyEdge( target_node_ids=["us_contract_node"], conditions=[ EdgeCondition(node_id="doc_type_node", tag_value_name="Contract"), EdgeCondition(node_id="region_node", tag_value_name="US"), ], )
Successful Response