Websocket transport call error : assistant.propert...
# support
s
I'm currently trying to use this : https://docs.vapi.ai/calls/websocket-transport in my javascript bun backend. whatever I do, I cannot successfully get the websocketCallUrl to initiate a websocket connection. I keep getting error :
Copy code
{"message":["assistant.property assistantId should not exist","transport.audioFormat.an unknown value was passed to the validate function"],"error":"Bad Request","statusCode":400}%
With this request :
Copy code
curl 'https://api.vapi.ai/call' \
  -H 'authorization: Bearer MY_VALID_VAPI_PRIVATE_KEY' \
  -H 'content-type: application/json' \
  --data-raw '{
    "assistant": { "assistantId": "MY_VALID_ASSISTANT_ID" },
    "transport": {
      "provider": "vapi.websocket",
      "audioFormat": {
        "format": "pcm_s16le",
        "container": "raw",
        "sampleRate": 16000
      }
    }
  }'
I'm aiming to do that in my server backend now, since for my client frontend I am absolutely stuck not being able to overcome a bug for which Vapi did not follow up. post about it : https://discord.com/channels/1211482211119796234/1361269676075647047 _ now, regarding the websocket error I'm getting, am I misunderstanding something or? I'm litterally following the doc to the letter. Thanks in advance.
v
Based on the error message, you need to modify your JSON payload. The issue is that you're nesting
assistantId
inside an
assistant
object, but it should be at the top level instead:
Copy code
json
{
  "assistantId": "MY_VALID_ASSISTANT_ID",
  "transport": {
    "provider": "vapi.websocket",
    "audioFormat": {
      "format": "pcm_s16le",
      "container": "raw",
      "sampleRate": 16000
    }
  }
}
This should resolve the first error according to Vapi's validation requirements. Source: - [Discord discussion about assistantId error](https://discord.com/channels/1211482211119796234/1336765707760963676)
k
Your error is due to incorrect JSON: assistant should be a string (not an object), and your audioFormat is likely valid, but malformed data structure triggers the validator, correcting assistant to just "assistant": "YOUR_ASSISTANT_ID" should fix it.
3 Views