websocket url not generating
# support
r
hey i using the correct format to send the api request using my private key to generate websocket url for a seesion but tis showing some error like { "message": [ "assistant.property assistantId should not exist" ], "error": "Bad Request", "statusCode": 400 } the format i use curl 'https://api.vapi.ai/call' \ -H 'authorization: Bearer YOUR_API_KEY' \ -H 'content-type: application/json' \ --data-raw '{ "assistant": { "assistantId": "YOUR_ASSISTANT_ID" }, "transport": { "provider": "vapi.websocket", "audioFormat": { "format": "pcm_s16le", "container": "raw", "sampleRate": 16000 } } }' with proper place holder values please resolve this
v
You are getting this error because the API expects
assistantId
at the root level, not inside an
assistant
object.
Try this corrected format:
Copy code
bash
curl 'https://api.vapi.ai/call' \
  -H 'authorization: Bearer YOUR_API_KEY' \
  -H 'content-type: application/json' \
  --data-raw '{
    "assistantId": "YOUR_ASSISTANT_ID",
    "transport": {
      "provider": "vapi.websocket",
      "audioFormat": {
        "format": "pcm_s16le",
        "container": "raw",
        "sampleRate": 16000
      }
    }
  }'
Replace
YOUR_API_KEY
and
YOUR_ASSISTANT_ID
with your actual values. This should resolve the error and generate the WebSocket URL as expected. Reference: [Vapi WebSocket Transport Docs](https://docs.vapi.ai/calls/websocket-transport) Source: - [Vapi WebSocket Transport Docs](https://docs.vapi.ai/calls/websocket-transport)
v
Message marked as helpful by @Rudra! 🎉
r
Thanks a lot 👍
v
Message marked as helpful by @_jerry09_.! 🎉