Markets500

Developers

Connect any platform to Markets500.

A trading API for platforms like trademyra.ai, and a Manager API for your back office. Plain JSON over HTTPS, with the same prices and rules as our WebTrader.

javascript · quick start
const BASE = "https://wary-lemming-853.convex.site/connect/v1";

async function call(path, { token, body } = {}) {
  const res = await fetch(BASE + path, {
    method: body ? "POST" : "GET",
    headers: {
      "Content-Type": "application/json",
      ...(token && { Authorization: "Bearer " + token }),
    },
    body: body && JSON.stringify(body),
  });
  const json = await res.json();
  if (!json.ok) throw new Error(json.error.code + ": " + json.error.message);
  return json.data;
}

// 1. Log in with the account number and trading password
const { token } = await call("/login", {
  body: { login: 8000123, password: "Trade2026x", client: "trademyra.ai" },
});

// 2. Buy 0.5 lots of EURUSD with a stop loss and take profit
const order = await call("/orders", {
  token,
  body: { symbol: "EURUSD", side: "buy", volume: 0.5, sl: 1.079, tp: 1.092 },
});
console.log("Opened ticket", order.ticket, "at", order.price);

Overview

Two APIs, one trading engine

Client API

For trading platforms and apps. A trader logs in with their account number and trading password, then sees prices and places, edits and closes trades.

Manager API

For CRMs, payment systems and partners. A Manager key reads every client and trade, opens accounts, and records deposits and withdrawals.

Same engine as the WebTrader

Every order uses live server prices, margin checks, risk limits and execution rules. The API can never do more than the terminal.

Getting started

How a platform connects an account

  1. 01

    Client sets a password

    In Accounts → API access, the client sets a trading password for a demo or Real account.

  2. 02

    Your platform logs in

    POST /login with the account number and password. You get a session token for 24 hours.

  3. 03

    Send the token

    Add 'Authorization: Bearer <token>' to every request.

  4. 04

    Trade

    Read quotes and positions, place orders, and close trades. Log in again when the session ends.

Basics

Responses and errors

Every response is JSON with the same envelope. Check ok first, then read data or error.

success
{
  "ok": true,
  "data": {
    "balance": 1250,
    "equity": 1292.15
  }
}
error
{
  "ok": false,
  "error": {
    "code": "BAD_REQUEST",
    "message": "volume: Too small: expected number to be >0"
  }
}
BAD_REQUEST400A field is missing or invalid. The message names it.
UNAUTHENTICATED401No token or key, wrong password, or the session expired.
FORBIDDEN403The key lacks the permission, or the account is a prop challenge account.
NOT_FOUND404The client, account, ticket or payment doesn't exist.
CONFLICT409An externalRef was reused for a different payment.
LOCKED429Too many wrong passwords. Try again in 15 minutes.
INTERNAL500Something went wrong on our side. Retry later.

Demo and Real

Both account kinds work. Prop challenge accounts can't be traded through the API.

Login lockout

Five wrong passwords lock logins on that account for 15 minutes.

Keys shown once

Manager keys are created by an admin, shown once, and can be revoked at any time.

Client API

Trade a client's account

Log in with an account number and trading password, then send the session token as a Bearer header. Prices and profit are in the account currency.

Base URL: https://wary-lemming-853.convex.site/connect/v1

Session

POST/loginNo token needed

Log in

Sign in with the account number and trading password the client set in Accounts → API access. Returns a session token valid for 24 hours. Five wrong passwords lock logins on that account for 15 minutes.

JSON body

loginrequirednumber

Account number, e.g. 8000123 (Real) or 5000123 (demo).

passwordrequiredstring

The account's trading password.

clientstring

Your platform's name. The client sees it in their list of connected platforms.

request
curl -X POST "https://wary-lemming-853.convex.site/connect/v1/login" \
  -H "Content-Type: application/json" \
  -d '{"login":8000123,"password":"Trade2026x","client":"trademyra.ai"}'
response · data
{
  "token": "m500_3f9c…",
  "tokenType": "Bearer",
  "expiresAt": "2026-11-27T09:00:00.000Z",
  "login": 8000123,
  "type": "real"
}
POST/logout

Log out

Ends the current session. The token stops working at once.

request
curl -X POST "https://wary-lemming-853.convex.site/connect/v1/logout" \
  -H "Authorization: Bearer <session token>"
response · data
{
  "signedOut": true
}

Account and market data

GET/account

Account summary

Balance, equity and margin at live prices. pricesIncomplete is true when a market had no live price, so equity leaves it out.

