How to Create a Binance API Key and Bind an IP Whitelist Correctly
Full flow for issuing a Binance API Key and locking it to a whitelist: permission ticks, the 203.0.113.0/24 CIDR notation, the 90-day rotation, and the emergency drill when a key leaks.
The correct order for creating a Binance API Key is: sign in and pass 2FA -> open Account -> API Management in the web app -> create a new key and name it -> immediately tick the IP whitelist option and enter your stable outbound IPv4 range (e.g. 203.0.113.0/24) -> tick only what you need out of read-only / spot trading / withdrawal (default: read-only) -> save the API Secret and back it up offline. Every newly issued key has a 90-day validity window, after which it must be rotated.
From a web developer's perspective, an API Key is the physical key that hands part of your account's power to a script, trading bot, or dashboard. Leaking it hands that power away. Three ironclad rules mitigate the blast radius: minimise the permission surface, lock the IP whitelist tight, and rotate on the shortest cycle you can operate. What follows expands each part of the flow and spells out CIDR notation, permission tiers, and leak response.
Preparation
Nail down your outbound IP first
Binding a whitelist assumes your program has a stable outbound IPv4 - otherwise every IP change forces you back to the whitelist page. Three typical situations:
- Home broadband: usually dynamic; you need DDNS or a VPN to pin it. Not recommended to bind directly.
- Cloud servers: outbound IP is normally fixed; use the public IPv4 the cloud provider assigned.
- Corporate network: confirm with IT whether egress is a single IP or a NAT pool.
If you do not yet have a fixed IP, create the key with read-only rights only, bind the whitelist, and expand permissions once the address stabilises.
Name each key by purpose
Different scripts get different keys - never let one key serve multiple use cases. Reference naming:
| Key name | Purpose | Permissions | Notes |
|---|---|---|---|
read-only-portfolio |
Balance pull for a dashboard | Read only | Polls hourly |
spot-bot-btc-usdt |
Spot grid bot | Spot trade | Single pair |
data-export |
Daily trade export | Read only | Runs once a day |
treasury-withdraw |
Scheduled cold-wallet transfer | Withdraw | Never enable trade |
Splitting keys means a single leak revokes one key without disturbing anything else, and audit logs cleanly show the last-used time of each.
Have 2FA and email verification ready
Every create / edit / delete on API Management requires a 2FA code plus email confirmation. If you recently migrated 2FA (see /posts/biabaweb-2fa-migration/), confirm the new authenticator is stable before you begin.
How to tick permissions
Binance's permission tiers descend from lightest to heaviest. Apply the principle of least privilege.
Permission cheat-sheet
| Permission | Enables | Risk | Suggested scenario |
|---|---|---|---|
| Read only | Balance, orders, trades | Low | Dashboards, tax export |
| Spot trade | Place / cancel orders | Medium | Grid / arbitrage bots |
| Futures | Open, close, adjust leverage | High | Futures strategies |
| Margin borrow | Borrow, repay | High | Margin strategies |
| Withdraw | On-chain withdrawal | Extreme | Treasury scripts |
| Universal wallet | Composite rights | Extreme | Do not enable |
The default behaviour of read-only
With only read-only ticked, the key can hit GET endpoints exclusively. Even a leaked read-only key exposes only balances and history - assets stay put, and combined with a whitelist the practical loss is near zero. Any data-analysis workload should stop at this tier.
The extra requirements for the withdraw permission
Ticking withdraw forces two constraints: an IP whitelist becomes mandatory, and it must be paired with an account-level withdrawal address whitelist (see /posts/biabaweb-withdrawal-whitelist/). Single-tx and 24-hour limits share the account-level withdrawal cap. Any script that automates withdrawals must have both whitelists on.
Q: Can I start with read-only and upgrade to trade after validation? A: Yes, and strongly recommended. Run a week on read-only, watch for IP drift and script stability, then step permissions up. Each escalation triggers 2FA + email confirmation again.
Q: If I tick both read-only and spot trade, are the two additive or replacing? A: Additive. Read-only is implicit for every key; ticking spot trade layers order placement on top of it.
How to write the IP whitelist
The IP whitelist accepts comma-separated entries: single IPs, multiple IPs, or CIDR ranges.
Common formats
- Single IPv4:
203.0.113.55 - Multiple IPv4:
203.0.113.55,203.0.113.56 - IPv4 range:
203.0.113.0/24(203.0.113.0 through 203.0.113.255) - Small range:
203.0.113.0/29(eight consecutive IPs)
Notation caveats:
- The larger the range (smaller the mask number), the more IPs it covers and the riskier it is. Do not go beyond /24 without cause.
- The field does not accept IPv6 in place of IPv4 or vice versa - use whatever protocol your egress actually speaks.
- Hostnames and DDNS names are not accepted; only numeric IPs.
- Separate entries with an English comma and no whitespace.
Confirming a cloud server's egress
If you deploy on a cloud VM, SSH in and hit a third-party IP echo service to confirm the outbound IP - do not trust the "public IP" shown in the console, because some providers assign different inbound and outbound addresses.
Advice on choosing CIDR blocks
Prefer the host's /32 (a single IP), or /29 (eight IPs for auto-scaling). Avoid /24 unless you truly have that much elasticity. Never use 0.0.0.0/0 or leave the whitelist blank - a blank whitelist means every IP can call the API, which is catastrophic.
Verifying the whitelist actually took effect
After binding, use the key from a machine outside the whitelist to hit any endpoint. You should get a definite -2015 or an "Invalid API-key, IP, or permissions" error. Getting that error confirms the whitelist is live; if the call succeeds, either the config never saved or the IP is not bound.
90-day expiry and rotation
Since 2023, Binance enforces a 90-day validity on any API Key with trade or withdraw permissions. Post-expiry the key is auto-downgraded to read-only until you manually renew or rotate.
How to rotate cleanly
- Seven days before expiry, mint a new key with matching permissions, IP whitelist, and notes.
- Deploy the new Access Key / Secret to your script and swap the env vars.
- Watch 24 hours for stable operation on the new key.
- Immediately delete the old key at expiry - never leave it "just in case."
Benefits: a 24-hour overlap eliminates downtime, and the old key is destroyed on time, shrinking the exposure window.
Do not lean on auto-renew
Binance offers an "extend validity" button, but relying on it means the Access / Secret pair never changes; any past leak becomes a permanent liability. Rotating keys is the only effective form of secret hygiene.
Interaction with the withdrawal whitelist
If a rotated key includes withdraw permission, you do not need to redo the withdrawal whitelist - the account-level address book is decoupled from the key. But do run a full drill: new key + existing whitelisted address, small-value withdraw, and only ramp up after the link is confirmed.
Leak response drill
The moment you suspect a key is compromised, run the following in order - five minutes minimises loss.
- Open Account -> API Management and delete the suspected key.
- Sign out every session (tick "Sign out other devices" on the sign-in page).
- Change the account password immediately.
- Inspect Security -> Login history and Operation log for anomalies.
- Inspect the funds ledger for unauthorised trades or withdrawals.
- Optionally reset 2FA if you suspect account intrusion.
- File a support ticket through Binance Official Site describing the incident.
- Within a week run a full security audit: whitelists, 2FA, APIs, bound email.
Post-mortem
How did the key leak? Common vectors:
- Committed to a public GitHub repo.
- Written into a config file that was uploaded to a chat app.
- Deploy script embedded the key and shipped to multiple hosts.
- An employee left and their credentials were not revoked.
- A dev tool with screenshot / log-upload features captured it.
Run a root cause on each leak and change the process so the next one is prevented.
Risk note: any social account that reaches out unsolicited and offers to "run a grid on your API" is a phishing lure. Anyone asking you to DM your Access or Secret Key is running a scam without exception. Grab the Official Binance App only from the official entry point; the same rules on identifying real vs fake are covered in /posts/binance-anti-phishing-real-fake/.
Frequently asked questions
How many keys can one account create?
Master accounts currently support up to 30 API Keys; sub-accounts count independently. In practice, no more than five concurrently active keys is a healthier ceiling; sweep the rest periodically.
Can sub-accounts issue their own keys?
Yes. Sub-accounts manage their own API list and IP whitelist, fully isolated from the master. For institutional-grade separation this is invaluable: one sub-account per strategy, one key per IP.
I forgot the Secret Key - can I recover it?
No. The API Secret is shown once at creation and Binance stores no plaintext copy. Loss means delete and rebuild. This is why you must write it into a password manager or an encrypted file the moment it appears.
Can someone else's IP use my key?
Not with a whitelist bound. Even holding both Access and Secret, an attacker outside the whitelist will fail immediately. That is the core value proposition.
Can I keep using an expired key?
You can, at read-only. Restoring trade or withdraw requires manually clicking "extend" and passing 2FA. In production do not depend on that path - rotate proactively.
Does the whitelist affect rate limits?
No. Rate limits are account-scoped and orthogonal to the whitelist. If you hit the limiter, tune your call frequency or request higher quota; adding more whitelisted IPs will not help.
Does the whitelist accept CIDR?
Yes. Notation such as 203.0.113.0/24. The larger the block the higher the risk - write /32 instead of /24 whenever possible, and /29 instead of /24 whenever practical.
I deploy across multiple cloud regions - how should I manage whitelists?
One key per region, each bound to that region's egress IP. Switching regions then only touches the relevant key, and failures localise cleanly. Do not glue one key to a multi-region CIDR - troubleshooting is painful and the blast radius grows.
Published 2026-07-01, next revalidation planned for 2026-10-01.