Short answer: Invalid API-key, IP, or permissions for action is Binance's error -2015, and every exchange has its own version: the request was refused at the key check. Check, in order, the key's environment and regional host, the IP allowlist, the key's permissions, and its expiry. Match on each exchange's own code, because numbers differ in meaning between exchanges.
Codes below are quoted from each exchange's official documentation, read 5 November 2026; the replies came from requests sent that evening with an obviously fake key. Never paste a live key or secret into a forum, a support chat, an AI tool or an online signature checker; Gate's documentation says not to give key information even to its customer service, and to delete and recreate a key that leaks.
This is a technical guide, not a recommendation of any platform; whether you may use one depends on your jurisdiction and its terms.
Invalid API-key, IP, or permissions for action: what to check first
The message is Binance's error -2015: the request failed at the key check, and Binance does not say which part failed. Check the host first (Spot Testnet and production keys are separate), then the outbound IP, the key's permissions and whether the key was deleted; Binance API error codes covers each cause.
On 5 November 2026, a fake key got the same HTTP 401 and -2015 from the Spot Testnet and production, so the reply cannot tell you which environment you reached. A too-short key got -2014.
API key error codes on nine exchanges, side by side
Each exchange reports these causes with its own codes; only some separate them.
| Exchange | Key unknown or malformed | IP not allowed | Permission missing | Environment, expiry or other |
|---|---|---|---|---|
| Binance | -2014 API-key format invalid. | -2015 Invalid API-key, IP, or permissions for action. (one code for all of these) | ||
| BingX | 100413 API Key is incorrect or missing. | 100419 The request IP is not in the API Key IP whitelist. | 100004 The API key does not have the required trading permission. | - |
| Bitget | 40006 Invalid ACCESS_KEY | - | 25620 permission denied (scope not stated) | 40037, returned in testing, is not on the UTA list |
| Bybit | 10003 API key is invalid. Check whether the key and domain are matched, there are 4 env: mainnet, testnet, mainnet-demo, testnet-demo | 10010 Unmatched IP, please check your API key's bound IP addresses. | 10005 Permission denied, please check your API key permissions. | 33004 (Derivatives) and -2015 (Spot): Your api key has expired |
| Gate | INVALID_KEY Invalid API Key | IP_FORBIDDEN Request IP not in whitelist | READ_ONLY API key is read-only | HTTP 401 on authentication failure |
| Kraken | EAPI:Invalid key | - | EGeneral:Permission denied | EGeneral:Temporary lockout |
| KuCoin | 400003 KC-API-KEY does not exist | 400006 The requested ip address is not on the api whitelist | 400007 Access Denied (scope not stated) | 400004 KC-API-PASSPHRASE error |
| MEXC | 10072 invalid access key | 700006 IP non white list | 700007 No permission to access the endpoint | - |
| OKX | 50119 API key doesn't exist; 50111 Invalid OK-ACCESS-KEY. | 50110 Your IP {param0} is not included in your API key's IP whitelist. | 50120 This API key doesn't have permission to use this function | 50101 APIKey does not match current environment. |
Numbers collide: on Bybit, -2015 is an expired spot key, and in its WebSocket order-entry list 10003 means too many sessions. Key every lookup by exchange and interface, and match on codes, not message text.
What a fake API key actually returns: tests on 5 November 2026
Every exchange tested refused a fake key, often with a different HTTP status or wording than its documentation shows.
At 18:58 UTC, a Python script sent a request signed with fake credentials to a private endpoint on each host.
| Exchange and endpoint | HTTP | Body returned |
|---|---|---|
| Binance, testnet and production | 401 | -2015 Invalid API-key, IP, or permissions for action. |
| BingX | 200 | 100413 Incorrect apiKey, please check your valid api key in https://bingx.com/en/account/api |
| Bitget | 400 | 40037 Apikey does not exist |
| Bybit wallet balance (testnet and production); linear open orders (testnet) | 401 | Empty body |
| Bybit testnet, key information | 200 | 10003 API key is invalid. |
| Bybit testnet, spot open orders | 200 | 10003 You are not authorized to execute this request. |
| Gate, production and testnet | 401 | INVALID_KEY Invalid key provided |
| KuCoin | 401 | 400003 The API key does not exist or site mismatch. |
| MEXC | 400 | 10072 Api key info invalid |
| OKX, UUID-shaped key | 401 | 50119 API key doesn't exist |
| OKX, other key | 401 | 50111 Invalid OK-ACCESS-KEY |
- Statuses differ from the documents. OKX lists
50119as HTTP 200 but sent 401; BingX sent 200 for a rejected key; Bitget sent an unlisted code. Checking only the status misses failures, and parsing only the body crashes on Bybit's empty 401. - Wording drifts. Gate, KuCoin, MEXC and BingX sent text that differs from their error pages; KuCoin's mentions a site mismatch.
- Kraken was not tested on purpose. Its error guide says repeated
EAPI:Invalid keyreplies lock out every key from that IP for about 20 minutes, valid ones included. Never test a fake key from a server where a live bot runs.
IP, permission and expiry errors need a real key, so they were not reproduced.
The API key doesn't exist: OKX 50119 and similar errors
An unknown-key error means the host you called holds no key with that value, which is not always a typo.
- Copy errors. A trailing newline from an environment file, or the secret pasted where the key belongs; see API signature generation.
- Another regional site. OKX's documentation says
openapi.okx.comwill not work for users registered on app.okx.com, who useus.okx.com, or on my.okx.com, who useeea.okx.com. Bybit lists separate mainnet hosts for several regions, such as the EEA and Japan. - Inactivity. OKX keys with trade or withdraw permission and no linked IP expire after 14 days of inactivity, and only calls that require authentication count as use.
- Demo against live. An OKX demo key needs the header
x-simulated-trading: 1, and OKX lists50101: APIKey does not match current environment. See the OKX API Python guide.
Otherwise, create a new key as in how to create an exchange API key.
Why is my API key not working? IP, permissions and expiry
If the key exists on that host, check the address you call from, what the key may do, and how long it lives.
Outbound IP
An allowlist checks the public address the exchange sees, so check it from the machine that sends orders. Binance takes IPv4 addresses; OKX accepts up to 20 IPv4 or IPv6 addresses or network segments per key; MEXC allows 10. A server that connects over IPv6 is not matched by an IPv4-only list. Gate says key changes can take up to 5 minutes to take effect.
Hypothetical example. After a redeploy, every private call returns -2015 while public calls work. The new host leaves through a different NAT address; adding it to the allowlist fixes this, and a new key would not.
Permissions
Binance's API key FAQ, updated 6 November 2026, says a key cannot enable Futures permission if it was created before you enabled your Futures account, or if you have activated Portfolio Margin. Give a bot only what it uses, as in API key security for trading bots.
Expiry
- Bybit: its key information endpoint returns
deadlineDayandexpiredAtonly for keys with no IP bound or after a password change; the pages read did not state the period. - MEXC: its API FAQ says a key without a linked IP is valid for 90 days.
The wider fault-finding order is in trading bot not working.
Python helper: map an exchange response to a likely cause
A short function can map these replies to a likely cause if it checks the status and never assumes the body is JSON.
import io, json
from http.client import HTTPException
from urllib.error import HTTPError
KEY, IP, PERM, OLD = "key unknown on this host", "IP not on allowlist", "permission missing", "key expired"
CAUSES = { # from each official error page, read 5 November 2026
"binance": {"-2014": KEY, "-2015": "key, host, IP or permission"},
"bingx": {"100413": KEY, "100419": IP, "100004": PERM},
"bitget": {"40006": KEY, "40037": KEY}, # 40037: returned in testing, not listed
"bybit": {"10003": KEY, "10010": IP, "10005": PERM, "33004": OLD, "-2015": OLD,
"10009": "region restricted: not a code problem"},
"gate": {"INVALID_KEY": KEY, "IP_FORBIDDEN": IP, "READ_ONLY": PERM},
"kraken": {"EAPI:Invalid key": KEY + "; stop, repeats lock the IP",
"EGeneral:Permission denied": PERM},
"kucoin": {"400003": KEY, "400006": IP, "400007": "access denied"},
"mexc": {"10072": KEY, "700006": IP, "700007": PERM},
"okx": {"50119": KEY, "50111": KEY, "50110": IP, "50120": PERM, "50101": "wrong environment"},
}
FIELD = {"bybit": "retCode", "gate": "label", "kraken": "error"} # the rest use "code"
SUCCESS = {"None", "", "0", "00000", "200", "200000"} # 200: MEXC
def likely_causes(exchange, status, text):
"""Return (code, cause) pairs; [] means a parsed reply with no error."""
ex = exchange.lower()
try:
body = json.loads(text)
except (TypeError, ValueError): # empty, HTML or cut-off reply
if status < 400:
return [(str(status), "reply is not JSON: not a confirmed success")]
body = {}
raw = body.get(FIELD.get(ex, "code")) if isinstance(body, dict) else None
codes = [str(c) for c in raw] if isinstance(raw, list) else [str(raw)]
codes = [c for c in codes if c not in SUCCESS]
if not codes and status >= 400: # check the status, not only the body
if status in (403, 451):
return [(str(status), "blocked before the key check: not a key problem")]
return [(str(status), "no error code in the body")]
return [(c, CAUSES.get(ex, {}).get(c, "not in this table")) for c in codes]
def diagnose(exchange, fetch):
"""fetch() returns (status, text). A network error says nothing about the key."""
try:
status, text = fetch()
except HTTPError as err: # urllib raises on 4xx/5xx: still a reply
status, text = err.code, err.read().decode("utf-8", "replace")
except (OSError, HTTPException) as err: # DNS, refused, timeout, cut-off read; requests too
if getattr(err, "response", None) is None:
return [("network", type(err).__name__ + ": no complete reply, key status unknown")]
status, text = err.response.status_code, err.response.text # raise_for_status()
return likely_causes(exchange, status, text)
samples = [
("binance", 401, '{"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}'),
("bybit", 200, '{"retCode":-2015,"retMsg":"(Spot) Your api key has expired"}'),
("bybit", 401, ""),
("okx", 401, '{"msg":"API key doesn\'t exist","code":"50119"}'),
("kraken", 200, '{"error":["EAPI:Invalid key"],"result":{}}'),
("binance", 451, '{"code":0,"msg":"synthetic"}'),
("binance", 200, "<html>synthetic</html>"),
]
for ex, status, text in samples:
print(ex, status, likely_causes(ex, status, text))
def offline():
raise ConnectionError("simulated")
def rejected(): # what urlopen raises on a 401
raise HTTPError("", 401, "", None, io.BytesIO(b'{"code":-2015}'))
print("mexc", diagnose("mexc", offline))
print("binance", diagnose("binance", rejected))
Output (Python 3.11, rerun 26 November 2026; bodies from official pages or the fake-key tests above, plus three synthetic ones):
binance 401 [('-2015', 'key, host, IP or permission')]
bybit 200 [('-2015', 'key expired')]
bybit 401 [('401', 'no error code in the body')]
okx 401 [('50119', 'key unknown on this host')]
kraken 200 [('EAPI:Invalid key', 'key unknown on this host; stop, repeats lock the IP')]
binance 451 [('451', 'blocked before the key check: not a key problem')]
binance 200 [('200', 'reply is not JSON: not a confirmed success')]
mexc [('network', 'ConnectionError: no complete reply, key status unknown')]
binance [('-2015', 'key, host, IP or permission')]
Keying by exchange keeps Bybit's -2015 apart from Binance's; a 451 with code 0 or an HTML page never passes as success; and an HTTP error raised by urllib or raise_for_status() is read as a reply: both gave -2015 against the Spot Testnet with a fake key. Never retry an authentication failure in a loop.
Restricted region errors are not a code problem
Some refusals concern where the request comes from; no change to the code or key fixes them.
Bybit's 10009 reads: Service Restricted: Access is currently unavailable for your region. One of the three causes Bybit lists for HTTP 403 is a U.S. IP address. OKX lists 50121: You can't access our services through the IP address ({param0}). If you get one of these, stop and contact the platform; do not route around it. Article 99/A of Capital Markets Law No. 6362 treats activity by foreign crypto-asset platforms directed at Turkish residents as unauthorized.
For integration work in general, see trading bot code review or exchange API integration; naming these exchanges here does not mean Fincode integrates them or has built on them.
Related guide: Kraken API invalid nonce.
Frequently asked questions
What does invalid API-key, IP, or permissions for action mean on Binance?
It is error -2015: the key is unknown on that host, your IP is not allowed, or the key lacks permission. Binance does not say which.
Why does OKX say the API key doesn't exist?
Error 50119 means the host you called has no key with that value: check for copy errors, your region's domain, and whether a key without a linked IP expired after 14 days of inactivity.
Why is my Bybit testnet API key invalid?
Bybit keys belong to one of four environments: mainnet, testnet and a demo mode on each. A mainnet key does not work on api-testnet.bybit.com.
What does the MEXC message Api key info invalid mean?
It came with code 10072, which MEXC's documentation calls invalid access key. Check the key, and whether a key without a linked IP has passed its 90 days.
Sources
- Binance Spot API documentation: Error codes (-2014, -2015) (opens in a new tab)
- Binance FAQ: How to Create API Keys on Binance? (updated 6 November 2026) (opens in a new tab)
- BingX API documentation: API Error Code Reference (opens in a new tab)
- Bitget API: REST API Error Code (unified trading account) (opens in a new tab)
- Bybit V5 API: Error Codes (opens in a new tab)
- Bybit V5 API: Integration guidance (hosts by region) (opens in a new tab)
- Bybit V5 API: Get API Key Information (deadlineDay, expiredAt) (opens in a new tab)
- Gate API v4 documentation, changelog v4.106.187 of 23 November 2026 (authentication error labels, key changes, key security) (opens in a new tab)
- Kraken API: Error messages (EAPI:Invalid key, temporary lockout) (opens in a new tab)
- KuCoin API: Spot error codes (opens in a new tab)
- MEXC Spot V3 API documentation (error codes, API key FAQ) (opens in a new tab)
- OKX API v5 documentation (error codes, API key security, regional domains) (opens in a new tab)
- Capital Markets Law No. 6362, Article 99/A (Turkish, consolidated text) (opens in a new tab)
This guide is general information about software and markets, not investment, legal or tax advice. Automated trading can lose money, past or backtested performance does not guarantee future results, and the rules that apply depend on your jurisdiction and your exchange's terms. Sources, checks and corrections: see the editorial policy.