accept (the call connects normally) or reject (the caller hears a busy tone and the call is never answered). This lets you gate calls with your own logic — most commonly, blocking an end-user who is out of credit — without Nixflex ever needing to know your billing.
The decision happens before the call is answered, so a rejected call is never connected and incurs no Nixflex call charge.
This is separate from your own Nixflex balance. Nixflex independently checks that your account has credit. The pre-call gate is your layer, for your end-users.
When to use it
- Billing gate — block an end-user who has run out of credit in your system.
- Business hours — refuse calls outside opening times.
- Blocklist — refuse known spam numbers.
Setting the URL
You can set the URL at two levels. Agent-level is recommended — set it once and every number on the agent is gated, including numbers you add later.Agent-level (recommended)
Number-level (optional override)
url is required and must be https://.
Use the full API key in the
Authorization header — both halves, KEY_ID:KEY_SECRET (the nxf_... id, a colon, then the nxfs_... secret). Not just the secret.What Nixflex sends
When a call comes in, Nixflex POSTs this to your URL and waits for your reply:| Field | Type | Notes |
|---|---|---|
event | string | Always call.inbound. |
from | string | The caller’s number. |
to | string | The number that was dialled. This identifies which of your end-users the call is for. |
call_id | string | The Twilio call SID for this call. |
What you reply
Respond with200 and one of these JSON bodies, within 5 seconds:
accept→ the call connects normally.reject→ the caller hears a busy tone. The call is never answered.reasonis optional and is logged on your call record.
Example endpoint
Fail-open behaviour
Only an explicit{"action":"reject"} blocks a call. Everything else — accept, empty body, malformed JSON, a 500, a timeout — connects.
The timeout is 5 seconds. Keep your endpoint to a single database lookup. If you run it on a serverless platform (Edge Functions, Lambda), watch for cold starts — a slow first invocation will silently fall through to connect. Keep the function warm or the logic minimal.
Reading and removing the URL
The
GET response field is precall_webhook_url, even though you set it with url in the PUT body. Read is_set to check programmatically whether a gate is configured.Security
Request signing (anX-Nixflex-Signature HMAC header, like the post-call webhook) is on the roadmap. When it ships, you will be able to verify the pre-call POST the same way.
Testing it
Set the URL
Set an agent-level URL pointing at an endpoint that returns
{"action":"reject","reason":"test"}.Call the number
Call any number on that agent. You should hear a busy tone — the call is never answered.
Flip to accept
Change your endpoint to return
{"action":"accept"} and call again. The call connects normally.Limits and notes
- Inbound only. Outbound calls are initiated by you, so gate them in your own code before placing the call.
- 5-second timeout. Slower than that = fail-open (connect).
- Only explicit
rejectblocks. Everything else connects. - Reject = busy tone, before answer. No Nixflex call charge for a rejected call, and a busy tone signals “try again later” to the caller.
Roadmap
accept / reject covers billing and access gating today. A future version may also let the response inject dynamic variables or override which agent handles the call. The current contract (accept / reject) will continue to work unchanged.