Invalid API Key - but only for certain actions (I've read the FAQ)

Accessing market data, over REST or Websockets works as expected. Trying to do anything account oriented (view account, submit test orders, etc.) rejects the API Key. I’ve verified that I whitelisted the appropriate IP (the market endpoints wouldn’t anyhow if this was the cause), and that I’ve enabled spot trading.

Further, I ran the binance provided tests here:

and can confirm that while the first (klines) example works, the subsequent 4 requests reject the API key. This indicates to me that send_signed_request seems to be where the problem is as that’s where the secret is actually used. I thought maybe there was something wrong with my API secret despite the fact that I simply cut/paste it, so I just created a new one and the same problem persists.

Additionally I temporarily removed the IP restrictions just as a test, and it has no effect. Any idea what would cause this behavior?

Hi Tomas - most of the libraries default to, and if you’re not using the U.S. website then that should be fine and your problem is likely either the API key, or you selected IP access restrictions but didn’t whitelist your IP.

If you are using the U.S. version of Binance (which I doubt since you’re in Argentina), you need to change the API URL. I’m not sure which python library you are using, but assuming it’s this one, you can call the Client constructor with tld='us' to modify the base API URL:

client = Client(api_key, api_secret,tld='us').

1 Like

Thanks !!!

Already answered you in client.get_account_status() error (python)

With all due respect, I don’t think you answered my question.

As mentioned above, I’m not using a 3rd party library, I’m using Binance’s own example from their repo:

The call to /api/v3/account which uses send_signed_request results in a 2015 invalid API Key... regardless of the fact that I’ve tried it now with two separately generated key pairs.

1 Like

Final solution - Install POSTMAN and import the collections from (there’re instructions)
Then try your api key/secret there. Good luck and come back with something new

OK - here is something new then:

As expected, it still does not work. Below is a snippet of an example request URI which get’s a 2015 response, using Postman and the assosciated environments/collections you linked to. I realize it’s difficult to diagnose without having the key pair yourself, but at this point I’ve verified the behavior on two 3rd-party API’s, Binance’s Python example, and Binance’s Postman examples. Furthermore, I’ve tried this on two separately created key/value pairs. I think the problem is not on my end.


I’m not sure if it’s relevant, but I did notice while researching potential sources of the problem that the only checkboxes related to trading I can enable for the API Key are:

  • Can Read
  • Enable Spot Trading
  • Enable Withdrawals

I assume that since Enable Spot Trading was on, and the calls I was making were through the Spot API, that this should be sufficient. I noticed that other people have a variety of other trading related checkboxes, for example:

Some others have a checkbox which doesn’t differentiate between spot/margin and simply says “Enable Trading”. I don’t know if these are from older versions of the API, and I doubt they are the source of my problem, but thought I’d mention it as I’m out of ideas at this point.

The only other idea I have is that since the error message indicates it could also be IP address related, how could I confirm if my specific IP is blocked? I don’t mean blocked by my settings, as I’ve turned on all IP’s for now, but blocked by binance perhaps?

The problem was that all the examples and libraries use while my account and API key were for I would have expected that to be pretty high up in the FAQ or perhaps throw an error that is more descriptive, but figured I’d post here in case others run into this.

Mann I have the same problem and it make me crazy, can you explain me how you fixed it ? I m trying to make like a bot in python using the api. I m from Argentina if this means something important in this error