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:
In order to generate the Signature all spaces must be removed from the request body:
Please note that the order of the fields matters for calculating the signature. Fields must be in the same order they are listed on doc pages for requests.
Please note that optional fields, like atag
must also be included in signature generation, even if they have null
values. For example, if atag
field has null
value then it must be included in signature generation like so:
Then message for HMAC algorithm has to be formed using following template:
Please note that for requests that have no body, like GET requests, above template will only consist of {timestamp}
.
So the message should look like the following:
The computed Signature for this request is:
A 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
Your Secret Key
is located on your API Settings page. Login to Betstack to access your Secret Key
Last updated