Knowledge Base
API endpoints related to managing Knowledge Bases. Knowledge bases contain information that Agents can use to answer questions. They are linked to an Organization.
Note: These endpoints require an API key scoped to the organization in the path. Requests made with an API key that belongs to a different organization return
401 Unauthorized.
Get Knowledge Bases
Retrieves a list of all knowledge bases for a given organization.
GET /v1/organizations/{organizationId}/knowledge-bases
Path Parameters:
organizationId(string, required): The unique identifier of the organization.
Headers:
x-api-key(string, required): Your API key for authentication.
Response:
- 200 OK: Knowledge bases retrieved successfully.
{"message": "Successfully retrieved organization knowledge bases","data": [{"id": "kb_123abc","name": "Product Information","url": "https://example.com/product-info","usageMode": "auto"},{"id": "kb_456def","name": "Company Policies","url": "https://example.com/policies","usageMode": "auto"}]}
- 400 Bad Request: Invalid or expired API key.
- 404 Not Found: Organization with specified organizationId not found or no agents found for this organization.
Try it yourself
Create Knowledge Base
Creates a new knowledge base for the organization by providing a name and URL.
POST /v1/organizations/{organizationId}/knowledge-bases
Path Parameters:
organizationId(string, required): The unique identifier of the organization.
Headers:
x-api-key(string, required): Your API key for authentication.Content-Type(string, required):application/json
Request Body:
{
"name": "Product Documentation",
"url": "https://example.com/documentation"
}
Response:
- 200 OK: Knowledge base created successfully.
{"message": "Successfully created organization knowledge base","data": [{"id": "kb_previous123","name": "Existing Knowledge Base","url": "https://example.com/existing"},{"id": "kb_new456","name": "Product Documentation","url": "https://example.com/documentation"}]}
- 400 Bad Request: Invalid input (e.g., missing required fields).
- 404 Not Found: Organization not found or no agents found for this organization.
Try it yourself
Get Knowledge Base by ID
Retrieves details for a specific knowledge base within the organization.
GET /v1/organizations/{organizationId}/knowledge-bases/{knowledgeBaseId}
Path Parameters:
organizationId(string, required): The unique identifier of the organization.knowledgeBaseId(string, required): The unique identifier of the knowledge base to retrieve.
Headers:
x-api-key(string, required): Your API key for authentication.
Response:
- 200 OK: Knowledge base details retrieved successfully.
{"message": "Successfully retrieved organization knowledge base","data": {"id": "kb_123abc","name": "Product Documentation","url": "https://example.com/documentation"}}
- 400 Bad Request: Knowledge base ID is required.
- 404 Not Found: Organization, agent, or knowledge base with the specified IDs not found.
Try it yourself
Delete Knowledge Base
Deletes a specific knowledge base from the organization.
DELETE /v1/organizations/{organizationId}/knowledge-bases/{knowledgeBaseId}
Path Parameters:
organizationId(string, required): The unique identifier of the organization.knowledgeBaseId(string, required): The unique identifier of the knowledge base to delete.
Headers:
x-api-key(string, required): Your API key for authentication.
Response:
- 200 OK: Knowledge base deleted successfully.
{"message": "Successfully deleted organization knowledge base","data": {"id": "kb_123abc","name": "Product Documentation","url": "https://example.com/documentation"}}
- 400 Bad Request: Knowledge base ID is required.
- 404 Not Found: Organization, agent, or knowledge base with the specified IDs not found.