https://retellai.com/?utm_source=discord&utm_medium=seo logo
in a function can I use a variable as the api endp...
# ❓・ai-evy-support
o
@AI Evy in a function can I use a variable as the api endpoint?
a
Thanks for tagging me @objectsclattering. I'll look through relevant sources and get back to you shortly.
### Answer Yes, you can use dynamic variables in custom function URLs. Dynamic variables allow you to inject personalized data into your agent's responses and configurations for each specific call [(1) ]() . Dynamic variables can be used in tool configurations, including custom function URLs . You can define custom headers and query parameters that can include dynamic variables using the
{{variable_name}}
syntax [(2) ]() [(3) ]() . For example, if you have a dynamic variable called
{{user_id}}
or
{{endpoint_path}}
, you could construct your endpoint URL to include these variables [(1) ]() . To implement this: 1. Set up your dynamic variables at the agent level or pass them during call creation 2. In your custom function configuration, include the dynamic variable in your endpoint URL using the
{{variable_name}}
format [(2) ]() [(3) ]() 3. The variable will be replaced with the actual value when the function is called [(1) ]() This allows you to create flexible custom functions that can call different endpoints or include personalized parameters based on the specific context of each call .
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.