This introduction contains a brief description to help you start interacting with API PBX.
We currently recognize 2 types of APIs:
IPBX API - centralized API containing a wide range of management/configuration options
Local API (deprecated) - API running on each PBX, will be part of IPBX API in the future
1. Creating API access
API access you can create in IPEX Portal https://portal.voipex.io/.
In the section For Developer you choose API access
Create your API access to press the button in the top-right corner “Create access”.
You have to fill these information
E-mail - it is a user name
Password - you can choose custom or use generated, press the question mark to get help
Switchboard - select by clicking the arrow on the right
Impersonation - checking impersonation allows you to access to all of the user’s API functions and you can impersonate an user.
- if you leave the box unchecked, accesses are only to the Rest api (calls log, switchboard)
2. Authorization
Our API uses OAuth 2.0
password grant flow to allow you access data from .. .
Obtaining token
Access token is obtained making POST
request to authorization endpoint https://auth.voipex.io/token
. The post body must be formatted using x-www-form-urlencoded
.
Parameter | Value |
---|---|
| password |
| api |
| <access_email> |
| <access_password> |
Example:
curl -d "grant_type=password&client_id=api&username=<access_email>&password=<access_password>" -H "Content-Type: application/x-www-form-urlencoded" -X POST https://auth.voipex.io/token
Refreshing token
Access token is valid for 1 hour. After that time client needs to obtain new access token using refresh_token
and making POST
request to authorization endpoint URL (https://auth.voipex.io/token
). The post body for this specific method must be also formatted using x-www-form-urlencoded
.
Parameter | Value |
---|---|
| refresh_token |
| api |
| <refresh_token> |
Example:
curl --location --request POST 'https://auth.voipex.io/token' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'client_id=api' --data-urlencode 'grant_type=refresh_token' --data-urlencode 'refresh_token=eyJhb...'
Impersonification
POST
request to https://auth.voipex.io/token-exchange
. Access e-mail is e-mail of user for whom the impersonation will be performed. The impersonification can be performed by the user who has impersonation enabled in the api access.
Parameter | Value |
---|---|
| <email/login assigned to a user that you want to impersonate> |
Example
curl --location --request POST 'https://auth.voipex.io/token-exchange' --header 'Authorization: Bearer eyJhb...' --header 'Content-Type: application/json' --data-raw '{"email": "<email>"}'
3. Using our API
Access token is provided in Authorization
header with every request in Bearer <access_token>
format. The best way to try our API is to visit the documentation page. Before making requests, copy your token to the input field in topbar (do not forget to add Bearer
before the token).