Signature
Generate HMAC hash signature to access Betstack APIs
Some APIs require signature in incoming requests (like BetEngine API).
The Signature is calculated based on the timestamp, request body and your Secret Key with HMAC hash using SHA256 Algorithm. 
Here is an example on how to generate the Signature for create /ticket request with Secret Key=12345ABCDE, timestamp=1706090303 and following request body:
{
    "operator": "site",
    "token": "UnIqUe-ToKeN",
    "price": 5000,
    "currency": "KES",
    "atag": "affiliate-1",
    "source": "mobile",
    "type": "superbet",
    "event": 100001,
    "bets": [101, 102, 103, 104, 105, 106]
}In order to generate the Signature all spaces must be removed from the request body:
{"operator":"site","token":"UnIqUe-ToKeN","price":5000,"currency":"KES","atag":"affiliate-1","source":"mobile","type":"superbet","event":100001,"bets":[101,102,103,104,105,106]}Then message for HMAC algorithm has to be formed using following template:
{timestamp}{request body with removed spaces}So the message should look like the following:
1706090303{"operator":"site","token":"UnIqUe-ToKeN","price":5000,"currency":"KES","atag":"affiliate-1","source":"mobile","type":"superbet","event":100001,"bets":[101,102,103,104,105,106]}The computed Signature for this request is:
f99aee9f77eef1ee8b64c78e7f8612e3234f03cce5fecdebd7ea27f2b9081423A free online HMAC Generator for testing is available on https://www.freeformatter.com/hmac-generator.html#before-output.
Here is how we calculated the Signature from above example using Free Formatter


Last updated