Request Body API Tool Error
# support
b
Hi there, I want some help with creating a custom API tool, Im trying to link it to my google sheets. I have the correct endpoint, but I cant request body I want name,email,phone as the properties but it doesnt let me and keeps giving me a Form has validation errors: body.type: Invalid literal value, expected "object" Can you please help, I saw on another thread it said I needed a body thats an object? I tried this but it doesnt work, when I try put name,email,phone as type:string it doesnt work Nothing works, please help https://cdn.discordapp.com/attachments/1377624960167579648/1377624960360775680/image.png?ex=6839a4b9&is=68385339&hm=65196798cffe66ad4a47011cc476fccd5d2aebca49ad5b29fd9e084712ffc2e9&
v
To fix the "body.type: Invalid literal value, expected 'object'" error, define your request body schema like this:
Copy code
json
{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  },
  "required": ["name", "email", "phone"]
}
Enter this as your request body schema (not nested under a "body" property), and it should resolve the validation error. Source: - [Custom Tools Documentation](https://docs.vapi.ai/tools/custom-tools)
To fix the "body.type: Invalid literal value, expected 'object'" error, define your request body schema like this:
Copy code
json
{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  },
  "required": ["name", "email", "phone"]
}
Enter this as your request body schema (not nested under a "body" property), and it should resolve the validation error. Source: - [Custom Tools Documentation](https://docs.vapi.ai/tools/custom-tools)
To fix the "body.type: Invalid literal value, expected 'object'" error, define your request body schema like this:
Copy code
json
{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  },
  "required": ["name", "email", "phone"]
}
Enter this as your request body schema (not nested under a "body" property), and it should resolve the validation error. Source: - [Custom Tools Documentation](https://docs.vapi.ai/tools/custom-tools)
To fix the error, define your request body schema as a top-level object with your properties, like this:
Copy code
json
{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  }
}
**Do not nest these under a "body" property**—just use the structure above. This should resolve the validation error you’re seeing. See the [Vapi custom tools guide](https://docs.vapi.ai/tools/custom-tools) for more details. Source: - [Custom Tools | Vapi Documentation](https://docs.vapi.ai/tools/custom-tools)
To fix the error, define your request body schema as a top-level object with your properties, like this:
Copy code
json
{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  }
}
**Do not nest these under a "body" property**—just use the structure above. This should resolve the validation error you’re seeing. See the [Vapi custom tools guide](https://docs.vapi.ai/tools/custom-tools) for more details. Source: - [Custom Tools | Vapi Documentation](https://docs.vapi.ai/tools/custom-tools)
To fix the error, define your request body schema as a top-level object with your properties, like this:
Copy code
json
{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  }
}
**Do not nest these under a "body" property**—just use the structure above. This should resolve the validation error you’re seeing. See the [Vapi custom tools guide](https://docs.vapi.ai/tools/custom-tools) for more details. Source: - [Custom Tools | Vapi Documentation](https://docs.vapi.ai/tools/custom-tools)
It looks like the error is due to the request body not being structured as a proper JSON object. Try defining your properties like this (not nested under "body" unless required):
Copy code
json
"parameters": {
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  }
}
If your API expects a "body" property, then "body" itself should be an object with its own "properties". Could you clarify if your API endpoint expects the data inside a "body" property, or should "name", "email", and "phone" be at the root of the JSON payload? This will help me provide the exact schema you need. For more details, see the [Vapi Custom Tools documentation](https://docs.vapi.ai/tools/custom-tools#understanding-the-tool-structure). Source: - [Vapi Custom Tools documentation](https://docs.vapi.ai/tools/custom-tools#understanding-the-tool-structure)
It looks like the error is due to the request body not being structured as a proper JSON object. Try defining your properties like this (not nested under "body" unless required):
Copy code
json
"parameters": {
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  }
}
If your API expects a "body" property, then "body" itself should be an object with its own "properties". Could you clarify if your API endpoint expects the data inside a "body" property, or should "name", "email", and "phone" be at the root of the JSON payload? This will help me provide the exact schema you need. For more details, see the [Vapi Custom Tools documentation](https://docs.vapi.ai/tools/custom-tools#understanding-the-tool-structure). Source: - [Vapi Custom Tools documentation](https://docs.vapi.ai/tools/custom-tools#understanding-the-tool-structure)
Try this JSON schema for your request body:
Copy code
json
{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  },
  "required": ["name", "email", "phone"]
}
Make sure you are not nesting these fields under a
body
property unless your API specifically requires it. This should resolve the "expected 'object'" error and let you send the correct data structure to your endpoint. Source: - [Custom Tools Documentation](https://docs.vapi.ai/tools/custom-tools)
It looks like the error is due to the request body not being structured as a proper JSON object. Try defining your properties like this (not nested under "body" unless required):
Copy code
json
"parameters": {
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  }
}
If your API expects a "body" property, then "body" itself should be an object with its own "properties". Could you clarify if your API endpoint expects the data inside a "body" property, or should "name", "email", and "phone" be at the root of the JSON payload? This will help me provide the exact schema you need. For more details, see the [Vapi Custom Tools documentation](https://docs.vapi.ai/tools/custom-tools#understanding-the-tool-structure). Source: - [Vapi Custom Tools documentation](https://docs.vapi.ai/tools/custom-tools#understanding-the-tool-structure)
Try this JSON schema for your request body:
Copy code
json
{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "email": { "type": "string" },
    "phone": { "type": "string" }
  },
  "required": ["name", "email", "phone"]
}
Make sure you are not nesting these fields under a
body
property unless your API specifically requires it. This should resolve the "expected 'object'" error and let you send the correct data structure to your endpoint. Source: - [Custom Tools Documentation](https://docs.vapi.ai/tools/custom-tools)
c
Hey, really sorry for your experience. If possible, could you record a loom video describing this error/behavior or inconsistency in the dashboard with the steps to reproduce it? That way, I can share this with my team, and we'll take a look. We'll even try to reproduce the same so we can fix it for you. Also, I'll request you to share your tool ID.
4 Views