Get started

Python SDK

Use Python jobs, CRMs, and data pipelines to launch calls and read outcomes.

Back to documentation
Get started9 min
1

Create the Python client

This client wraps the real production call endpoints and raises clear exceptions for API errors.

Python SDK
from urllib.parse import quote

import requests


class QuickCallError(RuntimeError):
    pass


class QuickCallAI:
    def __init__(self, api_key: str, base_url: str = "https://ai.quickcall.tech/api", timeout: int = 30):
        self.api_key = api_key
        self.base_url = base_url.rstrip("/")
        self.timeout = timeout

    def _request(self, method: str, path: str, json=None):
        response = requests.request(
            method,
            f"{self.base_url}{path}",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json",
            },
            json=json,
            timeout=self.timeout,
        )
        try:
            data = response.json() if response.content else {}
        except ValueError:
            data = {}
        if not response.ok or data.get("success") is False:
            raise QuickCallError(data.get("message") or data.get("error") or response.text)
        return data

    def initiate_call(self, phone_number: str, customer_name: str, prompt: str, **options):
        return self._request("POST", "/calls/demo/initiate", {
            "phone_number": phone_number,
            "customer_name": customer_name,
            "prompt": prompt,
            "language": options.get("language", "en-US"),
            "voice_model": options.get("voice_model", "aura-asteria-en"),
            "provider": options.get("provider", "twilio"),
            "agent_id": options.get("agent_id"),
            "transfer_phone_number": options.get("transfer_phone_number"),
        })

    def get_call_status(self, call_id: str):
        return self._request("GET", f"/calls/demo/{quote(call_id, safe='')}/status")

    def end_call(self, call_id: str):
        return self._request("POST", f"/calls/demo/{quote(call_id, safe='')}/end")
2

Run a call from a worker

Use the SDK inside a queue worker, CRM automation, or scheduled campaign preparation job.

Usage
client = QuickCallAI(api_key=os.environ["QUICKCALLAI_API_KEY"])

created = client.initiate_call(
    phone_number="+15551234567",
    customer_name="Asha Patel",
    prompt="Confirm interest, answer questions, and book a demo slot.",
    language="en-IN",
    voice_model="google:en-IN-Chirp3-HD-Charon",
    provider="twilio",
)

status = client.get_call_status(str(created["call_id"]))