fascinating-indigo
fascinating-indigo4mo ago

Tool - API Request

Is the "API Request" Tool new or a work in progress? I was using a function to send data to a cloud function and then handle the business logic there but have seen that there is an API request tool now. Is it appropriate to use the API request tool in place of a function? I'm getting the below odd behaviour when trying to even save the tool...
No description
22 Replies
Vapi Support Bot
The API Request tool is a supported feature and can often replace a function for direct API calls.
To fix the "body:type: Invalid literal value, expected 'object'" error, define your request body as a JSON object schema, like this:
{
"type": "object",
"properties": {
"content": { "type": "string" }
}
}
{
"type": "object",
"properties": {
"content": { "type": "string" }
}
}
This should resolve the validation issue and let you save the tool. Source: - API Request Node Documentation
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
Vapi Support Bot
The API Request tool is a new, fully supported feature that replaces the old HttpRequest node and is appropriate for making direct HTTP calls within your workflow. If you see the error "body:type: Invalid literal value, expected 'object'", ensure your request body is a valid JSON object. For example:
{
"content": "your message"
}
{
"content": "your message"
}
Tip: Use the API Request tool for simple API calls; for complex business logic, a function or cloud function may still be preferable. Sources: - API Request documentation - Changelog: API Request Node - Custom Tools Guide
Duckie
Duckie4mo ago
Message marked as helpful by @Daco! 🎉 Message marked as helpful by @Daco! 🎉
fascinating-indigo
fascinating-indigoOP4mo ago
This isn't the case when using the Function tool in the web interface, you define the parameter and it's content, not a JSON object schema like you provided.
fascinating-indigo
fascinating-indigoOP4mo ago
Hi, still can't save the "API Request" tool, from within then web gui. is this a bug?
No description
fascinating-indigo
fascinating-indigoOP4mo ago
Thanks mate. Just confirming, with custom tools. Can I do both a GET and POST? For the GET can I define query Params?
broad-brown
broad-brown4mo ago
@Shubham Bajaj so we cant create API request tools anymore?
wise-white
wise-white4mo ago
@Daco @Marcos Please Ignore My last Message. @Marcos @Daco The main issue is that you're using a GET request method but have configured a request body with properties. GET requests don't typically use request bodies, and the validation error suggests the body type configuration is incorrect for your intended use case. Two possible fixes depending on your intent: ### Option 1: If you need to send data (recommended) - Change HTTP Method from GET to POST - Keep your request body configuration as is - The body type should automatically resolve to "object" when you have properties defined ### Option 2: If this should be a GET request - Remove the entire Request Body section - Use URL parameters or headers instead for any data you need to send - GET requests should not have request bodies Step-by-step implementation: 1. For POST request (Option 1): - Change the HTTP Method dropdown from "GET" to "POST" - Add a Content-Type: application/json header if not already present - Your existing message property configuration should work correctly 2. For GET request (Option 2): - Keep GET method - Remove the "message" property from the Request Body section - If you need to send the message, add it as a URL parameter instead
fascinating-indigo
fascinating-indigoOP4mo ago
Doh, that seems so obvious, I hadn't changed it to a POST! Thanks heaps for your help, will try again soon Last question hopefully, is it possible to pass URL Params for get request? Or dynamically change the URI?
broad-brown
broad-brown4mo ago
No description
broad-brown
broad-brown4mo ago
Im not able to save the post request @Shubham Bajaj What is wrong? I get the same body error
probable-pink
probable-pink4mo ago
i am getting the same error too, even with the method set to POST
Sahil
Sahil4mo ago
Hey @Daco and @Simonding can you share a loom video?
fascinating-indigo
fascinating-indigoOP3mo ago
Hi Shubham, just got back into work today, trying to get a simple POST working but i just can't save the tool? Here is a loom example https://www.loom.com/share/026823e355ae40ff866079169bf4a33f?sid=2ea531d9-c17f-4435-9473-8de0ca296d3e
broad-brown
broad-brown3mo ago
I have the same issue
Sahil
Sahil3mo ago
Thanks, last thing can you send me your account email address and tool id?
fascinating-indigo
fascinating-indigoOP3mo ago
damir@tmc.net 1ab710d2-c53c-48e7-a06e-53c25dc64dbd
Sahil
Sahil3mo ago
Weird, just made the tool and it seems to be working fine. https://www.loom.com/share/ab7981d4a8d24cb194eb254ba7b07515 Can you recreate it?
fascinating-indigo
fascinating-indigoOP3mo ago
Hey Sahil, yes very weird. I've just gone to that same tool, that had the default settings pointing to vapi and hit "save" - it worked to my surprise. However, i think went and changed the name to "GetBookingAvailability" set the endpoint to a custom ngrok endpoint. set body param String date default value of '2025-06-04" required. hit save and get the toast popup saying error...
Sahil
Sahil3mo ago
Marking this ticket as Solved ✅ @Daco you can also reopen the ticket or create a new ticket.
fascinating-indigo
fascinating-indigoOP3mo ago
Sorry Shubham, if you read my response, you will note the issue is still happening, definitely not solved.
Sahil
Sahil3mo ago
Hey, I read your last message, but it looks like it was resolved. My understanding could be incorrect. Could you please rephrase your issue, and then help me out with these steps to reproduce a current issue so I can eventually help you out. I apologize for misunderstanding your message.

Did you find this page helpful?