Speak
POST/workstations/:workstation_id/audio/speak
Play voice audio into the virtual microphone via a text-to-speech model. You must provide the exact copy for the agent to speak. The audio is played in realtime via byte streaming to reduce latency.
Interrupting Speech:
There are two ways to interrupt a speak operation already in progress:
-
Recommended Method: Close the HTTP POST request. The /speak request keeps the connection open while the agent is speaking, and closing this connection will immediately stop the speech. A RST close packet is required to stop the speech.
Note: NodeJS developers should use the socket.resetAndDestroy() method to close the connection via an RST close packet. It is also helpful to pause for 100ms after
socket.resetAndDestroy()
to ensure the RST packet is sent. -
Alternative Method: Make a new /speak request while an existing one is in progress. This will automatically terminate the first request and begin playing the new speech. Note that this approach may cause delays if many interruptions occur in quick succession. This method is good for simple one-off 'emergency' interruptions.
Request
Responses
- 204
- 400
- 401
- 402
- 422
- 429
- 500
- 503
No Content - the operation was successful but there is no additional content to return.
Invalid Request Format - check API documentation for proper syntax.
Unauthorized - missing or invalid API key.
Payment Required - you have run out of trial credits or your payment method has expired. Please add payment details to your account.
Unprocessable Entity - cannot find requested asset associated with your API key.
Too Many Requests - you have exceeded the rate limit for your account. Please wait before making additional requests.
Internal Server Error - please retry your request.
Service Unavailable - our servers have dropped the request due to high load - please retry.