Quickstart · about 5 minutes

Your first API request

Kai answers your business line. The API lets your own software read every call and lead Kai takes, hear about each call the moment it ends, and ask Kai to place a call. Every example below runs as-is once your key is set.

Base URL
https://www.kaicalls.com/api/v1
Auth
Bearer kc_live_…
Format
JSON in, JSON out
Compliance is built in. Every call and text you send through the API is checked for calling hours, your do-not-call list, opt-outs and text consent before it goes out. STOP replies are handled for you. See every check →

Get an API key

Open Settings → Developer Platform and press Create key. Pick the one business the key is for. KaiCalls shows the full key once, and it starts with kc_live_.

A new key can only read by default: workspaces, numbers, agents, calls, texts, webhooks and events. Steps 3, 6 and 7 change things, so tick the write permissions they list when you create the key, or make a second key for them.

No account yet? You can sign up through the API and verify your email. No card is needed to get a key.

Terminal
export KAICALLS_API_KEY="kc_live_your_key_here"
Call the API from your server, never a browser.
One key per app, so you can revoke one alone.
Every example reads the key from this variable.

Check your key

This request changes nothing. It confirms the key works and lists what it is allowed to do in enabled_scopes. Run it first whenever something returns 401 or 403.

Errors always look the same: { "error": { "code": "forbidden", "message": "Missing calls:write scope" } }. The error reference lists every code.

GET/api/v1/capabilities
curl "https://www.kaicalls.com/api/v1/capabilities" \
  -H "Authorization: Bearer $KAICALLS_API_KEY"
ResponseShow
{
  "version": "2026-06-05",
  "authenticated": true,
  "enabled_scopes": [
    "workspaces:read",
    "agents:read",
    "calls:read",
    "webhooks:read"
  ],
  "webhook_event_types": ["call.completed", "lead.created", "…"],
  "endpoints": { "…": "…" }
}

Get a free test number (7 days)

Needsnumbers:write

Signed up through the API and have no number yet? Get a free one. Calls to it ring your agent, so you can hear Kai on a real call. No card needed.

It lasts 7 days and takes up to 10 calls a day. It only takes calls: it can't call out or send texts. Each business gets one. Asking again returns the same number.

To keep it, pick a plan at keep_it_url before expires_at. Already on a paid plan? Your number comes with it, so skip this step.

POST/api/v1/test-line
curl -X POST "https://www.kaicalls.com/api/v1/test-line" \
  -H "Authorization: Bearer $KAICALLS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "business_id": "9b2e4d7a-1c3f-4e8a-b6d5-2f0a7c1e3b98"
}'
ResponseShow
{
  "status": "active",
  "business_id": "9b2e4d7a-1c3f-4e8a-b6d5-2f0a7c1e3b98",
  "phone_number": "+15125550123",
  "expires_at": "2026-11-27T14:32:00Z",
  "calls_per_day": 10,
  "inbound_only": true,
  "keep_it_url": "https://www.kaicalls.com/dashboard/business/settings/subscription?selected_business_id=9b2e4d7a-1c3f-4e8a-b6d5-2f0a7c1e3b98"
}

Find your agent

Needsagents:read

An agent is Kai on one of your lines. Most requests below take its id as agent_id, so copy it from the response.

A key that reaches more than one business returns agents from all of them. Add ?business_id= to narrow it to one.

GET/api/v1/agents
curl "https://www.kaicalls.com/api/v1/agents" \
  -H "Authorization: Bearer $KAICALLS_API_KEY"
ResponseShow
{
  "agents": [
    {
      "id": "3f6c2a1e-8b4d-4c7e-9a2f-5d1b0e7c9a44",
      "name": "Kai",
      "business_id": "9b2e4d7a-1c3f-4e8a-b6d5-2f0a7c1e3b98",
      "created_at": "2026-10-02T14:32:00Z"
    }
  ]
}

Read calls and transcripts

Needscalls:read

Calls come back newest first, up to 100 at a time (50 by default). When has_more is true, pass the last created_at as after to get the next page.

For what was said, use transcripts. Each one has Kai's summary and the turn-by-turn conversation. It looks back 30 days by default; set days (up to 90), or pass call_id for one call.

