APIError when making an order

Hi there,

I’m trying to execute an BUY order but I’m getting (code=-2014): API-key format invalid.

https://api.binance.com/api/v3/order?symbol=BTCBUSD&side=BUY&type=MARKET&quantity=301.95953624&timestamp=1663246239028&recvWindow=60000&signature=dd86300966bf75075f753daa87c5ebdaff9dbff0f14a93dde790124bda07149a

Previously, I did a request to get all my account’s balances. That request was successfully so I don’t understand why I’m getting the error just making an order and I didn’t get same error when getting my account info if both requests needs my API info.

Thank you in advance

Hi,

Please follow this thread for error 2014 related discussion

1 Like

I’m working with NodeJS.

As I said before, previous request was successfully done. That request get all my account data and balances. I’m sharing the log anyway and will see the url to get my account info.

{
  method: 'get',
  url: 'https://api.binance.com/api/v3/account?timestamp=1663246238467&recvWindow=60000&signature=1e88d65513b33f9bb0a8887912276b910db31eae54d9aca8d3fa4b2e2c28d2b5',
  headers: {
    'Content-Type': 'application/json',
    'X-MBX-APIKEY': 'XXX'
  }
}
My BUSD balance is 301.95953624

And just after this request, is coming the other request for orders. So, if this one is working fine with the API, the other one should work as well.

Or both works, or both should has errors. Not one yes and one no.

Or both works, or both should has errors. Not one yes and one no.

It is possible for one request to work and another to fail. Please check that the API Key has the valid permissions to trade. Also double check the signature created is correct.

Hi, I knew that thing. Not my case because I created that api for trade so all permissions needed and IP restrictions are included.

Anyway, if the api were not that permission, the error would be “unauthorized” or something like that, not “api format invalid”, isn’t it?

I will share with you the permissions given for that api.

Have a look at this thread. It could be an issue with the argument placement.

Are GET requests working but POST requests failing? It might be that your signature process is incomplete, because the signature process is a bit more complex when making a request with parameters (especially a POST request). Here’s a node.js example showing how to do this with the axios request library:

This source is from the node.js connector, it’s also on npm to use directly as is, or you can just copy-paste the pieces you’re missing.