# MT5 API Key vs Broker Login: What's the Difference?

> MetaTrader 5 has no API key of its own. Here is what an API key, an MT5 login, a trading password and a server name each do, and where you get each one.

Published 2026-10-06 by fxapis. Canonical: https://fxapis.com/blog/mt5-api-key-vs-broker-login

## In short

- MetaTrader 5 and your broker do not issue API keys. They give you an account login, a password and a server name.
- An API key comes from the API provider. With fxapis, it identifies your application to fxapis and decides what it may do.
- You need both: the key on every request, and the account's login, trading password and server once, to connect each account.
- Keep them apart. The key lives on your server; the MT5 password is sent once and never stored by you.

If you searched for "MT5 API key" and found nothing in MetaTrader's settings, that is because there is none. **MetaTrader 5 and your broker give you a login, a password and a server name. An API key comes from the API you trade through.** An integration needs both kinds, for different jobs.

## Four credentials, two owners

| Credential | Looks like | Issued by | What it does |
|---|---|---|---|
| API key | `fx_live_7f3a9c21_ZmQ4…` | The API provider (fxapis) | Proves a request comes from your application, and limits what it may do |
| MT5 login | `81234567` | Your broker | The trading account's number |
| Trading password | chosen at the broker | Your broker | Lets software log in to the account and trade it |
| Server name | `VantageMarkets-Live` | Your broker | Which of the broker's trade servers the account lives on |

The first one belongs to your application. The other three belong to a trading account — yours, or one of your users'.

## How they fit together

Connecting an account uses all four, once. Your server sends the account's details to fxapis, authenticated with your key:

```bash
curl -X POST https://api.fxapis.com/v1/accounts \
  -H "Authorization: Bearer $FXAPIS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "login": "81234567",
    "server": "VantageMarkets-Live",
    "password": "the-trading-password",
    "mode": "warm_on_demand"
  }'
```

The answer is an account `id`. From then on, every request uses the key and that id — never the password again. fxapis encrypts the password on arrival with a key unique to that account, never returns it, and erases it when you disconnect the account.

## Getting each one

**The API key.** Sign up at [fxapis.com/sign-up](https://fxapis.com/sign-up), open the console and create a key under API keys. It is shown once; fxapis stores only a hash, so a lost key is replaced, not recovered. Give each key only the scopes it needs — for example `trading:reduce` for a risk tool that may close but never open.

**The login and password.** From the broker, when the account is opened — usually in the welcome email and the broker's client area. Use the **trading** (master) password. The investor password logs in but cannot trade; see [investor vs trading password](https://fxapis.com/blog/mt5-investor-password-vs-trading-password).

**The server name.** Shown in MetaTrader next to the account, and in the broker's email. It must match exactly; see [how to find your MT5 server name](https://fxapis.com/blog/find-mt5-broker-server-name).

## Where each one should live

- **The API key stays on your server.** It is a server-to-server credential: never in a browser, a mobile app or a repository. The `fx_` prefix makes a leaked key easy to find with a search.
- **The MT5 password passes through once.** Your connect form posts to your backend, your backend calls `POST /v1/accounts` in the same request, and nothing — database, log, queue — keeps a copy. Store the fxapis account `id` instead.

## Common mix-ups

- **"My API key does not log in to MetaTrader."** It is not meant to. The key talks to fxapis; MetaTrader never sees it.
- **"The account connected but cannot trade."** Usually the investor password was used instead of the trading password.
- **"A test key should not trade real money."** fxapis labels keys `live` or `test` so you can tell configurations apart, but both reach real brokers. Test with broker demo accounts.

## Next steps

- [Create your account and first key](https://fxapis.com/sign-up).
- The [authentication guide](https://docs.fxapis.com/authentication) covers scopes, rotation and member sessions.
- [Connect MT5 accounts](https://docs.fxapis.com/guides/connect-accounts) covers the connect screen in detail, including what to tell users when a login fails.

## Questions

### How do I get an MT5 API key?

MetaTrader 5 itself does not issue API keys. An API key comes from the API service you use. With fxapis, create a workspace at fxapis.com/sign-up, then create a key in the console under API keys. It is shown once, so copy it then.

### Is my MT5 account number an API key?

No. The account number (login) identifies the trading account at your broker. Together with the trading password and the server name it lets software log in to that account. An API key identifies your application to the API provider.

### Can one API key trade several MT5 accounts?

Yes. A key belongs to your fxapis workspace, and the workspace can hold every account you connect, up to your plan's limit. Each request names the account it is for.

### What is the difference between a live and a test fxapis key?

Only the label. fx_live_ and fx_test_ keys help you tell configurations apart, but both reach real brokers. To test safely, connect broker demo accounts.
