OrderFill

Quickstart

Create a key, connect an account, place an order.

1. Create an API key

Sign in, open API keys, and create one with the trade scope. The secret is shown once. Keep it in an environment variable:

export ORDERFILL_API_KEY=of_live_3f8a2b19_kZ...

2. Install the SDK

bun add @orderfill/sdk     # or: npm install @orderfill/sdk

Prefer raw HTTP? Every step below has a curl equivalent in Endpoints.

3. Connect your account

You need your login, password and server name, exactly as MetaTrader shows it: Exness-MT5Trial9, not Exness MT5 Trial 9.

import { OrderFill } from "@orderfill/sdk";

const client = new OrderFill({ token: process.env.ORDERFILL_API_KEY! });

const { account, notice } = await client.connect({
  platform: "mt5",
  login: "477072059",
  password: process.env.MT5_PASSWORD!,
  server: "Exness-MT5Trial9",
});

if (notice !== null) console.warn(notice); // accepted, but cannot connect yet

4. Place an order

const result = await client.account(account.id).placeOrder({
  symbol: "XAUUSD",
  side: "buy",
  volume: 0.1,
});

console.log(result); // { ok: true, ticket: "4737871287", price: 2411.82, message: "…" }

The first request takes 20–40 seconds. We are starting your terminal and logging it into your broker. After that, an order takes about as long as your broker does, typically around 600 ms. Set client timeouts above 60 seconds.

What can go wrong

You seeIt means
bad_request: "… is not available on this account"The symbol is not on this account. symbols() lists what is.
forbidden: "This API key is read-only"Create a key with the trade scope.
upstream_failed on first connectUsually a wrong password or a mistyped server name.
plan_limitYou have connected as many accounts as your plan allows.

On this page