https://retellai.com/?utm_source=discord&utm_medium=seo logo
I'm integrating with your API using n8n and gettin...
# ❓・ai-evy-support
d
@AI Evy I'm integrating with your API using n8n and getting a 500 error when trying to add URLs to an existing knowledge base. My current setup: - POST to: https://api.retellai.com/add-knowledge-base-sources/knowledge_base_XXYY - Body: { "knowledge_base_urls": ["https://example.com"] } - Result: 500 Internal Server Error Questions: 1. What is the correct REST API endpoint URL format for adding sources to an EXISTING knowledge base? 2. Should the knowledge_base_id be in the URL path or in the request body? 3. What is the correct request body structure? Your SDK documentation shows client.knowledgeBase.addSources() but doesn't show the underlying HTTP request format.
a
Thanks for tagging me @designthely. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Add Knowledge Base Sources](https://docs.retellai.com/api-references/add-knowledge-base-sources) [[2] Cannot Add Source to Knowledge Base Through API](https://discord.com/channels/1186424376300679209/1428127903199269046) ​
### Answer Based on the documentation, here are the answers to your questions: 1. Correct REST API endpoint URL format: The endpoint should be
POST /add-knowledge-base-sources/{knowledge_base_id}
where the knowledge base ID is in the URL path [(1) ]() . 2. Knowledge base ID placement: The knowledge_base_id should be in the URL path as a path parameter . According to the documentation, it's a required path parameter with the format
"kb_1234567890"
. 3. Correct request body structure: The request should use
multipart/form-data
format, not JSON . The body parameters are: -
knowledge_base_texts
(object[]) : Texts to add to the knowledge base -
knowledge_base_files
(file[]) : Files to add (limit 25 files, 50MB each) -
knowledge_base_urls
(string[]) : URLs to be scraped and added For URLs specifically, the format should be:
Copy code
json
[  
 "<https://www.example.com%22,>  
 "<https://www.retellai.com%22>  
]
Your issue: Your 500 error is likely caused by using JSON format instead of
multipart/form-data
. This matches a similar issue reported by another user who was getting 500 errors when using the wrong request format [(2) ]() . The correct approach would be to send the request as
multipart/form-data
with the knowledge base ID in the URL path, not in the request body.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
a
Thanks for the follow-up, @designthely. I'll get back to you soon.
### Answer Based on the documentation, here's the complete solution for adding sources to an existing knowledge base: URL Format:
Copy code
POST <https://api.retellai.com/add-knowledge-base-sources/%7Bknowledge_base_id%7D>
[(1) ]() Where
{knowledge_base_id}
should be replaced with your actual knowledge base ID (e.g.,
"kb_1234567890"
) . Content-Type: The request must use
multipart/form-data
format, not JSON . Request Body Structure: For adding URLs specifically, use the
knowledge_base_urls
parameter as a string array :
Copy code
json
[  
 "<https://www.example.com%22,>  
 "<https://www.retellai.com%22>  
]
Complete Example: - URL: ` - Method: POST - Content-Type:
multipart/form-data
- Authorization:
Bearer YOUR_API_KEY
- Body: Include
knowledge_base_urls
as a form field with your URL array The 500 error you're experiencing is likely because you're sending JSON instead of multipart/form-data. Switch to multipart/form-data format and ensure the knowledge base ID is in the URL path, not the request body .
​ To learn more, see the sources I considered: [[1] 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.
d
@AI Evy APIne keresztül elérhető az SSE?
a
Thanks for the follow-up, @designthely. I'll get back to you soon.
### Answer A rendelkezésre álló dokumentáció alapján nem találok konkrét információt az SSE (Server-Sent Events) API-n keresztüli elérhetőségéről [(1) ]() . Az API integrációs dokumentáció a webhook és API integrációkra összpontosít, amelyek lehetővé teszik az AI hangügynökök számára, hogy valós időben kommunikáljanak külső rendszerekkel, mint például CRM-ek, adatbázisok és egyéb eszközök . Sajnos a jelenlegi forrásokban nincs specifikus információ az SSE támogatásról. Ha szeretnél általános választ erre a kérdésre, kérlek jelezd, vagy látogass el a következő támogatási csatornákra további információért: - [Contact Sales]() - [)
​ To learn more, see the sources I considered: [[1] API Integration](https://www.retellai.com/glossary/api-integration) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.