# TradeLocker API POST /trade/accounts/{accountId}/orders

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/platforms/tradelocker/endpoints/post-account-orders, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Place a market, limit or stop order on the account, with an optional stop loss and take profit. The reply carries the new orderId.

- Request: `POST /trade/accounts/{accountId}/orders`
- Group: Trading
- Status: verified. Source: [public-api.tradelocker.com](https://public-api.tradelocker.com/reference/placeorder), checked 2026-10-12.
- Official reference: https://public-api.tradelocker.com/reference/placeorder

Note: Read on 12 Oct 2026 on TradeLocker's own reference page for this call, in the Markdown version the documentation site serves at the same address with .md on the end. That page carries the call's OpenAPI definition, headed Trading API version 2.11.0: the method, path, parameters and required marks here are that definition's. The reference names the optional header developer-api-key, while TradeLocker's getting started page calls the Developer Program key tl-developer-api-key and says it unlocks less restrictive rate limits. This record keeps the name on the reference page. An accepted order is not a fill: TradeLocker's page on order and position identifiers says a position with its own positionId exists only once the order fills. The mock reply uses the field names of the definition with invented values.

## Parameters

- `accountId` (in path, type integer, required): The account's identifier, the id that GET /auth/jwt/all-accounts returns for it.
- `accNum` (in header, type integer, required): The account number that selects which of the login's accounts the call acts on. It is the accNum from GET /auth/jwt/all-accounts, not the accountId.
- `qty` (in body, type number, required): Order size, as the number of units to buy or sell.
- `routeId` (in body, type number, required): The route identifier of the instrument. TradeLocker's getting started page says to use the TRADE route when placing orders.
- `side` (in body, type string, required): One of: buy, sell. An order that closes a position takes the side opposite to the position.
- `tradableInstrumentId` (in body, type integer, required): The identifier of the instrument, as tradableInstrumentId in the list of instruments.
- `type` (in body, type string, required): One of: limit, market, stop. A limit order needs price and a stop order needs stopPrice.
- `validity` (in body, type string, required): One of: GTC, IOC. The page says IOC for a market order and GTC for a limit or stop order.
- `price` (in body, type number, optional): The limit price of a limit order. The page says it can be 0 for a market order.
- `stopPrice` (in body, type number, optional): The stop price. Needed when type is stop.
- `stopLoss` (in body, type number, optional): The stop loss, read according to stopLossType.
- `stopLossType` (in body, type string, optional): One of: absolute, offset, trailingOffset.
- `takeProfit` (in body, type number, optional): The take profit, an absolute price or an offset in pips according to takeProfitType. Sent together with takeProfitType.
- `takeProfitType` (in body, type string, optional): One of: absolute, offset. Sent together with takeProfit.
- `trStopOffset` (in body, type number, optional): The trailing offset in pips, for the trailingOffset stop loss type.
- `strategyId` (in body, type string, optional): A label of up to 31 characters attached to the order, shown again in the lists of orders and positions.

### Authentication headers

- `Authorization` (type string, required): Send Bearer followed by the accessToken from POST /auth/jwt/token. The reference marks the call as secured by a bearer JWT. Placeholder only: never paste a real token into this site.
- `developer-api-key` (type string, optional): A key issued through the TradeLocker Developer Program. Optional.

## Request

Written from the method, path and parameters recorded on this page, against the demo host. Not executed against a live or demo account. Credentials are read from environment variables on your own machine and are never entered on this site. The request builder at https://openbrokerapi.com/tools/request-builder writes these same snippets, from the same record.

This call takes a request body. The samples send it as JSON with a placeholder for each of the 6 body fields the record marks as required. Each placeholder has to be replaced with a real value before the request can succeed.

### Python

```python
# Set TRADELOCKER_ACCESS_TOKEN, TRADELOCKER_ACC_NUM as environment variables first. Never paste real values into code.
# TRADELOCKER_ACCESS_TOKEN holds the Authorization header that POST /auth/jwt/token returns.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Optional and not shown: headers developer-api-key; body fields price, stopPrice, stopLoss, stopLossType, takeProfit, takeProfitType, trStopOffset, strategyId.
import os
import requests

BASE_URL = "https://demo.tradelocker.com/backend-api"  # the demo host
headers = {
    "Authorization": "Bearer " + os.environ["TRADELOCKER_ACCESS_TOKEN"],
    "accNum": os.environ["TRADELOCKER_ACC_NUM"],
}
body = {"qty": 0, "routeId": 0, "side": "...", "tradableInstrumentId": 0, "type": "...", "validity": "..."}
resp = requests.post(BASE_URL + "/trade/accounts/{accountId}/orders", headers=headers, json=body, timeout=10)
resp.raise_for_status()
print(resp.json())
```

### JavaScript

```javascript
// Set TRADELOCKER_ACCESS_TOKEN, TRADELOCKER_ACC_NUM as environment variables first. Never paste real values into code.
// TRADELOCKER_ACCESS_TOKEN holds the Authorization header that POST /auth/jwt/token returns.
// Replace each {placeholder}, "..." and 0 with a real value before running.
// Optional and not shown: headers developer-api-key; body fields price, stopPrice, stopLoss, stopLossType, takeProfit, takeProfitType, trStopOffset, strategyId.
// Run as a module, for example a .mjs file, on a Node version that has fetch built in.
const BASE_URL = "https://demo.tradelocker.com/backend-api"; // the demo host
const res = await fetch(BASE_URL + "/trade/accounts/{accountId}/orders", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.TRADELOCKER_ACCESS_TOKEN,
    "accNum": process.env.TRADELOCKER_ACC_NUM,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"qty": 0, "routeId": 0, "side": "...", "tradableInstrumentId": 0, "type": "...", "validity": "..."}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());
```

### curl

```bash
# Set TRADELOCKER_ACCESS_TOKEN, TRADELOCKER_ACC_NUM as environment variables first. Never paste real values into code.
# TRADELOCKER_ACCESS_TOKEN holds the Authorization header that POST /auth/jwt/token returns.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Optional and not shown: headers developer-api-key; body fields price, stopPrice, stopLoss, stopLossType, takeProfit, takeProfitType, trStopOffset, strategyId.
curl -X POST "https://demo.tradelocker.com/backend-api/trade/accounts/{accountId}/orders" \
  -H "Authorization: Bearer $TRADELOCKER_ACCESS_TOKEN" \
  -H "accNum: $TRADELOCKER_ACC_NUM" \
  -H "Content-Type: application/json" \
  -d '{"qty": 0, "routeId": 0, "side": "...", "tradableInstrumentId": 0, "type": "...", "validity": "..."}'
```

## Response

A mock response. The values are invented, so check field names against the [official reference](https://public-api.tradelocker.com/reference/placeorder).

```json
{
  "_mock": true,
  "d": {
    "orderId": "1"
  },
  "s": "ok"
}
```

## More on the TradeLocker API

- [All TradeLocker API endpoints](https://openbrokerapi.com/platforms/tradelocker/endpoints): 23 documented, grouped by what they do.
- [All TradeLocker API error codes](https://openbrokerapi.com/errors/tradelocker)
- [TradeLocker API page](https://openbrokerapi.com/platforms/tradelocker): The full record: access, authentication, limits and the source for each.
- [TradeLocker API as an OpenAPI file](https://openbrokerapi.com/specs/tradelocker.json): Generated from these endpoint records. Independent and unofficial.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: TradeLocker API POST /trade/accounts/{accountId}/orders. Broker API Hub, https://openbrokerapi.com/platforms/tradelocker/endpoints/post-account-orders, newest check 2026-10-12.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
