Signature Generation (Api-Sign)
The signature is calculated using the HMAC-SHA256 algorithm. The key is your API-KEY. The canonical JSON string of the request body is signed.
Canonical JSON Form
Request parameters are passed as an associative array. This array is serialized into a JSON object with curly braces {}. For a correct signature, you must:
- Sort the array keys alphabetically (lexicographically, ascending).
- Serialize the array to JSON without spaces (separators , and :).
The request body must always be a JSON object (an associative array).
The following fields are required:
id - a unique string up to 130 characters long, consisting only of Latin letters (a-z, A-Z) and numbers (0-9).
There are no empty arrays.
Example Request
Initial associative array (unsorted):
{"user_id": 42,"id": "a1b2c3d4e5f6g7h8i9j0..."}
Canonical signature string (after key sorting):
{"id":"a1b2c3d4e5f6g7h8i9j0...","user_id":42}
Algorithm
- Generate a unique id string (100 characters, only Latin letters and numbers).
- Prepare an object with parameters, including the required id key.
- Sort the keys alphabetically.
- Convert to a JSON string without spaces.
- Calculate the HMAC-SHA256 from this string using the API-KEY.
- Place the resulting hex digest (in lowercase) in the Api-Sign header.