This section describes how CXone clients (if you have the CXone session management setting enabled) access the SmartReach Public APIs using CXone user tokens. If you do not have the CXone session management setting enabled, you must use a Session ID to access the public APIs. 

The SmartReach APIs support authentication using CXone user tokens through the following headers:

  • Authorization
  • LV-CXone-Tenant-Id

In addition to existing service tokens, API endpoints now accept CXone user tokens for authentication. This enhancement provides greater flexibility and aligns the API Proxy with other CXone platform services.

Administrators can enable or disable this capability using the toggle available in the Client Configuration user interface.

Prerequisites

Before accessing the SmartReach Public APIs, you must obtain the following information:

    • accessKeyId
    • accessKeySecret

For more information about retrieving an access token, see the Retrieve an Access Token section in Getting Started.

Generating an Authorization Token

To generate an access_token using a user or agent accessKeyId and accessKeySecret: 

Request

POST /domain-name/authentication/v1/token/access-key

Content-Type: application/json

{

  "accessKeyId": <YOUR_ACCESS_KEY_ID>,

  "accessKeySecret": <YOUR_ACCESS_KEY_SECRET>

}

Response

200 OK

Content-Type: application/json

{

  "token_type": "Bearer",

  "access_token": "<ACCESS_TOKEN>",

  "refresh_token": "<REFRESH_TOKEN>",

  "id_token": "<ID_TOKEN>",

  "expires_in": 3600

}

ParameterDescription
access_tokenToken used to authenticate SmartReach API requests.
refresh_tokenToken used to generate a new access token after expiration.
id_tokenIdentity token containing user information.
expires_inToken expiration time in seconds.

Example:

#Request (JSON)
POST /authentication/v1/token/access-key
Content-Type: application/json

 
{
"accessKeyId": <YOUR_ACCESS_KEY_ID>,
"accessKeySecret": <YOUR_ACCESS_KEY_SECRET>
}

#Response (JSON)
200 OK
content-type: application/json

{
"id_token" : "<ID_TOKEN>",
"token_type" : "Bearer",
"refresh_token" : "<REFRESH_TOKEN>",
"access_token" : "<ACCESS_TOKEN>",
"expires_in" : 3600
}

Accessing SmartReach Public APIs

After generating the access token, include it in the Authorization header when calling SmartReach Public APIs.

You must also include the LV-CXone-Tenant-Id header.

Request

GET /contact/contacts/10

Authorization: Bearer <ACCESS_TOKEN>

Content-Type: application/json

LV-CXone-Tenant-Id: <LV-CXONE-TENANT-ID>

Response

200 OK


Info

The Authorization header must use the following format: Authorization: Bearer <ACCESS_TOKEN>

  • Access tokens expire after the duration specified in the expires_in field.

The LV-CXone-Tenant-Id value must match the tenant associated with the generated token. 

Example:

#Request (JSON)
GET /contact/contacts/10
Authorization: Bearer 
Content-Type: application/json
LV-CXone-Tenant-Id: <LV-CXONE-TENANT-ID>

#Response (JSON)
200 OK