User Data Streams Connect
-
The base API endpoint is: https://papi.binance.com
-
A User Data Stream
listenKeyis valid for 60 minutes after creation. -
Doing a
PUTon alistenKeywill extend its validity for 60 minutes, if response-1125error "This listenKey does not exist." Please usePOST /papi/v1/listenKeyto recreatelistenKey. -
Doing a
DELETEon alistenKeywill close the stream and invalidate thelistenKey. -
Doing a
POSTon an account with an activelistenKeywill return the currently activelistenKeyand extend its validity for 60 minutes. *Connection method for Websocket:- Base Url: wss://fstream.binance.com/pm
- User Data Streams are accessed at /ws/<listenKey>
- Example:
wss://fstream.binance.com/pm/ws/pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1
-
Message Ordering Guarantee:
- For the same user on a single Websocket connection, messages of the same event type (e.g.,
ACCOUNT_UPDATE,ORDER_TRADE_UPDATE) are strictly ordered by bothT(transaction time from Matching Engine) andE(event time when the message is generated). - Recommended: Use the
Efield for ordering updates, especially when:- Comparing events across different event types (e.g.,
ORDER_TRADE_UPDATEvs market data streams likeaggTrade). - Events from different services may share the same
Tbut have differentEvalues due to processing timing. - For the same event type on the same connection, both
TandEremain strictly ordered, so either field can be used reliably.
- Comparing events across different event types (e.g.,
- For the same user on a single Websocket connection, messages of the same event type (e.g.,
-
A single connection is only valid for 24 hours; expect to be disconnected at the 24 hour mark
-
Considering that RESTful endpoints may experience query delays under volatile market conditions, we strongly recommend prioritizing Websocket user data stream messages for retrieving orders, positions, and other information.