GET/api/v1/calls
curl "https://www.kaicalls.com/api/v1/calls?agent_id=3f6c2a1e-8b4d-4c7e-9a2f-5d1b0e7c9a44&limit=5" \
  -H "Authorization: Bearer $KAICALLS_API_KEY"
ResponseShow
{
  "calls": [
    {
      "id": "c9d8e7f6-5a4b-4c2d-9e0f-9a8b7c6d5e4f",
      "conversation_id": "019a7c2e-41b8-7d3e-a1f0-6c2b9e4d8a17",
      "status": "ended",
      "direction": "inbound",
      "duration": 127,
      "agent_id": "3f6c2a1e-8b4d-4c7e-9a2f-5d1b0e7c9a44",
      "agent_name": "Kai",
      "created_at": "2026-11-11T14:32:00Z"
    }
  ],
  "has_more": true
}
GET/api/v1/transcripts
curl "https://www.kaicalls.com/api/v1/transcripts?days=7&limit=3" \
  -H "Authorization: Bearer $KAICALLS_API_KEY"
ResponseShow
{
  "transcripts": [
    {
      "call_id": "c9d8e7f6-5a4b-4c2d-9e0f-9a8b7c6d5e4f",
      "agent_name": "Kai",
      "duration": 127,
      "summary": "Water heater leaking in the garage. Wants someone out today.",
      "transcript": [
        { "role": "assistant", "message": "Thanks for calling Acme Plumbing, this is Kai." },
        { "role": "user", "message": "Hi, my water heater is leaking..." }
      ],
      "transcript_format": "kaicalls.transcript.v1",
      "created_at": "2026-11-11T14:32:00Z"
    }
  ],
  "has_more": false
}

Get told when a call ends

Needswebhooks:write

Instead of polling, register a URL and KaiCalls posts to it when something happens. The response includes a webhook_secret. It is shown once, so save it next to your API key.

Every delivery carries an X-KaiCalls-Event header and an X-KaiCalls-Signature header shaped like t=1731340000,v1=…. The v1 value is an HMAC-SHA256 of {t}.{raw body} using your secret. Check it before you trust the body, and reject old timestamps.

Leave out business_id when your key is for one business. Popular events are call.completed, lead.created and voicemail.received; the webhooks reference lists all of them.

POST/api/v1/webhooks
curl -X POST "https://www.kaicalls.com/api/v1/webhooks" \
  -H "Authorization: Bearer $KAICALLS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "webhook_url": "https://example.com/webhooks/kaicalls",
  "events": [
    "call.completed",
    "lead.created",
    "voicemail.received"
  ]
}'
ResponseShow
{
  "business_id": "9b2e4d7a-1c3f-4e8a-b6d5-2f0a7c1e3b98",
  "webhook": {
    "id": "5c1e9a7b-2d4f-4b8e-9c3a-7f1d0e6b2a58",
    "url": "https://example.com/webhooks/kaicalls",
    "events": ["call.completed", "lead.created", "voicemail.received"],
    "is_active": true
  },
  "webhook_secret": "4f9c…e21a  ← shown once, save it now"
}
import crypto from "node:crypto";

// rawBody: the request body exactly as received (a string, not parsed JSON)
export function verifyKaiCalls(rawBody, signatureHeader, secret) {
  const parts = Object.fromEntries(
    signatureHeader.split(",").map((p) => p.split("=")),
  );
  const expected = crypto
    .createHmac("sha256", secret)
    .update(`${parts.t}.${rawBody}`)
    .digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
  const given = Buffer.from(parts.v1 ?? "");
  return (
    fresh &&
    given.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(expected), given)
  );
}

// verifyKaiCalls(body, req.headers["x-kaicalls-signature"], process.env.KAICALLS_WEBHOOK_SECRET)

Place an outbound call

Needscalls:write

Kai calls the number from your line. context tells Kai why it is calling; it is not read aloud. Numbers use E.164 format, like +15125551234.

Send an Idempotency-Key header. If your request times out and you retry with the same key, KaiCalls returns the first call (replayed: true) instead of dialing twice.

Built-in compliance

