Invalid API-key, IP, or permissions for action APIError(code=-2015):

Hello there, again.
Now, I need help in another feature: basically, I’m developing a software (in python) that receives a trade message on Telegram and uses that to open an order in the Binance Futures. I’m using Testnet and this is the point! I found many topics saying that the API and SECRET KEYS can get on, on API KEY folder (print below). Nevertheless, I’ve been seeing the message error: APIError(code=-2015): Invalid API-key, IP, or permissions for action. What more do I need to do to make it works?


My init method is:

class TradingBot:
    def __init__(self):
        self.binance_client = Client(

It seems that you can pass the api key to a library, which could be the reason that doesn’t auth correctly.

I would suggest to test your testnet api key with this script, it will be helpful to the debug.

Check your API’s permissions. If you have ip whitelist and don’t have your ip, you will receive this message. And maybe you did not enable futures?

Oh, right. I’ve been checking my API’s permissions and I had this message:


I cannot click on Enable Futures, so, should I to select the “Restrict access to trusted IPs only”, informing my computer IP?

EDIT *******
Hey guys, So… My problem has been solved, I was working normally this week when happened again. My testnet API and Secret Key are corrects, my IPV4 and Network IP are on the Binance permissions, futures enabled… I don’t know what to do to fix that. Can someone help me?

Just edit restrictions, enable Futures and you are good to go!
Check your ip if your ip is not changed.
Also you want to disable ip restrictions in case your ip is not static.