Dynamic Variables from API Request Tool Not Render...
# support
n
I'm experiencing an issue with dynamic variables not being properly rendered in my system prompt after a successful
apiRequest
tool call. I use the dashboard. I've thoroughly debugged the issue and would appreciate your assistance. Issue Details: - I've configured an API request tool that returns data including fields like date, dayOfWeek etc. - I've mapped these responses to dynamic variables in the tool configuration in response body. See attached images. the Response Body is auto generated when I test the tool call using "Save Schema" - When I check the call logs, I can see the tool call executes successfully - However, the system prompt is not being re-rendered with the populated variables (I checked the model Azure OpenAI HTTP request -> attributes.request.messages) - All variable references (e.g., {{data.dayOfWeek}}, {{data}}) are being replaced with empty strings even after the tool call completes Debugging Steps Taken: - Verified the API request tool is executing successfully in the call logs - Confirmed the API is returning the expected data structure - Added debug statements to the system prompt to check variable rendering - Verified that built-in variables like {{now}} are rendering correctly - Checked multiple conversation turns after the tool call completes - Examined the model requests that occur after the tool call in the call logs and latest model request in the call Am I debugging it wrong? What's the best way to debug it? Additional Information: - Assistant ID: bc4d9f7f-01f2-4370-9604-f77f684fe1a1 - Call ID for reference: 019ae217-d360-7000-8095-7dd4bc00798d I would greatly appreciate your help in resolving this issue. Please let me know if you need any additional information. https://cdn.discordapp.com/attachments/1445637070981824542/1445637072676454530/image.png?ex=694ac730&is=694975b0&hm=3661f4ab7e2fd1d56b8841c83784f52f05f2157bf7fd8a61a74abaea34495068&
v
Suggestion: Double-check that your API response structure exactly matches the variable extraction schema in your tool configuration. For example, if your response is:
Copy code
json
{
  "data": {
    "dayOfWeek": "Monday"
  },
  "success": true,
  "timestamp": "2025-12-03T04:45:36Z"
}
then reference the variable in your prompt as
{{data.dayOfWeek}}
. If the structure or key names differ, the variable will not populate—ensure both the API response and the extraction schema are in sync as shown in the [dynamic variables documentation](https://docs.vapi.ai/assistants/dynamic-variables). Source: - [Dynamic Variables documentation](https://docs.vapi.ai/assistants/dynamic-variables)
n
Response (taken from the call logs > Tool):
Copy code
{
  "id": "log-43",
  "level": 30,
  "time": 1764729819473,
  "timestamp": 1764729819473000000,
  "severityText": "INFO",
  "severityNumber": 9,
  "body": "Tool calls finished",
  "attributes": {
    "category": "tool",
    "callId": "019ae217-d360-7000-8095-7dd4bc00798d",
    "orgId": "87126cb3-1bd3-4e51-b782-1958b6307b99",
    "runDurationMs": 433,
    "totalResults": 1,
    "errorsCount": 0,
    "results": [
      {
        "name": "getCurrentTime",
        "toolCallId": "call_BkoNSi8jaazzRTNQxVaizejU",
        "type": "apiRequest",
        "result": "{\n  \"success\": true,\n  \"data\": {\n    \"dayOfWeek\": \"Wednesday\",\n    \"date\": 3,\n    \"month\": \"December\",\n    \"year\": 2025,\n    \"time\": \"12:43 PM\",\n    \"timezone\": \"Australia/Brisbane\",\n    \"locationName\": \"xxx\",\n    \"isOpen\": true\n  },\n  \"timestamp\": \"2025-12-03T02:43:39.317Z\"\n}",
        "metadata": {
          "responseBody": {
            "success": true,
            "data": {
              "dayOfWeek": "Wednesday",
              "date": 3,
              "month": "December",
              "year": 2025,
              "time": "12:43 PM",
              "timezone": "Australia/Brisbane",
              "locationName": "xxx",
              "isOpen": true
            },
            "timestamp": "2025-12-03T02:43:39.317Z"
          },
          "responseHeaders": {
            "access-control-allow-credentials": "true",
            "access-control-allow-origin": "https://corsproxy.io",
            "content-length": "216",
            "content-type": "application/json; charset=utf-8",
            "date": "Wed, 03 Dec 2025 02:43:39 GMT",
            "etag": "W/\"d8-hEUgU1Rhslk80+l5GAw/87Rzs44\"",
            "ngrok-agent-ips": "2406:2d40:39e6:b708:799c:e6e2:504b:d3f2",
            "vary": "Origin",
            "x-powered-by": "Express"
          }
        }
      }
    ]
  }
}
@Vapi Support Bot
v
Suggestion: Double-check that your system prompt references the variable using the exact path, like
{{data.dayOfWeek}}
, and that the prompt is updated after the tool call completes. For example:
Copy code
Today is {{data.dayOfWeek}} in {{data.locationName}}.
If the prompt is set before the tool call, it won't have access to the new variable values—ensure the prompt is refreshed or re-evaluated after the tool call as described in the [dynamic variables documentation](https://docs.vapi.ai/assistants/dynamic-variables). Source: - [Dynamic Variables documentation](https://docs.vapi.ai/assistants/dynamic-variables)
t
Hi! I can help troubleshoot why your dynamic variables aren’t rendering in the system prompt. Your API call is working, but references like {{data.dayOfWeek}} remain empty, which often happens if variable mappings aren’t properly linked or the system prompt accesses them before the tool call completes. A key check: are you using the variables in the same turn as the tool call or a later one? I can guide you step-by-step to verify mappings, ensure the prompt updates correctly, and make sure your dynamic data populates as expected. Can you confirm whether you’re referencing the variables immediately or in a following turn? @nfs-avn
k
You can also use dynamic variables to get the current date/time. The whole list is right here: https://docs.vapi.ai/assistants/dynamic-variables#default-variables
n
c
Closing this thread as it is a duplicate. Will respond to the other thread
n
which thread? can you send the link to the thread please? thanks
k
Sorry, just realized this is your thread. The other thread you linked previously was originally from someone else and I thought it was yours. Is this API Request tool being used at the start of the call? If so, you can use the assistantOverrides.variableValues to pass these dynamic variables instead. The assistant-request webhook works only for inbound calls, but passes the assistantOverrides to the assistant smoothly. Can you confirm if you are using this tool for inbound or outbound calls?
2 Views