Contents
Table of Contents
  1. 1. Telling -2015 apart from -2014, -1022 and -1002
  2. 2. Check that the request header carries the key you think it does
  3. 3. The IP whitelist needs the IPv4 address your script sends from
  4. 4. Spot trading, futures and withdrawals each need their own permission in API Management
  5. 5. How the key was created decides which endpoints it can call

Binance API Returns -2015: Check the Key, Then the IP Whitelist, Then Endpoint Permissions

-2015 comes back with one catch-all message, so you have to rule out each layer yourself. This page sets out what to print and what to compare at each one.

Published 2026-10-24 Revised 2026-10-30 by PromptDeck ~7 min read 1,500+ words
Scope: error -2015 returned by Binance's Spot and USDⓈ-M Futures REST APIs; the message text is identical on both. WebSocket, margin and options endpoints are out of scope, and error codes other than -2015 only come up for comparison in section 1.

You place an order or query your account and get back -2015 with the message Invalid API-key, IP, or permissions for action. That one line bundles several causes together, and nothing in the response says which one you hit, so you have to rule them out in order: the key, the IP whitelist, then endpoint permissions. The spot Errors page in Binance's developer documentation lists the code like this:

-2015 REJECTED_MBX_KEY
Invalid API-key, IP, or permissions for action.
Binance developer documentation error codes page: -2014 BAD_API_KEY_FMT, API-key format invalid.; -2015 REJECTED_MBX_KEY, Invalid API-key, IP, or permissions for action.
A malformed key returns -2014, while a missing key, a disallowed IP and a permission that isn't enabled all share the single -2015 message on Binance's October 2026 error code list.

Binance's own notes on this code give three examples: a key that doesn't exist, a request that doesn't come from an allowed IP range, and an endpoint whose permission hasn't been enabled. They are examples rather than a complete list, but they are where to start. USDⓈ-M Futures uses the same code, -2015 REJECTED_MBX_KEY, with word-for-word the same message, so spot scripts and futures scripts can be checked in the same order.

Before you start, have two things ready: the request your script actually sent this time (URL, headers, parameters), and this key's settings on the API Management page. If an AI wrote the script, reading the key, computing the signature and sending the request may be spread across several functions; printing those values on the line just before the request goes out is quicker than reading back through the code.

1. Telling -2015 apart from -2014, -1022 and -1002 #

Several neighbouring error codes also involve the key or its permissions, so first make sure which one you actually got:

Code (USDⓈ-M name)MessageWhat it meansCheck first
-2014 BAD_API_KEY_FMTAPI-key format invalid.The API key's format is invalidThe characters of the key string in the request header
-2015 REJECTED_MBX_KEYInvalid API-key, IP, or permissions for action.Key doesn't exist, IP outside the allowed range, endpoint permission not enabled, and so onSections 2–4 below
-1022 INVALID_SIGNATURESignature for this request is not valid.The signature is wrong, usually because the client code uses the wrong API secretThe secret used to compute the signature
-1002 UNAUTHORIZEDYou are not authorized to execute this request.Not authorized; check the key's API permissionsWhich permissions this key has

If the code you got is -1021, the problem is the timestamp and has nothing to do with the key; work through the -1021 timestamp checklist instead.

2. Check that the request header carries the key you think it does #

In Binance's request examples, the key goes in the X-MBX-APIKEY request header. System-generated keys use HMAC, and creating one gives you two strings: the API key and the Secret Key. The API key goes in the header; the Secret Key is only for computing the signature, so don't swap them. Self-generated Ed25519 or RSA keys work differently: you create the public-private key pair yourself with third-party software and give Binance only the public key.

Check these one by one:

  1. Just before the request goes out, print the length and the first and last few characters of the key actually being sent, and compare them character by character with the one you saved, looking for an extra space or line break, or a missing character.
  2. Confirm on the API Management page that the key still exists. If you notice unusual activity in your account, revoke all your keys immediately and contact Binance support; if you have revoked keys, switch the script's configuration to the newly created one.
  3. Make sure the key and the endpoint come from the same environment. Spot Testnet keys are generated separately on the testnet site and don't work with your main account. If a script sends a testnet key to api.binance.com, or a main-account key to the testnet, the server can't find that key, and you most likely land in the "key doesn't exist" case of -2015.

