Build
Server API and webhooks
Open and close your lines from your own server, and get a signed message when a call rings, connects or ends.
The Call button needs only your public key. If you also want your own server to control when calls are possible, or to know when a call is ringing, connected or over (for example to show “on the line now” on a radio page), iungo gives you a secret key, a small API, and webhooks.
Get a secret key
Ask iungo to make one for your partner. It is shown to you once. Send it with the header Authorization: Bearer sk_… on every request below. The base address is:
https://iungo-api.up.railway.app/api/partner-api/v1A missing or wrong key gets 401. A partner that iungo has paused gets 403.
Open and close your lines
Closing your lines makes the Call button tell visitors that your host is not available. Calls already in progress are not cut off. Use it to open the lines when your show starts and close them when it ends.
# Are the lines open?
curl https://iungo-api.up.railway.app/api/partner-api/v1/availability \
-H "Authorization: Bearer sk_live_YOUR_SECRET"
# Close them (open: true to open again)
curl -X PUT https://iungo-api.up.railway.app/api/partner-api/v1/availability \
-H "Authorization: Bearer sk_live_YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{ "open": false }'{ "status": "success", "data": { "lines_open": false, "host_available": true, "state": "closed", "environment": "live", "webhook_url": null } }| Field | Meaning |
|---|---|
lines_open | Your own switch: the one you change with this API. |
host_available | False while your host has not switched your site on in iungo (Settings → Website calls), or iungo has paused you. You cannot change that from the API. |
state | active, closed (you closed them), waiting (the host has not switched you on yet), switched_off (the host turned you off) or suspended. |
What the call is for
Set the options a visitor picks on the pre-call screen (for example “Join Radio Live”) from your server, so you can change them without touching your page. They take the place of the host's own services and the default options, unless your page sets its own with callReasons.
# Set them (replaces the whole list)
curl -X PUT https://iungo-api.up.railway.app/api/partner-api/v1/call-reasons \
-H "Authorization: Bearer sk_live_YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{ "options": ["Join Radio Live", "Advice", "Consultation"], "multiple": false, "heading": "What would you like to do?" }'
# See them, or remove them
curl https://iungo-api.up.railway.app/api/partner-api/v1/call-reasons -H "Authorization: Bearer sk_live_YOUR_SECRET"
curl -X DELETE https://iungo-api.up.railway.app/api/partner-api/v1/call-reasons -H "Authorization: Bearer sk_live_YOUR_SECRET"options: up to 10 names, 3 to 60 characters each, with no links or contact details. An empty list removes them.multiple(defaulttrue):truelets the visitor pick up to 3,falseexactly one.heading(optional): replaces “What do you need help with?”.- Options that offer company, chat or dating rather than a service are refused with a
400that names the option. - A visitor who is already on the pre-call screen keeps the list they opened it with; the next visitor sees the change.
Webhooks
A webhook is a message iungo sends to your server when something happens on a call placed from your site. Tell iungo where to send them:
curl -X PUT https://iungo-api.up.railway.app/api/partner-api/v1/webhook \
-H "Authorization: Bearer sk_live_YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{ "url": "https://www.example.com/iungo-webhook" }'The answer includes a signing_secret (it starts with whsec_). It is shown once, the first time you set an address. Use it to check that a message really came from iungo. The address must be a public https address. You can send a test message at any time:
curl -X POST https://iungo-api.up.railway.app/api/partner-api/v1/webhook/test -H "Authorization: Bearer sk_live_YOUR_SECRET"Other calls: POST /webhook/rotate-secret makes a new signing secret (the old one stops working at once), and DELETE /webhook stops the messages.
The events
| Type | When |
|---|---|
call.ringing | A visitor on your site started a call and your host's phone is ringing. |
call.connected | Your host answered. The two of them are talking. |
call.ended | The call is over, however it ended. reason says how: completed, declined, cancelled, missed or failed. |
ping | A test message you asked for. |
{
"id": "evt_9f2c1a7b3d4e5f60718293a4",
"type": "call.ended",
"created": "2026-11-30T10:02:36.120Z",
"livemode": true,
"data": {
"call_id": "6b0a1c...",
"caller": { "first_name": "Ada" },
"ringing_at": "2026-11-30T10:00:00.000Z",
"connected_at": "2026-11-30T10:00:05.000Z",
"ended_at": "2026-11-30T10:02:35.000Z",
"duration_seconds": 150,
"reason": "completed"
}
}The only thing about the caller is their first name. There is no email, phone number, surname or amount. duration_seconds is the time the two of them were connected.
Check the signature
Every message carries an Iungo-Signature header like t=1764496956,v1=…. The v1 part is an HMAC-SHA256, using your signing secret, of the timestamp, a dot and the raw request body. Check it before you trust a message, and reject timestamps more than five minutes old.
import { createHmac, timingSafeEqual } from "node:crypto";
export function isFromIungo(rawBody, header, signingSecret) {
const match = /^t=(\d+),v1=([0-9a-f]{64})$/.exec(header || "");
if (!match) return false;
if (Math.abs(Date.now() / 1000 - Number(match[1])) > 300) return false;
const expected = createHmac("sha256", signingSecret).update(match[1] + "." + rawBody).digest();
return timingSafeEqual(expected, Buffer.from(match[2], "hex"));
}Delivery
- Answer with any
2xxstatus, quickly. Do your slow work afterwards. - Anything else, or no answer within 8 seconds, is retried with growing gaps, ten attempts over about three hours, and then given up on.
- The same message can arrive more than once, and messages can arrive out of order. Use
idto ignore repeats, andcall_idto tie the events of one call together. - Your address is never followed through redirects, and it must not point at a private network.
Build a waiting list
iungo does not hold callers in a queue: if your host is already on a call, the next visitor is told they are busy. If your show needs a waiting list, you build it on your side with the pieces above. One way:
- Collect the line. Instead of showing every listener a Call button, show “Join the queue”. Your server keeps the ordered list (your own listener id and first name).
- Show the button to one person. Your page shows the Call button, or calls
openCall(), only for the listener at the front. Everyone else sees their place (“You're 3rd”). Give the person at the front a short time to take their turn before moving on. - Link the call to the queue entry. When that listener's page receives the
call:startedevent, it has thecallId. Send it to your server and store it against their entry. - Move on when the call ends. Your server receives
call.endedwith the samecall_id. Mark the entry finished and promote the next listener. Your page for that listener finds out through your own live update (polling or a socket). - “On the line now”. Show the first name from the latest
call.connectedthat has nocall.endedyet. If you use prefill you already know who they are too. - Open and close the show. Use
PUT /availabilityto open the lines when the show starts and close them when it ends.
Privacy
Webhooks tell your server a caller's first name. Your page is still never told it by iungo. Mention in your privacy policy that call events are sent to you, and keep to what you need.
Something missing or unclear? Tell us.