request
curl "https://wary-lemming-853.convex.site/connect/v1/account" \
  -H "Authorization: Bearer <session token>"
response · data
{
  "login": 8000123,
  "type": "real",
  "accountType": "standard",
  "currency": "USD",
  "balance": 1250,
  "equity": 1292.15,
  "floatingProfit": 42.15,
  "margin": 10.84,
  "freeMargin": 1281.31,
  "marginLevel": 11920.2,
  "leverageCap": null,
  "openPositions": 1,
  "pendingOrders": 1,
  "pricesIncomplete": false
}
GET/symbols

Symbols

Every tradable market with its price digits, the most leverage this account may use, and whether the market is open now.

request
curl "https://wary-lemming-853.convex.site/connect/v1/symbols" \
  -H "Authorization: Bearer <session token>"
response · data
[
  {
    "symbol": "EURUSD",
    "name": "Euro / US Dollar",
    "category": "forex",
    "digits": 5,
    "maxLeverage": 1000,
    "open": true
  }
]
GET/quotes

Quotes

Live bid and ask for up to 50 symbols. These are the exact prices this account fills at.

Query parameters

symbolsrequiredstring

Comma separated, e.g. EURUSD,XAUUSD.

request
curl "https://wary-lemming-853.convex.site/connect/v1/quotes?symbols=…" \
  -H "Authorization: Bearer <session token>"
response · data
[
  {
    "symbol": "EURUSD",
    "bid": 1.08455,
    "ask": 1.08462,
    "tradable": true,
    "time": "2026-11-26T10:15:00.000Z"
  }
]

Trades

GET/positions

Open positions

Every open position with live profit in the account currency.

request
curl "https://wary-lemming-853.convex.site/connect/v1/positions" \
  -H "Authorization: Bearer <session token>"
response · data
[
  {
    "ticket": 100234,
    "symbol": "EURUSD",
    "side": "buy",
    "volume": 0.5,
    "leverage": 500,
    "openPrice": 1.08412,
    "sl": 1.079,
    "tp": 1.092,
    "trailingDistance": null,
    "profit": 42.15,
    "openedAt": "2026-11-26T09:12:44.120Z"
  }
]
GET/orders

Pending orders

Limit, stop and stop-limit orders waiting to trigger.

request
curl "https://wary-lemming-853.convex.site/connect/v1/orders" \
  -H "Authorization: Bearer <session token>"
response · data
[
  {
    "ticket": 100240,
    "symbol": "XAUUSD",
    "side": "sell",
    "type": "limit",
    "volume": 0.1,
    "leverage": 200,
    "price": 2685.5,
    "limitPrice": null,
    "sl": 2700,
    "tp": 2650,
    "placedAt": "2026-11-26T10:01:02.000Z",
    "expiresAt": null
  }
]
GET/history

Trade history

Closed trades, newest first.

Query parameters

limitnumber

Items per page. Default 50, max 200.

cursorstring

nextCursor from the previous page.

fromISO date

Only trades closed at or after this time.

toISO date

Only trades closed before this time.

request
curl "https://wary-lemming-853.convex.site/connect/v1/history" \
  -H "Authorization: Bearer <session token>"
response · data
{
  "trades": [
    {
      "ticket": 100198,
      "symbol": "BTCUSD",
      "side": "buy",
      "volume": 0.05,
      "openPrice": 96120.5,
      "closePrice": 97010.2,
      "sl": null,
      "tp": 97000,
      "profit": 44.49,
      "commission": 0.35,
      "swap": 0,
      "netProfit": 44.14,
      "openedAt": "2026-11-25T14:20:00.000Z",
      "closedAt": "2026-11-25T18:02:11.000Z",
      "closeReason": "tp"
    }
  ],
  "nextCursor": null
}
POST/orders

Place an order

Market orders fill at once at the live price. Pending orders return pending: true and trigger later. Margin, risk checks and execution delays are the same as in the WebTrader.

JSON body

symbolrequiredstring

Market symbol, e.g. EURUSD.

siderequired"buy" | "sell"

Direction.

typestring

"market" (default), "limit", "stop" or "stop_limit".

volumerequirednumber

Lots, e.g. 0.1.

leveragenumber

Defaults to the most this account may use on the market.

pricenumber

Trigger price. Required for pending orders.

limitPricenumber

Limit price for stop_limit orders.

slnumber

Stop loss price.

tpnumber

Take profit price.

expiresAtISO date

When a pending order should expire.

request
curl -X POST "https://wary-lemming-853.convex.site/connect/v1/orders" \
  -H "Authorization: Bearer <session token>" \
  -H "Content-Type: application/json" \
  -d '{"symbol":"EURUSD","side":"buy","type":"market","volume":0.5,"sl":1.079,"tp":1.092}'
