Skip to content
Fixedmark

Algo trading · 10 min read

Updated

Crypto Exchange API Key IP Restrictions for Bots

Most large exchanges let you bind an API key to a list of IPs, and several penalize keys that are not bound. Binance limits unrestricted HMAC keys to reading, Bybit invalidates unbound keys after 90 days, and OKX deletes unbound trading keys after 14 idle days. A cloud bot keeps its key by sending signed calls from a fixed IP, such as a VM's static IP or a static IP proxy.

On this page

What each exchange does to keys without an IP list

Every exchange below lets you attach a list of IP addresses to an API key. After that, the exchange rejects any signed request that comes from another address. The difference is what happens when you leave the list empty. Some exchanges only recommend the list. Others cut permissions, expire the key, or delete it.

API key IP rules at major exchanges, from each exchange's own docs (checked November 2026)
ExchangeKey without an IP listNotes
BinanceA system-generated (HMAC) key can only read. Withdrawals need an IP restriction on every key type.Self-generated Ed25519 or RSA keys can get other permissions without an IP list. The withdrawal rule asks for IPv4 addresses.
Binance.USReset to read-only after 90 days unused.The reset applies to keys not secured by IP whitelisting.
BybitInvalid after 90 days. Also invalid 7 days after the account password changes.Pass IPs as a comma-separated list. Bound keys are exempt from both rules.
OKXDeleted after 14 days of inactivity if it has trade or withdraw permission.Up to 20 IPs per key, IPv4, IPv6, or ranges. Private calls count as activity.
KrakenNo penalty. IP Address Restriction is an optional setting.Listed under optional settings in Kraken's API key guide.
Delta Exchange IndiaA key with Trading permission cannot be created without whitelisted IPs.IPv4 and IPv6 accepted, several IPs per key.

Sources for the table are the Binance API key FAQ, Binance.US, the Bybit create key endpoint, the OKX API FAQ and OKX API docs, Kraken support, and the Delta Exchange API docs. These rules change. Binance capped trading permission on unrestricted keys at 90 days in a July 2021 announcement, and that page now says the rule stopped applying on 2023-10-24. The current Binance rule, read-only for unrestricted system-generated keys, dates from 2023-01-30.

So the premise needs one correction. IP binding is not mandatory for trading everywhere. At Binance an Ed25519 key can trade without an IP list, and Kraken never requires one. What is close to universal is that withdrawals need an IP list, and that keys without one live shorter lives. For a bot that runs for months, an IP list is the only setup that does not need a calendar reminder.

This post covers API security and networking only. It is not investment, legal, or tax advice, and it says nothing about whether crypto assets or any exchange are a good place for your money. Crypto trading is risky, and the rules for it differ by country. Check what applies where you live before you trade.

Why exchanges push keys toward fixed IPs

An API key and secret are a bearer credential. Anyone who copies them from a leaked .env, a public repo, or a compromised laptop can sign requests as you. An IP list turns that copy into something much less useful. The attacker now also needs to send traffic from one of your addresses.

That is why the rules cluster around trading and withdrawals. A read-only key that leaks exposes your balances. A trading key that leaks can be used to trade your funds into a thin market. A withdrawal key that leaks loses the funds outright, which is why Binance makes the IP list mandatory before it will enable withdrawals at all.

The expiry rules are the nudge. An exchange cannot force everyone onto fixed IPs, because many users trade from home connections whose address changes. So it lets unbound keys exist, but makes them expire or shrink. Bybit's 7-day rule after a password change follows the same logic. A password change often follows a suspected compromise, so unbound keys from before it should not live on.

An IP list is one layer, not the whole defence. Keep withdrawal permission off on any key a bot uses. Give each bot its own key, ideally on a sub-account with only the funds it trades. Binance also recommends Ed25519 keys and calls HMAC keys deprecated, because with Ed25519 the exchange only ever holds your public key.

Why a cloud bot breaks the IP list

A bot on your own VPS has one public IP, and the IP list just works. A bot on serverless functions, a PaaS container, or an autoscaling group does not. Those platforms send outbound traffic from shared address pools that change on redeploys, restarts, and scale events. The post on why serverless egress IPs change covers each platform's behaviour. You cannot list those addresses, and listing a whole cloud range would admit every other tenant on it, as the cloud IP ranges post explains.

When the bot's address is not on the list, the exchange answers with an error that often looks like an authentication problem. These are the documented messages.

IP mismatch errors as the exchanges document them
ExchangeCodeMessage
Binance-2015Invalid API-key, IP, or permissions for action. One code covers all three causes.
Bybit10010Unmatched IP, please check your API key's bound IP addresses.
Delta Exchangeip_not_whitelisted_for_api_keyThe response shows the rejected IP, so you can add it.
OKX50110Your IP {param0} is not included in your API key's IP whitelist. Returned with HTTP 401.

