# Custom function failure to substitute dynamic variable

**URL:** <https://community.retellai.com/t/custom-function-failure-to-substitute-dynamic-variable/231>\
**Category:** Support Help\
**Created:** [December 19, 2025, 12:12am UTC](https://community.retellai.com/t/custom-function-failure-to-substitute-dynamic-variable/231 "2025-12-19T00:12:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Office-Mate-AI](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.retellai.com/office-mate-ai/32/213_2.png) [@Office-Mate-AI](https://community.retellai.com/u/Office-Mate-AI)\
**Post date:** [December 19, 2025, 12:12am UTC](https://community.retellai.com/t/custom-function-failure-to-substitute-dynamic-variable/231/1 "2025-12-19T00:12:20Z")

</div>

Hello Retell Team, I am having issue with a tool call not appending the variable into the url. call id - call\_1796f2c8361d9e3a0d11c6b9ef8 i have the appointment\_id set up as an extracted variable as you advised. I can see the payload the data that we need is there from the list appointments tool call. My url for the rescehdule appointment is 100% correct, however its not passing the appointment Id variable through in the URL.. im saving it both in extracted variables as a custom function and as a response variable from check appointments. this needs to be at the path level so i cannot use it as a query param. Any suggestions on this?

---

<div class="post-metadata">

**Author:** ![support2](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.retellai.com/support2/32/15_2.png) [@support2](https://community.retellai.com/u/support2)\
**Post date:** [December 19, 2025, 12:12am UTC](https://community.retellai.com/t/custom-function-failure-to-substitute-dynamic-variable/231/2 "2025-12-19T00:12:43Z")

</div>

Let me help you with this path variable issue. Based on the sources, here’s what you need to check:

**Path Variable Syntax**  
When using dynamic variables in your custom function URL path, you must use double curly braces `{{variable_name}}` format[(1)](https://docs.retellai.com/build/dynamic-variables). For your reschedule appointment URL, it should look like:

```auto
/appointments/{{appointment_id}}/reschedule

```

**Variable Setup**  
Since you’re extracting the `appointment_id` from a previous tool call, ensure:

1. The variable is properly extracted using the Extract Dynamic Variables tool[(2)](https://docs.retellai.com/build/single-multi-prompt/extract-dv)
2. The variable name matches exactly what you’re using in the URL (case-sensitive)
3. If you’re also setting it as a response variable from the list appointments tool, make sure the response variable name matches[(1)](https://docs.retellai.com/build/dynamic-variables)

**Common Issues from Community**  
A similar issue was reported where variables weren’t populating in path parameters[(3)](https://discord.com/channels/1186424376300679209/1442542149546803312). The resolution involved:

- Using the variable name directly like `{{appointment_id}}` rather than dot notation[(3)](https://discord.com/channels/1186424376300679209/1442542149546803312)
- Ensuring the variable is extracted before the function call that uses it[(4)](https://discord.com/channels/1186424376300679209/1420898782828040192)

**Verification Steps**

1. Check that your URL uses `{{appointment_id}}` not `{appointment_id}`[(4)](https://discord.com/channels/1186424376300679209/1420898782828040192)
2. Verify the extract variable tool runs before your reschedule appointment tool call[(4)](https://discord.com/channels/1186424376300679209/1420898782828040192)
3. Confirm the variable name in your extraction matches exactly what’s in your URL[(3)](https://discord.com/channels/1186424376300679209/1442542149546803312)

If you’ve verified all these points and it’s still not working, the call logs should show whether the variable has a value when the tool is invoked. You can check the `collected_dynamic_variables` field in your call details[(5)](https://docs.retellai.com/api-references/get-call).

---

<div class="post-metadata">

**Author:** ![Office-Mate-AI](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.retellai.com/office-mate-ai/32/213_2.png) [@Office-Mate-AI](https://community.retellai.com/u/Office-Mate-AI)\
**Post date:** [December 19, 2025, 12:28am UTC](https://community.retellai.com/t/custom-function-failure-to-substitute-dynamic-variable/231/3 "2025-12-19T00:28:04Z")

</div>

The URL has the variable listed correctly as {{appointment\_id}}. When I checked the logs I can clearly see the appointment ID was saved properly as a dynamic variable as well. The tool is no invoking the endpoint the error continues to indicate it is passing as appointment\_id or empty not as the substituted number.

---

<div class="post-metadata">

**Author:** ![Office-Mate-AI](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.retellai.com/office-mate-ai/32/213_2.png) [@Office-Mate-AI](https://community.retellai.com/u/Office-Mate-AI)\
**Post date:** [December 19, 2025, 12:39am UTC](https://community.retellai.com/t/custom-function-failure-to-substitute-dynamic-variable/231/4 "2025-12-19T00:39:49Z")

</div>

For the URL you have /reschedule at the end of this. Why? My endpoint doesn’t require this, is this a retell requirement?

---

<div class="post-metadata">

**Author:** ![support2](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.retellai.com/support2/32/15_2.png) [@support2](https://community.retellai.com/u/support2)\
**Post date:** [December 19, 2025, 12:40am UTC](https://community.retellai.com/t/custom-function-failure-to-substitute-dynamic-variable/231/5 "2025-12-19T00:40:10Z")

</div>

No, `/reschedule` is not a Retell requirement - I used it only as an example.

When you configure a custom function, you simply add your actual endpoint URL in the “Add endpoint URL” field[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function). This must be a valid URL[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function), but Retell doesn’t impose any specific path structure.

Your endpoint URL should be exactly what your API expects. If your endpoint is:

```auto
https://yourapi.com/appointments/{{appointment_id}}

```

Then that’s what you should use - no need to add `/reschedule` unless your actual API endpoint requires it.

The key point is that you can use dynamic variables like `{{appointment_id}}` anywhere in your URL path[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function), and Retell will substitute the actual value when making the request.

---

<div class="post-metadata">

**Author:** ![Omar\_Ashraf](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.retellai.com/omar_ashraf/32/102_2.png) [@Omar\_Ashraf](https://community.retellai.com/u/Omar_Ashraf)\
**Post date:** [December 19, 2025, 3:21pm UTC](https://community.retellai.com/t/custom-function-failure-to-substitute-dynamic-variable/231/7 "2025-12-19T15:21:45Z")

</div>

Hello @Office-Mate-AI

The appointment\_id was extracted using the custom function, not using the extract dynamic variables function, so it will be sent in the body, not in the URL. To send it in the URL, you have to extract it before you call the custom function using the extract dynamic variables function, not extract it with the function if you want it in the URL, not in the body.

---

<div class="post-metadata">

**Author:** ![support2](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.retellai.com/support2/32/15_2.png) [@support2](https://community.retellai.com/u/support2)\
**Post date:** [December 19, 2025, 3:22pm UTC](https://community.retellai.com/t/custom-function-failure-to-substitute-dynamic-variable/231/8 "2025-12-19T15:22:13Z")

</div>

You’re correct about the distinction between response variables and extracted dynamic variables in Retell AI custom functions[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function).

When you save data as a **response variable** from a custom function, that data is extracted from the API response but isn’t automatically available for use in subsequent function calls’ URL paths or query parameters[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function).

To use a variable like `appointment_id` in the **URL path or query parameters** of another custom function, you need to:

1. **Extract it as a dynamic variable** using the Extract Dynamic Variable node (in Conversation Flow) or the extract dynamic variables function (in Single/Multi Prompt)[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function)
2. **Then reference it** using `{{appointment_id}}` in your custom function’s endpoint URL or query parameters[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function)

For **query parameters** , you can define them with dynamic variables, and both the description and const value can include dynamic variables[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function). The description will be resolved by the LLM while the const value will be applied directly to the function[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function).

For **request headers** , header values can be static or include dynamic variables[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function).

However, parameters defined in the JSON schema (for POST, PATCH, and PUT requests) are sent in the **request body** , not in the URL[(1)](https://docs.retellai.com/build/conversation-flow/custom-function)[(2)](https://docs.retellai.com/build/single-multi-prompt/custom-function).

Based on a similar issue in the Discord community, when variables weren’t being substituted in URLs, the solution was to use the variable name directly like `{{variable_name}}` in both the const value and description fields[(3)](https://discord.com/channels/1186424376300679209/1450867178906714123)[(4)](https://discord.com/channels/1186424376300679209/1430715756030722149).

\*\*
