User Data Stream (listenKey)
Type: USER-STREAM
Weight: 1
POST /fapi/v1/listenKey·PUT /fapi/v1/listenKey·DELETE /fapi/v1/listenKey
Binance-compatible listenKey lifecycle for the private WebSocket channels. All three calls are HMAC-signed (send timestamp + signature even though there are no other parameters).
Flow
POST /fapi/v1/listenKey→ 64-character key.- Connect to
wss://api-avax.sparkydex.app/wsand send{"type":"auth","listenKey":"<key>"}. - On
{"type":"auth_result","success":true}subscribe topositions,orders,balance(User data). - Keep-alive:
PUT /fapi/v1/listenKeyat least once per 60 min — optional while a socket authenticated with the key stays connected, because each lookup refreshes the TTL. DELETE /fapi/v1/listenKeywhen done.
Storage is Redis with a 3600 s TTL. Each user has one active key: repeated POSTs return the same key and refresh its TTL.
POST /fapi/v1/listenKey
{ "listenKey": "a1b2c3d4e5f6…(64 chars)" }
Idempotent.
PUT /fapi/v1/listenKey
No parameters — the user's current key is implicit.
{ "listenKey": "a1b2c3d4e5f6…" }
| HTTP | code | msg |
|---|---|---|
404 | -1125 | This listenKey does not exist (no active key — POST first). |
DELETE /fapi/v1/listenKey
{}
Idempotent (returns {} even when no key is active).
There is no wss://…/ws/<listenKey> URL form: the key is always sent in the auth message.
Authentication failures (INVALID_API_KEY, API_KEY_DISABLED, IP_NOT_ALLOWED, SIGNATURE_INVALID) apply to every signed endpoint and use Sparky's {"success":false,"error":{...}} envelope; see Error Codes.