Before dialing, KaiCalls checks the person's local calling hours (8am to 9pm), your do-not-call list and their opt-outs. If a check fails, no call is placed and you get a 409 that says which rule stopped it. You still need the person's permission to call them. See every check.

The result arrives on your call.completed webhook from step 6, or read it with GET /calls?id=.

POST/api/v1/calls
curl -X POST "https://www.kaicalls.com/api/v1/calls" \
  -H "Authorization: Bearer $KAICALLS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: followup-maria-2026-11-11" \
  -d '{
  "agent_id": "3f6c2a1e-8b4d-4c7e-9a2f-5d1b0e7c9a44",
  "to": "+15125551234",
  "name": "Maria Garcia",
  "context": "Following up on her request for a water heater quote."
}'
Response · 201 CreatedShow
{
  "id": "d4e5f6a7-b8c9-4d1e-8f3a-4b5c6d7e8f90",
  "conversation_id": "019a7c31-0b6e-7f2a-9d4c-3e8a1b5f7c20",
  "status": "queued",
  "direction": "outbound",
  "agent_id": "3f6c2a1e-8b4d-4c7e-9a2f-5d1b0e7c9a44",
  "to": "+15125551234",
  "name": "Maria Garcia",
  "replayed": false,
  "created_at": "2026-11-11T15:10:00Z"
}

More recipes

Each of these needs a permission that a new key doesn't have, so add it when you create the key.

Update a lead

Needsleads:readleads:write

Kai creates a lead for every new caller. List them with GET /leads?status=new, then update one. The response is the full updated lead. To update up to 100 at once, send { "updates": [ … ] }.

newcontactedqualifiednurturingconvertedlostunqualifiedspamdo_not_contact
PATCH/api/v1/leads
curl -X PATCH "https://www.kaicalls.com/api/v1/leads" \
  -H "Authorization: Bearer $KAICALLS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "id": "f7e6d5c4-b3a2-4098-8654-321fedcba098",
  "status": "qualified",
  "notes": "Budget confirmed. Wants an install this week."
}'

Send a text

Needssms:write

Sends from the agent's own number. The person must have agreed to texts, and anyone who replied STOP or is on your do-not-call list is refused. Outside 8am to 9pm their time you get tcpa_violation, or add "dispatch_policy": "queue_if_needed" to get 202 with scheduled_for instead.

POST/api/v1/sms/send
curl -X POST "https://www.kaicalls.com/api/v1/sms/send" \
  -H "Authorization: Bearer $KAICALLS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: eta-text-maria-2026-11-11" \
  -d '{
  "to": "+15125551234",
  "from_agent_id": "3f6c2a1e-8b4d-4c7e-9a2f-5d1b0e7c9a44",
  "message": "Thanks for calling Acme Plumbing. Your tech is on the way."
}'
ResponseShow
{
  "success": true,
  "message_sid": "SM9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d",
  "to": "+15125551234",
  "from": "+15125559876"
}

Check a call-and-text schedule before you queue it

Needscommunication-runs:write

For CRMs and partner systems that plan several calls and texts. Validation checks the shape of the run (ids, agent, number, timestamps) and always answers 200; read valid and issues. Calling hours, do-not-call and opt-outs are checked later, when each touch goes out (how). Then preview with POST /communication-runs/preview and create it with POST /communication-runs plus an Idempotency-Key.

POST/api/v1/communication-runs/validate
curl -X POST "https://www.kaicalls.com/api/v1/communication-runs/validate" \
  -H "Authorization: Bearer $KAICALLS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "agent_id": "3f6c2a1e-8b4d-4c7e-9a2f-5d1b0e7c9a44",
  "external_ref": "crm-run-8f12",
  "touches": [
    {
      "touch_id": "first-call",
      "channel": "call",
      "target": {
        "phone": "+15125551234",
        "timezone": "America/New_York"
      },
      "scheduled_at": "2026-11-18T15:00:00.000Z"
    }
  ]
}'
ResponseShow
{
  "valid": true,
  "business_id": "9b2e4d7a-1c3f-4e8a-b6d5-2f0a7c1e3b98",
  "normalized": { "…": "…" },
  "issues": [],
  "warnings": []
}