response · data
{
  "ticket": 100234,
  "price": 1.08412,
  "pending": false,
  "delayedMs": 0,
  "delayReason": null
}
POST/orders/cancel

Cancel a pending order

Removes a pending order before it triggers.

JSON body

ticketrequirednumber

Order ticket.

request
curl -X POST "https://wary-lemming-853.convex.site/connect/v1/orders/cancel" \
  -H "Authorization: Bearer <session token>" \
  -H "Content-Type: application/json" \
  -d '{"ticket":100240}'
response · data
{
  "ticket": 100240,
  "cancelled": true
}
POST/positions/modify

Change stop loss or take profit

Sets new levels on an open position. Send 0 (or leave out) to remove a level.

JSON body

ticketrequirednumber

Position ticket.

slnumber

New stop loss, or 0 for none.

tpnumber

New take profit, or 0 for none.

request
curl -X POST "https://wary-lemming-853.convex.site/connect/v1/positions/modify" \
  -H "Authorization: Bearer <session token>" \
  -H "Content-Type: application/json" \
  -d '{"ticket":100234,"sl":1.081,"tp":0}'
response · data
{
  "ticket": 100234,
  "sl": 1.081,
  "tp": null
}
POST/positions/close

Close a position

Closes the whole position at the live price.

JSON body

ticketrequirednumber

Position ticket.

request
curl -X POST "https://wary-lemming-853.convex.site/connect/v1/positions/close" \
  -H "Authorization: Bearer <session token>" \
  -H "Content-Type: application/json" \
  -d '{"ticket":100234}'
response · data
{
  "ticket": 100234,
  "profit": 42.15,
  "balance": 1292.15,
  "delayedMs": 0
}
POST/positions/partial-close

Close part of a position

Closes some of the lots and keeps the rest open.

JSON body

ticketrequirednumber

Position ticket.

volumerequirednumber

Lots to close.

request
curl -X POST "https://wary-lemming-853.convex.site/connect/v1/positions/partial-close" \
  -H "Authorization: Bearer <session token>" \
  -H "Content-Type: application/json" \
  -d '{"ticket":100234,"volume":0.2}'
response · data
{
  "ticket": 100234,
  "profit": 16.86,
  "balance": 1266.86,
  "remainingVolume": 0.3,
  "delayedMs": 0
}
POST/positions/close-all

Close all positions

Closes every open position. Markets that are closed right now are skipped.

request
curl -X POST "https://wary-lemming-853.convex.site/connect/v1/positions/close-all" \
  -H "Authorization: Bearer <session token>"
response · data
{
  "closed": 3,
  "skipped": 0,
  "balance": 1310.4
}

Manager API

Run your back office

Send your Manager key as a Bearer header. Each endpoint needs a permission: Read (every key), Accounts, or Money. Every write is logged under the key's name.

Base URL: https://wary-lemming-853.convex.site/manager/v1

Clients and accounts

GET/mePermission: Read

Check your key

Returns the key's name and permissions. Use it to test a new key.

request
curl "https://wary-lemming-853.convex.site/manager/v1/me" \
  -H "Authorization: Bearer m500mgr_…"
response · data
{
  "name": "trademyra.ai CRM",
  "scopes": [
    "read",
    "clients"
  ]
}
GET/clientsPermission: Read

List clients

All clients, newest first, or matching an email search.

Query parameters

searchstring

Part of an email address.

limitnumber

Items per page. Default 50, max 200.

cursorstring

nextCursor from the previous page.

request
curl "https://wary-lemming-853.convex.site/manager/v1/clients" \
  -H "Authorization: Bearer m500mgr_…"
response · data
{
  "clients": [
    {
      "clientId": "k17a…",
      "name": "Sara Khan",
      "email": "sara@example.com",
      "country": "AE",
      "kycStatus": "approved",
      "walletBalance": 150,
      "joinedAt": "2026-10-02T08:00:00.000Z"
    }
  ],
  "nextCursor": "eyJ…"
}
GET/clients/detailPermission: Read

Client detail

One client with their wallet and every trading account. Pass one of clientId, email or login.

Query parameters

clientIdstring

Client id from /clients.

emailstring

Client's sign-up email.

loginnumber

Any of the client's account numbers.

request
curl "https://wary-lemming-853.convex.site/manager/v1/clients/detail" \
  -H "Authorization: Bearer m500mgr_…"
