Base URL
The production API base URL is:Authentication header
Send the API key in thex-api-key header:
multipart/form-data. When using curl -F, do not manually set the multipart Content-Type; curl adds the required boundary automatically.
x-api-key. A dashboard JWT cannot replace an external API key.Choose the correct API
Agent API
An Agent API key is associated with a specific Valuez agent. That agent supplies the model, prompt, knowledge base, language configuration, voice, and transcriber used by the request.Unified agent endpoint
Requirements applied to every agent request
Before processing a request, Valuez checks:- The API key is present.
- The key format is valid.
- The key exists and is active.
- The key is associated with an agent.
- The individual key credit limit has not been exceeded.
- The account has an active subscription.
- The subscription includes integrations.
- The API key permits the requested communication mode.
- Voice access is available for STT, TTS, or STS requests.
- Sufficient account credits are available.
- The configured agent has the required model, knowledge, voice, and transcription settings.
403 if the requested mode is disabled for that key or unavailable under the current subscription.
Text-to-Text
Text-to-Text sends a question to the configured agent and returns an answer as text. Typical use cases include:- website chat;
- CRM assistants;
- internal support tools;
- messaging integrations;
- server-side automation;
- testing agent knowledge.
Synchronous request
A synchronous request returns the complete answer in one response.input.text:
TTT request parameters
Example synchronous response
The exact response can include additional fields depending on the deployed version.sessionUUID if the user is expected to continue the same conversation.
Streaming Text-to-Text
SetresponseMode to "stream" to receive Server-Sent Events.
Streaming client requirements
Your client should:- keep the HTTP connection open;
- process each
data:event; - preserve the returned
sessionUUID; - concatenate text in received order;
- detect normal completion;
- handle connection interruption;
- avoid automatically replaying a non-idempotent user message without confirming whether it was processed.
Continue an existing conversation
Pass the previously returnedsessionUUID:
Retrieve conversation history
Use the history endpoint to restore a conversation after a refresh or application restart.Example response
Speech-to-Text Agent Interaction
STT mode accepts user audio, transcribes it, sends the transcription to the configured agent, and returns the agent’s text response. The agent must have:- a configured transcription provider;
- a valid transcription model;
- a connected knowledge base;
- a configured language supported by the selected provider;
- permission for Speech-to-Text;
- a subscription with voice access.
Upload an audio file
Content-Type: multipart/form-data when using curl -F. Curl generates the multipart boundary automatically.Submit Base64 audio
Submit an audio URL
STT response
A successful response can include both the transcription and the agent answer:Text-to-Speech Agent Interaction
TTS mode sends a text question to the configured agent and returns the agent’s generated response as audio. This is different from the standalone TTS endpoint. Agent TTS first generates an answer using the agent’s prompt and knowledge base, then synthesizes that answer using the agent’s saved voice.audio/wav or another configured audio content type.
The conversation UUID can be returned through:
Content-Type before treating the body as audio. An error response can be JSON rather than an audio file.
Speech-to-Speech
STS initializes a real-time duplex voice session. The HTTP endpoint performs the handshake and returns a WebSocket URL.Create the STS session
responseMode: "realtime" is treated as an STS request.
Example handshake response
Connect to the WebSocket
Connect to the exactwsUrl returned by the handshake. Do not construct the URL manually when the response provides one.
The current runtime instructs the client to send a start message after connection:
Client responsibilities
A production STS client should handle:- WebSocket connection and reconnection;
- authentication and session initialization;
- binary audio framing;
- supported sample rate and encoding;
- microphone permission;
- playback buffering;
- interruption and barge-in;
- server processing and error messages;
- clean session completion;
- network timeout and retry policy.
Standalone Speech APIs
Standalone speech endpoints use an external speech key. They do not run an agent prompt, query an agent knowledge base, or maintain an agent conversation.External key configuration
An external speech key stores its selected:- STT provider;
- STT model;
- TTS provider;
- TTS voice or model;
- individual credit limit;
- used-credit total;
- active status.
ext_api_... format is supported for compatibility.
Standalone Text-to-Speech
TTS parameters
text, language, and optional pace. The older documentation fields pitch and volume are not accepted by the current validation schema.language field does not override the saved Ganas voice.
TTS response
The response is a binary attachment:application/octet-stream.
TTS errors
Standalone Speech-to-Text
STT parameters
Example STT response
STT errors
Generate an API Key
API keys are created from APIs and Integrations in the Valuez dashboard.Generate an Agent API key
Open Integrations
Create an API integration
Select an agent
Configure permissions
Set a credit limit
Generate and store the key
Test the key
Generate an external speech key
Open external speech integration
Name the key
CRM Production Speech.Select STT configuration
Select TTS configuration
Set the credit limit
Save the generated secret
API Usage Logs
The Valuez dashboard provides Speech API History for standalone STT and TTS requests. Authorized dashboard users can filter logs by:- external key;
- date range;
- action type;
- search text;
- page number and page size.
Error Handling
Common HTTP statuses
Example JSON error
message field instead:
errorMessage and message.
Retry guidance
Automatically retry only when:- the operation is safe to repeat;
- the server returned a transient failure;
- the client uses bounded exponential backoff;
- the request is not already being processed.
Security Best Practices
Keep API keys on trusted servers
Keep API keys on trusted servers
Use one key per application and environment
Use one key per application and environment
Enable only required modes
Enable only required modes
Use individual credit limits
Use individual credit limits
Never log complete keys
Never log complete keys
Rotate compromised keys
Rotate compromised keys
Protect session identifiers
Protect session identifiers
Validate downloaded audio responses
Validate downloaded audio responses
Content-Type before saving a response as audio. A JSON error saved as .wav is not a valid audio file.Production Checklist
Before enabling production traffic:- The key is stored in a secret manager.
- Development and production use separate keys.
- The key is associated with the correct agent or speech configuration.
- Only required communication modes are enabled.
- A suitable per-key credit limit is configured.
- The account has an active subscription and sufficient credits.
- Text-to-Text sync has been tested.
- Streaming behavior has been tested if used.
- Audio format and language have been tested.
- Session continuation has been tested.
- WebSocket reconnection has been tested for STS.
- Errors and rate limits are handled safely.
- Logs redact credentials and sensitive customer data.
- Monitoring and key-rotation ownership are assigned.