Knowledge Bases
Upload File
Creates a new knowledge base item by uploading a file.
POST
/
v1
/
knowledge
/
learn
curl -X POST https://api.bland.ai/v1/knowledge/learn \
-H "authorization: Bearer YOUR_API_KEY" \
-F "type=file" \
-F "name=Company FAQs" \
-F "description=Frequently asked questions and policies" \
-F "file=@company_faqs.pdf"
curl -X POST https://api.bland.ai/v1/knowledge/learn \
-H "authorization: Bearer YOUR_API_KEY" \
-F "type=file" \
-F "description=Product documentation" \
-F "file=@product_docs.pdf"
{
"data": {
"id": "kb_01H8X9QK5R2N7P3M6Z8W4Y1V5T",
"name": "Company FAQs",
"description": "Frequently asked questions and policies",
"status": "PROCESSING",
"type": "FILE",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z",
"file": {
"file_name": "company_faqs.pdf",
"file_size": 2048576,
"file_type": "application/pdf"
}
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "KB_UPLOAD_LIMIT_EXCEEDED",
"message": "You have reached your knowledge base upload limit"
}
]
}
{
"data": null,
"errors": [
{
"error": "KB_UPLOAD_RATE_LIMITED",
"message": "Please wait 10 seconds between knowledge base uploads, or wait for your current upload to complete."
}
]
}
Upload a file to create a knowledge base item that can be used to provide contextual information to your AI agents. Supported file formats include PDF, Word documents, text files, and more.
Docs for agents: llms.txt
Headers
Body Parameters (multipart/form-data)
Response
The created knowledge base item object.
curl -X POST https://api.bland.ai/v1/knowledge/learn \
-H "authorization: Bearer YOUR_API_KEY" \
-F "type=file" \
-F "name=Company FAQs" \
-F "description=Frequently asked questions and policies" \
-F "file=@company_faqs.pdf"
curl -X POST https://api.bland.ai/v1/knowledge/learn \
-H "authorization: Bearer YOUR_API_KEY" \
-F "type=file" \
-F "description=Product documentation" \
-F "file=@product_docs.pdf"
{
"data": {
"id": "kb_01H8X9QK5R2N7P3M6Z8W4Y1V5T",
"name": "Company FAQs",
"description": "Frequently asked questions and policies",
"status": "PROCESSING",
"type": "FILE",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z",
"file": {
"file_name": "company_faqs.pdf",
"file_size": 2048576,
"file_type": "application/pdf"
}
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "KB_UPLOAD_LIMIT_EXCEEDED",
"message": "You have reached your knowledge base upload limit"
}
]
}
{
"data": null,
"errors": [
{
"error": "KB_UPLOAD_RATE_LIMITED",
"message": "Please wait 10 seconds between knowledge base uploads, or wait for your current upload to complete."
}
]
}
Docs for agents: llms.txt
Was this page helpful?
⌘I
curl -X POST https://api.bland.ai/v1/knowledge/learn \
-H "authorization: Bearer YOUR_API_KEY" \
-F "type=file" \
-F "name=Company FAQs" \
-F "description=Frequently asked questions and policies" \
-F "file=@company_faqs.pdf"
curl -X POST https://api.bland.ai/v1/knowledge/learn \
-H "authorization: Bearer YOUR_API_KEY" \
-F "type=file" \
-F "description=Product documentation" \
-F "file=@product_docs.pdf"
{
"data": {
"id": "kb_01H8X9QK5R2N7P3M6Z8W4Y1V5T",
"name": "Company FAQs",
"description": "Frequently asked questions and policies",
"status": "PROCESSING",
"type": "FILE",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z",
"file": {
"file_name": "company_faqs.pdf",
"file_size": 2048576,
"file_type": "application/pdf"
}
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "KB_UPLOAD_LIMIT_EXCEEDED",
"message": "You have reached your knowledge base upload limit"
}
]
}
{
"data": null,
"errors": [
{
"error": "KB_UPLOAD_RATE_LIMITED",
"message": "Please wait 10 seconds between knowledge base uploads, or wait for your current upload to complete."
}
]
}