https://retellai.com/?utm_source=discord&utm_medium=seo logo
How do I find the data-agent-version for the chat...
# ❓・ai-evy-support
t
@AI Evy How do I find the data-agent-version for the chat widget in retell
a
Thanks for tagging me @Tubussie. I'll look through relevant sources and get back to you shortly.
### Answer --- The
data-agent-version
attribute is optional—if unset, it uses the latest version. [(1) ]() To find the version number for your chat agent, you can use the Get Chat Agent Versions API endpoint:
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) ;
[(2) ]() This returns an array of all versions for that agent. Each version object includes a
version
field (integer) that you can use for
data-agent-version
. Example widget setup with a specific version:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  data-public-key="key_xxxxxxxxxxxxxxxxxxxxx"
  data-agent-id="agent_xxxxxxxxxxxxxxxxxxx"
  data-agent-version="0"
></script>
[(1) ]()
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] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Get Chat Agent Versions](https://docs.retellai.com/api-references/get-chat-agent-versions) ​
t
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
### Answer That URL is an API endpoint template. Replace
{agent_id}
with your actual chat agent ID. Using the SDK (recommended) :
Copy code
javascript
import Retell from 'retell-sdk';

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

const chatAgentResponse = await client.chatAgent.create({
  response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
}) ;
console.log(chatAgentResponse.agent_id) ;
[(1) ]() The
agent_id
returned (e.g.,
oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD
) is what you'd use in the endpoint URL. Making the API call: You need to include your API key in the Authorization header with format
Bearer YOUR_RETELL_API_KEY
. So the full request would be: - Method: GET - URL: ` - Header:
Authorization: Bearer YOUR_RETELL_API_KEY
Your agent ID can be found in your Retell dashboard when viewing your chat agent, or from the response when you created the agent.
​ To learn more, see the sources I considered: [[1] Create Chat Agent](https://docs.retellai.com/api-references/create-chat-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy it is saying this {"error_message":"Authorization header required"}
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
### Answer ### Answer The
Authorization header required
error means your API request is missing the authentication header. [(1) ]() You need to include your API key in the request headers with this format:
Authorization: Bearer YOUR_RETELL_API_KEY
[(2) ]() If using cURL or a REST client:
Copy code
Authorization: Bearer YOUR_RETELL_API_KEY
If using the SDK (recommended) :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
[(3) ]() You can find your API key in the Retell dashboard. [(1) ]()
​ To learn more, see the sources I considered: [[1] "Authorization header required"](https://discord.com/channels/1186424376300679209/1417963292327936101) [[2] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[3] List Calls](https://docs.retellai.com/api-references/list-calls) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the feedback, glad I was helpful.