API Authentication

To use our APIs, you need to obtain an authentication token. To do this, you must create a user with API Access in the Customer Portal and then successfully execute a request to obtain your token.

 

Create a New User with API Access

  1. Log into the Customer Portal.
  2. Navigate to the appropriate account for API access.

Note: If you need API access for multiple accounts you must complete the steps below, switch accounts, and repeat the following steps again.

  1. Depending on your portal view, either:
    • Click User Management in the menu on the far right, Or;
    • Select the Manage Enterprise menu option from the top of the page and click Enterprise User Management.
  2. The User Management table appears.
  3. Click the Create New User/Contact button.

  1. On the User/Contact Details pop-up, fill in the Full Name, Email, and Phone.

Note: The Email address must be unique. If you already used your main email address for an existing user account, we recommend using email subaddressing (username+tag@example.com) to differentiate between users (e.g., if you already used jdoe@business.com you could use jdoe+1@business.com).

  1. Click Create Login.
  2. Enter a unique name in the Username field, and select API from the Access drop-down list.

Note: The Username must be unique.

  1. Click Save.

An email with your username and password is automatically sent to the email address you entered. Make sure to note the username and password, as they are required for your token request, below.

 

Obtain Your Token

Once you have created an API Access user, you can obtain your token.

To retrieve a short-term, 24-hour token, use the username and password you created for the API Access user to make the following request:

Note: Once the 24-hour token expires, repeat the request to get a new token.

We recommend using a tool like Postman to interact with our APIs.

 

Request

POST https://customer.intelepeer.com/_rest/v4/authenticate

Content-Type: application/json

Accept: application/json

Important: If you are using Postman to send your API requests, make sure to add the following Keys in the Headers section: Content-Type: application/json and Accept: application/json


{
	
	"username": "YOUR USERNAME",
	
	"password": "YOUR PASSWORD"
	
}
			

Remember, your username should be entered exactly as it appears in your account set up confirmation email. For example if you set up the account with username "jdoe" use that, not "jdoe+1@business.com" or "jdoe+1".

 

Success Response

Successful authentication. Token returned in the body of the response (in the "data"field).

Status: 200
{
"data":"fFkq...",
"error": null
}

 

Related Errors

Status: 401
{
"data": null,
"error": "Missing Authentication Token"
}

Note: If you are unable to retrieve your token, confirm the following: 1) The user you created has been granted API access in the Customer Portal; 2) Your username and password accuracy in the body of the request; 3) You're executing a "POST" request.

 

Using Your Token

Once you have your token, you can include it when interacting with our APIs.

Note: This token is specific to the account you created the API access user under. You must create another user with API access and request a unique token if you want to use APIs with a different account. For example, of you created a user and got a token for your Colorado dental office account, it would not be compatible with your Florida dental office account and you could not use our APIs to trigger a flow under the Florida account.

 

In the Header of your request, include your token in the Authorization parameter.

Depending on the API you are interacting with, you may need to include the word "Bearer" preceding the token. For example:

{
"authorization": "Bearer fFkq...",
"content-type": "application/json"
}

 

Code Examples

Example


package main.java.authorization;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;

public class GetToken {
    public static void main(String... args) throws Exception {
        final String url = "https://customer.intelepeer.com/_rest/v4/authenticate";
        final String USERNAME = "INSERT_USERNAME";
        final String PASSWORD = "INSERT_PASSWORD";

        HttpClient httpclient = HttpClientBuilder.create().build();
        HttpPost httpPost = new HttpPost(url);

        // add header
        httpPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
        httpPost.setHeader(HttpHeaders.ACCEPT, "application/json");

        // Data to be posted
        List urlParameters = new ArrayList();
        urlParameters.add(new BasicNameValuePair("username", USERNAME));
        urlParameters.add(new BasicNameValuePair("password", PASSWORD));

        // add data to post
        httpPost.setEntity(new UrlEncodedFormEntity(urlParameters));

        // execute post
        HttpResponse response = httpclient.execute(httpPost);

        // show post results
        System.out.println("nSending 'POST' request to URL : " + url);
        System.out.println("Post parameters : " + httpPost.getEntity());
        System.out.println("Response Code : " + 
                                    response.getStatusLine().getStatusCode());

        BufferedReader rd = new BufferedReader(
                        new InputStreamReader(response.getEntity().getContent()));

        StringBuffer result = new StringBuffer();
        String line = "";
        while ((line = rd.readLine()) != null) {
            result.append(line);
        }

        System.out.println(result.toString());
    }
}

 

Example

const request = require("request");
///////////////////////////////////////////////////////////////////////////////
/// update these accordingly                                                ///
///////////////////////////////////////////////////////////////////////////////
let data = { "username": "INSERT_USERNAME", "password": "INSERT_PASSWORD" }

///////////////////////////////////////////////////////////////////////////////
/// leave these alone                                                       ///
///////////////////////////////////////////////////////////////////////////////
let url  = "https://api.intelepeer.com/_rest/v4/app/sms/authenticate/get_portal_auth_token"
let hdrs = {  'Content-Type': "application/json", 'Accept': "application/json"}

///////////////////////////////////////////////////////////////////////////////
/// execute the task and parse results                                      ///
///////////////////////////////////////////////////////////////////////////////
request.get({
        url: url,
        headers: hdrs
    },
    (error, response, body) => {                
        let result = JSON.parse(body);
        console.log(result.token);
});

 

Example

"INSERT_USERNAME", "password" => "INSERT_PASSWORD" ];

###############################################################################
### leave these alone                                                       ###
###############################################################################
$url  = "https://api.intelepeer.com/_rest/v4/app/sms/authenticate/get_portal_auth_token";
$hdrs = ['Content-Type' => "application/json", 'Accept' => "application/json"];

###############################################################################
### execute the task and parse results                                      ###
###############################################################################

try{
  $client = new Client();
  $response = $client->post($url, [
    'headers' => $hdrs,
    'json' => $data
    ]);
}
catch (RequestException $e){
  echo "Request Failed:". $e->getMessage();
}

echo $response->getBody();
?>

 

Example

import requests

###############################################################################
### update these accordingly                                                ###
###############################################################################
data = { "username": "INSERT_USERNAME", "password": "INSERT_PASSWORD" }

###############################################################################
### leave these alone                                                       ###
###############################################################################
url  = "https://api.intelepeer.com/_rest/v4/app/sms/authenticate/get_portal_auth_token"
hdrs = {  'Content-Type': "application/json", 'Accept': "application/json" }

###############################################################################
### execute the task and parse results                                      ###
###############################################################################
response    = requests.post(url, json=data, headers=hdrs)
status_code = response.status_code
text        = response.text
token = None
try:
    token = response.json().get(u'token')
except: pass

print u'{}: {}'.format('OK' if response else 'ERROR', response.text )