Skip to main content
ContactNow: Creating an API Token
8x8 Support

ContactNow: Creating an API Token

Overview 

API access tokens are used to authenticate individual calls to read or write ContactNow contact center data, from outside the standard ContactNow agent or admin interface.

To create access tokens for the ContactNow API, you will first need ContactNow API key credentials for your specific contact center.

To obtain an API username and key, first, follow the link to Create a Case with 8x8 Technical Support. Once you've obtained the username and key, you can follow the instructions below to create your token and use the API functionality.

Additional ContactNow API documentation is linked at the bottom of this page.

Access the ContactNow API URL 

To access any ContactNow API interface, requests need to have an access token. The token will authorize requests for a particular account for a fixed period of time. By default, these requests are restricted to the internet address that requests the token.

The API URL to manipulate these tokens is

https://api-106.dxi.eu/token.php?action=get&username=[insert your username here]&password=[insert your password here]

The Token API has a number of available functions. The request arguments can all be passed as HTTP Post or Get variables. The response from the API can be formatted in either json or xml format. The default is json but this can be modified by the format argument below:

  • Formatxml or json

The API will output a number of optional values depending on the request made.

  • Success: This shows whether the request succeeded. It will contain a true or false value for json or a 1 or 0  for xml.
  • Error: If the request failed, this field will contain a description of the fault.

Example of JSON Return:

{"success":true,
"token":"bd932b769fc7263316345627d0a9ef3b8f8d1f8d",
"expire":1307975676}

Example of XML Return:

<result>
    <success>1</success> 
    <token>bd932b769fc7263316345627d0a9ef3b8f8d1f8d</token>
    <expire>1307975676</expire>
</result>

Obtain a Token 

This will return a new token if none exists or a previous token has expired. If a valid token already exists it will return the current details. Currently, all tokens are valid for a 12 hour period but this is subject to change. By default, the get request authorizes the ip address that sends the authentication request. This can be modified by sending the optional address argument set to the required IP address. This is typically used when a central application server needs to generate tokens for client end-point machines, e.g. ajax code.

  • Action: get
  • Arguments: username, password, address (optional)
token.php?action=get&username=...&password=...

This will return the following:

  • Token: The token id value.
  • Expire: The timestamp of when the token expires. This is in Unix timestamp format, the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

Validate a Token 

Check to see if the specified token is still valid or not.

  • Action: validate
  • Arguments: token

Example:

token.php?action=validate&token=...

This will return the following:

  • Expire: The timestamp of when the token expires.

Delete a Token 

Unauthorize an existing token.

  • Action: delete
  • Arguments: token

Example:

token.php?action=delete&token=...

Documentation 

The following 8x8 ContactNow API reference material is available to the public. Each link will open a new browser tab:

How can we help you?

X
  • Was this article helpful?