Knowledge base güncelle
Bir Knowledge base'i yeniden adlandırın veya açıklamasını güncelleyin
Mevcut bir Knowledge base'in adını veya açıklamasını günceller. Bu, dosya değiştirme rotası değildir. Bir dosyayı değiştirmek için Update a file kullanın.
Başlamadan önce
- API key scope:
KNOWLEDGE_FOLDER_APIkapsamına sahip bir API anahtarı gerekir. API anahtarının kendisinin Knowledge base üzerinde Editor rolü olmalıdır. Kurulum için Share Knowledge bases with the API sayfasına bakın. - Knowledge bases: Knowledge Folder API, Library'de Knowledge base olarak görünen kaynakları yönetir.
Base URL
https://api.ajan.ioDedicated deployments Tüm isteklerde
api.ajan.com'u/api/publicile değiştirin.
Request Format
Bu endpoint application/json kabul eder.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
folderId | string | Yes | Knowledge base ID'si |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Yeni ad. Trim sonrası boş olamaz. |
description | string | No | Yeni açıklama. |
En az bir alan ekleyin. Knowledge base oluşturmak veya silmek için genel bir endpoint yoktur.
Examples
Update with cURL
bash
curl -X PATCH "https://api.ajan.io/knowledge/{folderId}/folder" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Product handbook",
"description": "Internal product documentation"
}'Update with JavaScript
javascript
const axios = require("axios");
async function updateKnowledgeBase(folderId, data) {
const response = await axios.patch(
`https://api.ajan.io/knowledge/${folderId}/folder`,
data,
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
}
);
return response.data;
}
const result = await updateKnowledgeBase(
"550e8400-e29b-41d4-a716-446655440000",
{ name: "Product handbook" }
);
console.log("Updated:", result.result.name);Response Format
Success Response (200 OK)
typescript
{
status: "success";
result: {
id: string;
name: string;
description: string | null;
createdAt: string;
updatedAt: string;
};
}Example Response
json
{
"status": "success",
"result": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Product handbook",
"description": "Internal product documentation",
"createdAt": "2026-08-12T09:15:00.000Z",
"updatedAt": "2026-09-01T10:22:00.000Z"
}
}Error Handling
| Status | Meaning |
|---|---|
400 | Geçersiz gövde, boş ad veya alan sağlanmadı |
401 | Geçersiz veya eksik API anahtarı |
403 | Eksik KNOWLEDGE_FOLDER_API kapsamı veya anahtar bu Knowledge base'de Editor değil |
404 | Knowledge base bulunamadı |
429 | Rate limit aşıldı |
500 | Beklenmeyen sunucu hatası |
ajan, API anahtarınızı korumak ve uygulamalarınızın güvenliğini sağlamak için tarayıcı kaynaklı istekleri bilinçli olarak engeller. Daha fazla bilgi için API Key Best Practices kılavuzuna bakın.
OpenAPI
openapi: 3.0.0
info:
title: ajan API
version: 3.0.0
servers:
- url: https://api.ajan.io
description: Production
security:
- bearerAuth: []
paths:
/knowledge/{folderId}/folder:
patch:
summary: Update a Knowledge base name or description
parameters:
- name: folderId
in: path
required: true
description: The ID of the knowledge folder
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description:
type: string
responses:
'200':
description: Knowledge base updated successfully
security:
- bearerAuth: []
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: API Key
description: API key as Bearer token. Format "Bearer YOUR_API_KEY"