Skip to main content

Call2Me Python SDK

The official Python SDK for Call2Me — the AI voice agent platform.

Build, deploy, and manage AI voice agents that handle real phone calls, extract data, and take automated actions.

PyPI License

Features

  • 22 API Resources — Full coverage of the Call2Me REST API
  • Voice Agents — Create agents with 30+ AI models and custom voices
  • Phone & Web Calls — Inbound/outbound via SIP, browser, or chat widget
  • Campaigns — Bulk outbound calling with CSV upload
  • Scheduled Calls — Book follow-ups at specific dates
  • Post-Call Intelligence — Auto-extract data and trigger actions
  • Knowledge Base — RAG-powered answers from your documents
  • White-Label — Custom branding, domain, and tenant management
  • Payments — Checkout, saved cards, auto-charge

Installation

pip install call2me

Requires Python 3.8+

Getting Your API Key

  1. Sign up at dash.call2me.app — you get $5 free credit
  2. Go to API Keys in the dashboard
  3. Click Create API Key and copy your sk_call2me_... key

Quick Start

from call2me import Call2Me

client = Call2Me(api_key="sk_call2me_...")

# Create an agent
agent = client.agents.create(
    agent_name="Sales Agent",
    voice_id="elevenlabs-CFzl8WvPQ92EKMBs2hpS",
    language="tr-TR",
    system_prompt="You are a friendly sales agent."
)
print(f"Agent: {agent['agent_id']}")

# List calls
for call in client.calls.list()["calls"]:
    print(f"{call['call_id']} — {call['call_status']}")

# Check balance
print(f"Balance: ${client.wallet.balance()['balance_usd']}")

Full API Reference

Agents

client.agents.list(limit=100, offset=0)
client.agents.get("agent_id")
client.agents.create(agent_name="My Agent", voice_id="elevenlabs-CFzl8WvPQ92EKMBs2hpS", system_prompt="...")
client.agents.update("agent_id", agent_name="New Name")
client.agents.delete("agent_id")
client.agents.duplicate("agent_id")
client.agents.stats("agent_id", days=30)
client.agents.global_stats()

Calls

# Outbound call (REAL — dialled and charged). dynamic_variables fill {{key}}
# placeholders in the agent's prompt/opening/closing for this call only;
# begin_message is this call's opening line (outbound ignores the static one).
client.calls.create(
    agent_id="agent_id",
    to_number="+15551234567",
    dynamic_variables={"name": "Ada", "order_id": "A-42"},
    begin_message="Hi {{name}}, calling about your order {{order_id}}.",
)
client.calls.list(limit=50, agent_id="agent_id")
client.calls.get("call_id")
client.calls.end("call_id")
client.calls.recording("call_id")

Knowledge Base

client.knowledge_bases.list()
client.knowledge_bases.get("kb_id")
client.knowledge_bases.create(name="FAQ", texts=[{"title": "Returns", "text": "..."}])
client.knowledge_bases.delete("kb_id")
client.knowledge_bases.add_source("kb_id", source_type="text", content="...", name="intro")
client.knowledge_bases.add_source("kb_id", source_type="url", content="https://example.com/faq")
client.knowledge_bases.query("kb_id", "What is the return policy?", top_k=5)

Campaigns

client.campaigns.list()
client.campaigns.get("campaign_id")
client.campaigns.create(name="Spring Sale", agent_id="agent_id", from_number="+908501234567")
client.campaigns.update("campaign_id", name="Updated")
client.campaigns.delete("campaign_id")
client.campaigns.upload_csv("campaign_id", "/path/to/contacts.csv")
client.campaigns.start("campaign_id")
client.campaigns.pause("campaign_id")
client.campaigns.resume("campaign_id")
client.campaigns.cancel("campaign_id")
client.campaigns.contacts("campaign_id")

Scheduled Calls

client.schedules.list()
client.schedules.get("schedule_id")
client.schedules.create(agent_id="agent_id", phone_number="+905551234567", scheduled_at="2026-04-15T10:00:00+03:00", timezone="Europe/Istanbul")
client.schedules.update("schedule_id", scheduled_at="2026-04-16T14:00:00+03:00")
client.schedules.delete("schedule_id")
client.schedules.cancel("schedule_id")

Phone Numbers

client.phone_numbers.list()
client.phone_numbers.get("+908501234567")
client.phone_numbers.create(phone_number="+908501234567", trunk_id="trunk_id")
client.phone_numbers.update("+908501234567", display_name="Main Line")
client.phone_numbers.delete("+908501234567")
client.phone_numbers.bind_agent("+908501234567", "agent_id")
client.phone_numbers.unbind_agent("+908501234567")

SIP Trunks

client.sip_trunks.list()
client.sip_trunks.get("trunk_id")
client.sip_trunks.create(name="My Trunk", sip_server="sip.provider.com", sip_username="user", sip_password="pass")
client.sip_trunks.update("trunk_id", name="Updated")
client.sip_trunks.delete("trunk_id")
client.sip_trunks.test("trunk_id")

Wallet & Billing

client.wallet.balance()
client.wallet.transactions(limit=50, offset=0)
client.wallet.analytics(days=30)
client.wallet.pricing()

Payments

client.payments.checkout(amount=50.0, currency="USD")
client.payments.history(limit=50)
client.payments.saved_cards()
client.payments.auto_charge()
client.payments.update_auto_charge(enabled=True, threshold=5.0, amount=50.0)

