Why DELETE /fapi/v1/listenKey deleting all connections to all api keys on account

Why does deleting a key trigger a listenKeyExpired for all connections on the account? even those who use a different api key.

This is just hell! I just tried it, created a connection on my account using one key.
Everything is fine, then I made DELETE /fapi/v1/listenKey using the second api key. All active connections received listenKeyExpired.

This is such nonsense. If a person uses two connections, they will conflict in 100% of cases. How to separate multiple websocket connections? I can’t control how other apps working with webscoket sadly, its binance part

Do you mean you have more than one listenkey from one API key?

No. Super easy to reproduce.

One exchange account.
2 api keys.
Open websocket connection using 2 different api keys.
Send DELETE /fapi/v1/listenKey using first api key.
Receive listenKeyExpired on both connections.
Both connections will never receive anything from binance again.
Only after full reconnect with new listenKey

Expected result:
Only the api key which send DELETE will recieve listenKeyExpired.
Other connection should stay connected

i’m still not sure how did you test on this?

  • how many connections in total?
  • if 2 connections, subscript one listenkey on one connection?
  • 2 api keys from 2 accounts?


I have already received confirmation from the binance support that this is not a bug but a feature =)

Unfortunately, so far there is no reasonable possibility to keep two completely disconnected connections to one exchange account, even if 2 api keys are used.

I consider this to be basic functionality and would really like to see the ability to create multiple listen keys on one account.

Why you can’t use one ListenKey for all task?

Hello, are there any updates with respect to this issue? I’m having the same problem.

The listenKey is per account not per an account’s API Key, so if it’s closed then it’s expected to affect all the connections on the account.

The solution at the end just forget to all what binance saying on API docs page and do reconnect every XX minutes. They want us to do it the bad way, no problem)

P.S. its the only solution for good websocket connection, trust me.

Why you can’t use one ListenKey for all task?
I listen account, candles, trades, send REST to open and close orders without any recconect 24/7

First of all. I have over 15k api keys. So its not what I’m some kinda noob. Trust me. 6 servers working on this task and it works when you are doing it for your self. But on scale it does not at all, users using many terminals and services all of them trying to connect and disconnect to same account and all this mess just simple do not work stable enough

Try not to delete unnecessary ListenKey - they disconect by themselves after 60 minutes. By the way, the fact that you are working with 2 ListenKeys is strange, after a sometime one of the instances should stop receiving information …

You are asking for help and evading an answer.
I don’t trust you. No matter doing i it for myself or not - important how i do it and how it works. I have only one server that means i kinda noob?
I ask because cannot imagine a task requiring a solution to your problem, even on an enterprise scale. The answer could give an idea.

Wish you success