response · data
{
  "clientId": "k17a…",
  "name": "Sara Khan",
  "email": "sara@example.com",
  "country": "AE",
  "phone": "+971…",
  "kycStatus": "approved",
  "joinedAt": "2026-10-02T08:00:00.000Z",
  "wallet": {
    "number": "W-104233",
    "currency": "USD",
    "available": 150,
    "held": 0
  },
  "accounts": [
    {
      "login": 8000123,
      "type": "real",
      "accountType": "standard",
      "currency": "USD",
      "balance": 1250,
      "funded": true,
      "apiPasswordSet": true
    }
  ]
}
GET/accounts/detailPermission: Read

Account detail

Balance, equity, margin, open positions and pending orders for one account.

Query parameters

loginrequirednumber

Account number.

request
curl "https://wary-lemming-853.convex.site/manager/v1/accounts/detail?login=…" \
  -H "Authorization: Bearer m500mgr_…"
response · data
{
  "login": 8000123,
  "type": "real",
  "accountType": "standard",
  "currency": "USD",
  "balance": 1250,
  "equity": 1292.15,
  "floatingProfit": 42.15,
  "margin": 10.84,
  "freeMargin": 1281.31,
  "marginLevel": 11920.2,
  "pricesIncomplete": false,
  "clientId": "k17a…",
  "email": "sara@example.com",
  "leverageCap": null,
  "positions": [
    {
      "ticket": 100234,
      "symbol": "EURUSD",
      "side": "buy",
      "volume": 0.5,
      "leverage": 500,
      "openPrice": 1.08412,
      "sl": 1.079,
      "tp": 1.092,
      "trailingDistance": null,
      "profit": 42.15,
      "openedAt": "2026-11-26T09:12:44.120Z"
    }
  ],
  "pendingOrders": [
    {
      "ticket": 100240,
      "symbol": "XAUUSD",
      "side": "sell",
      "type": "limit",
      "volume": 0.1,
      "leverage": 200,
      "price": 2685.5,
      "limitPrice": null,
      "sl": 2700,
      "tp": 2650,
      "placedAt": "2026-11-26T10:01:02.000Z",
      "expiresAt": null
    }
  ]
}
GET/accounts/historyPermission: Read

Account trade history

Closed trades for one account, newest first.

Query parameters

loginrequirednumber

Account number.

limitnumber

Items per page. Default 50, max 200.

cursorstring

nextCursor from the previous page.

fromISO date

Closed at or after.

toISO date

Closed before.

request
curl "https://wary-lemming-853.convex.site/manager/v1/accounts/history?login=…" \
  -H "Authorization: Bearer m500mgr_…"
response · data
{
  "trades": [
    {
      "ticket": 100198,
      "symbol": "BTCUSD",
      "side": "buy",
      "volume": 0.05,
      "openPrice": 96120.5,
      "closePrice": 97010.2,
      "sl": null,
      "tp": 97000,
      "profit": 44.49,
      "commission": 0.35,
      "swap": 0,
      "netProfit": 44.14,
      "openedAt": "2026-11-25T14:20:00.000Z",
      "closedAt": "2026-11-25T18:02:11.000Z",
      "closeReason": "tp"
    }
  ],
  "nextCursor": null
}
GET/positionsPermission: Read

All open positions

Every open position on the platform, with the account it belongs to.

Query parameters

limitnumber

Default 100, max 500.

cursorstring

nextCursor from the previous page.

request
curl "https://wary-lemming-853.convex.site/manager/v1/positions" \
  -H "Authorization: Bearer m500mgr_…"
response · data
{
  "positions": [
    {
      "login": 8000123,
      "type": "real",
      "ticket": 100234,
      "symbol": "EURUSD",
      "side": "buy",
      "volume": 0.5,
      "leverage": 500,
      "openPrice": 1.08412,
      "sl": 1.079,
      "tp": 1.092,
      "trailingDistance": null,
      "profit": 42.15,
      "openedAt": "2026-11-26T09:12:44.120Z"
    }
  ],
  "nextCursor": null
}
POST/accountsPermission: Accounts

Open an account

Opens a demo or Real account for an existing client. If they already have one, it is returned with created: false. Optionally sets the trading password in the same call.

JSON body

clientIdstring

Client id from /clients.

emailstring

Client's sign-up email.

loginnumber

Any of the client's account numbers.

typerequired"demo" | "real"

Account kind.

passwordstring

Trading password: 8 to 64 characters with a letter and a number.

request
curl -X POST "https://wary-lemming-853.convex.site/manager/v1/accounts" \
  -H "Authorization: Bearer m500mgr_…" \
  -H "Content-Type: application/json" \
  -d '{"email":"sara@example.com","type":"real","password":"Trade2026x"}'
