KDC Open APIv1/Authentication & Signing
DEVELOPER GUIDE

Authentication & Signing

All private endpoints require HMAC-SHA256 request signing using your API Secret and millisecond timestamp.

Required Request Headers

HeaderRequiredDescription
KDC-API-KEYRequiredYour 32-character hex API Key.
KDC-API-TIMESTAMPRequiredCurrent UTC Unix timestamp in milliseconds.
KDC-API-SIGNRequiredLowercase hex HMAC-SHA256 signature computed with your API Secret.
KDC-API-RECV-WINDOWOptionalReceive window in milliseconds (default 5000, max 60000).

Signature Construction

payloadtimestamp + METHOD + path?query + body
signaturelowercase_hex( HMAC_SHA256( secret, payload ) )
  • Use the exact path and query string sent on the wire (e.g. /open/v1/spot/orders/open?symbol=BTCUSDT) without re-sorting parameters; GET request body is an empty string.
  • Requests with timestamp older than recvWindow or more than 1000 ms ahead of server time are rejected (230004). Call GET /open/v1/time to synchronize.
  • Write requests enforce replay protection: each signature may only be used once within its receive window. Use clientOrderId for idempotent order placement.
  • Repeated signature failures from the same IP are temporarily throttled with HTTP 429.

Signing Code Examples

import hashlib, hmac, json, time, requests

API_KEY = "<YOUR_API_KEY>"
SECRET  = "<YOUR_API_SECRET>"
BASE    = "https:">//api.kdc.exchange"

def call(method: str, path_query: str, body=None):
    ts = str(int(time.time() * 1000))
    raw = json.dumps(body, separators=(",", ":")) if body is not None else ""
    sign = hmac.new(
        SECRET.encode(),
        (ts + method + path_query + raw).encode(),
        hashlib.sha256,
    ).hexdigest()
    headers = {
        "KDC-API-KEY": API_KEY,
        "KDC-API-TIMESTAMP": ts,
        "KDC-API-SIGN": sign,
        "KDC-API-RECV-WINDOW": "5000",
        "Content-Type": "application/json",
    }
    resp = requests.request(method, BASE + path_query, data=raw or None, headers=headers, timeout=10)
    return resp.json()

print(call("GET", "/open/v1/asset/accounts"))