# Verify AI callers

Check an incoming phone call from an AI agent while it rings, ask for proof when the caller didn't register, ask the person behind the agent to confirm more, and wire the check into Twilio, Vapi, Retell or ElevenLabs.

Check an incoming call to your business and learn which agent is calling, which company operates it, whether a person approved the call and what that person allowed. Your AI receptionist or your front desk asks with the two phone numbers, and the answer comes back with a signed receipt.

**Before you begin:** you need an account key with the `authorize` scope and the phone line your business answers on. Each check that matches a registered call is billed as one verified call, once per call; see [plans and usage](https://provenanceauth.com/docs/account/plans-and-usage.md). The examples use the sandbox enterprise key and a line at `+14155550123`.

```bash
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
```

1. **Incoming call**: from and to numbers
2. **Provenance**: matches the registered call
3. **Your receptionist**: acts within the verdict

## 1. Verify your line

Add the number your business answers on with `side: answering`. Provenance texts it a 6-digit code, or reads the code out on a call with `channel: call` for a landline or a contact-centre line. Send the code back with [`POST /v1/mandate/call_numbers/{id}/verify`](https://provenanceauth.com/docs/api/calls.md#post-v1-mandate-call-numbers-id-verify) within 10 minutes.

**curl**

```bash
curl -s -X POST $PROVENANCE_API/v1/mandate/call_numbers \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "number": "+14155550123", "side": "answering", "channel": "call" }'
```

**Node**

```ts
import { Provenance } from "@provenanceauth/sdk";

const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const line = await prov.mandate.callNumbers.create({ number: "+14155550123", side: "answering", channel: "call" });
```

**Python**

```python
import os
from provenanceauth import Provenance

prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
line = prov.mandate.call_numbers.create(number="+14155550123", side="answering", channel="call")
```

```json
{
  "id": "cnum_01M6XS7ASYNDF98T837YFBQ3WE",
  "object": "call_number",
  "side": "answering",
  "last4": "0123",
  "country": "US",
  "status": "pending",
  "channel": "call",
  "verified_at": null,
  "delivery": { "channel": "call", "delivered": false, "reason": "channel_not_configured" }
}
```

A verified line lets you check calls to it by their numbers alone. On a line you haven't verified, a check needs the short code the caller gives you, so no account can ask about calls to someone else's line.

## 2. Check the incoming call

Send the caller ID as `from` and your line as `to`. The check matches a call the agent registered for these two numbers whose window covers now.

**curl**

```bash norun
curl -s -X POST $PROVENANCE_API/v1/authorize/call_checks \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "from": "+14155550100", "to": "+14155550123" }'
```

**Node**

```ts
const verdict = await prov.authorize.calls.check({ from: "+14155550100", to: "+14155550123" });
```

**Python**

```python
verdict = prov.authorize.calls.check(from_="+14155550100", to="+14155550123")
```

```json
{
  "id": "ccx_01M6XS88NC03EVE2XZ21T2VWCR",
  "object": "call_check",
  "result": "verified",
  "reason": null,
  "transport": "lookup",
  "agent": {
    "id": "agt_01M6XS88KNFTWDGP2MRBSJG3WR",
    "name": "Muse",
    "category": "ai_assistant_fetch",
    "directory": "https://api.provenanceauth.com/v1/public/agents/agt_01M6XS88KNFTWDGP2MRBSJG3WR/directory"
  },
  "operator": { "name": "Larkspur Assist", "domain_verified": false },
  "person": { "approved": true, "approved_at": "2026-11-08T14:33:30.010Z", "approved_via": "grant", "pseudonym": "hum_d3v3dtfd6rqyq6ifahve" },
  "scope": { "purposes": ["book", "cancel"], "max_amount": 20000, "currency": "USD" },
  "call": {
    "purpose": "book",
    "purpose_text": "Table for 2 at 7pm Friday",
    "window": { "from": "2026-11-08T14:33:30.000Z", "until": "2026-11-08T14:43:30.000Z" },
    "disclosure": { "ai": true, "statement": "spoken_at_start" },
    "consent": { "basis": "customer_request", "ref": "booking-4471" }
  },
  "receipt": "eyJhbGciOiJFUzI1NiIsInR5…",
  "status_url": "https://api.provenanceauth.com/v1/authorize/call_checks/ccx_01M6XS88NC03EVE2XZ21T2VWCR",
  "created_at": "2026-11-08T14:33:30.028Z"
}
```

Act only on `result: "verified"`, and only within `scope`. The verdict never contains a phone number or a device. `person.pseudonym` is stable for the same person at your business and different at every other business. Checking the same call again returns the same verdict and isn't billed again.

When the caller reads out its short code, pass it as `code`. A call with no registration answers `no_proof`, which is what a spoofed number gets:

**curl**

```bash
curl -s -X POST $PROVENANCE_API/v1/authorize/call_checks \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "from": "+14155550177", "to": "+14155550123", "code": "123456" }' | tee check.json
export CHECK_ID=$(jq -r .id check.json)
```

**Node**

```ts
const unproven = await prov.authorize.calls.check({ from: "+14155550177", to: "+14155550123", code: "123456" });
```

**Python**

```python
unproven = prov.authorize.calls.check(from_="+14155550177", to="+14155550123", code="123456")
```

```json
{
  "object": "call_check",
  "result": "no_proof",
  "reason": "unknown_caller",
  "transport": "code",
  "agent": null,
  "operator": null,
  "receipt": null
}
```

A person at the desk with no API key can check a short code on the [verify a call](https://provenanceauth.com/verify-call) page. It shows the agent, its operator, whether a person approved and the purpose.

## 3. Ask for more during the call

When a verified caller asks for something you didn't check, such as a larger deposit, send it to [`POST /v1/authorize/call_checks/{id}/requests`](https://provenanceauth.com/docs/api/call-checks.md#post-v1-authorize-call-checks-id-requests). Inside the grant's call scope and budget the answer is `within_scope`, and nothing is spent from the grant. Over it, the person behind the agent gets a confirmation on their own device while the call holds, billed to your account as one confirmation.

**curl**

```bash norun
curl -s -X POST $PROVENANCE_API/v1/authorize/call_checks/ccx_01M6XS88NC03EVE2XZ21T2VWCR/requests \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "action_type": "book", "amount": 45000, "currency": "USD", "description": "Private room for 12, with a deposit" }'
```

**Node**

```ts
const asked = await prov.authorize.calls.request(verdict.id, {
  actionType: "book", amount: 45000, currency: "USD", description: "Private room for 12, with a deposit",
});
```

**Python**

```python
asked = prov.authorize.calls.request(verdict["id"], action_type="book", amount=45000, currency="USD",
                                     description="Private room for 12, with a deposit")
```

```json
{
  "id": "ccx_01M6XS88NC03EVE2XZ21T2VWCR",
  "object": "call_check",
  "result": "verified",
  "request": {
    "action_type": "book",
    "amount": 45000,
    "currency": "USD",
    "description": "Private room for 12, with a deposit",
    "status": "pending_confirmation",
    "decided_at": null
  }
}
```

Poll [`GET /v1/authorize/call_checks/{id}`](https://provenanceauth.com/docs/api/call-checks.md#get-v1-authorize-call-checks-id) with `?wait=` until the person answers. The answer appears in `request.status`, which reads `expired` if nobody answers in time. The confirmation stays open for `wait` seconds, 120 by default.

## 4. Ask for proof when the caller didn't register

Try these in order. Each starts from the check of the call.

### Challenge the caller

Check again with `challenge: true`. When `from` is a number an operator verified, the answer carries a challenge, and the operator's agent is asked for proof:

```json
{
  "id": "ccx_01M6XS88PYFZ9T119KKNHFF5KD",
  "object": "call_check",
  "result": "pending",
  "challenge": {
    "state": "open",
    "expires_at": "2026-11-08T14:38:30.085Z",
    "code": "675807",
    "phrase": "Please verify this call with Provenance, code 6-7-5-8-0-7.",
    "dtmf": "*675807#"
  },
  "proof_request": { "status": "requested" }
}
```

Read `phrase` out on the call and play `dtmf` as keypad tones. An agent on Provenance answers by itself, and [`GET /v1/authorize/call_checks/{id}`](https://provenanceauth.com/docs/api/call-checks.md#get-v1-authorize-call-checks-id) with `?wait=10` turns `verified` with `transport: in_call_challenge`. The last digit is a check digit: if the caller repeats a code that fails it, ask for the code again. A challenge expires in 5 minutes and allows 5 tries. A number no operator verified answers `no_proof` at once.

### Confirm with the guest

For a caller not on Provenance, send a confirmation to the phone or email you already hold for the guest, from the booking or your own records. The person approves on their own device, and the check turns `verified` with `agent: null` and `person.approved_via: "booking_contact"`. It is billed to your account as one confirmation.

**curl**

```bash
curl -s -X POST $PROVENANCE_API/v1/authorize/call_checks/$CHECK_ID/guest_confirmations \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "contact": { "email": "rowan@tarrowby.example" }, "description": "Confirm your table for 2 at 7pm Friday" }'
```

**Node**

```ts
const pending = await prov.authorize.calls.guestConfirmation(unproven.id, {
  contact: { email: "rowan@tarrowby.example" },
  description: "Confirm your table for 2 at 7pm Friday",
});
```

**Python**

```python
pending = prov.authorize.calls.guest_confirmation(unproven["id"], contact={"email": "rowan@tarrowby.example"},
                                                  description="Confirm your table for 2 at 7pm Friday")
```

```json
{
  "object": "call_check",
  "result": "pending_confirmation",
  "transport": "guest_confirmation",
  "agent": null,
  "person": { "approved": false, "approved_at": null, "approved_via": "booking_contact", "pseudonym": null },
  "delivery_hint": "an address at tarrowby.example"
}
```

You learn that a real person approved through the booking's contact, and not which agent called. `contact` takes a phone, an email or both, and `channels` narrows which messages may go. Leave `contact` out to send nothing: the response carries `approve_url` for you to pass to the guest yourself.

### Relay a short code

Only when you have no contact for the person: [`POST /v1/authorize/call_checks/{id}/relay_codes`](https://provenanceauth.com/docs/api/call-checks.md#post-v1-authorize-call-checks-id-relay-codes) returns a 6-digit code and a fixed short address. Read both out, and ask the caller to read the code back. The agent relays them to its person, who enters the code at the address and approves. The code works once and expires in 5 minutes.

```json
{
  "object": "call_relay_code",
  "check_id": "ccx_01M6XS88RWJQJT5AM1M8CYYSFX",
  "code": "842100",
  "short_address": "provenanceauth.com/c",
  "expires_at": "2026-11-08T14:38:30.148Z"
}
```

## 5. Keep the receipt

A verified check carries `receipt`, an ES256 JWS. [`GET /v1/authorize/call_checks/{id}/receipt`](https://provenanceauth.com/docs/api/call-checks.md#get-v1-authorize-call-checks-id-receipt) returns it decoded. It holds the check, the agent's key, the person's pseudonym and `numbers_digest`, a SHA-256 of both numbers and the credential's `jti`, never the numbers themselves. Verify it offline against `/.well-known/jwks.json`, as on the [call credential reference](https://provenanceauth.com/docs/authorize/reference/call-credential.md#verify-a-receipt).

## 6. Connect your voice platform

Each platform below calls your server during the call; your server calls Provenance with its key and answers with the verdict. Keep the Provenance key on your server, never in the platform's prompt. These setups use each platform's own custom-tool or webhook feature.

### Twilio

Point your Twilio number's voice webhook at your server. `verifyTwilioCall` in `@provenanceauth/sdk` checks the request's `X-Twilio-Signature` against your Twilio auth token, then checks the call from its `From` and `To` parameters:

```ts
import express from "express";
import { Provenance, verifyTwilioCall } from "@provenanceauth/sdk";

const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY! });
const app = express();

app.post("/voice", express.urlencoded({ extended: false }), async (req, res) => {
  const v = await verifyTwilioCall({
    url: "https://bistro-nine.example/voice", // the URL exactly as set in Twilio
    params: req.body,
    signature: req.header("X-Twilio-Signature"),
    authToken: twilioAuthToken, // your Twilio auth token, from your secret store
    prov,
  });
  if (!v.signatureValid) return res.status(403).end();
  const greeting = v.verified ? `Hello, ${v.check?.agent?.name}.` : "Hello, how can I help?";
  res.type("text/xml").send(`<Response><Say>${greeting}</Say></Response>`);
});
```

When Provenance can't be reached, the verdict is `unverified`, never `verified`.

### Vapi

Add a function tool with a server URL on your side. Vapi's static parameters fill in the numbers from the call, so the model never types them, and they merge into the arguments Vapi sends your server:

```json
{
  "type": "function",
  "function": {
    "name": "verify_caller",
    "description": "Check whether this caller is an AI agent with proof, and what its person allowed.",
    "parameters": { "type": "object", "properties": { "code": { "type": "string", "description": "A 6-digit code the caller gave, if any." } } }
  },
  "server": { "url": "https://bistro-nine.example/vapi/tools" },
  "parameters": [
    { "key": "from", "value": "{{ customer.number }}" },
    { "key": "to", "value": "{{ phoneNumber.number }}" }
  ]
}
```

Your server answers Vapi's `tool-calls` message with one result per tool call:

```ts
app.post("/vapi/tools", express.json(), async (req, res) => {
  const results = await Promise.all(
    req.body.message.toolCallList.map(async (call: { id: string; function: { arguments: { from: string; to: string; code?: string } } }) => {
      const { from, to, code } = call.function.arguments;
      const v = await prov.authorize.calls.check({ from, to, ...(code ? { code } : {}) });
      return { toolCallId: call.id, result: JSON.stringify({ result: v.result, agent: v.agent?.name, operator: v.operator?.name, scope: v.scope }) };
    }),
  );
  res.json({ results });
});
```

Protect the endpoint with the server authentication Vapi offers for tool calls.

### Retell

Add a custom function that posts to your server. Map Retell's system variables `{{user_number}}` (the caller on an inbound call) and `{{agent_number}}` (your number) to the function's `from` and `to` parameters. Retell signs each request with `X-Retell-Signature`; verify it over the raw body with your Retell API key before you call Provenance.

```ts
import Retell from "retell-sdk";

app.post("/retell/verify-caller", express.text({ type: "*/*" }), async (req, res) => {
  if (!Retell.verify(req.body, retellApiKey, req.header("X-Retell-Signature")!)) return res.status(401).end();
  const { args } = JSON.parse(req.body);
  const v = await prov.authorize.calls.check({ from: args.from, to: args.to, ...(args.code ? { code: args.code } : {}) });
  res.json({ result: v.result, agent: v.agent?.name ?? null, operator: v.operator?.name ?? null, scope: v.scope });
});
```

Retell passes a JSON response to the model, so return only the fields it needs.

### ElevenLabs

Add a webhook tool to your agent with your server's URL and the POST method. Add body parameters `from` and `to` with the value type **Dynamic variable**, set to `system__caller_id` and `system__called_number`. Store your own server's token as a secret header, and have your server call `prov.authorize.calls.check` as in the Vapi handler and return the verdict.

### MCP

An AI receptionist that speaks MCP can use the `verify_caller` and `request_caller_confirmation` tools in `@provenanceauth/mcp-server`, on its own or through [Provenance MCP](https://provenanceauth.com/docs/provenance-mcp.md). `verify_caller` returns the verdict with a one-line `summary` the model can act on. See [agent tools](https://provenanceauth.com/docs/provenance-mcp/agent-tools.md).

## Errors you might see

| Symptom | Cause | Fix |
| --- | --- | --- |
| `call_line_unverified` (403) | `to` isn't a line your account verified, and no `code` was given | Verify the line (step 1), or pass the caller's short code. |
| `result: "replayed"` | Another business already checked this call | Treat it as unverified. |
| `result: "no_proof"` | Nothing is registered for these numbers | Ask for proof (step 4). |
| `call_check_not_verified` (409) | A request or a receipt for a check that didn't match a registered call | Check the call first, or confirm with the guest. |
| `customer_routing_not_allowed` (400) | The guest chose not to get approval requests from your business | Use another path. |
| `trial_ended` (402) | The Free trial's API calls are used | Choose a plan. |
| `calls_not_configured` (503) | Verified calls aren't turned on for this deployment | Treat the call as unverified. |

## See also

- [Verified calls](https://provenanceauth.com/docs/authorize/concepts/verified-calls.md)
- [Register calls](https://provenanceauth.com/docs/mandate/guides/register-calls.md), the caller's side
- [Call credential format](https://provenanceauth.com/docs/authorize/reference/call-credential.md)
- [Plans and usage](https://provenanceauth.com/docs/account/plans-and-usage.md)
- [Webhooks](https://provenanceauth.com/docs/integrate/webhooks.md)
