SDKs for TypeScript and Python
Official clients for the AI Call Studio API: typed methods for every endpoint, safe retries, one error type to branch on, and a webhook signature check, in TypeScript (Node.js) and Python.
Before you start
- Node.js 18.17 or newer for TypeScript, or Python 3.9 or newer.
- API access is on Growth and above. Without it every request answers 402, and the key works again once the plan includes it.
- A live key from the Developers page of your dashboard. Keep it on your server: it acts for your whole workspace.
Install the SDK
The SDKs are not on npm or PyPI yet. Install them from this site: for Node.js, npm install https://aicallstudio.com/sdks/aicallstudio-sdk-0.1.0.tgz; for Python, pip install https://aicallstudio.com/sdks/aicallstudio-0.1.0-py3-none-any.whl. To check a download first, fetch https://aicallstudio.com/sdks/SHA256SUMS, which lists the SHA-256 of every file, and compare. A new version has a new file name, and the old ones stay.
Make a client
Give it your key, or set AICALLSTUDIO_API_KEY and give it nothing. The address is the same for live and sandbox keys: the key decides which you get, and the client says which one it holds.
Place a call
calls.dial takes the same fields as the API: your own number and an agent's id. It sends an Idempotency-Key for you, the same on every retry, so a retried request never rings twice.
This is a real call, billed like any other. Try it on your own number first.
POST
/api/calls/dialPlace a call in the API referencePOST /api/calls/dial with curl curl -X POST "https://aicallstudio.com/api/calls/dial" \ -H "Authorization: Bearer mtc_YOUR_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"phone":"9876543210","agent_id":"YOUR_AGENT_ID","name":"Asha Verma","variables":{"amount":"12,500","due_date":"5 December"}}'Check every webhook
Pass the raw body, the X-Aicallstudio-Signature header and the webhook's signing secret to constructWebhookEvent (TypeScript) or construct_webhook_event (Python). It refuses a body that was changed and gives you the event when it is genuine. Webhooks has every event.
call.completed, a sample delivery { "event": "call.completed", "ts": 1772634500, "id": "1b2c3d4e5f6a47b8c9d0e1f2a3b4c5d6", "data": { "call": { "id": "00000000-0000-0000-0000-000000000001", "contact_id": "00000000-0000-0000-0000-000000000002", "campaign_id": null, "agent_id": "00000000-0000-0000-0000-000000000003", "direction": "outbound", "status": "completed", "duration_seconds": 94, "disposition": "interested", "disposition_label": "Interested", "classification": "hot", "score": 82, "summary": "Asked for a site visit on Saturday.", "transcript": "Agent: Hello, am I speaking with Asha?\nLead: Yes.", "transcript_turns": [ { "speaker": "agent", "text": "Hello, am I speaking with Asha?" }, { "speaker": "lead", "text": "Yes." } ], "placed_by": { "kind": "ai_agent", "id": "00000000-0000-0000-0000-000000000003", "name": "Priya" }, "cost_inr": 4.5, "disposition_by": "ai" } } }
What do the SDKs do that plain HTTP does not?
They type every request and answer from the API's own OpenAPI file, so a renamed field is a compile error rather than a surprise at 3am. They retry a 429 or a 5xx answer with backoff, waiting as long as Retry-After says, and retry nothing else. They send an Idempotency-Key on every write. They raise one family of errors that carry the API's error code, its message and the request id to quote to us. And they check webhook signatures the way the server signs them.
How are they kept in step with the API?
The types and the one method per endpoint are generated from the same OpenAPI file that the API reference is drawn from, and a build check fails when the two drift apart. A new endpoint therefore appears in both SDKs when the reference shows it.
What if I use another language?
The API is plain HTTPS and JSON, so any language works: the quickstart shows curl, Node.js, Python and PHP, and the OpenAPI file and Postman collection on the API reference generate a client for most others.
Costs and what to watch
- Every call placed through an SDK is a real call to a real person, billed from your wallet like any other call. Messages are billed per message.
- A sandbox key (it starts with mtc_sandbox_) writes nothing and has no sample data behind it: it only proves the key and its scopes. Use a live key and your own number to see a call.
- Never put a key in a web page or a mobile app. The SDKs are for your server.
Questions, answered.
Is there an official AI Call Studio SDK?
Do the SDKs retry failed requests?
How do I verify a webhook with the SDK?
Read next
Quickstart: your first AI call from code in 5 minutes
Make an API key, find your agent, place one AI call to your own number and read its outcome, in curl, Node.js, Python or PHP.
Read more →Webhooks: every event, with a sample
Every event AI Call Studio can send your server, with a sample of each, the headers, how to check the signature, and what happens when a delivery fails.
Read more →Use cases
Recipes with every step and the code to copy: form to call, EMI reminders, CRM leads, WhatsApp follow-ups.
Read more →