NaCaller API Reference
Build with NaCaller using your AI coding agent
Claude Code, Codex, Cursor and Antigravity can integrate NaCaller for you. Give the agent this page, the plain-text llms-full.txt, or the MCP server below, and it can write the two server calls that verify a phone number, with the key kept out of your front end. Everything here matches the API as it is today; the agent is told what does not exist so it does not invent it.
Three steps
- Get a key. Create it in the NaCaller dashboard. Verification keys (
nck_live_…, Verify page, one per site) power OTP; developer keys (nc_live_…, Settings, Developers) power calls and campaigns. 25 verifications are free on a new account. - Put it in an environment variable (for example
NACALLER_KEY), never in client code or git. - Connect your agent with the MCP server, or paste the block for CLAUDE.md / AGENTS.md.
The MCP server
Open source (MIT) at github.com/talkingwp/nacaller-mcp. Your agent runs it straight from GitHub with npx, so there is nothing to install or sign up for first. Needs Node 18 or newer.
claude mcp add nacaller -e NACALLER_API_KEY=nc_live_xxx -- npx -y github:talkingwp/nacaller-mcp{
"mcpServers": {
"nacaller": {
"command": "npx",
"args": ["-y", "github:talkingwp/nacaller-mcp"],
"env": { "NACALLER_API_KEY": "nc_live_xxx" }
}
}
}[mcp_servers.nacaller]
command = "npx"
args = ["-y", "github:talkingwp/nacaller-mcp"]
env = { NACALLER_API_KEY = "nc_live_xxx" }NACALLER_API_KEY=nc_live_xxx npx -y github:talkingwp/nacaller-mcp --selftestThe key is read from the environment only. It is never a tool argument and is never printed.
| Tool | What it does | Key |
|---|---|---|
otp_send_voice | Phone a number and read a 6-digit code in one of 10 languages. A real call, one voice credit. | Verification key |
otp_check | Check the code the person heard. | Verification key |
otp_missed_call_start | Start a missed-call verification and get the number to ring. | Verification key |
otp_status | pending, verified or expired. | Verification key |
calls_place | Place one real AI call with one of your agents. | Developer key |
calls_list, calls_get | Recent calls; one call with transcript and a signed recording link. | Developer key |
agents_list | Your agents and their ids. | Developer key |
agents_get | One agent in full (prompt, greeting, languages, status). | Developer key (agents scope) |
agents_create, agents_update | Save an agent as a DRAFT. A person must press Activate in the dashboard before it can call. | Developer key (agents scope) |
ivr_list, ivr_get, ivr_create, ivr_update | Keypad (IVR) flows, strictly validated, saved as drafts. | Developer key (agents scope) |
balance_get | Wallet balance, plan minutes left and OTP credits. Read only. | Developer key |
billing_topup_link | A link a person opens, signed in, to add money. Charges nothing; the agent never pays. | Developer key (billing_link scope) |
campaigns_create | Two steps: a dry run (real cost estimate and wallet check) and a confirmation token, then create. Capped at 100 contacts by default. | Developer key |
campaigns_results | Totals and one row per contact. | Developer key |
nacaller_docs | Bundled guidance and framework snippets, offline. | None |
campaigns_create never dials on the first call: it returns a summary (de-duplicated contact count, agent, calling hours) and a one-time token, and only a second call with the same arguments and that token creates the campaign. There are no tools that move money, change billing, manage keys or read other accounts. agents_create, agents_update and the ivr_* tools save drafts only.
Paste this into CLAUDE.md or AGENTS.md
## NaCaller (phone verification and AI calling)
Docs for agents: https://nacaller.com/docs/ai-agents · plain text: https://nacaller.com/llms-full.txt
- Base URL https://api.nacaller.com. Auth: Authorization: Bearer <key>.
- Verification key (nck_live_...) in env var NACALLER_KEY for /api/verify. Developer key (nc_live_...) for /api/v1. Server-side only: never in browser code, NEXT_PUBLIC_/VITE_ vars, logs or git.
- Phone verification = two calls from OUR SERVER: start, then status (missed call) or check (voice OTP). The browser talks only to our own routes.
- Mark a phone verified only when NaCaller says verified. Verify webhooks on the raw body (X-MissOTP-Signature, HMAC-SHA256 hex), constant-time compare.
- Indian mobiles only (10 digits, 6-9). Voice OTP languages: te hi en ta kn ml mr bn or gu.
- Build against a TEST key (nc_test_..., Settings > Developers > Test key): same API, simulated, no real call, no credits. OTP test code is 123456. A key can be scoped (otp, calls, campaigns, read, agents, billing_link): ask for the narrowest. Estimate a campaign with POST /api/v1/campaigns?dryRun=true before creating it.
- Spec: https://nacaller.com/openapi.json (OpenAPI 3.1). The key types nck_ (OTP site key) and nc_ (scoped developer key) both work for OTP.
- Never place real calls or start campaigns without asking the owner. Agents and keypad flows you create or edit are saved as DRAFTS: tell the owner to press Activate in the dashboard; you cannot. Editing a live agent puts it back to draft, so ask first. Top-ups: give the owner the link from billing_topup_link; never try to pay or move money.
- Do not invent endpoints. If it is not in the docs, it does not exist.Phone verification in two calls
Miss OTP: start, then poll status. The user gives a missed call to the number you show, and is verified in about 3 seconds once the call is made. Voice OTP: start, then check. We phone the number and read a 6-digit code in one of 10 languages (te hi en ta kn ml mr bn or gu). Offer Voice OTP as the fallback for people who cannot give a missed call. Indian mobile numbers only.
# Call 1: start (missed call). Save requestId on the user.
curl -X POST https://api.nacaller.com/api/verify/start \
-H "Authorization: Bearer $NACALLER_KEY" -H "Content-Type: application/json" \
-d '{"phone":"9876543210","reference":"user_123"}'
# 200 { "requestId":"…", "phone":"9876543210", "callNumber":"…", "status":"pending",
# "expiresAt":"…", "expiresIn":300, "instruction":"Give a missed call to … from 9876543210. …" }
# Call 2: status, every 2-3 s until verified or expired
curl https://api.nacaller.com/api/verify/status/REQUEST_ID -H "Authorization: Bearer $NACALLER_KEY"
# 200 { "requestId":"…", "status":"verified", "verified":true, "verifiedAt":"…", … }# Call 1: we phone the number and read a 6-digit code
curl -X POST https://api.nacaller.com/api/verify/start \
-H "Authorization: Bearer $NACALLER_KEY" -H "Content-Type: application/json" \
-d '{"phone":"9876543210","method":"voice","language":"hi","reference":"user_123"}'
# 200 { "id":"…", "method":"voice", "status":"calling", "expiresAt":"…" }
# Call 2: check what the user typed
curl -X POST https://api.nacaller.com/api/verify/check \
-H "Authorization: Bearer $NACALLER_KEY" -H "Content-Type: application/json" \
-d '{"id":"…","code":"123456"}'
# 200 { "verified":true, "id":"…", "phone":"…", "reference":"user_123" }
# 400 { "verified":false, "error":"Incorrect code.", "attemptsLeft":4 }
# 410 { "verified":false, "error":"This code has expired. Start a new verification." }In every framework the rule is the same: the browser calls your server, your server calls NaCaller with the key, and you mark the phone verified only when NaCaller answers verified.
// app/api/verify/start/route.ts (server only)
import { NextResponse } from "next/server";
const BASE = "https://api.nacaller.com/api/verify";
const headers = { Authorization: `Bearer ${process.env.NACALLER_KEY}`, "Content-Type": "application/json" };
export async function POST(req: Request) {
const { phone, userId } = await req.json();
const r = await fetch(`${BASE}/start`, { method: "POST", headers, body: JSON.stringify({ phone, reference: userId }) });
return NextResponse.json(await r.json(), { status: r.status }); // { requestId, callNumber, instruction, expiresAt }
}
// app/api/verify/status/[id]/route.ts
export async function GET(_: Request, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const r = await fetch(`${BASE}/status/${encodeURIComponent(id)}`, { headers });
return NextResponse.json(await r.json(), { status: r.status }); // { status, verified }
}// Express (server only)
import express from "express";
const BASE = "https://api.nacaller.com/api/verify";
const headers = { Authorization: `Bearer ${process.env.NACALLER_KEY}`, "Content-Type": "application/json" };
const app = express(); app.use(express.json());
app.post("/verify/start", async (req, res) => {
const r = await fetch(`${BASE}/start`, { method: "POST", headers, body: JSON.stringify({ phone: req.body.phone, reference: req.user.id }) });
res.status(r.status).json(await r.json());
});
app.get("/verify/status/:id", async (req, res) => {
const r = await fetch(`${BASE}/status/${encodeURIComponent(req.params.id)}`, { headers });
const data = await r.json();
if (data.verified) { /* mark req.user's phone verified in YOUR database */ }
res.status(r.status).json({ status: data.status, verified: !!data.verified });
});# views.py (server only)
import os, requests
from django.http import JsonResponse
from django.views.decorators.http import require_GET, require_POST
BASE = "https://api.nacaller.com/api/verify"
AUTH = {"Authorization": f"Bearer {os.environ['NACALLER_KEY']}"}
@require_POST
def verify_start(request):
r = requests.post(f"{BASE}/start", headers=AUTH, timeout=10,
json={"phone": request.POST["phone"], "reference": str(request.user.id)})
return JsonResponse(r.json(), status=r.status_code)
@require_GET
def verify_status(request, rid):
r = requests.get(f"{BASE}/status/{rid}", headers=AUTH, timeout=10)
data = r.json()
if data.get("verified"):
pass # mark request.user's phone verified in your database
return JsonResponse({"status": data.get("status"), "verified": bool(data.get("verified"))}, status=r.status_code)<?php // routes/web.php (server only). NACALLER_KEY is in .env
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
Route::post('/verify/start', function (Request $request) {
$r = Http::withToken(env('NACALLER_KEY'))->acceptJson()->timeout(10)
->post('https://api.nacaller.com/api/verify/start', [
'phone' => $request->input('phone'),
'reference' => (string) $request->user()->id,
]);
return response()->json($r->json(), $r->status());
});
Route::get('/verify/status/{id}', function (string $id) {
$r = Http::withToken(env('NACALLER_KEY'))->acceptJson()->timeout(10)
->get('https://api.nacaller.com/api/verify/status/' . urlencode($id));
if ($r->json('verified')) { /* mark the user's phone verified in your database */ }
return response()->json(['status' => $r->json('status'), 'verified' => (bool) $r->json('verified')], $r->status());
});<!-- The page talks ONLY to your own server routes (/verify/start, /verify/status/:id).
Never call https://api.nacaller.com/api/verify from the browser: the key would be exposed. -->
<form id="f"><input name="phone" inputmode="numeric" maxlength="10" placeholder="10-digit mobile" required>
<button>Verify</button></form><p id="msg"></p>
<script>
f.onsubmit = async (e) => {
e.preventDefault();
const r = await fetch("/verify/start", { method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ phone: f.phone.value }) });
const d = await r.json();
if (!r.ok) return (msg.textContent = d.error);
msg.textContent = d.instruction; // "Give a missed call to <number> from <phone>..."
const t = setInterval(async () => {
const s = await (await fetch("/verify/status/" + d.requestId)).json();
if (s.status !== "pending") { clearInterval(t); msg.textContent = s.verified ? "Verified" : "Expired, try again"; }
}, 2500);
};
</script>Verify the webhook signature
Instead of polling you can receive verification.verified at an HTTPS URL. It is signed with X-MissOTP-Signature: the hex HMAC-SHA256 of the raw body, keyed with the site’s signing secret (NACALLER_WEBHOOK_SECRET). Compare in constant time and reject timestamps older than 5 minutes. Delivery is one attempt, so keep polling as a backup. Details on the webhooks page.
// Express. The signature covers the EXACT bytes we sent, so read the raw body —
// JSON.stringify(req.body) will not reproduce it byte for byte.
import express from "express";
import crypto from "node:crypto";
const app = express();
app.post("/webhooks/nacaller", express.raw({ type: "application/json" }), (req, res) => {
const sent = String(req.get("X-MissOTP-Signature") || "");
const expected = crypto
.createHmac("sha256", process.env.NACALLER_WEBHOOK_SECRET)
.update(req.body) // a Buffer: the raw body
.digest("hex");
const ok = sent.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(sent), Buffer.from(expected));
if (!ok) return res.status(401).end();
const event = JSON.parse(req.body.toString("utf8"));
if (Date.now() - event.timestamp > 5 * 60 * 1000) return res.status(400).end(); // replay
// event.requestId is verified — mark that user's phone as verified here.
res.sendStatus(204);
});# Flask. Verify against request.get_data() — the raw bytes, not parsed JSON.
import hashlib, hmac, json, os, time
from flask import Flask, request, abort
app = Flask(__name__)
SECRET = os.environ["NACALLER_WEBHOOK_SECRET"].encode()
@app.post("/webhooks/nacaller")
def nacaller_webhook():
raw = request.get_data()
expected = hmac.new(SECRET, raw, hashlib.sha256).hexdigest()
sent = request.headers.get("X-MissOTP-Signature", "")
if not hmac.compare_digest(sent, expected):
abort(401)
event = json.loads(raw)
if time.time() * 1000 - event["timestamp"] > 5 * 60 * 1000:
abort(400) # too old — treat as a replay
# event["requestId"] is verified — mark that user's phone as verified here.
return "", 204Error codes
| Status | Meaning | What to do |
|---|---|---|
400 | Invalid number, method or language; wrong voice code (with attemptsLeft) | Show the message; fix the input |
401 | Missing or invalid key | Check the env var; keys are per site |
402 | Out of verification or voice credits | A human tops up in the dashboard; do not retry |
403 | Number cannot be verified | Do not retry |
404 | Unknown request id | Use the id from start |
410 | Voice code expired or attempts used up | Start a new verification |
429 | Rate limit (120 starts a minute per key, 5 per number per 10 minutes; voice 3 per number per hour, 10 per day) | Wait; do not loop |
502 / 503 | Call could not be placed / line not available | Retry once later |
The Developer API (/api/v1, nc_live_ key) answers { "error": { "code", "message" } }, for example agent_not_found, outside_calling_hours (calls go out 9 am to 9 pm India time), daily_limit_reached and rate_limited (300 requests a minute per key). Verification errors are { "error": "message", "code": "…", "message": "…" } (the old string is kept; code is new). A key that lacks a scope gets 403 insufficient_scope. An agent or keypad flow saved through the API is a draft: calls and campaigns on it answer 409 agent_draft until a person activates it in the dashboard.
Safety notes
- The key is a server secret. Environment variable only; never in the browser, a
NEXT_PUBLIC_orVITE_variable, a mobile app, a log or git. Never paste it into a chat with an agent. - Give an agent a test key. In Settings, Developers, tick Test key and pick the narrowest scope. An
nc_test_key behaves like a live one but nothing real happens: no phone rings, no credits or wallet are used, and the OTP code is always123456. Site keys (nck_live_) have no sandbox, so test those with your own phone. The spec is at/openapi.json(OpenAPI 3.1). - Scopes limit the damage.
otp,calls,campaigns,read(GET only),agentsandbilling_link, with presets OTP only, Calling, Read only and Full access (the only preset that holdsagentsandbilling_link). A request outside the key's scopes is refused withinsufficient_scope. A campaign can be estimated first withPOST /api/v1/campaigns?dryRun=true: contact counts, a cost range, and whether the wallet covers it. - Real calls cost real minutes. Have the agent ask you before it places a call or starts a campaign. Calls go out 9 am to 9 pm India time and do-not-call numbers are never dialled.
- Do not let an agent invent endpoints. If it is not in these docs or in
llms-full.txt, it does not exist. There is no SDK, no delete endpoint and no way to activate an agent or pay through the API. - Agents are saved as drafts. An agent or keypad flow created or edited with the
agentsscope cannot place calls, run campaigns or answer a number until a person presses Activate on the Agents page. Editing a live agent puts it back to draft, so the agent should ask first. Test keys do all of this in the sandbox, with nothing stored. - Money stays with people.
balance_getreads the balance.billing_topup_linkreturns a link to the dashboard’s Add money page with the amount filled in; a person opens it signed in and pays. The tool never charges, and the agent must not try.
Related
- Prompts to paste and the machine-readable files
- Miss OTP reference · Voice OTP reference
- Developer API (calls, campaigns, results)
- OpenAPI 3.1 spec (
/openapi.json)
Stuck on the NaCaller API? Ask us.
A developer reads every message and replies by email, usually within one business day.