https://retellai.com/?utm_source=discord&utm_medium=seo logo
I am getting an Internal server error when adding ...
# ❓・ai-evy-support
s
@AI Evy I am getting an Internal server error when adding a knowledge base source using the API
a
Thanks for tagging me @Sanjay. I'll look through relevant sources and get back to you shortly.
### Answer --- This is a known issue that others have reported. [(1) ]() [(2) ]() [(3) ]() Key points: 1. The Knowledge Base API for create/add currently only works reliably with the SDK [(3) ]() 2. URL-based sources may cause issues — Users have reported 500 errors specifically when including URLs in knowledge base requests. The URL may not be parseable or accessible (due to redirects, bot blocking, or unsupported page formats) . [(4) ]() [(1) ]() 3. Using the SDK is recommended. Here's the correct approach with the JavaScript SDK: [(5) ]()
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.addSources({
    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() ;
Troubleshooting steps: - If using URLs, verify they are public and accessible without login or cookies [(4) ]() - Try adding sources without URLs first (just texts or files) to isolate the issue - Ensure you're using the official SDK rather than raw HTTP requests [(3) ]() The Retell team has been aware of and working on knowledge base issues. [(1) ]()
​ To learn more, see the sources I considered: [[1] internal server error on create knowledge base by API](https://discord.com/channels/1186424376300679209/1391417148215136376) [[2] We’re getting a 500 Internal Server Error onPOST /add-knowledge-base-sources/{knowledge_base_id}](https://discord.com/channels/1186424376300679209/1439976536135696554) [[3] API knowledge base bug](https://discord.com/channels/1186424376300679209/1448946789385371668) [[4] Discord message from @colin_43491 on 2025-11-04](https://discord.com/channels/1186424376300679209/1294891368505937952/1435219186719653920) [[5] Add Knowledge Base Sources](https://docs.retellai.com/api-references/add-knowledge-base-sources) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.