Skip to content
Back to App

Accounts

Every trading session in TestMax operates within an account. Accounts hold your balance, track your P&L, and are referenced by every order, position, and trade endpoint. Before you can place orders or start a replay session, you need to retrieve your account ID.

POST Account/search

Search for trading accounts associated with the authenticated user.

URL: POST /api/topstep-sim/Account/search

Authentication: Bearer token required.

Request body

{
"onlyActiveAccounts": true
}
FieldTypeRequiredDefaultDescription
onlyActiveAccountsbooleanNofalseWhen true, returns only active accounts. When false, returns all accounts including inactive/closed ones.

Response

{
"success": true,
"errorCode": 0,
"errorMessage": null,
"accounts": [
{
"id": 12345,
"name": "TestMax Sim Account",
"balance": 50000.00,
"canTrade": true
}
]
}
FieldTypeDescription
accountsarrayList of account objects
accounts[].idnumberUnique account identifier. Use this as accountId in all other endpoints.
accounts[].namestringHuman-readable account name
accounts[].balancenumberCurrent account balance in USD
accounts[].canTradebooleanWhether the account is eligible for trading

Example

# Get all active accounts
result = api("Account/search", {"onlyActiveAccounts": True})
if result["success"]:
accounts = result.get("accounts", [])
for acct in accounts:
print(f"Account {acct['id']}: {acct['name']} — ${acct['balance']:,.2f}")
# Use the first active account
if accounts:
ACCOUNT_ID = accounts[0]["id"]
print(f"Using account: {ACCOUNT_ID}")
else:
print(f"Error: {result['errorMessage']}")

Usage notes

  • Most users have a single active account. Use the first account from the response.
  • The id field is what you pass as accountId to every other endpoint (orders, positions, trades, replay).
  • Account balances update in real time during a replay session as orders are filled and P&L is realized.
  • In the Algo Playground, the account is set up automatically and stored in the ACCOUNT_ID global variable.