Signature Mechanism

Use HMAC SHA256 for parameter signature.

Required Configuration Parameters

Generate api-key api-secret

Test Configuration
api_key AAAAACcVAAABnztMqrATYmlG5XNpNnyY
api_secret 41a2cba262436582f859b1453de08a3c
api_url https://dex-api.benpay.com/

Request Required Headers
API-KEY
API-SIGNATURE-METHOD HmacSHA256  (fixed value)  
API-SIGNATURE-VERSION 1  (fixed value)  
API-TIMESTAMP 1751871801483 (current timestamp in milliseconds) 
API-Signature  (dynamically generated signature)

Signature Steps

All parameters are sent via query string

Example: Sending a GET request via curl
https://dex-api.benpay.com/v1/contracts/orders/closed?range=202507&offsetId=0&limit=100

payload - Signature Content
Concatenate in order: method host url sorted-params key signature-method version timestamp
GET
dex-api.benpay.com
/v1/contracts/orders/closed
limit=100&offsetId=0&range=202507
API-KEY: AAAAACcVAAABnztMqrATYmlG5XNpNnyY
API-SIGNATURE-METHOD: HmacSHA256
API-SIGNATURE-VERSION: 1
API-TIMESTAMP: 1751876801442 must be included here\n

signature aea0677b6b594b06809ab7b6ecb3255a9aaab391fb7653b43a1c2867d9c6a4d3 payload signature content

Add the above signature as API-Signature in the request header.

Sample curl request
curl -X 'GET' \
  'https://dex-api.benpay.com/v1/contracts/orders/closed?limit=100&offsetId=0&range=202507' \
  -H 'accept: */*' \
  -H 'API-KEY: AAAAACcVAAABnztMqrATYmlG5XNpNnyY' \
  -H 'API-SIGNATURE-METHOD: HmacSHA256' \
  -H 'API-SIGNATURE-VERSION: 1' \
  -H 'API-TIMESTAMP: 1751876801442' \
  -H 'API-Signature: aea0677b6b594b06809ab7b6ecb3255a9aaab391fb7653b43a1c2867d9c6a4d3' \
  -d ''

Response
{"success":true,"data":{"hasMore":false,"nextOffsetId":0,"results":[],"range":"202507"}}

All parameters are sent via request body

Example cURL POST request
https://dex-api.benpay.com/v1/contracts/positions/XBTC/settings
body
{"cross":false,"leverage":5}

payload - Signature Content
Concatenate in order: method host url sorted-params key signature-method version timestamp

POST
dex-api.benpay.com
/v1/contracts/positions/XBTC/settings

API-KEY: AAAAACcVAAABnztMqrATYmlG5XNpNnyY
API-SIGNATURE-METHOD: HmacSHA256
API-SIGNATURE-VERSION: 1
API-TIMESTAMP: 1751881676080
{"cross": true, "leverage": 10}

signature 48bb9c5962deac32b5c728d986653e633b5624d025c9c3c419eb3406eb67924d payload signature content

Request headers (must include API-Signature)

Request
curl -X 'POST' \
  'https://dex-api.benpay.com/v1/contracts/positions/XBTC/settings' \
  -H 'accept: */*' \
  -H 'API-KEY: AAAAACcVAAABnztMqrATYmlG5XNpNnyY' \
  -H 'API-SIGNATURE-METHOD: HmacSHA256' \
  -H 'API-SIGNATURE-VERSION: 1' \
  -H 'API-TIMESTAMP: 1751881676080' \
  -H 'API-Signature: 48bb9c5962deac32b5c728d986653e633b5624d025c9c3c419eb3406eb67924d' \
  --data-raw '{"cross":false,"leverage":10}'

Response
{'success': True, 'data': {'id': '10005_900000201', 'userId': 10005, 'symbolId': 900000201, 'riskLimit': {'id': 109, 'initialMarginRate': '0.01', 'maintenanceMarginRate': '0.005', 'marginRateStep': '0.005', 'maxLeverage': 20, 'riskLimitBase': '10', 'riskLimitStep': '5', 'maxRiskLimitSteps': 9, 'maxQuantity': '55', 'createdAt': 1735689600000}, 'cross': True, 'createdAt': 1751336113229, 'updatedAt': 1751881676881, 'entryValue': '0', 'entryPrice': '0', 'margin': '0', 'leverage': 10, 'liquidationPrice': '0', 'direction': 'LONG', 'quantity': '0', 'realizedPNL': '0', 'riskLevel': 0, 'minimumMaintenanceMarginRate': '0.005', 'minQuantity': '0', 'maxQuantity': '10', 'version': 0, 'empty': True}}

Python Demo

Last updated