Welcome to SkySwitch FAX API!
The Fax API uses a separate source of authentication tokens from the rest of the Skyswith API.
Prepare the Credentials
To begin using the Fax API, open a ticket with SkySwitch Control Tower to speifically request for client_id and client_secret for the Fax API.
client_id
: request this from Skyswitch Control Tower
client_secret
: request this from Skyswitch Control Tower
username
: the PBX user's login name
password
: the PBX user's password
Obtaining an Access Token
To obtain a fresh access token, you will use the credentials prepared above.
The grant_type
is always `"password".
Add "scope" = "offline_access"` if you want to get a Refresh Token.
REQUEST:
curl --location 'https://api.skyswitch.com/oauth2/token'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'grant_type=password'
--data-urlencode 'client_id=your_client_id_provided_by_control_tower'
--data-urlencode 'client_secret=your_client_secret_provided_by_control_tower'
--data-urlencode 'username=your_pbx_user_login_name'
--data-urlencode 'password=your_pbx_user_password'
--data-urlencode 'scope=offline_access'
RESPONSE:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImd0eSI6WyJwYXNzd29yZCJdLCJraWQiOiIwNTRkYmUyMTg5In0.eyJhdWQiOiI2YTMyNTBjOC0yMGQ0LTRjMGEtOGYyYS1lMWEzOTcwNjZkNzEiLCJleHAiOjE3MzA5MTg2OTQsImlhdCI6MTczMDgzMjI5NCwiaXNzIjoiYXV0aC51Yy10ZWNobm9sb2dpZXMuY29tIiwic3ViIjoiYTVkNjU0MDMtMjYyYS01MjhmLWFhMzYtZjhjMTA0NGFjNTU5IiwianRpIjoiMGY0Nzc1ZTctNzGEwOS00NzEzLWIzMDItYjVmYjliMzBkMGE1IiwiYXV0aGVudGljYXRpb25UeXBlIjoiUEFTU1dPUkQiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiI2NjEzQHNreXN3aXRjaCIsImFwcGxpY2F0aW9uSWQiOiI2YTMyNTBjOC0yMGQ0LTRjMGEtOGYyYS1lMWEzOTcwNjZkNzEiLCJyb2xlcyI6WyJwYnhfcmVzZWxsZXIiXSwic2NvcGUiOiJvZmZsaW5lX2FjY2VzcyIsInNpZCI6IjgzNWI2Njc2LTM4YjctNDMzNS04MzY3LTI3OWM5OTkzMTZmNyIsImF1dGhfdGltZSI6MTczMDgzMjI5NCwidGlkIjoiM2Y2MDYzZTQtMzM3NC0xMWVjLWEyNmUtMGExNjZmMTM5NjY5IiwibnNVaWQiOiI2NjEzQHNreXN3aXRjaC4xNTYxMS5zZXJ2aWNlIiwicGJ4Q29ubmVjdG9yVXVpZCI6ImE1ZDY1NDAzLTI2MmEtNTI4Zi1hYTM2LWY4YzEwNDRhYzU1OSIsInVpZCI6IjY2MTNAc2t5c3dpdGNoLjE1NjExLnNlcnZpY2UiLCJjaGltZUFybiI6ImFybjphd3M6Y2hpbWU6dXMtZWFzdC0xOjQ2NDYxNDA0NDY3NTphcHAtaW5zdGFuY2UvNTMwODViZDYtMDM0NC00MGIzLWI5ZTUtOTJlYWRjMWVmNGIzL3VzZXIvYTVkNjU0MDMtMjYyYS01MjhmLWFhMzYtZjhjMTA0NGFjNTU5IiwicmVzZWxsZXJfaWQiOiIxNTYxMSJ9.5RK4gIxrGzscwcb5ZkQEbdzL1lS9p5Y1OQtLG1iGf2o",
"expires_in": 86400,
"refresh_token": "ZdaHTfNaE3kKoMveMj40EFIn1v4t6od82LA1JRy2QPoOpXWZPkF5Ng",
"refresh_token_id": "835b6676-38b7-4335-8367-279c999316f7",
"scope": "offline_access",
"token_type": "Bearer",
"userId": "11115403-262a-528f-aa36-f8c1044a1111"
}
Use the providedaccess_token
for subsequent Fax API method calls. For more information, see Obtain access token method doc.
Use the provided userID
whenever a uuid
is required by the rest of the Fax API method call. The userID
is a system-generated unique identifier assigned to the PBX user having the username
passed in the request.
If you have a long running app, before the expires_in
expiry is reached, use the refresh_token
to get a new access token. See next section below for more info.
Authorization Header
For Fax API calls method other calls, the access_token
must be passed as a bearer token in an Authorization header.
Here is an example Fax API method call using the access_token returned in the preceding section.
curl --location 'https://api.skyswitch.com/users/11115403-262a-528f-aa36-f8c1044a1111/faxes/number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YWRjMWVmNGIzL3VzZXIvYTVkNjU0MDMtMjYyYS01MjhmLWFhMzYtZjhjMTA0NGFjNTU5IiwicmVzZWxsZXJfaWQiOiIxNTYxMSJ9.5RK4gIxrGzscwcb5ZkQEbdzL1lS9p5Y1OQtLG1iGf2o'
Refreshing a Token
For applications that would access the Fax API for long-running processes and without the original username and password, you may generate a new access_token based off a valid refresh_token.
Here is a sample API call to get a new access token.
REQUEST
curl --location 'https://api.skyswitch.com/oauth2/token'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'grant_type=refresh_token'
--data-urlencode 'client_id=your_client_id_provided_by_control_tower'
--data-urlencode 'client_secret=your_client_secret_provided_by_control_tower'
--data-urlencode 'scope=offline_access'
--data-urlencode 'refresh_token=ZdaHTfNaE3kKoMveMj40EFIn1v4t6od82LA1JRy2QPoOpXWZPkF5Ng'
RESPONSE
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImd0eSI6WyJwYXNzd29yZCIsInJlZnJlc2hfdG9rZW4iXSwia2lkIjoiMDU0ZGJlMjE4OSJ9.eyJhdWQiOiI2YTMyNTBjOC0yMGQ0LTRjMGEtOGYyYS1lMWEzOTcwNjZkNzEiLCJleHAiOjE3MzA5MTg4ODIsImlhdCI6MTczMDgzMjQ4MiwiaXNzIjoiYXV0aC51Yy10ZWNobm9sb2dpZXMuY29tIiwic3ViIjoiYTVkNjU0MDMtMjYyYS01MjhmLWFhMzYtZjhjMTA0NGFjNTU5IiwianRpIjoiYWM3ZDM2NTEtYzYyOS00MDQ3LWJjNjMtOTdkZmVlM2E4NTg5IiwiYXV0aGVudGljYXRpb25UeXBlIjoiUkVGUkVTSF9UT0tFTiIsInByZWZlcnJlZF91c2VybmFtZSI6IjY2MTNAc2t5c3dpdGNoIiwicm9sZXMiOlsicGJ4X3Jlc2VsbGVyIl0sImF1dGhfdGltZSI6MTczMDgzMjI5NCwiYXBwbGljYXRpb25JZCI6IjZhMzI1MGM4LTIwZDQtNGMwYS04ZjJhLWUxYTM5NzA2NmQ3MSIsInRpZCI6IjNmNjA2M2U0LTMzNzQtMTFlYy1hMjZlLTBhMTY2ZjEzOTY2OSIsInNpZCI6IjgzNWI2Njc2LTM4YjctNDMzNS04MzY3LTI3OWM5OTkzMTZmNyIsIm5zVWlkIjoiNjYxM0Bza3lzd2l0Y2guMTU2MTEuc2VydmljZSIsInBieENvbm5lY3RvclV1aWQiOiJhNWQ2NTQwMy0yNjJhLTUyOGYtYWEzNi1mOGMxMDQ0YWM1NTkiLCJ1aWQiOiI2NjEzQHNreXN3aXRjaC4xNTYxMS5zZXJ2aWNlIiwiY2hpbWVBcm4iOiJhcm46YXdzOmNoaW1lOnVzLWVhc3QtMTo0NjQ2MTQwNDQ2NzU6YXBwLWluc3RhbmNlLzUzMDg1YmQ2LTAzNDQtNDBiMy1iOWU1LTkyZWFkYzFlZjRiMy91c2VyL2E1ZDY1NDAzLTI2MmEtNTI4Zi1hYTM2LWY4YzEwNDRhYzU1OSIsInJlc2VsbGVyX2lkIjoiMTU2MTEifQ.LMlPZve80CUj98klsf9IhiCcO1-5ycPzcE2A9_qHAmw",
"expires_in": 86400,
"refresh_token": "ZdaHTfNaE3kKoMveMj40EFIn1v4t6od82LA1JRy2QPoOpXWZPkF5Ng",
"refresh_token_id": "835b6676-38b7-4335-8367-279c999316f7",
"scope": "offline_access",
"token_type": "Bearer",
"userId": "a5d65403-262a-528f-aa36-f8c1044ac559"
}