response · data
{
  "login": 8000123,
  "type": "real",
  "created": true,
  "apiPasswordSet": true
}
POST/accounts/passwordPermission: Accounts

Set a trading password

Sets or replaces the password used to log in with the Client API. Existing sessions on that account are signed out.

JSON body

loginrequirednumber

Account number.

passwordrequiredstring

8 to 64 characters with a letter and a number.

request
curl -X POST "https://wary-lemming-853.convex.site/manager/v1/accounts/password" \
  -H "Authorization: Bearer m500mgr_…" \
  -H "Content-Type: application/json" \
  -d '{"login":8000123,"password":"NewPass2026"}'
response · data
{
  "login": 8000123
}

Payments

GET/paymentsPermission: Read

List payments

Deposit or withdrawal requests by status. Pending requests come oldest first.

Query parameters

typestring

"deposit" (default) or "withdrawal".

statusstring

"pending" (default), "completed", "rejected" or "cancelled".

limitnumber

Items per page. Default 50, max 200.

cursorstring

nextCursor from the previous page.

request
curl "https://wary-lemming-853.convex.site/manager/v1/payments" \
  -H "Authorization: Bearer m500mgr_…"
response · data
{
  "payments": [
    {
      "reference": "DP-7Q2K9",
      "clientId": "k17a…",
      "type": "deposit",
      "method": "bank",
      "status": "pending",
      "amount": 500,
      "currency": "USD",
      "accountLogin": null,
      "externalRef": null,
      "note": null,
      "createdAt": "2026-11-26T07:40:00.000Z",
      "updatedAt": "2026-11-26T07:40:00.000Z"
    }
  ],
  "nextCursor": null
}
POST/depositsPermission: Money

Add a deposit

Credits money you already received outside Markets500. It goes to the wallet, or straight into the Real account with toAccount: true (or a Real login). The client is notified.

JSON body

clientIdstring

Client id from /clients.

emailstring

Client's sign-up email.

loginnumber

Any of the client's account numbers.

amountrequirednumber

USD, at most 2 decimals.

commentstring

Shown in the back office.

externalRefstring

Your own payment id. Sending the same id again returns the first result instead of paying twice.

toAccountboolean

Move the money into the client's Real account. Default false.

request
curl -X POST "https://wary-lemming-853.convex.site/manager/v1/deposits" \
  -H "Authorization: Bearer m500mgr_…" \
  -H "Content-Type: application/json" \
  -d '{"email":"sara@example.com","amount":500,"toAccount":true,"externalRef":"TMY-PAY-88121"}'
response · data
{
  "reference": "DP-8H3LM",
  "duplicate": false,
  "accountLogin": 8000123,
  "wallet": {
    "number": "W-104233",
    "currency": "USD",
    "available": 150,
    "held": 0
  }
}
POST/withdrawalsPermission: Money

Take a withdrawal

Takes money you paid out outside Markets500 from the client's wallet. Money in a trading account must be moved to the wallet first, so open trades keep their margin.

JSON body

clientIdstring

Client id from /clients.

emailstring

Client's sign-up email.

loginnumber

Any of the client's account numbers.

amountrequirednumber

USD, at most 2 decimals.

commentstring

Shown in the back office.

externalRefstring

Your own payment id. Sending the same id again returns the first result instead of paying twice.

request
curl -X POST "https://wary-lemming-853.convex.site/manager/v1/withdrawals" \
  -H "Authorization: Bearer m500mgr_…" \
  -H "Content-Type: application/json" \
  -d '{"login":8000123,"amount":100,"externalRef":"TMY-OUT-3021"}'
response · data
{
  "reference": "WD-2N7TX",
  "duplicate": false,
  "wallet": {
    "number": "W-104233",
    "currency": "USD",
    "available": 50,
    "held": 0
  }
}
POST/payments/decidePermission: Money

Approve or reject a request

Decides a pending deposit or withdrawal, exactly like the back office. Crypto payouts return status processing until the network confirms them.

JSON body

referencerequiredstring

Payment reference from /payments.

decisionrequired"approve" | "reject"

What to do.

notestring

Reason, shown to the client on rejection.

request
curl -X POST "https://wary-lemming-853.convex.site/manager/v1/payments/decide" \
  -H "Authorization: Bearer m500mgr_…" \
  -H "Content-Type: application/json" \
  -d '{"reference":"DP-7Q2K9","decision":"approve"}'
response · data
{
  "reference": "DP-7Q2K9",
  "status": "completed"
}

Questions

Developer FAQ