# Add phone calls to a Lovable, Bolt, v0 or Replit app | KaiCalls

Source: https://www.kaicalls.com/docs/api/app-builders

Lovable · Bolt · v0 · Replit · any AI builder

# Add phone calls to the app you're building

Building in a chat? Paste one prompt and your app can place calls and send texts from a real business number. Kai makes the call, follows the calling rules, and tells your app how it went.

Step 1

## Get a line and a key

Your app calls from a KaiCalls line. Lines start at $10/mo on Kai Backup; [see every plan](https://www.kaicalls.com/pricing).

- [Get a line](https://www.kaicalls.com/start). It takes about three minutes.
- Open [Settings → Developer Platform](https://www.kaicalls.com/dashboard/settings/api-keys), press **Create key**, and tick the permissions on the right. The key starts with kc_live_ and is shown once.
- Building on Vercel or v0? [Add the KaiCalls integration](https://www.kaicalls.com/integrations/vercel) and it puts the key and line id into your project for you.

Secrets your app needs

KAICALLS_API_KEY=kc_live_your_key_here
KAICALLS_AGENT_ID=your_line_id

Tick these when you make the key

workspaces:read agents:read numbers:read calls:read calls:write sms:read sms:write webhooks:read webhooks:write events:read

Step 2

## Paste the prompt into your builder

Pick your builder, copy the prompt, and paste it into the chat. When it asks for KAICALLS_API_KEY, give it the key from step 1.

Short on room? Tell the builder: Follow https://www.kaicalls.com/docs/api/app-builders/prompt.txt

Then ask for what you want in your own words, like "add a Call me back button to the contact form" or "text the customer when their order is ready."

Paste into the builder's chat

Add phone calls and texts to this app with KaiCalls.

Read https: //www.kaicalls.com/llms.txt and the API spec at https://www.kaicalls.com/api/v1/openapi.json before writing code.

Setup:
- Lovable asks for the key when the code needs it. Add it as a secret named KAICALLS_API_KEY.
- Also store KAICALLS_AGENT_ID (the id of the KaiCalls line that places the calls). If it is missing, call GET /api/v1/agents once and use the first agent id.
- The call to KaiCalls runs in a backend (edge) function, never in the page.
- Base URL: https: //www.kaicalls.com/api/v1. Send "Authorization: Bearer <KAICALLS_API_KEY>" and JSON.

Build this:
1. A server function placeCall(to, name, reason) that sends POST /api/v1/calls with { "agent_id": KAICALLS_AGENT_ID, "to": <E. 164 like + 15125551234 >, "name": name, "context": reason } and an Idempotency-Key header (a fresh UUID per user action) so a retry never dials twice. "context" tells the caller why it is calling; it is not read aloud.
2. A server function sendText(to, message) that sends POST /api/v1/sms/send with { "to": to, "from_agent_id": KAICALLS_AGENT_ID, "message": message } and an Idempotency-Key header.
3. A webhook route that receives call results. Register it once with POST /api/v1/webhooks { "webhook_url": <this route>, "events": [ "call.completed" ] }, save the webhook_secret it returns as KAICALLS_WEBHOOK_SECRET, and check the X-KaiCalls-Signature header (t=<unix>,v1=<hex>; v1 is HMAC-SHA256 of "<t>.<raw body>" with that secret) before trusting the body.
4. Show the call status and summary in the UI. GET /api/v1/calls?agent_id=<id> lists calls; GET /api/v1/transcripts?call_id=<id> returns the summary and transcript.

Rules:
- Never call KaiCalls from the browser and never expose the key to client code.
- A 409 means a calling-hours, do-not-call or opt-out rule stopped the call or text. Show the message to the user; do not retry it.
- Only call or text people who agreed to hear from this business. Texts also need the line's texting registration approved; if a text is refused for that reason, say so in the UI.
- If a request returns 401 or 403, call GET /api/v1/capabilities and tell the user which permission the key is missing.

Docs: https: //www.kaicalls.com/docs/api/app-builders

Step 3

## What the builder makes

Place a call

Kai calls a customer from your business number, says why it is calling, and reports back.

Send a text

A text from the same number, so customers see one business, not a random sender.

Hear how it went

A signed webhook tells your app when a call ends, with the summary and transcript.

Key stays on the server

The prompt tells the builder to keep your key out of the browser.

Every call and text is checked for local calling hours, your do-not-call list and opt-outs before it goes out. If a rule stops it, your app gets a 409 that says which one. [See every check](https://www.kaicalls.com/docs/api/compliance). You still need each person's permission to call or text them.

Step 4

## Files your builder can read

AI builders read docs as plain text. Point yours at any of these.

- [llms.txt](https://www.kaicalls.com/llms.txt) What KaiCalls is, in plain text
- [OpenAPI spec](https://www.kaicalls.com/api/v1/openapi.json) Every endpoint and field, no key needed
- [This prompt as text](https://www.kaicalls.com/docs/api/app-builders/prompt.txt) Add?builder=lovable, bolt, v0 or replit
- [This page as Markdown](https://www.kaicalls.com/docs/api/app-builders.md) For builders that read docs
- [MCP server](https://www.kaicalls.com/api/mcp) For coding agents that speak MCP

Want the full walk-through with cURL, Node.js and Python? [Read the quickstart](https://www.kaicalls.com/docs/api/quickstart).
