API Keys: The Permissions You Should Never Grant

automation

Connecting a bot, a dashboard or a copy service to an exchange account means issuing an API key. The permissions attached to that key are the entire security model, and the defaults are usually more generous than they need to be.

The permission ladder

PermissionWhat it allowsGrant it?
ReadBalances, positions, trade historyYes, for dashboards and reporting
TradePlace and cancel ordersOnly for a service that must trade
Margin or futuresLeveraged positionsOnly if that is the explicit purpose
WithdrawMove assets off the venueNo. There is no legitimate third-party use
Internal transferMove between sub-accountsRarely. Treat as close to withdrawal

Six settings that do most of the work

  • 01Bind every key to a fixed IP address. A stolen key is useless from elsewhere.
  • 02One key per service. Revoking one then costs nothing.
  • 03Set an expiry and rotate on a schedule you actually keep.
  • 04Use a sub-account with a capped balance for anything automated.
  • 05Turn on withdrawal address allowlisting at the account level, independent of keys.
  • 06Store secrets outside the code. Keys in a repository are the most common single failure.
One rule covers most of it. If a service asks for withdrawal permission, or for your account password rather than a key, the conversation is over. No legitimate tool needs either.

Operational habits

Log every order your automation sends, separately from the venue record, so the two can be reconciled. Alert on unexpected order volume rather than on price. And rehearse the kill switch: know exactly how to revoke a key and flatten positions manually, before the day you need to do it quickly.

A key with trade permission can lose you money. A key with withdrawal permission can end the account.

Written by Aram Latifi. Ex-quant developer, now writing about the plumbing of retail trading. No affiliate links on this site.

About the Author

Aram Latifi

Aram Latifi built execution and risk systems for a mid-sized brokerage for seven years before leaving to write about them. Artificial Forex is a notebook, not a shop: it carries no affiliate links, sells no signals and takes no payment from any broker, exchange or platform mentioned on it.

You may also like these