Skip to main content
Sayna exposes a compact set of HTTP endpoints that reuse the same providers and caches that power the streaming stack. Use the interactive playground inside the API reference for request-by-request schemas and try-it-out support. If you need tenant-scoped room management (listing rooms, inspecting participants, or moderating LiveKit sessions), see the Livekit Room Management guide.
Authentication is optional. Enable it through the Authentication guide if you need shared secrets or delegated JWT validation.
Want idiomatic clients? Install one of the Sayna SDKs to reuse the snippets shown below.
SDK examples assume you have already instantiated a client (see the SDK guides for setup) and are showing only the method call relevant to each endpoint.

GET / – health check

  • Purpose: returns { "status": "ok" } when the server and dependencies are alive.
  • Status codes: always 200 OK when the Axum router is reachable.
  • Usage: liveness/readiness probes and smoke tests after deployments.

GET /voices – provider catalog

Response schema mirrors each provider’s capabilities, including languages, sample rates, and optional tags. Use the payload to drive voice pickers inside your product.

POST /speak – one-shot synthesis

  • Request: JSON body plus optional auth via Authorization header or api_key query parameter.
  • Response: 200 OK with raw audio/pcm bytes plus x-audio-format and x-sample-rate response headers.
  • Errors: 400 when text is empty, 500 for provider failures or missing credentials.

POST /livekit/token – participant tokens

Returns: When authentication is enabled, this endpoint creates the room if it doesn’t exist and sets metadata.auth_id for tenant isolation.
  • Errors: 400 when any field is empty, 403 when the room exists with a different tenant’s auth_id, 500 when LiveKit credentials are misconfigured.
  • Typical flow: once a WebSocket session advertises LiveKit settings in the config message, call this REST endpoint from your control plane to mint attendee tokens.

GET /recording/{stream_id} – download session audio

Recording files live at {recording_s3_prefix}/{stream_id}/audio.ogg when livekit.enable_recording=true and storage credentials are set.

POST /sip/call – initiate SIP call

The optional sip object allows overriding global SIP configuration on a per-request basis. This is useful when you need to use different SIP providers or credentials for specific calls.
  • Request: JSON body plus optional auth via Authorization header or api_key query parameter.
  • Response: 200 OK with call status, room name, participant identity, participant ID, and SIP call ID.
  • Errors: 400 when phone number is invalid or required fields are empty, 404 when room exists with a different tenant’s auth_id, 500 when LiveKit is not configured, outbound address is missing, or call fails.
Phone numbers support international format (+1234567890), national format (07123456789), or internal extensions (1234). See the API reference for detailed schema information.

Cache-aware behavior

  • /speak reuses cached synthesis when both the text and tts_config hash match a previous request and caching is enabled.
  • Cache assets live under CACHE_PATH; mount a persistent volume in production if you want to avoid cold starts.
  • Clear server caches when rotating provider credentials or when you change voice defaults that affect TTS hashes.