error 422?
# support
e
what does it mean failed with status code 422? i got it when test a function endpoint on the vapi dashboard.
v
Hi @ema, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [List Calls]() * [Call Ended Reason]() * [Create Phone Call]() * [Get Call]() -----------------------------
### Answer HTTP status code 422 indicates an "Unprocessable Entity." This means that the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions. For Vapi, this often occurs when the function call parameters do not match the expected schema. You should review the function call parameters to ensure they conform to the required schema. Here is an example error reported from a similar issue:
Copy code
json
{
  "message": "Invalid schema for function 'PlaceTakeoutOrder': In context=('properties', 'items'), array schema missing items",
  "type": "invalid_request_error",
  "param": null,
  "code": null
}
[(1)]() Make sure your function's parameters are correctly structured and all required fields are included.
e
how can i run the options request from the vapi dashboard, is it by giving my json data ?
v
Thanks for the follow-up, @ema. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Server Events]() * [Get Call]() * [Outbound Calls from Python]() * [Prompting Guide]() -----------------------------
### Answer To run an OPTIONS request from the Vapi dashboard, you typically use the HTTP method to retrieve information about the communication options available for a target resource. This is generally used to check the allowed methods, headers, and other parameters. However, the Vapi dashboard primarily supports creating and managing assistants, setting up calls, and configuring your Vapi environment. You might not directly run an OPTIONS request through the dashboard itself. If you're working programmatically, you could use tools like cURL or Postman to send an OPTIONS request. Here's an example using cURL:
Copy code
bash
curl -X OPTIONS https://api.vapi.ai/your-endpoint \
  -H "Authorization: Bearer <your-token>"
Replace
"https://api.vapi.ai/your-endpoint"
with the actual endpoint you want to query and
"<your-token>"
with your Vapi authorization token. For more information about setup and configuration, you can refer to the Vapi documentation [(1)]() , [(2)]() .
e
can i test a call function elsewhere the dashboard ?
v
Thanks for the follow-up, @ema. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Get Call]() * [Setting Server URLs]() * [Function API Call Syntax]() * [Function calls used to work fine for me, but now they NEVER work]() -----------------------------
### Answer Yes, you can test a call function outside the Vapi dashboard by using the Vapi API. You can make function calls via code in languages such as Python or JavaScript, or by using tools like Postman or cURL. For instance, you can set the server URL for a function call via the API as follows:
Copy code
python
import requests

url = "https://api.vapi.ai/assistants/{assistantId}/functions/{functionId}"
headers = {
    "Authorization": "Bearer <your_access_token>",
    "Content-Type": "application/json"
}
payload = {
    "serverUrl": "https://your-server-url.com"
}

response = requests.put(url, headers=headers, json=payload)
print(response.json())
Replace
"{assistantId}"
,
"{functionId}"
, and
"<your_access_token>"
with your actual assistant ID, function ID, and access token, respectively. This example updates the server URL for a function call [(1)]() .