Tool - API Request
# support
d
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... https://cdn.discordapp.com/attachments/1377163612975796365/1377163613181182053/image.png?ex=6837f70f&is=6836a58f&hm=d88375f84c3ded998e846748868aa57c40edba1c3c16ab12d5fb59658d447770&
v
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:
Copy code
json
{
  "type": "object",
  "properties": {
    "content": { "type": "string" }
  }
}
This should resolve the validation issue and let you save the tool. Source: - [API Request Node Documentation](https://docs.vapi.ai/workflows/nodes/api-request)
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:
Copy code
json
{
  "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](https://docs.vapi.ai/workflows/nodes/api-request) - [Changelog: API Request Node](https://docs.vapi.ai/changelog/2025/2/1) - [Custom Tools Guide](https://docs.vapi.ai/tools/custom-tools#understanding-the-tool-structure)
v
Message marked as helpful by @Daco! 🎉
Message marked as helpful by @Daco! 🎉
d
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.
k
Hey Daco, To use APIs with your assistants, you should use custom tools only. It was mistakenly exposed(API Request Node/Tool) under the tools section. Please use custom tools exclusively for now.
d
Thanks mate. Just confirming, with custom tools. Can I do both a GET and POST? For the GET can I define query Params?
m
@Shubham Bajaj so we cant create API request tools anymore?
s
@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
d
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?
Im not able to save the post request
@Shubham Bajaj
What is wrong?
I get the same body error
s
i am getting the same error too, even with the method set to POST
k
Hey @Daco and @Simonding can you share a loom video?
d
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
m
I have the same issue
k
Thanks, last thing can you send me your account email address and tool id?
d
damir@tmc.net 1ab710d2-c53c-48e7-a06e-53c25dc64dbd
k
Weird, just made the tool and it seems to be working fine.
Can you recreate it?
d
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...
k
Marking this ticket as Solved ✅
@Daco you can also reopen the ticket or create a new ticket.
d
Sorry Shubham, if you read my response, you will note the issue is still happening, definitely not solved.
k
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.