https://retellai.com/?utm_source=discord&utm_medium=seo logo
your /create-knowledge-base endpoint is giving con...
# ❓・ai-evy-support
c
@AI Evy your /create-knowledge-base endpoint is giving consistent 500s. I’m testing the /create-knowledge-base endpoint and seeing consistent 500 Internal Server Error responses whenever I include a valid-looking body. The endpoint is definitely reachable, because if I send no body I get: { "status": "error", "message": "knowledge base name not a string" } So auth and connectivity are fine. But as soon as I include a proper knowledge_base_name, the endpoint returns 500. For example: { "knowledge_base_name": "debug-link-test" } Response: { "status": "error", "message": "Internal Server Error" } And even the full JSON shape from your docs, including knowledge_base_urls, gives the same 500. Because of this, I want to confirm: - Is /create-knowledge-base JSON-only, form-data-only, or both? Your OpenAPI spec shows multipart/form-data, but the docs also show JSON examples. - If form-data is required, what is the correct syntax for URL sources?
a
Thanks for tagging me @cute_courgette_01177. I'll look through relevant sources and get back to you shortly.
### Answer --- The
/create-knowledge-base
endpoint requires multipart/form-data format [(1) ]() . The documentation explicitly states the body type as
multipart/form-data
, not JSON. When you send JSON directly (like
{"knowledge_base_name": "debug-link-test"}
) , the server likely cannot parse it correctly as form-data, resulting in the 500 error you're seeing. For the correct syntax with URL sources using multipart/form-data, the JavaScript SDK example shows :
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%22,>
 "<https://docs.retellai.com%22,>
 ],
 knowledge_base_files: [
 fs.createReadStream("../sample.txt") ,
 ],
 }) ;
 console.log(knowledgeBaseResponse.knowledge_base_id) ;
}
main() ;
If you're making raw HTTP requests instead of using the SDK, you'll need to format your request as multipart/form-data with the
knowledge_base_name
as a form field and
knowledge_base_urls
as an array field .
​ To learn more, see the sources I considered: [[1] Create Knowledge Base](https://docs.retellai.com/api-references/create-knowledge-base) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @cute_courgette_01177. I'll get back to you soon.
c
@AI Evy followed your guidance to use multipart/form-data for /create-knowledge-base, but I’m still consistently getting a 500 Internal Server Error, even with the simplest possible valid request. Here’s the exact cURL I’m running: curl -X POST "https://api.retellai.com/create-knowledge-base" \ -H "Authorization: Bearer key_********************" \ -H "Content-Type: multipart/form-data" \ -F "knowledge_base_name=debug-link-test" \ -F "enable_auto_refresh=true" \ -F "knowledge_base_urls[0]=https://www.arthur.ai" Response: {"status":"error","message":"Internal Server Error"} Notes: The endpoint is reachable and auth works — if I send no body, I get: { "status": "error", "message": "knowledge base name not a string" } which shows the server is validating input. But as soon as I send a valid knowledge_base_name via multipart/form-data (per your docs and SDK example), I get the 500, even with a simple HTTPS URL like https://www.arthur.ai. Could you please: Check server logs for this request pattern (POST /create-knowledge-base with knowledge_base_name=debug-link-test) and confirm if there’s a backend issue? Confirm whether anything else is required in the form-data (e.g., do you require at least one of knowledge_base_texts or knowledge_base_files in addition to knowledge_base_urls)?
a
Copy code
javascript
import Retell from 'retell-sdk';
import fs from 'fs';

const client = new Retell({
    apiKey: 'YOUR_RETELL_API_KEY',
}) ;

async function main() {
    try {
        const formData = new FormData() ;
        formData.append('knowledge_base_name', 'KB_Name') ;
        formData.append('knowledge_base_urls', '<https://www.arthur.ai')> ;

        const response = await fetch('<https://api.retellai.com/create-knowledge-base',> {
            method: 'POST',
            headers: {
                'Authorization': `Bearer ${client.apiKey}`,
            },
            body: formData,
        }) ;

        if (!response.ok) {
            const errorText = await response.text() ;
            console.error('Error creating knowledge base:', errorText) ;
            return;
        }

        const result = await response.json() ;
        console.log('Knowledge base created successfully:', result) ;

    } catch (error) {
        console.error('Error:', error) ;
    }
}

main() ;
## Requirements According to the documentation, you don't need all three source types (texts, files, URLs) simultaneously [(1) ]() . You can create a knowledge base with just URLs, just files, or just text snippets [(1) ]() [(3) ]() . If the corrected cURL syntax doesn't resolve the 500 error, I recommend reaching out to Retell AI support directly: - Visit [Contact Sales]() - Visit [)
### Answer I can see you're experiencing a 500 Internal Server Error with the
/create-knowledge-base
endpoint. Based on the available sources, there are a few issues with your cURL command that might be causing this problem. ## Issue with URL Array Syntax Your cURL command uses `knowledge_base_urls[0]= but the documentation shows that
knowledge_base_urls
should be a string array [(1) ]() . The proper way to send arrays in multipart/form-data with cURL is to repeat the field name, not use bracket notation. Try this corrected cURL command:
Copy code
bash
curl -X POST "<https://api.retellai.com/create-knowledge-base%22> \
  -H "Authorization: Bearer YOUR_RETELL_API_KEY" \
  -F "knowledge_base_name=debug-link-test" \
  -F "enable_auto_refresh=true" \
  -F "knowledge_base_urls=<https://www.arthur.ai%22>
## Community-Reported Similar Issues Other users have reported similar 500 errors when creating knowledge bases via API [(2) ]() . One solution that worked involved using the Retell SDK with proper FormData construction:
​ To learn more, see the sources I considered: [[1] Create Knowledge Base](https://docs.retellai.com/api-references/create-knowledge-base) [[2] internal server error on create knowledge base by API](https://discord.com/channels/1186424376300679209/1391417148215136376) [[3] Knowledge Base](https://docs.retellai.com/build/knowledge-base) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
### Answer Based on your testing, this appears to be a backend issue with the
/create-knowledge-base
endpoint. You've correctly identified that: 1. The endpoint is reachable and authentication works (confirmed by the validation error when no body is sent) [(1) ]() 2. You're using the correct
multipart/form-data
format as specified in the documentation 3. The 500 error occurs consistently whenever
knowledge_base_name
is included with valid values ## What the Documentation Shows The official API reference shows the endpoint expects
multipart/form-data
with these fields : -
knowledge_base_name
(string, required) -
knowledge_base_texts
(object[], optional) -
knowledge_base_files
(file[], optional) -
knowledge_base_urls
(string[], optional) -
enable_auto_refresh
(boolean, optional) ## Community Reports Confirm This Issue Other users have reported identical 500 errors when creating knowledge bases via API [(2) ]() . One user specifically noted getting
{"status":"error","message":"Internal Server Error"}
even with minimal valid payloads . ## Recommended Next Steps Since you've exhausted the documented approaches and this appears to be a server-side issue, you should contact Retell AI support directly: - Visit [Contact Sales]() - Visit [) When contacting support, share: - Your exact cURL command (with redacted API key) - The timestamp of your requests - The consistent 500 response pattern This will help them check server logs and identify the root cause of the internal server error. **
Thanks for the follow-up, @cute_courgette_01177. I'll get back to you soon.
c
@AI Evy ’ve now tried the endpoint with multipart/form-data and the simplest possible body, using both array syntaxes for knowledge_base_urls, and I’m still consistently getting a 500. Endpoint is reachable (no body → 400) If I send no body, I get: { "status": "error", "message": "knowledge base name not a string" } So auth and connectivity are fine. Multipart/form-data with repeated knowledge_base_urls (no brackets) Here’s the exact curl I just ran: curl -X POST "https://api.retellai.com/create-knowledge-base" \ -H "Authorization: Bearer key_***" \ -F "knowledge_base_name=debug-link-test" \ -F "enable_auto_refresh=true" \ -F "knowledge_base_urls=https://www.arthur.ai/" Response: {"status":"error","message":"Internal Server Error"} I also previously tried the knowledge_base_urls[0]=... style and saw the same 500. At this point: I’m sending multipart/form-data (letting curl set the boundary), With only knowledge_base_name, enable_auto_refresh, and a single HTTPS URL, And any time knowledge_base_name is present, the endpoint returns 500.
a
​ To learn more, see the sources I considered: [[1] Create Knowledge Base](https://docs.retellai.com/api-references/create-knowledge-base) [[2] internal server error on create knowledge base by API](https://discord.com/channels/1186424376300679209/1391417148215136376) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Appreciate the feedback! Feel free to ask me again with additional guidance or context.