For a side-by-side list of testnet and live endpoints, see Binance Spot Testnet: Test AI-Written Trading Scripts First.

3. The IP whitelist needs the IPv4 address your script sends from #

The second case is a request that doesn't come from an allowed IP range. Once a key has IP access restrictions, requests have to come from an address on the list; if the script moves to another machine or network and its outgoing address isn't listed, the request is refused.

Skipping the whitelist has a cost too. A system-generated HMAC API key without IP access restrictions has no permissions other than reading. To enable other permissions, you have to add IP access restrictions (IPv4 format), use a self-generated key (such as Ed25519 or RSA), or disable the default security controls. Withdrawal permission has no alternative: adding IP access restrictions in IPv4 format is mandatory (Binance FAQ, How to Create API Keys on Binance?).

The whitelist only takes IPv4 addresses, and which address to enter is something you have to check yourself:

4. Spot trading, futures and withdrawals each need their own permission in API Management #

Every endpoint name has its security type next to it; the order endpoint, for example, is labelled New order (TRADE). An endpoint without one counts as NONE, and every endpoint with a security type is a SIGNED request that needs a signature. A key can be limited to certain types of endpoint. By default an API key cannot TRADE; you have to enable trading in API Management first.

Endpoint you want to callSecurity type / permissionWhat it takes to enable
Public market dataNONENo signature needed
Account information such as order status and trade historyUSER_DATABinance's example: a separate key with only USER_DATA permission can monitor order status
Spot orders and cancellationsTRADE, with trading enabled in API ManagementA system-generated HMAC key first has to meet one of the conditions in section 3
Futures ordersFutures permissionIf the key was created before you enabled your Futures account, or you have activated Portfolio Margin, the key can't enable Futures permission
WithdrawalsWithdrawal permissionIP access restrictions in IPv4 format are mandatory

The futures row is the easy one to miss. When checking, look at when the key was created, before or after you opened your Futures account, and whether the account has Portfolio Margin activated. The read-only limit on keys without an IP whitelist isn't new: Binance states that from 2023-01-30 00:00 (UTC), a system-generated API key's permission can only be set to [Enable Reading] if its IP access is unrestricted.

When you have an AI write the script, ask it to list every endpoint it calls together with its security type, then compare that list with the permissions actually ticked in API Management. If the AI only reads data and never places orders, the permission level you need is covered in our guide to a read-only Binance API key for AI.

5. How the key was created decides which endpoints it can call #

Can a Binance API key place orders without an IP whitelist?

Not a system-generated HMAC key: without IP access restrictions it only has read permission. To enable trading, add an IPv4 whitelist, switch to a self-generated key (such as Ed25519 or RSA), or disable the default security controls.

Binance API returns -1022 invalid signature: where should I look?

-1022 means the signature in the request doesn't match the one the server computes by its rules, and the usual cause is a wrong API secret in the client code. Check first that the signature is computed with the Secret Key paired with this API key, then that the parameter string you signed matches what was actually sent.

How do I enable futures trading permission on a Binance API key?

Enable Futures permission for the key in API Management. It only works if the key was created after you enabled your Futures account and the account doesn't have Portfolio Margin activated. A key created before the Futures account, or on an account with Portfolio Margin, can't get this permission.

— PromptDeck, 2026-10-24

Risk and links note: this page is compiled from the spot Errors page, the USDⓈ-M futures Error Codes page and the endpoint security type notes in Binance's developer documentation, plus the Binance FAQ How to Create API Keys on Binance?. API rules change as the documentation is updated. Nothing here is investment advice. Placing orders on a live account from a script can lose you money; before you run one, check whether the service is available where you are. Some review pages on this site carry Binance referral links, and this site may earn a commission when someone signs up through them; this troubleshooting piece has no referral links. Full disclosure →