The messages come from each exchange's error reference (Binance, Bybit, OKX, and the Delta Exchange docs). Binance's single -2015 code is the hard one, because a wrong key, a missing permission, and a wrong IP all look the same. Check the IP first. It is the cause that changes without you touching anything.

IPv6 can leave by a different door

A host with both IPv4 and IPv6 may reach the exchange over IPv6 when the API hostname has an IPv6 address. The exchange then sees your IPv6 address, which is not the IPv4 address you listed. Binance's withdrawal rule asks for IPv4 addresses specifically. Delta's docs warn about this mismatch and suggest whitelisting both protocols or turning one off. The IPv6 egress post shows how to force IPv4 in common clients.

Three ways to give the bot a fixed IP

  1. Run the bot on a VM with a static public IP. This is the simplest option if you are happy to patch and monitor a server. One VM is also one point of failure, and its IP leaves with it if you rebuild it carelessly.
  2. Keep the bot where it is and send its traffic through a cloud NAT gateway with a reserved IP. This works inside one cloud and one network, and the NAT bill can exceed the bot's own cost. The NAT gateway cost calculator shows the numbers for AWS.
  3. Keep the bot on any platform and send only its exchange calls through a static IP proxy. The bot keeps its host. The exchange sees the proxy's IP. This is the option that works on serverless and PaaS platforms that have no static IP of their own.

The home IP vs VPS vs proxy post compares these for Indian stock broker APIs, and most of it carries over to exchanges. Two points are specific to crypto exchanges.

First, the IP must be yours alone. A shared proxy IP means other customers' traffic also comes from an address on your key's list, so the list stops protecting you from them. Second, exchanges apply some limits per IP. Binance documents request weight as IP-based, and its -1003 error reads Way too much request weight used; IP banned until %s. On a shared IP, another user's traffic can spend your weight or get the address banned.

Use two IPs, not one, and list both. A pair on separate hosts lets the bot keep trading when one host fails. The static IP pairs post explains how that failover works. Bybit, OKX, and Delta all document lists of several IPs per key.

Route only signed calls through the proxy

Most bots talk to exchanges through ccxt. It has a httpsProxy property for REST calls and a separate wssProxy property for websocket connections. The proxy tunnels each connection with HTTP CONNECT, so TLS runs end to end from your bot to the exchange. The HTTP CONNECT post walks through that handshake.

Public market data does not need the fixed IP. Order books and trade streams are heavy, and sending them through a proxy costs bandwidth and adds a hop for nothing. A clean pattern is two exchange objects. One reads public data directly. The other holds the key and the proxy.

# pip install "ccxt>=4.5"   (Python 3.11+ for an https:// proxy URL)
import asyncio
import os

import ccxt.async_support as ccxt


async def main():
    # Public data goes direct: no key, no proxy.
    public = ccxt.bybit()

    # Signed calls leave from the fixed IPs on the key's list.
    private = ccxt.bybit({
        "apiKey": os.environ["BYBIT_API_KEY"],
        "secret": os.environ["BYBIT_API_SECRET"],
    })
    private.httpsProxy = os.environ["FIXEDMARK_PROXY_URL"]

    try:
        ticker = await public.fetch_ticker("BTC/USDT")
        balance = await private.fetch_balance()
        print(ticker["last"], balance["total"].get("USDT"))
    finally:
        await public.close()
        await private.close()


asyncio.run(main())

We ran ccxt 4.5.92 REST and websocket calls through a local CONNECT proxy and logged each tunnel. Two behaviours are worth knowing before you deploy.

  • In ccxt's synchronous Python client, httpProxy fills only the http key of the requests proxies dict. Calls to an https:// exchange URL then skip the proxy with no error, and the exchange sees your platform's IP. Set httpsProxy, which fills the https key. The async client passes either property to aiohttp, so both work there.
  • In Node, ccxt sends REST calls through undici and needs nothing extra. Websockets through wssProxy need both http-proxy-agent and https-proxy-agent installed. With only one of them, watchTicker threw a NotSupported error that asks you to install https-proxy-agent, even when that package was present.

Treat any connection that authenticates with the key as restricted. That includes private websocket logins and the REST call that creates a user data stream. If you write raw HTTP clients instead of using ccxt, the selective proxying post covers per-client proxy settings in each language, and why a global HTTPS_PROXY is riskier.

Check what the exchange sees

Do not guess the egress IP. Ask a service that echoes it, through the same proxy URL your bot uses. Then ask the exchange what it thinks of your key.

Terminal
# The IP a destination sees through the proxy. Repeat it to see both IPs of a pair.
curl --proxy "$FIXEDMARK_PROXY_URL" https://fixedmark.com/api/ip

# Connection and TLS timing to an exchange through the same path.
curl -s -o /dev/null --proxy "$FIXEDMARK_PROXY_URL" \
  -w 'connect=%{time_connect}s tls=%{time_appconnect}s total=%{time_total}s\n' \
  https://api.bybit.com/v5/market/time

