Update Reserved Fields
Update the core reserved fields of a knowledge item. Reserved fields include type, title, and language - fundamental properties that define the knowledge item's identity.
Endpoint
PUT /v1/workspaces/{workspaceId}/knowledge/{knowledgeId}/reservedFieldAuthentication
Requires Bearer token authentication. See Authentication for details.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string (UUID) | Yes | The ID of your workspace |
knowledgeId | string (UUID) | Yes | The ID of the knowledge item to update |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Knowledge type: URL, FILE, LINK, STRING, WEBSITE, or ELASTICSEARCH_INDEX |
title | string | Yes | New title for the knowledge item |
language | string | No | Language code (e.g., 'en', 'es', 'fr') |
Supported Knowledge Types
The following types can be updated:
URL- Web content fetched from URLsFILE- Uploaded filesLINK- Link references without contentSTRING- Plain text content
Response
Success Response
Status Code: 200 OK
Headers:
X-API-Version: v1Body:
{
"knowledgeId": "550e8400-e29b-41d4-a716-446655440000"
}Examples
Update Knowledge Title
Update the title of a knowledge item:
curl -X PUT \
'https://api.sharely.ai/v1/workspaces/your-workspace-id/knowledge/123e4567-e89b-12d3-a456-426614174000/reservedField' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"type": "FILE",
"title": "Updated Product Documentation",
"language": "en"
}'Response:
{
"knowledgeId": "123e4567-e89b-12d3-a456-426614174000"
}Update Language Only
Update just the language of a knowledge item:
curl -X PUT \
'https://api.sharely.ai/v1/workspaces/your-workspace-id/knowledge/987fcdeb-51a2-43f7-b8c9-123456789abc/reservedField' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"type": "URL",
"title": "API Documentation",
"language": "es"
}'JavaScript Example
const API_KEY = 'YOUR_API_KEY';
const WORKSPACE_ID = 'your-workspace-id';
const BASE_URL = 'https://api.sharely.ai/v1';
async function updateReservedFields(knowledgeId, type, title, language = null) {
const body = {
type: type,
title: title
};
if (language) {
body.language = language;
}
const response = await fetch(
`${BASE_URL}/workspaces/${WORKSPACE_ID}/knowledge/${knowledgeId}/reservedField`,
{
method: 'PUT',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
}
);
if (!response.ok) {
throw new Error(`Update failed: ${response.statusText}`);
}
return await response.json();
}
// Usage - Update title and language
try {
const result = await updateReservedFields(
'123e4567-e89b-12d3-a456-426614174000',
'FILE',
'Updated Documentation',
'en'
);
console.log('Knowledge updated:', result.knowledgeId);
} catch (error) {
console.error('Update failed:', error.message);
}Python Example
import requests
import json
API_KEY = 'YOUR_API_KEY'
WORKSPACE_ID = 'your-workspace-id'
BASE_URL = 'https://api.sharely.ai/v1'
def update_reserved_fields(knowledge_id, knowledge_type, title, language=None):
payload = {
'type': knowledge_type,
'title': title
}
if language:
payload['language'] = language
response = requests.put(
f'{BASE_URL}/workspaces/{WORKSPACE_ID}/knowledge/{knowledge_id}/reservedField',
headers={
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
},
json=payload
)
response.raise_for_status()
return response.json()
# Usage - Update title and language
try:
result = update_reserved_fields(
'123e4567-e89b-12d3-a456-426614174000',
'FILE',
'Updated Documentation',
'en'
)
print(f"Knowledge updated: {result['knowledgeId']}")
except requests.exceptions.HTTPError as error:
print(f"Update failed: {error}")Error Responses
400 Bad Request
Missing required fields:
{
"error": "Bad Request",
"message": "Missing required field: title"
}Invalid type:
{
"error": "Bad Request",
"message": "Invalid knowledge type"
}401 Unauthorized
Invalid or missing API key:
{
"error": "Unauthorized",
"message": "Invalid or missing API key"
}403 Forbidden
Insufficient permissions:
{
"error": "Forbidden",
"message": "Insufficient permissions to update this knowledge item"
}404 Not Found
Knowledge item doesn't exist:
{
"error": "Not Found",
"message": "Knowledge item not found"
}422 Unprocessable Entity
Type mismatch:
{
"error": "Unprocessable Entity",
"message": "Knowledge type mismatch"
}500 Internal Server Error
Server error during update:
{
"error": "Internal Server Error",
"message": "Failed to update knowledge item"
}Use Cases
Rename Knowledge Items
Update titles for better organization:
await updateReservedFields(
knowledgeId,
'FILE',
'Q4 2025 Product Roadmap',
'en'
);Standardize Titles
Batch update titles to follow naming conventions:
const knowledgeItems = await listKnowledge();
for (const item of knowledgeItems) {
const standardizedTitle = standardizeTitle(item.title);
await updateReservedFields(
item.id,
item.type,
standardizedTitle,
item.language
);
}Update Language Tags
Set language for multilingual content:
// Update language for Spanish content
await updateReservedFields(
knowledgeId,
'URL',
'Documentación del Producto',
'es'
);Validate Before Updating
Check that the knowledge exists and you have permissions:
try {
const knowledge = await getKnowledge(knowledgeId);
await updateReservedFields(
knowledgeId,
knowledge.type,
newTitle,
newLanguage
);
} catch (error) {
if (error.status === 404) {
console.error('Knowledge not found');
} else if (error.status === 403) {
console.error('Insufficient permissions');
}
}Use Consistent Language Codes
Use standard ISO 639-1 language codes:
// Good
await updateReservedFields(knowledgeId, 'FILE', 'Title', 'en');
await updateReservedFields(knowledgeId, 'FILE', 'Title', 'es');
await updateReservedFields(knowledgeId, 'FILE', 'Title', 'fr');
// Avoid non-standard codes
await updateReservedFields(knowledgeId, 'FILE', 'Title', 'english');Don't Change Type Unnecessarily
The type should match the actual content. Changing it might cause inconsistencies:
// Only update title and language, keep type the same
const knowledge = await getKnowledge(knowledgeId);
await updateReservedFields(
knowledgeId,
knowledge.type, // Keep existing type
'Updated Title',
'en'
);Notes
Type Validation
The API validates that the type matches the knowledge item's stored type. Attempting to change the type will result in a 422 error.
Required Type Field
Even though the type typically shouldn't change, it's required in the request body to ensure you're aware of what you're updating.
Language Field
The language field is optional. If omitted, the existing language value will be preserved.
Immutability of Content
This endpoint only updates the reserved fields. The actual content of the knowledge item remains unchanged.
Search Index Updates
Updated titles and language codes are immediately reflected in search indexes for semantic and title searches.
Related Endpoints
- Get Knowledge - Retrieve current field values
- Search Knowledge - Find knowledge using updated titles
- Create Knowledge - Create new knowledge items