Create Knowledge Base Collection
Create a vector collection for the RAG knowledge base. Typically called once before uploading documents for the first time.
Try It
POST
/database/collectionshttps://api-platform.ope.aiAuthentication
Uses Bearer Token authentication.
- Header:
Authorization: Bearer <token> - Example:
Authorization: Bearer sk-xxxxxx
Request Body (application/json)
The request body can just be an empty JSON object.
{}
Default Limits
A single account can create a maximum of 5 knowledge bases by default. One API Key can create one independent knowledge base; you can use 5 API Keys to create 5 isolated knowledge bases. For more knowledge bases, higher capacity, or dedicated deployment solutions, please contact us.
Request Examples
- cURL
- JavaScript
curl -X POST "https://api-platform.ope.ai/database/collections" \
-H "Authorization: Bearer $OPEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
const res = await fetch("https://api-platform.ope.ai/database/collections", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OPEAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});
console.log(await res.json());
Response Example
{
"success": true
}
Error Responses
| Status Code | Scenario | Description |
|---|---|---|
401 | Authentication failed | API Key is missing, invalid, or has insufficient permissions |
422 | Validation failed | Request format is incorrect |
500 | Collection creation failed | Vector database connection failed or collection creation failed |