Not able to set tool to async
# support
b
curl -Method Post "https://api.vapi.ai/tool"
Copy code
-Headers @{
    "Content-Type" = "application/json"
    "Authorization" = "my-auth-id"
  }
-Body '{ "tools": [ { "toolId": "your-tool-id-1", "async": true } ] }' But it is returning following error curl : {"message":["property tools should not exist","type must be one of the following values: dtmf, endCall, transferCall, transferCancel, transferSuccessful, handoff, output, voicemail, query, sms, function, mcp, apiRequest, code, bash, computer, textEditor, google.calendar.event.create, google.calendar.availability.check, google.sheets.row.append, slack.message.send, gohighlevel.calendar.event.create, gohighlevel.calendar.availability.check, gohighlevel.contact.create, gohighlevel.contact.get, make, ghl","type must be a string"],"error":"Bad Request","statusCode":400} At line:1 char:1 + curl -Method Post "https://api.vapi.ai/tool" ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc eption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
v
Your request is failing because the API expects a single tool object, not a "tools" array. Here’s the correct format to create a custom async tool:
Copy code
powershell
curl -Method Post "https://api.vapi.ai/tool" `
  -Headers @{
    "Content-Type" = "application/json"
    "Authorization" = "Bearer 06788ce6"
  } `
  -Body '{
    "type": "function",
    "function": {
      "name": "your_tool_name",
      "description": "Describe your tool",
      "parameters": {
        "type": "object",
        "properties": {
          "param1": {
            "type": "string",
            "description": "Parameter description"
          }
        },
        "required": ["param1"]
      }
    },
    "server": {
      "url": "https://your-server-endpoint.com/webhook"
    },
    "async": true
  }'
Replace the placeholders with your actual tool details. This should resolve the error and enable async mode as needed. Sources: - [Custom tools troubleshooting](https://docs.vapi.ai/tools/custom-tools-troubleshooting) - [Tools calling](https://docs.vapi.ai/tools-calling)
b
but my took already exists, so i dont want to create it again instead only want to change a property
c
Hi baadshah2, To update a property of an existing tool instead of creating a new one, you should use the update endpoint. The error you're encountering is due to providing an incorrect JSON structure with a "tools" array, which is not supported for updates. Here's how you can update a property using the correct format:
Copy code
powershell
curl -Method Patch "https://api.vapi.ai/tool/your-tool-id" `
  -Headers @{
    "Content-Type" = "application/json"
    "Authorization" = "Bearer YOUR_AUTH_ID"
  } `
  -Body '{
    "async": true
  }'
Replace
your-tool-id
with the actual ID of the tool you want to update and adjust any other properties you need to change. Ensure the endpoint specifies the existing tool ID for updating properties. For more detailed information, you can refer to the [Tools Update documentation](https://docs.vapi.ai/api-reference/tools/update).
2 Views