Skip to main content
POST
/
taxonomy
/
upsert
Python
import os
from unstructured import UnstructuredClient

client = UnstructuredClient(
    username=os.environ.get("UNSTRUCTURED_USERNAME"),  # This is the default and can be omitted
    password=os.environ.get("UNSTRUCTURED_PASSWORD"),  # This is the default and can be omitted
)
taxonomy_operation_response = client.taxonomy.upsert(
    taxonomy_name="taxonomy_name",
)
print(taxonomy_operation_response.taxonomy_name)
import UnstructuredClient from 'unstructured-sdk';

const client = new UnstructuredClient({
authMethod: 'My Auth Method',
username: process.env['UNSTRUCTURED_USERNAME'], // This is the default and can be omitted
password: process.env['UNSTRUCTURED_PASSWORD'], // This is the default and can be omitted
});

const taxonomyOperationResponse = await client.taxonomy.upsert({ taxonomy_name: 'taxonomy_name' });

console.log(taxonomyOperationResponse.taxonomy_name);
A valid request URL is required to generate request examples
A valid request URL is required to generate request examples
A valid request URL is required to generate request examples
A valid request URL is required to generate request examples
A valid request URL is required to generate request examples
{
  "taxonomy_name": "<string>"
}
{
"detail": "<string>"
}
{
"detail": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"detail": "<string>"
}
{
"detail": "<string>"
}

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Body

application/json
taxonomy_name
string
required
new_taxonomy_name
string | null
taxonomy_description
string | null
taxonomy_data
TaxonomyGraph · object

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"), ], )

Response

Successful Response

taxonomy_name
string
required