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

ContactNow: Creating an API Token

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 need to create a case with 8x8 Technical Support to obtain an API username and key. Once you have the username and key, you can use the instructions below to create your token and use the API functionality.

NOTE: 8x8 does not provide programming support for the ContactNow API. However, further API reference material is linked in the Documentation section at the bottom of this article.

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.contactnow.8x8.com/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>

To 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=...

Change a Password

Change the password for the given account by entering in it in the token API.

Action: newpass
Arguments: Enter your password and the token ID value.

Example:

token.php?action=newpass&password=...&token=...

Documentation

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

 

  • Was this article helpful?