Authentication
Fax.Plus API offers two methods for authentication:- Personal Access Tokens (PATs) (Recommended)
- OAuth2 Authorization Code
Option 1: Personal Access Tokens (PATs)
To generate a new token, go to the Integrations page in your account settings. Scopes Personal Access Tokens can be generated with different scopes. Each scope grants access to a specific set of endpoints. The available scopes are: List of available scopes:fax:all:read
Grants read-only access to all fax-related operations, including viewing faxes, users, members, and numbers.
fax:all:edit
Grants full access to all fax-related operations, allowing editing and management of faxes, users, members, webhooks, and numbers.
fax:webhook:read
Allows read-only access to webhook configurations, enabling retrieval of webhook details.
fax:webhook:edit
Grants full access to manage and modify all webhook configurations.
fax:fax:read
Allows viewing and listing of all faxes, including access to outbox lists, fax files, and reports.
fax:fax:edit
Grants full permissions to manage and edit faxes, including operations on the outbox, files, and fax details.
fax:user:read
Allows viewing of the current user’s details (PAT owner).
fax:user:edit
Grants permission to update the current user’s details (PAT owner).
fax:member:read
Allows viewing of account and member details, including retrieving account and member-specific information.
fax:member:edit
Grants permission to update member details and manage account-related member information.
fax:numbers:read
Allows retrieval and listing of fax numbers.
fax:numbers:edit
Grants full permissions to manage and edit fax numbers, including all operations related to numbers.
Personal Access Token (PAT) Usage
You have to include an Authorization header with a value of Bearer TOKEN in every request.
Option 2: OAuth2 Authorization Code
Fax.Plus API also employs the OAuth2 Authorization Code flow for getting and refreshing the authentication token. This flow requires:- explicit access confirmation from the user
- redirect URL to which user will be redirected after logging in
OAuth2 Authorization Code Grant
The first step is to obtain an authorization code. Redirect the user to the URL https://accounts.fax.plus/login providing the following query parameters:client_id- your client IDredirect_uri- one of your registered redirect URIsresponse_type=codescope=all
https://accounts.fax.plus/login?response_type=code&client_id=CLIENT_ID&redirect_uri=http://my.web.app&scope=all
On the redirected page, the user will be asked to log in and authorize the API. After the permission is granted, the user will be redirected to the given redirect URI with the authorization code as a code query parameter. For example, http://my.web.app?code=XXXXXX
The next step is to obtain an access token. The client must send a HTTP POST request to the base URL https://accounts.fax.plus/token with the following parameters:
- Headers:
Content-type: application/x-www-form-urlencodedAuthorization: Basic XXXwhereXXXis the base64 encoded stringCLIENT_ID:CLIENT_SECRET
- Parameters (url-encoded in query or body):
grant_type=authorization_codeclient_id=YOUR_CLIENT_IDcode=AUTHORIZATION_CODE_FROM_PREVIOUS_STEPredirect_uri=YOUR_REDIRECT_URL
Authorization header is properly composed, and that the client ID is passed in the request body. Most libraries require additional flags to be set to enable this behavior.
If the request was successful, you will be granted an access token in JSON format.
This token should be passed as a Bearer Token inside the Authorization header with every request.
Refreshing An OAuth2 Access Token
To renew your access token, make anHTTP POST request to the base URL https://accounts.fax.plus/token, passing the refresh token that you have received when obtaining the initial access token as a refresh_token query parameter. Add the grant_type parameter equal to the refresh_token.
https://accounts.fax.plus/token?grant_type=refresh_token&refresh_token=REFRESH_TOKEN
Use the same Authorization header as the one you used for obtaining the access token.
In the response, you will receive the same JSON structure as the one returned when issuing the access token.
The refresh token will remain valid until the user requests a new access token, or revokes the permissions given to the client.