https://retellai.com/?utm_source=discord&utm_medium=seo logo
i keep on getting 404s when calling a chat agent i...
# ❓・ai-evy-support
m
@AI Evy i keep on getting 404s when calling a chat agent in a custom chat implementation.
a
Thanks for tagging me @medivoice_63089. I'll look through relevant sources and get back to you shortly.
### Answer For 404 errors when calling a chat agent, here are the most common causes based on the documentation: Check your API endpoint and chat ID format: - For retrieving a chat, use:
GET /get-chat/{chat_id}
[(1) ]() - For creating a chat session, use the create chat endpoint [(2) ]() Verify your authentication: - Ensure you're using the correct API key format:
"Bearer YOUR_API_KEY"
in the Authorization header [(1) ]() Common issues that cause 404s: - Invalid chat_id format - it should look like:
"16b980523634a6dc504898cda492e939"
- Incorrect agent configuration during creation [(3) ]() For chat agent setup: - Make sure you've properly created a chat agent first [(4) ]() - You can create a new chat agent or convert an existing voice agent to a chat agent Here's the correct JavaScript implementation for retrieving a chat:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const chatResponse = await client.chat.retrieve('16b980523634a6dc504898cda492e939') ;
console.log(chatResponse.agent_id) ;
[(1) ]() If you're still getting 404s, verify that: 1. Your chat agent is properly created [(4) ]() 2. You're using the correct chat_id format [(1) ]() 3. Your API key has proper permissions
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Get Chat](https://docs.retellai.com/api-references/get-chat) [[2] Create Chat](https://docs.retellai.com/api-references/create-chat) [[3] 404 when creating agent with /create-agent](https://discord.com/channels/1186424376300679209/1392679614882517042) [[4] Create chat agent](https://docs.retellai.com/build/create-chat-agent) ​