Developers

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.

Developers

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.
  1. 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.

  2. 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.

  3. 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/dial Place a call in the API reference

    POST /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"}}'
  4. 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.
FAQ

Questions, answered.

Is there an official AI Call Studio SDK?
Yes, for TypeScript (Node.js) and Python, with every public endpoint as a typed method, under the MIT licence. They are not on npm or PyPI yet: install them from https://aicallstudio.com/sdks/, where SHA256SUMS lists the checksum of every file.
Do the SDKs retry failed requests?
Only a 429 or a 5xx answer, twice by default, with backoff and the same Idempotency-Key, honouring Retry-After. A 400, 401, 402, 403, 404, 409 or 422 raises an error at once, because the same request would get the same answer.
How do I verify a webhook with the SDK?
Pass the raw request body, the X-Aicallstudio-Signature header and the webhook's signing secret to constructWebhookEvent in TypeScript or construct_webhook_event in Python. Do it before parsing the JSON yourself: it throws when the signature does not match.

Put AI Call Studio on your phone lines.

Book a 30-minute walkthrough, or call us right now: +91 922 222 1378