Required headers
How the signature is computed
The signature isHMAC-SHA256(secret, prehash), hex-encoded, where:
Building the canonical string
The canonical string is built from sorted parameters joined intokey=value pairs with a | separator. Where the parameters come from depends on the method:
- POST / PUT / PATCH
- GET / DELETE
Use the JSON request body. Sort its top-level keys alphabetically and join them:For a body of
{"market":"BTCUSDT","side":"buy","type":"limit","amount":"0.5","price":"35000"}:Send decimal values (
amount, price, …) as strings, exactly as they appear in the body you transmit. This keeps the signed value identical to the sent value and avoids floating-point formatting differences.Worked example
ForPOST /perpetual/order at timestamp 1701938200 with the body above:
Code examples
- Node.js
- Python