https://retellai.com/?utm_source=discord&utm_medium=seo logo
can you use dynamic variables in the custom functi...
# ❓・ai-evy-support
h
@AI Evy can you use dynamic variables in the custom function API endpoint url
a
Thanks for tagging me @hintenjoyer. I'll look through relevant sources and get back to you shortly.
### Answer Based on the official documentation, dynamic variables can be used in custom function API endpoints, but there are specific ways to implement them [(1) ]() [(2) ]() . For query parameters, you can include dynamic variables in the request URL . The documentation shows you can set query parameters where "Query parameter values can be static or include dynamic variables" . However, for path variables in the endpoint URL itself, there are some limitations. From community discussions, it appears that while dynamic variables work in POST request bodies, using them directly in GET endpoint URLs as path variables can be problematic [(3) ]() . The recommended approach is to: 1. Use query parameters instead of path variables for dynamic values [(1) ]() [(2) ]() 2. Set up dynamic variables using the Extract Dynamic Variables function before calling your custom function [(3) ]() 3. For GET requests, pass dynamic values as query parameters rather than embedding them in the URL path [(4) ]() [(3) ]() For example, instead of
/api/employee/{{employeeId}}
, use
/api/employee
with
employeeId
as a query parameter [(3) ]() . The documentation confirms that you can "define query parameters to include in the request URL that Retell appends to your endpoint" and
that "Query parameter values can be static or include dynamic variables" [(1) ]() [(2) ]() .
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] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] I'm having trouble with Custom Functions that need dynamic path variables in GET endpoints](https://discord.com/channels/1186424376300679209/1420898782828040192) [[4] Can't use dynamic variable with date-time format in GET URL for custom function?](https://discord.com/channels/1186424376300679209/1405204331896246434) ​