Endpoints
Add to Knowledge Base
Description
This endpoint adds a new text resource to a specified knowledge base. The content is automatically split into chunks and embedded for vector similarity search.
Endpoint
Headers
- Content-Type:
application/json
- Authorization: Bearer
<API_KEY>
(required for API access)
Request Body
Responses
Success (201)
Returns the created resource object.
- X-RateLimit-Limit: The rate limit for the user.
- X-RateLimit-Remaining: The remaining number of requests for the user.
Bad Request (400)
Returned if required fields are missing or if adding the resource would exceed the knowledge base character limit.
Unauthorized (401)
Returned if the API key is invalid or missing.
Not Found (404)
Returned if the specified knowledge base is not found.
Internal Server Error (500)
Returned if there’s an error during the addition process.
Example Request
Notes
- Credits used are calculated based on character count (1 credit per 10,000 characters).
- There is a total character limit of 10,000,000 characters per knowledge base.
- The content is automatically split into chunks and embedded for vector similarity search.
- The resource is stored with metadata including size, character count, and mime type.
- Usage is recorded for each addition, including the knowledge base ID and the number of credits used.
- The content must be in plain text format (mime type: text/plain).
Rate Limiting
Rate limit headers (X-RateLimit-Limit
and X-RateLimit-Remaining
) are included in the response to indicate the user’s current rate limit status.