List accounts
Retrieve a paginated list of your trading accounts (both prop firm and retail broker accounts).
Endpoint: GET /api/v1/accounts
Query parameters
Example requests
cURL - All accounts:
curl "https://app.mypropjournal.com/api/v1/accounts" \
-H "Authorization: Bearer mpj_your_api_key_here" \
-H "Content-Type: application/json"
cURL - Prop accounts only:
curl "https://app.mypropjournal.com/api/v1/accounts?type=prop" \
-H "Authorization: Bearer mpj_your_api_key_here" \
-H "Content-Type: application/json"
JavaScript:
async function getAccounts(type = null) {
const url = new URL('https://app.mypropjournal.com/api/v1/accounts');
if (type) url.searchParams.append('type', type);
const response = await fetch(url, {
headers: {
'Authorization': 'Bearer mpj_your_api_key_here',
'Content-Type': 'application/json'
}
});
return response.json();
}
// Get all accounts
const allAccounts = await getAccounts();
// Get only prop accounts
const propAccounts = await getAccounts('prop');
console.log(`Total prop accounts: ${propAccounts.pagination.total}`);
Python:
import requests
def get_accounts(account_type=None, page=1, limit=50):
url = 'https://app.mypropjournal.com/api/v1/accounts'
headers = {
'Authorization': 'Bearer mpj_your_api_key_here',
'Content-Type': 'application/json'
}
params = {'page': page, 'limit': limit}
if account_type:
params['type'] = account_type
response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
return response.json()
# Get retail broker accounts
retail_accounts = get_accounts(account_type='retail')
for account in retail_accounts['data']:
print(f"{account['broker_name']}: ${account['current_value']:.2f}")
Example response
{
"data": [
{
"id": "f1588e0d-93fd-4a76-b876-b0753f93bc09",
"type": "prop",
"firm_name": "TopStep",
"account_number": "TS123456",
"balance": 150000.0,
"status": "funded",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-03-15T10:30:00Z"
},
{
"id": "a8b9c0d1-e2f3-4567-8901-234567890abc",
"type": "retail",
"broker_name": "Interactive Brokers",
"account_number": "IB987654",
"current_value": 25000.0,
"created_at": "2023-12-01T00:00:00Z",
"updated_at": "2024-03-15T10:30:00Z"
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 2,
"totalPages": 1,
"has_more": false
}
}
Response fields
Common fields (all account types):
Prop account specific fields:
Retail account specific fields:
Get a single account
Retrieve detailed information for a specific trading account.
Endpoint: GET /api/v1/accounts/{id}
Example request
cURL:
curl "https://app.mypropjournal.com/api/v1/accounts/f1588e0d-93fd-4a76-b876-b0753f93bc09" \
-H "Authorization: Bearer mpj_your_api_key_here" \
-H "Content-Type: application/json"
JavaScript:
async function getAccount(accountId) {
const response = await fetch(
`https://app.mypropjournal.com/api/v1/accounts/${accountId}`,
{
headers: {
'Authorization': 'Bearer mpj_your_api_key_here',
'Content-Type': 'application/json'
}
}
);
return response.json();
}
const account = await getAccount('f1588e0d-93fd-4a76-b876-b0753f93bc09');
console.log(`Account: ${account.data.firm_name} - ${account.data.status}`);
Python:
import requests
def get_account(account_id):
url = f'https://app.mypropjournal.com/api/v1/accounts/{account_id}'
headers = {
'Authorization': 'Bearer mpj_your_api_key_here',
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
account = get_account('f1588e0d-93fd-4a76-b876-b0753f93bc09')
print(f"Balance: ${account['data']['balance']:.2f}")
Example response
Returns a single account object with the same structure as shown in the list endpoint.
{
"data": {
"id": "f1588e0d-93fd-4a76-b876-b0753f93bc09",
"type": "prop",
"firm_name": "TopStep",
"account_number": "TS123456",
"balance": 150000.0,
"status": "funded",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-03-15T10:30:00Z"
}
}
Common use cases
Get total account value
async function getTotalAccountValue() {
const accounts = await getAccounts();
const total = accounts.data.reduce((sum, account) => {
const value = account.type === 'prop'
? account.balance
: account.current_value;
return sum + value;
}, 0);
return total;
}
const totalValue = await getTotalAccountValue();
console.log(`Total across all accounts: $${totalValue.toFixed(2)}`);
Group accounts by type
def group_accounts_by_type():
accounts = get_accounts()
grouped = {'prop': [], 'retail': []}
for account in accounts['data']:
grouped[account['type']].append(account)
return grouped
accounts_by_type = group_accounts_by_type()
print(f"Prop accounts: {len(accounts_by_type['prop'])}")
print(f"Retail accounts: {len(accounts_by_type['retail'])}")
Error responses
401 Unauthorized
Missing or invalid API key:
{
"error": "Invalid API key",
"code": "INVALID_API_KEY"
}
404 Not Found
Account doesn't exist or doesn't belong to you:
{
"error": "Account not found",
"code": "NOT_FOUND"
}