API Keys

client.api_keys.list()
client.api_keys.create(name="Production Key")
client.api_keys.revoke("key_id")
client.api_keys.delete("key_id")
client.api_keys.usage("key_id")

Users & Branding

client.users.me()
client.users.update(full_name="John Doe", company_name="Acme Inc")
client.users.stats()
client.users.usage(days=30)
client.users.daily_usage(days=30)
client.users.branding()
client.users.update_branding(app_name="My Platform", primary_color="#6366f1")
client.users.tenant_members(page=1, per_page=20)

Widgets

client.widgets.list()
client.widgets.get("widget_id")
client.widgets.create(agent_id="agent_id", name="Support Widget")
client.widgets.update("widget_id", greeting_message="Hi!")
client.widgets.delete("widget_id")
client.widgets.chat("widget_id", "Hello, I need help")

Voices

client.voices.list()
client.voices.providers()

Headless voice sessions

Open an AI voice session with an agent from your own app:

s = client.voice_sessions.create("agent_abc123")
# s = {"token": ..., "url": "wss://livekit.call2me.app", "room_name": ..., "session_limit_sec": 3600}
# Connect a LiveKit client with s["token"] + s["url"]; the agent auto-joins and talks.

Interpreters

it = client.interpreters.create(name="Supplier calls", source_language="en", target_language="zh")
client.interpreters.enable_web(it["interpreter_id"])   # browser link, no app needed
client.interpreters.web_status(it["interpreter_id"])
client.interpreters.list() / get(id) / update(id, **fields) / delete(id) / calls()

Numbers & SMS

client.numbers.allowed_countries()
client.numbers.search(country="US", area_code="415")
client.numbers.checkout("+1415...", agent_id="...")   # paid
client.sms.send("+1415...", "Hello", from_="+1650...")
client.sms.list(direction="inbound")

Chats

client.chats.list(limit=50)
client.chats.get("session_id")
client.chats.send_message("session_id", "Hello!", model="openrouter/auto")

Events

Forward application errors and business events to the Call2Me observability pipeline. The POST endpoint is public; sending the API key lifts your per-minute ceiling from 10 (anon) to 100.

client.events.report(
    type="payment_failed",
    source="api",
    message="Paddle rejected the webhook",
    severity="error",
    meta={"payment_id": "pay_abc", "provider": "paddle"},
)

# Admin-only, requires a dashboard session token (JWT) — sk_ API keys get 401:
client.events.query(severity="error", hours=24)

Common type values: js_error, unhandled_rejection, http_5xx, auth_login, auth_signup, payment_success, payment_failed, call_started, call_ended, call_failed, agent_crash.

Error Handling

from call2me import Call2MeError

try:
    agent = client.agents.get("invalid_id")
except Call2MeError as e:
    print(e.status_code, e.detail)   # 404 Agent not found

Call2MeError subclasses httpx.HTTPStatusError, so existing handlers keep working.

Changelog

1.6.0 (2026-11-01)

  • calls.create accepts dynamic_variables (dict[str, str], fills {{key}} in prompt/opening/closing) and begin_message (opening line for that call).

1.5.2 (2026-10-14)

  • Fixed knowledge_bases.create / add_source (sent field names the API rejected with 422); create accepts texts, urls, agent_id.
  • Fixed payments.update_auto_charge (threshold and amount were silently ignored).
  • New Call2MeError with status_code and the API's detail message.
  • README quickstart fixed (calls.list() returns {"calls": [...], "total": ...}).

1.5.0 – 1.5.1 (2026-10-05)

  • Added interpreters, numbers, sms, extension resources and calls.create (outbound calls).

1.4.0 (2026-07-02)

  • Added voice_sessions.create(agent_id, context=None) — open a headless AI voice session (LiveKit token) with an agent.

1.3.1 (2026-04-24)

  • README — publish the 1.3.0 events-resource documentation to PyPI (the 1.3.0 upload shipped the pre-release README by accident).

1.3.0 (2026-04-24)

  • Add events resource — client.events.report() and .query() for forwarding errors and business events to the observability pipeline.
  • Published via PyPI Trusted Publishing (OIDC, no API token).

1.2.0

  • All 14 resources, campaigns, schedules, widgets.

License

MIT

Metadata

Release files for call2me 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for call2me 1.6.0
File Size Uploaded Provenance Actions
call2me-1.6.0.tar.gz 20.2 kB With provenance Details for call2me-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for call2me 1.6.0
File Interpreter ABI Platform Actions
call2me-1.6.0-py3-none-any.whl Python 3 none any Details for call2me-1.6.0-py3-none-any.whl

Total release size: 34.6 kB

Release files / call2me-1.6.0.tar.gz

Download URL call2me-1.6.0.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
08af9a444e122f91a79a05c5add6fa15b2f87743efba5e64b49b1c60abf81aba
BLAKE2b-256 checksum
How to use checksums
4887cb43df787d68c20ff94dca4447d63841eb034a7fd63d971234f7f2a5486d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / call2me-1.6.0-py3-none-any.whl

Download URL call2me-1.6.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b94386f84d167b2b717d81aac5f41bb629330044970a26f7d9012bb1968b5a8
BLAKE2b-256 checksum
How to use checksums
447727caf211c31393299423c7dce7b20ec08e1a1525b13524bc9d692ae95c0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for call2me 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for call2me-1.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page