Docs / API reference

API reference 10 endpoints Agents & voices

Agents, quick test, translation and TTS

Create and update receptionists, run Quick test conversation turns, pre-warm audio responses, translate text and synthesize MP3 speech.

Agents

POST /api/agents Session required · 201 Created

Creates a new receptionist agent. Agents are listed via GET /api/bootstrap.

FieldTypeDefault / Rules
namestringRequired, 1 to 80 chars.
rolestringDefault "AI receptionist".
languagesstring[]Default ["Hindi", "English"]. Non-empty on patch.
voicestringDefault "neural:hi-IN-SwaraNeural".
greetingstringDefault "".
greeting_languagestringDefault "Hindi".
tonestring"casual" (default) or "formal".
instructions, transfer_numberstringDefault "".
statusstring"draft" (default), "live", or "paused".
curl -s -b cookies.txt -X POST https://dhvani.aware.co.in/api/agents \
  -H "Content-Type: application/json" \
  -d '{"name":"Clinic Desk","languages":["Hindi","English"],"tone":"formal"}'
PATCH /api/agents/{agent_id} Session required · 200 OK

Partially updates only the submitted fields. Returns 404 if missing or 422 on invalid status, tone or empty required fields.

DELETE /api/agents/{agent_id} Session required · 204 No Content

Deletes the agent. Existing call logs are preserved. Pass ?keep_notes=true to retain agent-specific knowledge notes for all agents instead of deleting them.

Quick test and pre-warming

POST /api/agents/{agent_id}/test Session required · 200 OK

Evaluates one caller turn in Quick test mode using the agent's greeting, tone and knowledge notes, localized to language.

Request fieldTypeNotes
messagestringRequired, 1 to 2000 chars.
languagestringTarget reply language, default "English".
greetingbooleanIf true, returns the localized opening greeting.
curl -s -b cookies.txt -X POST https://dhvani.aware.co.in/api/agents/agent-front-desk/test \
  -H "Content-Type: application/json" \
  -d '{"message":"What are your AC inspection charges?","language":"Hindi"}'
{
  "reply": "...",
  "source": "Services and pricing",
  "source_language": "English",
  "mode": "retrieval",
  "translated": true,
  "language": "Hindi",
  "tone": "casual"
}
POST /api/agents/{agent_id}/warm Session required · 202 Accepted

Pre-warms translations and voice audio for the agent's greeting, top knowledge notes and fallback responses in the background so browser test playback starts immediately.

{"language": "Hindi", "voice": "hi-IN-SwaraNeural"}

Translation and text-to-speech

POST /api/translate Session required · 200 OK

Translates text (1 to 5000 chars) into language (Hinglish returns unchanged). Returns translation_unavailable: true if translation could not be completed.

{"text": "We open at 9 AM.", "language": "Tamil", "source_language": "English"}
{"text": "...", "language": "Tamil", "translated": true, "translation_unavailable": false}
GET /api/tts/voices Public · 200 OK

Returns the 20 supported neural voices across 10 locales plus "browser_only": ["Odia"].

POST /api/tts Session required · 200 OK (audio/mpeg)

Synthesizes MP3 audio for text (1 to 1200 chars) and voice (must be a valid neural voice ID; otherwise 422).

POST /api/tts/prepare Session required · 200 OK

Prepares an utterance for streamed playback and returns its stream URL.

{"id": "a1b2c3...", "url": "/api/tts/stream/a1b2c3...", "cached": false}
GET /api/tts/stream/{key} Session required · 200 OK (audio/mpeg)

Streams MP3 audio for a key returned by /api/tts/prepare (`404` if unknown).