[BUG REPORT] PATCH Tool API: "type" Field Causes E...
# support
k
Hi VAPI TEAM 👋, I’ve been working on a PATCH request to update a tool via the Vapi API. According to the docs, the "type" field is supported, so I initially tried this cURL: curl -X PATCH https://api.vapi.ai/tool/c66414dd-4fb7-4e5f-a53c-591ba7ecf241 \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "type": "sms", "function": { "name": "usmadin", "description": "usmadin" }, "messages": [ { "type": "request-complete", "content": "let me check" } ] }' But this throws an error related to "type" not being valid. My Fix: Removing the "type" field entirely worked! Here's the corrected version that works perfectly: curl -X PATCH "https://api.vapi.ai/tool/2e5d717b-96bb-4d37-b830-8738efeb2223" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "type": "request-complete", "content": "Thank you! I have sent you the updated booking link via SMS." } ], "function": { "name": "SMS_Tool_For_Sending_Booking_Links", "description": "When lead shows interest Message: Hi! Here is your updated booking link" }, "metadata": { "from": "+16672269325" } }' Suggestion: Either update the docs to reflect the current working format, or fix the "type" field behavior in the API if it's still meant to be supported.
c
Hi Kavish, To update a tool via the PATCH request in the Vapi API, ensure that the request body adheres to the expected format. The "type" should correspond to a valid tool type and might require specific properties for that type. Here's a simplified example based on the [updating tool documentation](https://docs.vapi.ai/api-reference/tools/update):
Copy code
bash
curl -X PATCH https://api.vapi.ai/tool/c66414dd-4fb7-4e5f-a53c-591ba7ecf241 \
     -H "Authorization: Bearer <your-token>" \
     -H "Content-Type: application/json" \
     -d '{
       "type": "sms",
       "function": {
         "name": "usmadin",
         "description": "usmadin"
       },
       "messages": [
         {
           "type": "request-co"
         }
       ]
     }'
Ensure the "type" field value matches one of the supported tool types and includes all required fields for that type. Adjust your JSON structure if needed, especially for "function" and "messages" attributes. If you are still encountering issues, double-check that the token and URL are correct and the request parameters conform to the API specifications.
3 Views