A nonce is a unique identifier for each API call. A nonce is required for all REST API and WebSocket API calls with an exception for Public API calls.
A nonce is implemented as a counter that must be an incremental numerical value (>0). The incremental numerical value should never repeat or decrease. For example, assuming a starting nonce of 1, valid subsequent nonce values would be 2, the next number would be greater than 2 and so on.
While a simple counter may work with nonce, EXMO recommends to use a UNIX timestamp in milliseconds as a nonce. Using a high resolution UNIX timestamp for the nonce will guarantee that your nonce will be unique and always increasing.
Examples of nonce in different programming languages:
JS
function init() {
config.nonce = new Date().getTime();
}
PHP
$mt = explode(‘ ‘, microtime());
$NONCE = $mt[1] . substr($mt[0], 2, 6);
Python
params[‘nonce’] = int(round(time.time() * 1000))