What is a PBX API?
An API (Application Programming Interface) is an interface that lets other systems talk to the PBX: read calls and history, download recordings, send SMS and place calls — in code, without touching the control panel.
What an API is, in plain words
API stands for Application Programming Interface. It is a door through which one piece of software asks another for things, according to agreed rules. The control panel is the door for people: you click, choose, save. The API is the door for computers: you send an orderly request, and get an orderly answer.
A familiar picture is a waiter in a restaurant. You do not walk into the kitchen and cook yourself. You order from the menu, the waiter passes the order along, and brings you the dish. The API is the waiter, the menu is the list of actions you are allowed to ask for, and the kitchen is the PBX.
Why does this matter? Because the phone is not an isolated organ in an organization. There is a website, an ordering system, accounting software, a CRM system. An API lets you connect them to the PBX, so information moves on its own and actions happen without anyone copying numbers from screen to screen.
The term REST, which often appears next to the word API, describes a common style of interfaces: every action is a web address, and the answer comes back in a structured text format that software can easily read.
How an API request works
- Your system sends a request — for example "give me yesterday's calls" or "send an SMS to this number." The request is sent to the API's address, using the GET method (usually to read information) or POST (usually to perform an action).
- The request carries a token — a secret string that identifies the sender. It is like an employee badge: without a badge, you do not get in.
- The API checks permissions — whether this user is allowed to perform this action.
- The PBX carries it out — it pulls the data or performs the action.
- A response comes back — the data itself, or confirmation that the action was done (or an error message explaining why not).
All of this happens in a fraction of a second, and it can be repeated thousands of times a day without anyone touching a keyboard.
What you can do with a PBX API
A PBX API usually touches several areas:
- Calls — which calls are active right now, who is waiting in a queue, and the call history from the call log.
- Recordings — pulling the recording file of a specific call, to save it in another system or analyze it.
- SMS — sending a message from the business's number, from within software.
- Dialing — creating a call: the PBX dials the agent, and when they answer, dials the customer.
- PBX components — reading and changing settings, such as extensions, queues and numbers.
Real-life examples
- A website that shows how many are waiting — a service center shows on its "Contact us" page how many people are currently waiting in the queue. The customer decides whether to call now or later.
- A booking system that sends SMS — a clinic or an office books an appointment in its system, and the system sends the customer a confirmation and a reminder by SMS from the business's number.
- An automatic monthly report — on the first of every month the call log is pulled, and the nonprofit's management receives a report: how many calls, how many were answered, what the wait times were.
- A "Call me" button — a customer clicks on the website, and the PBX dials an available agent and then the customer. The customer does not wait on the line.
- Dialing from a customer card — in the CRM you click a number and the call goes out, without typing.
What all the examples have in common: something that used to be done by hand, or not done at all, happens on its own and on time.
API versus webhook
An API and a webhook sound similar, but the direction is opposite. With an API, your system asks the PBX: "What is the status?" With a webhook, the PBX notifies your system the moment something happens: "A call just came in from this number."
| Topic | API | Webhook |
|---|---|---|
| Who initiates | Your system | The PBX |
| When | When you ask | The moment the event happens |
| Best for | Pulling data, performing an action | Immediate reaction to an event |
| Example | Call report, sending SMS | Opening a customer record when the phone rings |
Most good integrations use both: a webhook announces that a call came in, and the API is used to pull the full details or to take an action in response.
Security: token, permissions and two-step verification
An API opens a door into the phone system, so it matters who holds the key. Three common principles:
- Secure token — instead of a username and password in every request, the system receives a long secret string. It can be revoked and a new one issued without changing anyone's password.
- Permissions by user — the token inherits the permissions of the user it belongs to. A user who is only allowed to read the call log will not be able to change extensions or dial abroad through the API.
- Two-step verification — an extra layer of protection: in addition to the password, a one-time code that is sent to, or generated on, a separate device.
Common mistakes: putting the token in the code of a web page that any visitor can see, sending it by email or in a group chat, or giving a website's connection full permissions when it only needs to read one piece of data. The rule is simple: the token lives on the server, not in the browser, and each connection gets only the permissions it truly needs.
What to check before you start
- Exactly what you want to happen — describe the process in words before writing a line of code: "When an appointment is booked, an SMS is sent."
- Who will write the integration — a programmer at your organization, your CRM vendor, or an outside developer.
- A dedicated user — create a separate user for the integration with limited permissions, and don't use the administrator's account.
- What happens when something fails — if the phone system didn't respond or returned an error, what does your system do? Does it retry? Does it alert someone?
- Don't overload it — don't query the interface every second for data that changes once an hour.
Three requests, in words: what is sent and what comes back
You don't need to read code to understand an API. It's enough to see what your system says to the phone system, and what the phone system answers. Three examples, translated into plain English. The field names are for illustration — the exact format is set in the interface documentation.
1. "Give me yesterday's calls" (GET). Your system sends a request to the call log's address, including its token, a start date, an end date, and possibly a filter — only incoming calls, only for the sales queue. The response is a list. For each call on the list: a unique ID, the time, the number that called, the number that was dialed, who answered, how long the caller waited, how long they talked, and whether there is a recording. Your system goes through the list and puts each row into a report or a customer record. 400 calls come back at once, in a fraction of a second.
2. "Send an SMS to this number" (POST). The request carries: a token, the recipient's number, the message text, and sometimes the business number to send from. The response is short: "Received" and a message ID, or an error with a reason — invalid number, no permission to send. Save the ID, so that you know later which message it refers to.
3. "Call the customer for me" (POST). An agent clicks a number in a customer record. Your system sends: a token, the agent's extension, and the customer's number. The response: the ID of the call that was created. What happens next is no longer in the API but in the phone system: the agent's phone rings, they pick up, and only then does the phone system dial the customer. The agent hears a ring and then "Hello." If the customer doesn't answer, the call is logged as unanswered, and you can pull it with request number 1 the next day.
Notice the pattern that repeats in all three: a short request with a token, an orderly response with an ID, and your system saves the ID to connect the actions. That's the whole secret.
Permissions and tokens: how to set them up properly
- One user per connection. For the website — a user called "Website"; for the CRM — a user called "CRM". Don't share them, and don't use the administrator's user.
- Minimum permissions. A user who only displays how many callers are waiting in a queue doesn't need to send SMS or change extensions. If their token leaks, the damage is small.
- Token in a protected place. In a settings file on the server, not in the page's code and not in an email. Anyone who views the page in a browser sees everything in it.
- Periodic replacement. Every few months, issue a new token and revoke the old one. Also when a programmer or vendor finishes their work.
- Two-step verification for human users. For accounts that people sign in to, add a code on top of the password. For an automated connection, the token is the protection, which is why it's important to guard it.
- Log. Know which connection did what, and when. When something strange happens, this is the first place to look.
Ask, or wait to be notified: how to choose
The deciding question is how quickly you need to know. If the answer is "the moment it happens" — a webhook. If it's "once a day" or "when someone opens the report" — an API request when needed. Three cases:
- A customer record that pops up when the phone rings — requires a webhook. A request every five seconds asking "is there a new call?" will overload the interface and still be late.
- A monthly call report — API only. There is no point in being notified of every call just to count them at the end of the month.
- A donation counter on a screen — possible either way: a webhook on every call, or an API request every minute. The difference is a minute of delay versus the need for a server that listens.
Rule of thumb: event → webhook; question → API; and if you need both — a webhook that notifies, and an API that fills in the details.
When something doesn't work: reading the error
The interface doesn't just return "failed." It tells you why, and it's worth knowing how to read it:
- "Not identified" — the token is missing, wrong or revoked. Check that it is being sent and that it is still valid.
- "No permission" — the token is valid, but its user isn't allowed to perform this action. Expand the permission, or use a different user.
- "Not found" — a call ID or extension that doesn't exist. Usually a copy-and-paste mistake.
- "Too many requests" — your system is asking too fast. Slow down, and consider a webhook.
- "Server error" — something on the phone system's side. Try again after a few seconds; if it keeps happening, contact support with the time and the request ID.
How it works with us at Kesher
At Kesher, we are setting up an API for the phone system. The interface is intended for calls, recordings, SMS, dialing and control of the phone system's components, and works with GET or POST requests.
Permissions in the interface are per user: each connection gets exactly what its user is allowed to do, and no more. Access is through a secure token, and two-step verification can be added as an extra layer of protection.
We already use the phone system's API ourselves: the CRM we built pulls call history and recordings through it, identifies the customer by number, and allows dialing and SMS from the customer record.
Have an idea for an integration — a website, a booking system, an automated report? Talk to us. We'll check together what can be done today and what will become possible when the interface opens to customers.
FAQ
What is the difference between an API and a webhook?
With an API, your system contacts the phone system and asks a question or requests an action. With a webhook, the phone system contacts your system the moment an event happens.
Do I need a programmer to use an API?
Usually yes, or a vendor of a system that already knows how to connect. The API is meant for software, not for manual use.
Is it safe to open an API to the phone system?
When done properly, yes: a secret token kept on the server, limited permissions for each connection, and two-step verification if needed.
What is the difference between GET and POST?
Usually GET is used to read information and POST to perform an action or send data, such as sending an SMS.
Is Kesher's API available yet?
The interface is being set up. Talk to us to check what can already be connected today for your needs.
How do I check that the connection works before turning it on?
Start with a simple read request, such as pulling yesterday's calls, and only after it returns correctly move on to actions like sending an SMS or dialing.
What do I do if the token leaks?
Revoke it immediately and issue a new one. That's why a separate token for each connection is important — you can revoke one without stopping the rest.
Does the API replace the control panel?
No. The control panel stays for people, the API is for systems. Both perform the same actions, through different doors.
What is the difference between a token and a password?
A password identifies a person and stays the same everywhere. A token is a long string issued for a single connection; it can be revoked on its own without affecting the others, so it suits systems and not people.