This introduction contains a brief description to help you start interacting with API PBX.

We currently recognize 2 types of APIs:

1. Creating API Access

You can create API access in the IPEX Portal https://portal.voipex.io/.

You choose API access in the section For Developers.

You can create your API access by pressing the button in the top right corner “Create access”.

You need to fill in this information:

2. Authorization

Our API uses OAuth 2.0 password grant flow to allow you to access data from .. .

Obtaining a Token

The access token is obtained by making POST request to authorization endpoint https://auth.voipex.io/token. The post body must be formatted by using x-www-form-urlencoded.

Parameter

Value

grant_type

password

client_id

api

username

<access_email>

password

<access_password>

scope

openid profile

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 a Token

The access token is valid for 50 minutes. After that time the client needs to obtain a new access token by using refresh_token and making aPOST request to authorization endpoint URL (https://auth.voipex.io/token). The post body for this specific method must also be formatted by using x-www-form-urlencoded.

Parameter

Value

grant_type

refresh_token

client_id

api

refresh_token

<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

<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).