Create API User
To use the ClearIP API, first create a ClearIP user account to use for the API and whitelist the relevant IP address under the user account settings. This will allow the API user to bypass entering the one-time password. A phone number is still required to create the user account, but it will not be used.
The email address must be different from any existing user account. This email address will receive an email with the initial temporary password.
Below is an example of how the API user account should look on the User Accounts page.
Operator | First Name | Last Name | Phone | Service Provider | Group | User | Role | Whitelisted IP Addresses | Locked | |
---|---|---|---|---|---|---|---|---|---|---|
API | User | example@example.com | 14041112222 | Administrator | 1.1.1.1 | No |
Get Access Token
The ClearIP API authenticates requests by verifying a valid access token. The access token must be included in the Authorization header of every request like ‘Bearer ACCESS_TOKEN_HERE’.
Method: POST URL: https://api.clearip.com/auth/login
Request Body:
{
"email": "EMAIL_HERE",
"password": "PASSWORD_HERE"
}
Response Body:
{
"token": "TOKEN_HERE"
}
Refresh Access Token
Access tokens are valid for 5 minutes. Before the access token expires, a new access token must be retrieved by refreshing it.
Method: POST URL: https://api.clearip.com/auth/refresh
Request Body:
{}
Response Body:
{
"token": "TOKEN_HERE"
}
Operator Access
The API request examples provided in this documentation are shown for an API user account that is restricted to a single Operator. If the API user account has access to view and modify the configuration for multiple Operators because the Operator field in the user account is blank, then the Operator field is a required field that should be added to each API request shown in this documentation.
For example, to add a new Service Provider using an API user account that is assigned to a single Operator, use the following API request.
Method: POST URL: https://api.clearip.com/serviceProviders
Request Body:
{
"serviceProvider": {
"name": "NAME_HERE",
"status": "active",
"comment": "COMMENT_HERE"
}
}
However, to add a new Service Provider using an API user account that can access multiple Operators, use the following API request.
Method: POST URL: https://api.clearip.com/serviceProviders
Request Body:
{
"serviceProvider": {
"operator": "CLEARIP_OPERATOR_ID_HERE",
"name": "NAME_HERE",
"status": "active",
"comment": "COMMENT_HERE"
}
}