Skip to main content

Overview

The voice gateway exposes five endpoints under /api/voice that power the Pamela voice agent. Use them to synthesize speech, look up appointment availability mid-call, book appointments live, ingest post-call data, and dispatch outbound calls. All endpoints accept and return JSON, except POST /api/voice/tts, which returns raw MP3 audio.
Speech synthesis requires the ELEVENLABS_API_KEY environment variable. See the Pamela voice agent guide for configuration.

POST /api/voice/tts

Synthesizes speech from text using ElevenLabs and returns the audio as audio/mpeg. The response includes an X-Voice-Id header identifying the voice that was used.

Request body

Example

Returns HTTP 400 if text is missing. Returns HTTP 500 if ELEVENLABS_API_KEY is not configured or the ElevenLabs API call fails.

GET /api/voice/slots

Returns available diagnostic appointment slots. Pamela calls this endpoint mid-call to propose times to the caller.

Example response

POST /api/voice/book

Books an appointment during a live call. The booking is written to the security audit log and a booking reference is returned.

Request body

Example

Example response

Returns HTTP 400 if callerPhone or scheduledSlot is missing.

POST /api/voice/webhook

Ingests post-call data from the voice provider: recording, transcript, sentiment, and disposition. Call details are logged to the Results Vault and CRM.

Request body

Example response

Returns HTTP 400 if callId is missing.

POST /api/voice/dispatch

Queues an outbound call from Pamela with a campaign-specific script. The endpoint builds the script from the lead context, logs the dispatch to the security audit log, and returns the script alongside a dispatch ID.

Request body

Example

Example response

Returns HTTP 400 if recipientPhone is missing.