A API key is an authorization you create yourself, inside your account on an exchange, to let a program talk to that account. The program can be a bot, a signals service, an app that keeps your portfolio in order or tax software. Instead of your password you hand it two codes: the key itself and a secret. On many exchanges a third is added, a passphrase chosen by you.
The advantage is simple. Your password opens everything, while an API key opens only what you decide. That is why it is the right tool for any external software, and why it is worth understanding the permissions well before you press «create».
The names change from one exchange to another, but the categories are almost always these, and you switch them on one by one.
| Permission | What it allows | Risk if the key ends up with a stranger |
|---|---|---|
| Read | Seeing balance, positions, orders and history. | It sees your data, it moves nothing. |
| Trading | Opening and closing orders. | It can place trades in your place, even losing ones. |
| Withdrawal | Moving funds to other addresses. | It is the most delicate: it can take money out. |
The principle to keep in mind is called least privilege: each key has only the permissions its task needs, and not one more. An app that only has to show you your balance needs read access. A service that operates on your account needs trading as well. Withdrawal is a separate permission: if a service asks for it, it has to tell you which exact function needs it, and that explanation has to be written on a public page. How it works in detail on OKX is in the guide to OKX API key permissions.
The procedure is in your account settings, in the section dedicated to APIs. The habits that matter are few.
An IP address is, in simple words, the number that identifies the computer or server a request comes from. When you bind a key to an address, the exchange accepts requests only from there. If someone copies the key and tries to use it from somewhere else, they are turned away.
It is one of the most effective protections, because it turns a stolen code into an almost useless one. Some exchanges make it close to mandatory: keys with trading or withdrawal permissions that are not bound to an IP can be deleted after a period of inactivity. Check your exchange's rules, because they change over time.
A few questions to ask before pasting any code. Who runs the service and where do you find their details? Which permissions does it ask for, one by one, and what is each one for? Are the keys stored encrypted? Can you revoke them yourself at any time, without asking anyone's permission? Is there a history of operations you can check on your own, including the losing ones?
If an answer goes around in circles, stop. And remember a rule with no exceptions: no serious service asks you for your password, your two-factor verification codes or the key's secret in a chat, by email or over the phone. Whoever asks for them is trying to get in. For a wider picture of how to recognize who is trustworthy, there is the guide to serious trading platform, and to understand who holds your funds, the one onregulated crypto exchange.
Time matters more than precision. If you suspect a key has slipped out of your control, for example you pasted it in the wrong place or you see operations you do not recognize, follow this order.
For this reason a key with fewer permissions is a smaller problem: if it cannot withdraw, it cannot take funds out of the account, and with trading alone the damage is limited to the operations. It is still damage, which is why a loss limit on every position and cautious sizes are used as well, as the article on risk management in trading.
Yes, that is exactly how a bot connects to the exchange: it reads prices and sends orders through the key. That is why the security of the key matters as much as the quality of the strategy. An excellent bot with a key left lying around is still a risk, and a mediocre bot with wide permissions is an even bigger one. What these programs really do and what they promise is in the article on crypto trading bots, while the big picture of automation is in the guide to automated trading.
STA is a card service for crypto and US stocks on OKX: ten artificial intelligence agents analyze 175 markets on OKX Europe, including 44 US stocks and ETFs, twice a day, with a debate between a Bull and a Bear, and every card has its own stop. Your funds stay in your OKX account. The permissions requested from keys and their purpose are explained on the page about security, and before connecting a real account you can try everything with the DEMO, free forever, with real prices and the same cards as the REAL. You need an account. For now, web version only.
Every card as soon as it closes, with the result and what STA learned from it. It's free and you don't need to sign up.
Follow the channelA DEMO account with virtual capital and real prices, the same cards as REAL users.
Try DEMO for free →This article is for information only and is not investment advice. Trading crypto-assets involves a high risk, including the total loss of the capital used. Numerical examples are for illustration.
Revenge trading: what the urge to win back a loss is, why it leads to losing more, and five rules to stop you before you open the next position.
Panic selling: what it is, why it happens right when the market falls, and five rules to write down beforehand so you can decide calmly.
Regulated crypto exchange: what the MiCA licence is, how to check an exchange in the ESMA register and the questions to ask before depositing.