API Key
To let a bot, tax tool or portfolio app talk to your exchange account, you create an API key — a credential that works without your password. Grant the narrowest rights the tool needs, never withdrawal rights, and lock the key to specific IP addresses.
An API key is how software logs in to your exchange account on your behalf. Trading bots, portfolio trackers and tax tools all use one, and none of them needs your password. That convenience is also the risk: a key is a set of permissions that works for whoever holds it. This entry explains how API keys work, which permissions to grant, how IP restrictions and expiry dates protect you, and what to do if a key leaks.
- Category
- Cryptocurrency and Blockchain
- Reading time
- 6 min
- Also called
- API keys, API secret, Exchange API key
- Updated
API keys in plain words
An API key usually comes as a pair: a public key that identifies you and a private or secret part that signs each request. Exchanges advise treating both like your username and password and storing them in a password manager rather than in plain text.1
Each key carries its own permissions. On one large exchange, for example, rights are split into funds (query, deposit, withdraw), orders and trades (query, place, cancel) and data (ledger and exports), and a key for a third-party trading tool does not need withdrawal rights.1
Keys can also be limited to certain IP addresses and given an expiry date, so a stolen copy is useless from another computer or after a set time.1 Another exchange warns that a secret with transfer permission could let someone move funds out of your account.2
How to set up an API key safely, step by step
Decide what the tool must do
Read-only data, trading, or (rarely) transfers.
Create the key in your account
Usually under settings, in an API section.1
Tick only the needed rights
Give only the access a credential needs.3
Leave withdrawals off
A trading bot can trade without moving funds out.1
Restrict to IP addresses
Lock the key to the server the tool runs on.1
Set an expiry date
A key that ends on its own limits forgotten access.1
Store the secret safely
Use a password or secrets manager, never your code.2
Worked examples
Example 1 — A key for a tax tool
Read-onlyHypothetical: a tax app needs your trade history to prepare a report.
| Query balances and trades | On |
| Export data | On |
| Place orders | Off |
| Withdraw funds | Off |
A read-only key gives the tool the data it needs and nothing it could misuse.
Example 2 — A key for a trading bot
Limited exposureHypothetical: you run a bot in a separate sub-account holding $2,000 of your $10,000 on the exchange.
| Rights | Query + trade, no withdraw |
| IP restriction | The bot’s server only |
| Funds the key can trade | $2,000 |
| Share of total | $2,000 ÷ $10,000 = 20% |
Isolating the bot means a bug or a leaked key can touch at most 20% of the balance. See Trading Bots.
Example 3 — A leaked key
Damage depends on rightsHypothetical: a secret is pushed to a public code repository. The account holds $8,000.
| Key with withdraw rights | Up to $8,000 at risk |
| Read-only key | Data exposed, funds safe |
| First step either way | Delete the key, make a new one |
If a credential leaks, create a new one, replace the old one wherever it is used, and delete the compromised one.3
Password vs. API key
| Aspect | Account password | API key |
|---|---|---|
| Used by | You, in the app or website | Software acting for you |
| Access | Everything in the account | Only the rights you tick |
| Location limits | Rarely | Can be locked to IP addresses |
| If leaked | Change it, secure the account | Delete it and create a new key |
Why API keys matter
Trading bots
Bots place orders through a key, not a login. See Trading Bots.
Portfolio and tax tools
Read-only keys pull balances and trade history.
Separating strategies
A key per sub-account keeps mistakes contained. See Sub-Account.
Scam awareness
Anyone who asks for a key with withdrawal rights should be treated as a thief.
Advantages and disadvantages
Advantages
- Tools can work without your account password.
- Permissions can be limited to exactly what a tool needs.
- IP restrictions and expiry dates shrink the damage from a leak.
- A key can be deleted at once without touching your login.
Disadvantages
- A key works for whoever holds it.
- Keys with withdrawal rights can empty an account.
- Secrets are easy to leak in code, chats or screenshots.
- Every connected tool is another party you must trust.
Going deeper
Read as far as you need. Each level builds on the one before it.
Never share a secret
Beginner
Do not paste a secret into email or chat, and never commit it to a code repository, even a private one.3 Anyone asking for your secret in a support chat is not support. See Social Engineering.
IP restrictions as a gatekeeper
Intermediate
Some exchanges build restrictions into the key itself. On Binance, a system-generated key without IP restrictions can only read data, and adding an IP restriction is mandatory before withdrawal permission can be switched on.4
Kraken lets you restrict a key to client IP addresses and set an expiry, and it supports adding a second factor to an existing key if your software can handle it.1
Key types and secret storage
Advanced
Exchanges differ in how keys sign requests. Binance offers system-generated HMAC keys and self-generated Ed25519 or RSA key pairs, where you keep the private key and give the exchange only the public one.4 Coinbase requires ECDSA keys for its app API.2
Keep secrets out of source code: Coinbase recommends environment variables, and GitHub recommends a secrets manager plus scanning repositories to block pushes that contain secrets.23
Common mistakes
Check your understanding
Test yourself before moving on. Each answer comes with an explanation.
Key points to remember
- An API key lets software use your exchange account without your password.
- Each key has its own permissions; grant the minimum the tool needs.
- Leave withdrawal rights off for bots and data tools.
- Lock keys to IP addresses and give them an expiry date.
- If a key leaks, delete it and create a new one at once.
Frequently asked questions
Is an API key the same as my password?
Does a trading bot need withdrawal permission?
What should I do if I think a key leaked?
Further learning
- Trading Bots
The most common reason to create a key.
- Social Engineering
How attackers talk people into handing keys over.
- Algorithmic Trading
Automated trading beyond crypto.
- Centralised and Decentralised Exchanges
Where exchange API keys are used.
Sources
This article is written in our own words. The sources below support the specific facts, rules and figures marked with a number in the text. Links open the original publisher’s page.
- Kraken. How to create an API key on Kraken Pro (opens in a new tab) Checked .
- Coinbase. Coinbase App API Key Authentication (opens in a new tab) Checked .
- GitHub Docs. Keeping your API credentials secure (opens in a new tab) Checked .
- Binance. How to Create API Keys on Binance? (opens in a new tab) Checked .
Educational content, not financial advice. Examples use hypothetical prices and simplified costs; actual fees, margin rules and regulations vary by broker, market and country. We are not affiliated with any publisher linked above. Last reviewed . Report an error or request a source credit.