https://retellai.com/?utm_source=discord&utm_medium=seo logo
<@1145576664366055464> I am try to call https://a...
# ❓・ai-evy-support
n
@AI Evy I am try to call https://api.retellai.com/create-knowledge-base api.. but its not working.. and giving server error .ANy help. ?
a
Thanks for tagging me @neha_09141. I'll look through relevant sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Create Knowledge Base]() * [Add Knowledge Base Sources]() * [Retell Python API library]() * [Debug call disconnection]() -----------------------------
### Answer Based on recent reports, there are a few key things to note about the Knowledge Base API: 1. The API requires a multipart form body, not a JSON body [(1)]() 2. For the knowledge_base_urls parameter, it needs to be a JSON serialized string from a list of URL strings. For example: "['https://example.com']" Here's an example of how to properly create a Knowledge Base using the JavaScript SDK:
Copy code
javascript
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",
      "https://docs.retellai.com",
    ],
    knowledge_base_files: [
      fs.createReadStream("../sample.txt"),
    ],
  });

  console.log(knowledgeBaseResponse.knowledge_base_id);
}

main();
[(2)]() If you're still experiencing issues, make sure you're: 1. Using the correct content type (multipart form) [(1)]() 2. Properly formatting the knowledge_base_urls as a JSON serialized string The Knowledge Base feature was introduced in October 2024 and includes functionality for scraping webpages, uploading files, and manually adding text [(3)]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.