Binance has a signed endpoint, GET /sapi/v1/account/apiRestrictions, that returns ipRestrict and each permission flag. Bybit's GET /v5/user/query-api returns the bound ips, plus expiredAt and deadlineDay for keys that will expire. ccxt exposes both as implicit methods.

check_keys.py
# pip install "ccxt>=4.5"
import os

import ccxt

proxy = os.environ["FIXEDMARK_PROXY_URL"]

binance = ccxt.binance({
    "apiKey": os.environ["BINANCE_API_KEY"],
    "secret": os.environ["BINANCE_API_SECRET"],
})
binance.httpsProxy = proxy  # httpsProxy, not httpProxy, in sync Python
r = binance.sapiGetAccountApiRestrictions()
print("binance ipRestrict:", r["ipRestrict"],
      "trading:", r["enableSpotAndMarginTrading"],
      "withdrawals:", r["enableWithdrawals"])

bybit = ccxt.bybit({
    "apiKey": os.environ["BYBIT_API_KEY"],
    "secret": os.environ["BYBIT_API_SECRET"],
})
bybit.httpsProxy = proxy
info = bybit.privateGetV5UserQueryApi()["result"]
print("bybit ips:", info["ips"],
      "expiredAt:", info["expiredAt"],
      "readOnly:", info["readOnly"])

Run the check from a scheduled job, not once. If ipRestrict turns false or expiredAt gets close, alert before the bot fails mid-trade. When you rotate keys, create the new key with the same IP list, deploy it, and only then delete the old one. The credential rotation post describes the overlap pattern.

A fixed IP is not a way around geoblocks

Exchanges also decide who may use them by location, and they enforce it partly by IP. Bybit's error reference lists You are using U.S IP as a cause of HTTP 403. Developers calling Binance.com from US servers report HTTP 451 with a message that begins Service unavailable from a restricted location according to 'b. Eligibility', in threads on Binance's developer forum.

This matters when you pick a region for the bot's fixed IP. Choose an egress location where the exchange operates and where you are an eligible user. Do not pick a region to make your traffic appear to come from a country the exchange restricts or where you do not live. That breaks the exchange's terms, it can freeze the account, and a fixed IP makes it easy for the exchange to see.

For traders in India, note that the static IP rules in SEBI's algo trading framework apply to stock brokers' APIs. Crypto exchange IP rules are each exchange's own policy. Delta Exchange India, for one, requires whitelisted IPs on every key with Trading permission.

Doing this with Fixedmark

Fixedmark is a static outbound IP proxy, in early access. On the Pro plan (planned at $29 a month) you get a dedicated pair of IPv4 addresses in one region. You list both on the exchange key, set FIXEDMARK_PROXY_URL to your proxy URL, and point ccxt's httpsProxy and wssProxy at it as shown above. Planned regions are Mumbai, Singapore, Newark, and Ashburn. See regions, and keep the geoblocking section in mind when you choose.

  • TLS passes through end to end and is never decrypted, so the proxy never sees your API key, signatures, or order payloads. See security.
  • Connection logs show the destination, SNI, egress IP, and result of each connection, which helps when an exchange returns an IP error.
  • Destination allowlists, on Business and up, can limit a proxy token to hosts such as api.bybit.com:443, so a leaked proxy token cannot reach anything else.
  • The trial runs on a shared IP pair. Do not put shared IPs on an exchange key. Use the trial to test your code path, then list the dedicated pair.

Per-language proxy setup is in the Python and Node.js docs, and verify your egress IP has more ways to confirm the address. If you trade Indian equities too, the algo trading static IP page covers broker registration.

Sources

Checked November 2026. Confirm current details on the vendor's site before you decide. Prices and limits change.

Blog

Frequently asked questions

Do Binance API keys need an IP whitelist to trade?

Not always. A system-generated HMAC key without an IP restriction can only read. A self-generated Ed25519 or RSA key can get trading permission without one. Withdrawal permission needs an IP restriction on any key type.

Why did my Bybit API key stop working after three months?

Bybit's API docs say a key with no IP binding becomes invalid after 90 days, and 7 days after an account password change. Keys bound to IPs are exempt. Create a new key and bind it to your bot's fixed IPs.

Why was my OKX API key deleted?

OKX deletes keys that have trade or withdraw permission, have no IP binding, and see 14 days without private API calls. Bind up to 20 IPs to the key to stop this.

Can I whitelist my Lambda or Vercel IP on an exchange?

Not reliably. Those platforms send outbound traffic from shared pools that change. Route the bot's signed calls through a VM, NAT gateway, or static IP proxy with addresses only you use, and whitelist those.

Should my crypto bot use a shared proxy IP?

No. Other users' traffic would come from an address on your key's list, and IP-based rate limits and bans would be shared with them. Use a dedicated IP, ideally a pair.

Make it fixed.

Fixedmark is in early access. Join the list to get dedicated static IPs when your region opens.