Complete REST API & WebSocket documentation for Vocred
All API requests require a JWT token in the Authorization header. Include your API key as the Bearer token.
curl -X GET "https://api.vocred.ai/v1/agents" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Events sent between the client and server during a voice session over wss://api.vocred.ai/ws/voice
| Direction | Event | Description |
|---|---|---|
| server → client | ready | Voice session is ready. Server sends session config. |
| server → client | transcript | Real-time speech-to-text transcript from the user. |
| server → client | response_text | Full AI response text when generation completes. |
| server → client | response_text_chunk | Streaming chunk of AI response text. |
| server → client | audio | Full audio response (base64-encoded). |
| server → client | audio_stream | Binary audio stream chunk (raw PCM16). |
| server → client | audio_end | Signals end of audio response. |
| server → client | session_ended | Voice session has ended with reason. |
| server → client | interrupt | User interruption detected; server stops playback. |
| server → client | clear_audio | Clear audio playback buffer. |
| server → client | error | Server-side error occurred. |
| client → server | audio | User microphone audio (base64-encoded PCM16). |
| client → server | audio_binary | User microphone audio as raw binary PCM16. |
| client → server | interrupt | Client-side interrupt signal (user barge-in). |
| client → server | end_call | Request to end the voice session. |
llama-3.1-8b-instant, llama-3.3-70b-versatile, mixtral-8x7b-32768gpt-4o, gpt-4o-mini, gpt-4-turbogemini-1.5-flash, gemini-1.5-proclaude-3-haiku, claude-3-sonnetllama-3.1-8b, llama-3.3-70bJenny, Guy, Neerja, Swara, 100+ voicesEleven Turbo v2, Eleven Multilingual v2Sonic (ultra-fast)50+ neural voicesNova-2, Whisper| Code | Error | Description |
|---|---|---|
| 400 | Bad Request | Invalid request parameters or body |
| 401 | Unauthorized | Missing or invalid JWT token |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource does not exist |
| 409 | Conflict | Resource already exists (e.g., duplicate name) |
| 422 | Unprocessable Entity | Validation error in request body |
| 429 | Too Many Requests | Rate limit exceeded. Retry after 60s. |
| 500 | Internal Server Error | Something went wrong on our end |
| 502 | Bad Gateway | Upstream provider (LLM/STT/TTS) unavailable |
| 503 | Service Unavailable | Service temporarily down for maintenance |
Install the official Vocred SDK for programmatic access to all API endpoints.
npm install vocred-sdkimport { Vocred } from 'vocred-sdk'
const vocred = new Vocred({ apiKey: 'YOUR_API_KEY' })
// List agents
const agents = await vocred.agents.list()
// Create agent
const agent = await vocred.agents.create({
name: 'Support Bot',
systemPrompt: 'You are a helpful agent...',
voiceProvider: 'edge-tts',
llmProvider: 'groq',
})
// Start a voice call
const call = await vocred.calls.create({
to: '+919999999999',
agentId: agent.id,
})