Platform

Webhooks

InferexAI sends a signed HTTPS request to your server when something happens on your account: a call ends, a recording is ready, your wallet runs low. Deliveries are retried, logged, and can be sent again.

Events

call.startedA voice-agent call connected.
call.completedA call ended. Carries duration, turns, typical reply time and cost.
call.failedA call ended because of an error.
recording.readyThe stereo recording of a call can be fetched.
agent.version.publishedA voice agent got a new live version, by an edit, a publish or a rollback.
topupMoney was added to the wallet.
low_balanceThe wallet fell below your alert threshold.
key_expiredAn API key was revoked.
lead.createdA website call widget call ended and its lead was saved: outcome, summary, captured details and the page it came from. Once per call; never for test calls.
addon.enabledYour organisation turned an add-on on. Also addon.setup_completed, addon.paused, addon.resumed, addon.disabled, addon.charged, addon.suspended, addon.reactivated and addon.price_changing.

Create a webhook

bash
curl https://api.inferexai.in/portal/webhooks \
  -X POST \
  -H "Authorization: Bearer sk-live-your-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-server.example.com/inferex-events",
    "events": ["call.completed", "recording.ready", "low_balance"],
    "description": "Order desk"
  }'
JSON
{
  "id": 7,
  "secret": "3f9c…  (64 hex characters, shown once)",
  "api_version": 2
}

The secret is shown once. Store it; you need it to check signatures. The address must be a public https:// URL on port 443 or 8443.

What you receive

http
X-Inferex-Event: call.completed
X-Inferex-Event-Id: evt_5b1f0c2a9d3e4f6a7b8c9d0e
X-Inferex-Signature: t=1794900003,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
JSON
{
  "id": "evt_5b1f0c2a9d3e4f6a7b8c9d0e",
  "type": "call.completed",
  "created": 1794900000,
  "api_version": 2,
  "organisation_id": 12,
  "data": {
    "call_id": "0c8f6f0e-2d0b-4a53-9f43-6a1d2f7b9c11",
    "agent_id": "va_3f2a9c1b7d5e4f608a12",
    "agent_version": 4,
    "source": "live",
    "caller_ref": "customer-8421",
    "started_at": "2026-11-16T10:00:00+00:00",
    "ended_at": "2026-11-16T10:02:14+00:00",
    "duration_s": 134,
    "ended_by": "agent_ended_call",
    "turns": 9,
    "reply_median_ms": 870,
    "cost_inr": 1.9432
  }
}

Events carry ids and summaries, never audio or a full transcript. Fetch those with the API when you need them. An event keeps its id across retries and redeliveries, so use it to ignore repeats.

Verify the signature

X-Inferex-Signature is t=<unix time>,v1=<hex>, where the hex is the HMAC-SHA256 of <t>.<raw body> with your secret. Check it on the raw bytes, before parsing JSON, and refuse anything older than five minutes.

verify_webhook.py
import hashlib
import hmac
import time


def verify_webhook(secret: str, body: bytes, signature_header: str, tolerance_s: int = 300) -> bool:
    """True when the request really came from InferexAI and is recent."""
    timestamp, signatures = None, []
    for part in signature_header.split(","):
        key, _, value = part.strip().partition("=")
        if key == "t":
            timestamp = value
        elif key == "v1":
            signatures.append(value)
    if not timestamp or not timestamp.isdigit() or not signatures:
        return False
    if abs(time.time() - int(timestamp)) > tolerance_s:
        return False
    signed = timestamp.encode() + b"." + body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return any(hmac.compare_digest(expected, s) for s in signatures)
verify_webhook.js
const crypto = require('crypto')

// True when the request really came from InferexAI and is recent.
// rawBody must be the exact bytes received, before any JSON parsing.
function verifyWebhook(secret, rawBody, signatureHeader, toleranceS = 300) {
  let timestamp = null
  const signatures = []
  for (const part of signatureHeader.split(',')) {
    const [key, value] = part.trim().split('=')
    if (key === 't') timestamp = value
    else if (key === 'v1') signatures.push(value)
  }
  if (!timestamp || !/^\d+$/.test(timestamp) || signatures.length === 0) return false
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > toleranceS) return false
  const signed = Buffer.concat([Buffer.from(timestamp + '.'), Buffer.from(rawBody)])
  const expected = crypto.createHmac('sha256', secret).update(signed).digest('hex')
  return signatures.some(s =>
    s.length === expected.length && crypto.timingSafeEqual(Buffer.from(s), Buffer.from(expected)))
}

module.exports = { verifyWebhook }

Retries

Answer with any 2xx status within 5 seconds. Anything else is retried after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 24 hours: seven attempts in all. Redirects are not followed. After 10 events in a row fail every attempt, the webhook is switched off; switch it back on once your endpoint is fixed.

Rotate the secret

bash
curl -X POST https://api.inferexai.in/portal/webhooks/7/rotate \
  -H "Authorization: Bearer sk-live-your-key-here"

You get a new secret at once. For the next 24 hours every delivery carries two v1= values, one for each secret, so you can deploy the new secret without dropping events. The snippets above accept either.

Webhooks created before signed timestamps

Older webhooks keep their original format: the event fields at the top level of the body, and X-Inferex-Signature: sha256=<HMAC-SHA256 of the raw body>. Move one to the format on this page by setting api_version to 2 with PATCH. This cannot be undone.

Endpoints

GET /portal/webhooksList your webhooks
GET /portal/webhooks/eventsEvery event you can subscribe to
POST /portal/webhooksCreate one. Optional agent_id limits it to one voice agent
PATCH /portal/webhooks/{id}Change url, events, description, is_active, agent_id
POST /portal/webhooks/{id}/rotateNew signing secret; the old one works for 24 hours
POST /portal/webhooks/{id}/testSend a test event now
GET /portal/webhooks/{id}/deliveriesDelivery log: status, time taken, next retry
POST /portal/webhooks/{id}/deliveries/{delivery_id}/redeliverSend a past event again
DELETE /portal/webhooks/{id}Delete