Skip to main content

User Data Stream requests

The following requests manage User Data Stream subscriptions.

Note: The user data can ONLY be retrieved by a separate Websocket connection via the User Data Streams url (i.e. wss://stream.binance.com:443).

Start user data stream (USER_STREAM)

{
"id": "d3df8a61-98ea-4fe0-8f4e-0fcea5d418b0",
"method": "userDataStream.start",
"params": {
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A"
}
}

Start a new user data stream.

Note: the stream will close in 60 minutes unless userDataStream.ping requests are sent regularly.

Weight: 2

Parameters:

NameTypeMandatoryDescription
apiKeySTRINGYES

Data Source: Memory

Response:

Subscribe to the received listen key on WebSocket Stream afterwards.

{
"id": "d3df8a61-98ea-4fe0-8f4e-0fcea5d418b0",
"status": 200,
"result": {
"listenKey": "xs0mRXdAKlIPDRFrlPcw0qI41Eh3ixNntmymGyhrhgqo7L6FuLaWArTD7RLP"
},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 2
}
]
}

Ping user data stream (USER_STREAM)

{
"id": "815d5fce-0880-4287-a567-80badf004c74",
"method": "userDataStream.ping",
"params": {
"listenKey": "xs0mRXdAKlIPDRFrlPcw0qI41Eh3ixNntmymGyhrhgqo7L6FuLaWArTD7RLP",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A"
}
}

Ping a user data stream to keep it alive.

User data streams close automatically after 60 minutes, even if you're listening to them on WebSocket Streams. In order to keep the stream open, you have to regularly send pings using the userDataStream.ping request.

It is recommended to send a ping once every 30 minutes.

Weight: 2

Parameters:

NameTypeMandatoryDescription
listenKeySTRINGYES
apiKeySTRINGYES

Data Source: Memory

Response:

{
"id": "815d5fce-0880-4287-a567-80badf004c74",
"status": 200,
"response": {},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 2
}
]
}

Stop user data stream (USER_STREAM)

{
"id": "819e1b1b-8c06-485b-a13e-131326c69599",
"method": "userDataStream.stop",
"params": {
"listenKey": "xs0mRXdAKlIPDRFrlPcw0qI41Eh3ixNntmymGyhrhgqo7L6FuLaWArTD7RLP",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A"
}
}

Explicitly stop and close the user data stream.

Weight: 2

Parameters:

NameTypeMandatoryDescription
listenKeySTRINGYES
apiKeySTRINGYES

Data Source: Memory

Response:

{
"id": "819e1b1b-8c06-485b-a13e-131326c69599",
"status": 200,
"response": {},
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 6000,
"count": 2
}
]
}

Subscribe to User Data Stream (USER_STREAM)

{
"id": "d3df8a21-98ea-4fe0-8f4e-0fcea5d418b7",
"method": "userDataStream.subscribe"
}

Subscribe to the User Data Stream in the current WebSocket connection.

Notes:

  • This method requires an authenticated WebSocket connection using Ed25519 keys. Please refer to session.logon.
  • User Data Stream events are available in both JSON and SBE sessions.
    • Please refer to User Data Streams for the event format details.
    • For SBE, only SBE schema 2:1 or later is supported.

Weight:
2

Parameters:
NONE

Response:


{
"id": "d3df8a21-98ea-4fe0-8f4e-0fcea5d418b7",
"status": 200,
"result": {}
}

Sample user data stream payload from the WebSocket API:

{
"event": {
"e": "outboundAccountPosition",
"E": 1728972148778,
"u": 1728972148778,
"B": [
{
"a": "ABC",
"f": "11818.00000000",
"l": "182.00000000"
},
{
"a": "DEF",
"f": "10580.00000000",
"l": "70.00000000"
}
]
}
}

Unsubscribe from User Data Stream (USER_STREAM)

{
"id": "d3df8a21-98ea-4fe0-8f4e-0fcea5d418b7",
"method": "userDataStream.unsubscribe"
}

Stop listening to the User Data Stream in the current WebSocket connection.

Weight:
2

Parameters:

NONE

Response:

{
"id": "d3df8a21-98ea-4fe0-8f4e-0fcea5d418b7",
"status": 200,
"result": {}
}