Skip to main content

Installation

Or install directly from source:
Requirements: Python 3.9+, httpx>=0.24.0, pydantic>=2.0.0

Authentication

Every client call injects your API key as the X-API-Key header. Generate a key from platform.vaani.dev → Settings → API Keys.
Use the client as a context manager to ensure the HTTP connection is properly closed:

Outbound Calls

Trigger a Call

trigger_call returns a TriggerCallResponse: call_id, room_name, live_captions_url, agent_name, dispatch_id and call_db_id for telephony; token, room_name, connection_url and live_captions_url for medium="webrtc". The full response is in .raw.

Call History

Filters (all optional): search, start_date, end_date, status, direction (Incoming / Outgoing), agent_id, call_id, from_number, to_number, rating (thumbs_up / thumbs_down / unrated). See Get Call History. call.raw["call_transcription"] is the transcript text, and call.raw["recording_api"] / call.raw["call_details"] are links to the stream and call-details endpoints.

Transcript and Call Details

Stream Audio


WebRTC Voice Sessions

Use client.sessions to create and manage real-time voice sessions powered by LiveKit.

Flow Overview

1

Create a session

Call client.sessions.create(...) to get a session_token and an embeddable session_url.
2

Connect and get LiveKit credentials

Call client.sessions.connect(session_token) to obtain lk_url and lk_token.
3

Join via LiveKit

Pass lk_url and lk_token to the LiveKit client SDK in your browser or mobile app to establish the WebRTC connection.
4

End the session

Call client.sessions.disconnect(session_token) when the user leaves.

Quickstart

sessions.create() Parameters

ui_type must be "fullpage" or "widget". grace_period and session_ttl outside their ranges are rejected with 422. explicit_end=True on disconnect() ends the session immediately instead of starting the reconnection grace period.

Real-Time Session Events

The session-events socket is public like connect and status: the unguessable session_token in the URL is the credential, and the browser Origin must be allowed for the agent. A wrong token is refused during the handshake (403). For live call transcripts use the signed live_captions_url returned by Create Dispatch.
Connect to the WebSocket URL to receive push events while the session is active:

Agent Management

Create an Agent

List and Inspect Agents

agents.list() returns Agent objects (id, agent_name, display_name, …). agents.get() returns an AgentConfigResponse, because the API answers with the full saved configuration rather than a list row.

Delete an Agent

Permanently delete an agent by UUID or system name:

Update Agent Configuration


Campaigns

The CSV and the six config keys above are required by the API; config also accepts max_retries, retry_delay_mins, perform_dnd_check, notification_emails, campaign_webhook_url and per_call_webhook_url. campaigns.update(campaign_id, config) pauses the campaign first, so call resume afterwards. Field rules, error codes and webhook payloads are in the Campaign API reference and Campaign Webhooks.

Async Usage

Every method has an exact async equivalent on AsyncVaaniClient, including all resource namespaces.

Error Handling

All SDK exceptions inherit from VaaniError and carry a .status_code attribute.