Receiving 400 on Vapi webhook
# support
t
Hey Vapi Team, A fellow waterloo Alum and and co-founder of Keyflow (https://keyflow.space) here. We are trying to build an integration for Vapi in our AI workflow automation platform so users can build voice assistants on Vapi and connect it to other system of records like CRMs, email inbox, etc. We constantly keep getting this error when Vapi sends us a webhook back. We have an
https://
url and yet it asks us to send a valid
https://
or
wss://
url. Can someone please assist us on what is going on here. Not really sure what the issue is.
Copy code
Status code: 400 Body: { "message": [
"assistantOverrides.server.url must be al valid URL. Hot tip, the protocol should be https:// or wss://, but found https://keyflow-
backend-62hevvkvea-
uc.a.run.app/api/trigger/vapi/webhook" ],
"error": "Bad Request", "statusCode": 400 }.
https://cdn.discordapp.com/attachments/1350125273806536745/1350125274125176842/Screenshot_2025-03-14_at_10.27.11_AM.png?ex=67d599a5&is=67d44825&hm=7e68b86e4c44abc7e530a1bc2946511895e79c58e97b0bf049f339a56a4ff843&
v
Hi there, fellow Waterloo alum! 👋 I can see what's happening with your webhook URL. Looking at the error message, I noticed your URL appears to have line breaks in it:
Copy code
https://keyflow-
backend-62hevvkvea-
uc.a.run.app/api/trigger/vapi/webhook
This is likely causing the validation error. The URL needs to be a single continuous string without any breaks or special characters. Try updating your webhook URL to:
Copy code
https://keyflow-backend-62hevvkvea-uc.a.run.app/api/trigger/vapi/webhook
When configuring webhooks in Vapi, remember: 1. URLs must be publicly accessible 2. Only
https://
or
wss://
protocols are accepted 3. The server URL follows a specific order of precedence:
assistant.server.url
phoneNumber.serverUrl
org.serverUrl
If you're still experiencing issues after fixing the URL format, you might want to try manually testing your webhook endpoint with a tool like Postman or cURL to verify it's accessible and responding correctly. Let me know if this helps resolve your issue! Sources: - [Accepted protocols and URL formats for configuring webhooks in Vapi](https://docs.vapi.ai/server-url) - [Common causes of a 400 Bad Request error when Vapi sends a webhook](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1343699958874787896) - [How to troubleshoot and resolve URL validation errors for Vapi webhooks](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336345690393149452)
e
Any more updates?
k
Hey! To help track down this issue, could you share: - The call ID This would really help us figure out what went wrong!
s
@trillhouse An reminder message to continue this thread if we didn't receive any further response then eventually we have to mark this thread to be closed. So please reply back with a required call ID.
t
@User Sure, let me find the call id
@Shubham Bajaj I just tried calling the
getCall
API and i got the same 400 error, but I can't see
callID
or the failed logs in API logs, so not sure how to get you the
callId
Since the error is happening when its trying to call
getCall
endpoint, I don't have access to
callId
. I am curious as to why I can't see any API logs for the API calls I am making in API Logs page
We are using the following version of the SDK "@Vapi-ai/server-sdk": "^0.4.0"
Still can't find call ID since we don't have receive any call ID from the API request
@Shubham Bajaj plz let me know if this is helpful^?
s
@trillhouse I can see there's an issue with your VAPI API call. Looking at the error message and request data, I've identified the problem. The error is occurring because there's a leading space in the
assistantOverrides.server.url
field. In your request body, the URL is:
Copy code
json
"url": " https://keyflow-backend-62hevvkvea-uc.a.run.app/api/trigger/vapi/webhook"
Notice there's a space character at the beginning of the URL, before "https://". The validation is failing because it's expecting a valid URL that starts with either "https://" or "wss://", but instead it's finding " https://" (with a leading space). To fix this issue, you need to remove the leading space from the URL value in your request, so it should be:
Copy code
json
"url": "https://keyflow-backend-62hevvkvea-uc.a.run.app/api/trigger/vapi/webhook"
Leading or trailing whitespace in URL fields often causes validation issues like this, especially in JSON payloads where every character is significant.
🔴 11:23:47:590 POST /call, BadRequestException 400 Response: { "message": [ "assistantOverrides.server.url must be a valid URL. Hot tip, the protocol should be https:// or wss://, but found https://keyflow-backend-62hevvkvea-uc.a.run.app/api/trigger/vapi/webhook" ], "error": "Bad Request", "statusCode": 400 } Request: { "body": { "assistantOverrides": { "artifactPlan": { "recordingEnabled": true, "transcriptPlan": {"enabled": true, "assistantName": "Outbound"} }, "serverMessages": ["end-of-call-report"], "server": { "url": " https://keyflow-backend-62hevvkvea-uc.a.run.app/api/trigger/vapi/webhook", } }, }
@trillhouse Let me know after making a change how it goes for you.
t
🤦‍♂️ that was a stupid error on our part. Thanks @User for the help. Appreciate it
2 Views