1. Knowledge Base
  2. Admin
  3. Integrations (External Applications)

Casebook API Access Token / Register 3rd Party Applications

CB platform authenticates any other software applications that you want to use with Casebook APIs. With our APIs, you should be able to perform all the operations that an end user can perform in the UI of a Casebook.

This article covers how to do the following:

  • Register external applications to consume APIs
  • Get Access Token 

How to Register External Applications

Before you can get an access token, you'll need to register the external application in cb Admin to consume APIs.

  1. Go to cb Admin and navigate to the Global → External applications section

    External applications highlighted in Global section of cb Admin
  2. Click on the 'Register an external application' button plus sign - register an external application button (plus + sign) in the bottom right corner of the page to add a new application. From there, a 'New Application' pop up will be displayed. External Application

  3. Fill in the following sections: 
    • Application name * (Required): Enter the name of the application that you want to register. 
    • Email * (Required): Enter the email address where you will receive alerts and notifications about this integration. It can be an individual’s email address or a group email address. 
      Note: The email address cannot be associated with an existing Casebook account. 
    • Application URL: Enter the URL link of the application you’re registering.
    • Roles * (Required): Select the roles (eg: Engage Supervisor) from the dropdown so this application can get the right access to consume Casebook’s APIs.

      Please note that this list of roles is what you see when you add a user as well. When a role is selected, all the permissions of that role will be applicable to this application.

      For example if a role has View, Edit, Create permissions for cb Engage, then the application will get the same permissions if assigned that role. 
    • Description: Enter a description of the external application. 
  4. Click ‘Save’ to submit and save the external application. After it is saved, the external application will be displayed in the External applications section. Alternatively, you can click on 'Cancel' to discard and not save the new application. 

Get Access Token

After registering the external application, the next step is using the credentials created to get the access token.

An access token is what the application needs in order to start consuming the Casebook APIs.

  • Client ID: You can locate the Client ID by clicking on the expand icon of the external application. 

    Expanded View to Show Client ID, as well as, Description, Application URL, and Callback URL
  • Client Secret:
    1. Click on the ‘View client secret' icon (the key). 

      View client secret - key icon
    2. You will need to re-authenticate your Casebook login information for security purposes. Enter your password for your Casebook account here.
      Enter password to view the client secret
    3. After you've clicked Verify, the Client secret will be displayed. 
  • Callback URL: You can locate the Callback URL by clicking on the expand icon of the external application.
    Expanded view for Callback URL, as well as, Description, Application URL and Client ID
  1. Using Client ID and Client Secret, make a POST request to the ‘Callback URL’ from the application you want to connect to get the access token. The Content-Type of the request is application/x-www-form-urlencoded

    Please find below a sample code snippet you can use:

    const clientId = '[INSERT_CLIENT_ID]';
    const clientSecret = '[INSERT_CLIENT_SECRET]';
    const callbackUrl = '[CALLBACK URL]';

    async function getAccessToken() {
    const params = new URLSearchParams();
    params.append('client_id', clientId);
    params.append('client_secret', clientSecret);
    params.append('grant_type', 'client_credentials');

    const authenticationResponse = await axios({
    url: callbackUrl + '/oauth2/token',
    headers: { 'Content-Type', 'application/x-www-form-urlencoded'},
    method: 'post',
    data: params,
    });

    const token = authenticationResponse.data.access_token;

    return token;
    }
  2. Once the access token is retrieved, you can start making API calls to the Casebook API from the external application based on the roles assigned. Please note that the expiration for access token is 1 hour.

Get Refresh Token 

After 1 hour expiry, the access token should be refreshed for continued access to Casebook APIs. This should be programmatically done in your external application to fetch a new access token.

Have questions? Check out the 3rd Party (external) applications FAQ