https://retellai.com/?utm_source=discord&utm_medium=seo logo
i am constantly getting {"status":"error","message...
# ❓・ai-evy-support
a
@AI Evy i am constantly getting {"status":"error","message":"Internal Server Error"} for chat-completion api
a
Thanks for tagging me @amine_86940. I'll look through relevant sources and get back to you shortly.
### Answer For the chat completion API, you need to first create a chat session using the
create-chat
API endpoint, which returns a
chat_id
that you'll need for subsequent requests [(1) ]() . Then use the
create-chat-completion
API endpoint to generate responses from the chat agent . Here's the correct implementation pattern:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
[(2) ]() The API requires proper authentication with the header format "Bearer YOUR_API_KEY" [(3) ]() . Make sure you're using the correct
agent_id
in your request . Common causes for Internal Server Error include: - Incorrect API key format or missing authentication header - Invalid
agent_id
parameter - Malformed request body Double-check that your request includes the required
agent_id
parameter and follows the proper authentication format . If the issue persists, I'd recommend checking the API reference documentation for the exact request format and visiting [Contact Sales]() or [) for additional support.
​ To learn more, see the sources I considered: [[1] Create Chat Completion](https://docs.retellai.com/deploy/create-chat-completion) [[2] Get Chat](https://docs.retellai.com/api-references/get-chat) [[3] Create Chat](https://docs.retellai.com/api-references/create-chat) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
yes all is correct but keep getting {"status":"error","message":"Internal Server Error"} on certain chats