TradeLocker API GET /auth/jwt/all-accounts
List every account under the login, each with its id and the accNum that the /trade calls need as a header.
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.
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. This call takes no accNum header: it is the call that returns it. The balance field is spelled aaccountBalance in the definition, with a doubled a, and the mock reply keeps that spelling. Its values are invented.
Parameters
No parameters recorded beyond authentication.
Authentication headers
| Name | Type | Description |
|---|---|---|
| Authorizationrequired | string | 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. |
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 writes these same snippets, from the same record.
Python
# Set TRADELOCKER_ACCESS_TOKEN as an environment variable first. Never paste real values into code.
# TRADELOCKER_ACCESS_TOKEN holds the Authorization header that POST /auth/jwt/token returns.
import os
import requests
BASE_URL = "https://demo.tradelocker.com/backend-api" # the demo host
headers = {
"Authorization": "Bearer " + os.environ["TRADELOCKER_ACCESS_TOKEN"],
}
resp = requests.get(BASE_URL + "/auth/jwt/all-accounts", headers=headers, timeout=10)
resp.raise_for_status()
print(resp.json())JavaScript
// Set TRADELOCKER_ACCESS_TOKEN as an environment variable first. Never paste real values into code.
// TRADELOCKER_ACCESS_TOKEN holds the Authorization header that POST /auth/jwt/token returns.
// 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 + "/auth/jwt/all-accounts", {
method: "GET",
headers: {
"Authorization": "Bearer " + process.env.TRADELOCKER_ACCESS_TOKEN,
},
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());curl
# Set TRADELOCKER_ACCESS_TOKEN as an environment variable first. Never paste real values into code. # TRADELOCKER_ACCESS_TOKEN holds the Authorization header that POST /auth/jwt/token returns. curl -X GET "https://demo.tradelocker.com/backend-api/auth/jwt/all-accounts" \ -H "Authorization: Bearer $TRADELOCKER_ACCESS_TOKEN"
Response
A mock response. The values are invented, so check field names against the official reference.
{
"_mock": true,
"accounts": [
{
"id": "0000",
"name": "MOCK#ACCOUNT#1",
"currency": "USD",
"status": "ACTIVE",
"accNum": "1",
"aaccountBalance": 10000
}
]
}TradeLocker API errors you may meet
- 400 Bad RequestHTTP 400. TradeLocker lists 400 with the description "Bad Request" as a response of its authentication routes: POST /auth/jwt/token, which fetches the JWT tokens, POST /auth/jwt/refresh and GET /auth/jwt/all-accounts.
- 401 UnauthorizedHTTP 401. TradeLocker lists 401 with the description "Unauthorized" as a response of its /trade routes, including placing, modifying and cancelling orders.
- 403 ForbiddenHTTP 403. TradeLocker lists 403 with the description "Forbidden" as a response of its /trade routes, including placing, modifying and cancelling orders.
- 404 Not FoundHTTP 404. TradeLocker lists 404 with the description "Not Found" as a response of many /trade routes, including placing an order, closing all positions and the account, instrument, configuration and history routes.
- no_dataA status in the response of GET /trade/history, not an HTTP error.