Sanjay
03/27/2026, 8:23 PMAI Evy
03/27/2026, 8:23 PMAI Evy
03/27/2026, 8:24 PMAI Evy
03/27/2026, 8:24 PMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
async function main() {
const knowledgeBaseResponse = await client.knowledgeBase.create({
knowledge_base_name: "Sample KB",
knowledge_base_texts: [
{
text: "Hello, how are you?",
title: "Sample Question",
},
],
knowledge_base_urls: [
"<https://www.retellai.com%22,>
"<https://docs.retellai.com%22,>
],
knowledge_base_files: [
fs.createReadStream("../sample.txt") ,
],
}) ;
console.log(knowledgeBaseResponse.knowledge_base_id) ;
}
main() ;
The endpoint is POST /create-knowledge-base. You can include texts, URLs, or files as sources. The Knowledge Base name must be less than 40 characters. You can enable auto-refresh for URLs to retrieve data every 12 hours by setting enable_auto_refresh: true.
Important note: Based on community reports, if you encounter HTTP 500 errors when creating a KB via API, you may need to use the SDK rather than direct HTTP requests. [(2) ]()AI Evy
03/27/2026, 8:24 PM