Setup & Security
This guide covers everything you need to configure and secure your integration with the EvenBet Gaming API: credentials, communication protocol, and request signing.
If you've followed the Quick Start guide, you've already seen a simplified version of the signature process in action. This page is the complete reference, including pseudocode, code samples in multiple languages, and testing tools.
Credentials
Before you start integration, you need to get the following information from us:
| Credential | Description |
|---|---|
| API_URL | The URL to get access to the API |
| CLIENT_ID | The ID of your casino that will be passed in the queries |
| SECRET_KEY | The secret key to sign the queries |
Additionally, there may be a userId value that will be passed when calling the API methods. It is the value of your internal userId or userId of your system.
Please be advised that it is necessary to contact our support team in case your secret key is disclosed.
Communication Protocol
Communication via HTTP(S)-queries in JSON API format is used for integration. The query parameters can be passed in the query string (GET method) and in the query body (POST method). The response is passed in the JSON API format.
It is necessary to set the following header in your request:
Content-Type: application/json; charset=UTF-8
URL Structure
All API endpoints follow this template:
http(s)://API_URL/{methodName}?[parameterName=parameterValue]&clientId={your casino ID }&sign={QuerySign}
The following parameters are required for every query:
| Parameter Name | Data Type | Description |
|---|---|---|
| clientId | Varchar | Your casino ID |
| sign | String | Query signature |
Query sample:
http(s)://API_URL/v2/app/users/:userId/balance?clientId=[clientId]&userId=[userId]¤cy=[currency]
Generating the Signature
In order to ensure the API security, query signature generated with the help of the secret key is used. Query signature is validated on our server and in case it doesn't match, the error is returned.
For a step-by-step walkthrough with a real example, see Quick Start: Generating the sign Header. The section below is the full algorithm reference with pseudocode and code samples.
Algorithm
Steps to generate query signature:
- Gather the ALL parameters (query parameters, path parameters, form parameters) into array
- Delete parameter
clientIdfrom array with query parameters. Other parameters that do not participate in signature generation:access-token,action,auth,channel,controller,locale,method,module,sign,version,per-page,page,sort. - If a JSON string is passed, decode it into an associative array and merge it with the rest of the query parameters
- Sort the array by parameter names in alphabetical order. If one of the array values is an array then it should be sorted by parameter names in alphabetical order too
- Concatenate the array values into one string. If one of the array values is an array, then its values should be concatenated into one string too
- Concatenate the resulting string and your SECRET_KEY
- Get hash of the string using SHA256 algorithm
In the end you get the signature that can be used in queries.
Pseudocode
function generateSignature(array params, string secretKey) {
if (exists key 'clientId' in array params) {
delete key 'clientId' from array params;
}
params = sortArray(params);
paramString = implodeArray(params);
paramString = concatString(paramString, secretKey);
signature = SHA256(paramString);
return signature;
}
function sortArray(array params) {
sortByKeys(params);
for each value with index key in params {
if the value is an array {
params[key] = sortArray(value);
}
}
return params;
}
function implodeArray(array params) {
paramString = '';
for each value in params {
if the value is an array {
paramString = concatString(paramString, implodeArray(value));
} else {
paramString = concatString(paramString, value);
}
}
return paramString;
}
Code Examples
The Quick Start guide includes concise signature generation functions in Node.js, PHP, and Python for simple (flat) parameters.
Below are samples that demonstrate the full signature generation including recursive sorting for nested parameters.
- PHP
- JavaScript
- Python
/* function sorting the query parameters
* $array - array with the query parameters in the following format:
* {parameter_name: value}
*/
function sortArray(&$array, $sortFlags = SORT_REGULAR)
{
if (!is_array($array)) {
return false;
}
// Sort array by parameter name
ksort($array, $sortFlags);
// Sort nested arrays, if any
foreach ($array as &$value) {
sortArray($value, $sortFlags);
}
return true;
}
// Generate query signature
// Step 1. Get the required data
$params = []; // Query parameters
$SECRET_KEY = ''; // Your secret key
// Step 2. Delete the parameter 'clientId' from array with query parameters
if (array_key_exists('clientId', $params)) {
unset($params['clientId']);
}
// Step 3. Sort the parameters
sortArray($params);
// Step 4. Concatenate the parameters into a string
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($params));
$paramString = implode('', iterator_to_array($iterator));
// Step 5. Add a secret key to the string
$paramString = $paramString . $SECRET_KEY;
// Step 6. Generate a signature using the SHA256 algorithm
$sign = hash('sha256', $paramString);
function sortObjectRecursive(obj) {
var keys = Object.keys(obj).sort();
var sortedObject = {};
keys.forEach((key) => {
let value = obj[key];
if (value instanceof Object || value instanceof Array) {
sortedObject[key] = sortObjectRecursive(value);
} else {
sortedObject[key] = value;
}
});
return sortedObject;
}
function implodeRecursive(obj, separator = '') {
var str = '';
for (let key in obj) {
if (!obj.hasOwnProperty(key)) {
continue;
}
let value = obj[key];
if (value instanceof Object || value instanceof Array) {
str += implodeRecursive(value, separator) + separator;
} else {
str += value + separator;
}
}
return str.substring(0, str.length - separator.length);
}
// Step 1. Get the required data
var allParams = {}; // Query parameters
const SECRET_KEY = ''; // Your secret key
// Step 2. Delete the parameter 'clientId' from array with query parameters
if (allParams.hasOwnProperty("clientId")) {
delete allParams["clientId"];
}
// Step 3. Sort the parameters
allParams = sortObjectRecursive(allParams);
// Step 4. Concatenate the parameters into a string
var paramString = implodeRecursive(allParams);
// Step 5. Add a secret key to the string
paramString = paramString + SECRET_KEY;
// Step 6. Generate a signature using the SHA256 algorithm
var sign = sha256(paramString);
console.log(sign);
import hashlib
from collections import OrderedDict
def sort_od(od):
res = OrderedDict()
for k, v in sorted(od.items()):
if isinstance(v, dict):
res[k] = sort_od(v)
else:
res[k] = v
return res
def implode_recursive(arr):
str_p = ''
if isinstance(arr, dict):
values = arr.values()
else:
values = arr
for val in values:
if isinstance(val, (list, tuple, dict)):
str_p = str_p + str(implode_recursive(val)) + separator
else:
str_p = str_p + str(val) + separator
return str_p[0:len(str_p) - len(separator)]
# Step 1. Get the required data
allParams = {
'moneyType': 82,
'amount': 100,
'playerId': 74094,
'locale': 'ru',
'recursive': {
'x': 3,
'b': 2,
'a': 1,
'z': 4
},
'recursiveArray': [3, 2, 1, 4]
} # Query parameters
secret = '' # Your secret key
separator = ''
# Step 2. Delete the parameter 'clientId' from the array with query parameters
exceptedParams = (
'clientId',
)
params = {}
for (key, value) in allParams.items():
if key not in exceptedParams:
params[key] = value
# Step 3. Sort the parameters
params = sort_od(params)
# Step 4. Concatenate the parameters into a string
strParams = implode_recursive(params)
# Step 5. Add a secret key to the string
strParams = strParams + secret
# Step 6. Generate a signature using the SHA256 algorithm
m = hashlib.sha256()
m.update(str(strParams).encode('utf-8'))
sign = m.hexdigest()
print(sign)
Testing Tools
Use these tools to check your integration implementation:
| Tool | Purpose | URL |
|---|---|---|
| Open Session Tester | Check your integration implementation for user authorization | tests.evenbetgaming.com/opensession/ |
| Seamless Wallet Tester | Check your integration implementation for seamless wallet operations | tests.evenbetgaming.com/seamless/ |
Native Application Integration
If your integration includes native desktop or mobile applications, additional configuration is required for player authentication. See the dedicated guide: Native Application Setup.
What's Next?
- Make your first API call → Follow the Quick Start guide to create a player session
- Choose a wallet type → See the Wallet Integration Overview
- Open a game for a player → See the Open Poker Lobby endpoint