Create Taxonomy
Create a new taxonomy to organize categories and control access through roles and languages.
Endpoint
POST /v1/workspaces/{workspaceId}/taxonomyAuthentication
Requires API key authentication with a valid access token.
Request
curl -X POST \
'https://api.sharely.ai/v1/workspaces/{workspaceId}/taxonomy' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'organizationid: your-organization-id' \
-d '{
"name": "Medical Knowledge Taxonomy",
"description": "Organized medical knowledge by specialty"
}'Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string (UUID) | Yes | The unique identifier of the workspace |
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token with access token |
organizationid | string (UUID) | Yes | Your organization ID |
Content-Type | string | Yes | Must be application/json |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Taxonomy name |
description | string | No | Taxonomy description |
Response
Success Response (201 Created)
{
"id": "taxonomy-uuid",
"workspaceId": "workspace-uuid",
"name": "Medical Knowledge Taxonomy",
"description": "Organized medical knowledge by specialty",
"published": false,
"createdAt": "2024-11-14T15:30:00Z",
"updatedAt": "2024-11-14T15:30:00Z"
}Response Fields
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Taxonomy unique identifier |
workspaceId | string (UUID) | Parent workspace ID |
name | string | Taxonomy name |
description | string | Taxonomy description |
published | boolean | Publication status (always false for new taxonomies) |
createdAt | string (ISO 8601) | Creation timestamp |
updatedAt | string (ISO 8601) | Last update timestamp |
Example Usage
const fetch = require('node-fetch');
async function createTaxonomy(workspaceId, data, accessToken, organizationId) {
const response = await fetch(
'https://api.sharely.ai/v1/workspaces/' + workspaceId + '/taxonomy',
{
method: 'POST',
headers: {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/json',
'organizationid': organizationId
},
body: JSON.stringify(data)
}
);
if (!response.ok) {
throw new Error('Failed to create taxonomy: ' + response.status);
}
return await response.json();
}
// Usage
const taxonomy = await createTaxonomy(
workspaceId,
{
name: 'Medical Knowledge',
description: 'Medical specialty taxonomy'
},
accessToken,
organizationId
);
console.log('Created taxonomy:', taxonomy.id);Next Steps
After creating a taxonomy:
- Assign languages to support multilingual content
- Assign roles for RBAC
- Assign categories to organize content
- Publish the taxonomy to make it active