https://retellai.com/?utm_source=discord&utm_medium=seo logo
"The request is failing because the URL https://ap...
# ❓・ai-evy-support
t
@AI Evy "The request is failing because the URL https://api.retellai.com/get-chat/undefined is invalid. The undefined segment indicates a programming error where a chat identifier or parameter was not correctly provided when constructing the request URL. To resolve this, the code initiating this request needs to be debugged to ensure that a valid chat ID or resource identifier is passed in place of "undefined"."
a
Thanks for tagging me @Tubussie. I'll look through relevant sources and get back to you shortly.
### Answer --- The analysis is correct. The
undefined
in the URL indicates your code is not passing a valid
chat_id
to the API endpoint. [(1) ]() The Get Chat endpoint requires a valid
chat_id
as a path parameter:
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) ;
To fix this: 1. Check where you're obtaining the
chat_id
in your code before making the request 2. Ensure the variable holding the chat ID is defined and contains a valid string value 3. The
chat_id
should be a string like
"16b980523634a6dc504898cda492e939"
Debug your code to trace where the
chat_id
becomes `undefined`—this is likely happening because the variable is not being assigned correctly or is being accessed before it's set.
​ To learn more, see the sources I considered: [[1] Get Chat](https://docs.retellai.com/api-references/get-chat) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
Thanks for the explanation. I’m using the retell-widget.js web chat widget, not the retell SDK. In this integration, the widget itself calls POST /create-chat and should receive the chat_id automatically. In my case, POST /create-chat returns 401 Unauthorized, so no chat_id is ever created, which leads to GET /get-chat/undefined. There is no place in my frontend code where I manually set or pass chat_id. Could you please confirm whether Web Chat is enabled for my workspace and whether my public key is authorised for chat widget usage? @AI Evy
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
### Answer --- I don't have access to your workspace or account settings, so I cannot verify your specific configuration. However, the 401 Unauthorized error with the chat widget typically indicates a domain whitelisting issue. ## Common Causes for 401 on Chat Widget **Domain Whitelisting**: Public keys are restricted to specific domains. [(1) ]() The error "Public key is not allowed for this domain" appears when your domain isn't whitelisted in the Retell dashboard. [(2) ]() To configure allowed domains: [(1) ]() 1. Navigate to the Public Keys section in your Retell dashboard 2. Click on the public key you want to configure 3. Add the domains where your public key can be used (e.g.,
example.com
,
app.example.com
) 4. Save your changes **Testing on localhost**: Add
localhost
to your allowed domains list for local development. ## Widget Setup Verification Ensure your chat widget script includes the required attributes: [(3) ]() -
data-public-key
- Your Retell public key -
data-agent-id
- Your chat agent ID ## Additional Considerations A similar issue was reported where the widget wasn't creating a chat ID—this was attributed to a missing agent ID, wrong environment, or WordPress loading the script before the config. [(4) ]() Double-check the exact domain where the widget is embedded matches what's whitelisted. [(2) ]() ---
​ To learn more, see the sources I considered: [[1] Public Keys](https://docs.retellai.com/accounts/public-keys) [[2] Chat bot not responding](https://discord.com/channels/1186424376300679209/1384593638499160124) [[3] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) [[4] Discord message from @itstubzy on 2026-01-13](https://discord.com/channels/1186424376300679209/1294891368505937952/1460668540058079365) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
t
@AI Evy A 403 Forbidden error for wp/v2/users/me?context=edit typically means the authenticated user lacks the necessary permissions, the X-WP-Nonce is invalid, or a security measure is blocking the request. Ensure the user is logged in with appropriate capabilities and a valid X-WP-Nonce is included in the request headers.
a
message has been deleted
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
### Answer The error you're describing (
403 Forbidden
for
wp/v2/users/me?context=edit
) is a WordPress REST API issue, not a Retell AI issue. This relates to WordPress authentication and user permissions. ## This Is Unrelated to Retell AI The
wp/v2/users/me
endpoint is part of the WordPress REST API. The 403 error indicates: - The WordPress user lacks
edit_users
capability - The
X-WP-Nonce
header is missing or expired - A WordPress security plugin is blocking the request ## Regarding Your Original Retell Chat Widget Issue Based on our previous discussion, your actual Retell issue is the 401 Unauthorized error when the chat widget calls
POST /create-chat
. To resolve that: 1. Verify domain whitelisting in your Retell dashboard under Public Keys 2. Add your exact domain (including
localhost
for local testing) 3. Confirm your
data-public-key
and
data-agent-id
attributes are correct in the widget script For WordPress-specific REST API issues, you'll need to consult WordPress documentation or support resources, as that falls outside Retell AI's scope. Is there anything else regarding the Retell chat widget configuration I can help clarify?
t
@AI Evy How do i find my chat agent version
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
### Answer You can find your chat agent version using several methods: ## Option 1: Get Chat Agent Retrieve a specific chat agent, which includes the
version
field in the response: [(1) ]()
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const chatAgentResponse = await client.chatAgent.retrieve('16b980523634a6dc504898cda492e939') ;
console.log(chatAgentResponse.agent_id) ;
The response includes a
version
field (integer) representing the version of the chat agent. ## Option 2: Get All Versions of a Chat Agent If you need to see all versions of a specific chat agent: [(2) ]()
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const chatAgentResponses = await client.chatAgent.getVersions('16b980523634a6dc504898cda492e939') ;
console.log(chatAgentResponses) ;
## Option 3: List All Chat Agents This returns all chat agents with their version information: [(3) ]()
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const response = await client.chatAgent.list() ;
Replace the agent ID string with your actual chat agent ID.
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 Agent](https://docs.retellai.com/api-references/get-chat-agent) [[2] Get Chat Agent Versions](https://docs.retellai.com/api-references/get-chat-agent-versions) [[3] List Chat Agents](https://docs.retellai.com/api-references/list-chat-agents) ​