eastern-cyan
eastern-cyan3h ago

variable in api tool

I believe I have set this up correctly but the variable in my api request tool url will not populate the dynamic data. I am successfully setting the variable from the HTTP request which initiates the call. I can successfully query the get URL value when I hard code a static value into the URL. But the moment I add the variable to the URL it doesn't recognize it and sends the literal variable text to the GET URL which returns nothing.
No description
2 Replies
Vapi Support Bot
Try this:
Make sure your API tool defines the variable in the body schema, even for GET requests. For example:
{
"type": "apiRequest",
"name": "getHistory",
"url": "https://rnogrvgymqipnmwgxjmp.supabase.co/rest/v1/n8n_chat_histories_maverick?select=*&ten_digit=eq.{{ten_digit}}&limit=20",
"method": "GET",
"body": {
"type": "object",
"properties": {
"ten_digit": {
"description": "The ten digit phone number",
"type": "string"
}
},
"required": ["ten_digit"]
}
}
{
"type": "apiRequest",
"name": "getHistory",
"url": "https://rnogrvgymqipnmwgxjmp.supabase.co/rest/v1/n8n_chat_histories_maverick?select=*&ten_digit=eq.{{ten_digit}}&limit=20",
"method": "GET",
"body": {
"type": "object",
"properties": {
"ten_digit": {
"description": "The ten digit phone number",
"type": "string"
}
},
"required": ["ten_digit"]
}
}
This ensures {{ten_digit}} is recognized and replaced in your URL.
Check your tool config and redeploy if needed.
(Source: information found in the Default Tools documentation)
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
eastern-cyan
eastern-cyanOP3h ago
Okay, trying now. That worked! Needed to set the request body even for a get. Thanks!

Did you find this page helpful?