Every OpenFX account maintains a set of balance entries that reflect its current financial state. Use GET /accounts/{accountId}/balances to retrieve the latest balances for any account, whether fiat or crypto.Balances are read-only. They are updated automatically as transactions (payments, conversions, transfers, fees) affect the account.
Each balance entry has a type that indicates what portion of the funds it represents:
Type
Description
available
Funds that are immediately spendable. This is the amount you can use for payments, conversions, and transfers right now.
pending
Funds that are in transit. These are expected to settle and become available, but are not yet confirmed (e.g., pending ACH credits).
held
Funds that are reserved for a specific purpose. These are part of the total balance but are not available for spending (e.g., funds locked for a pending payment or compliance hold).
total
The sum of all funds in the account, regardless of availability. Equal to available + pending + held.
The available balance is the most important number for determining whether an account has sufficient funds to initiate a payment or conversion. Always check available rather than total before creating transactions.
All monetary amounts in the OpenFX API are represented as strings, never floating-point numbers. This prevents rounding errors inherent in IEEE 754 floating-point arithmetic, which is critical for financial calculations.Always parse amounts using a decimal/big-number library in your code, not native floating-point types.
Examples of correct handling:
Copy
from decimal import Decimal# Correct: use Decimal for financial mathavailable = Decimal(balance["amount"]) # Decimal("10000.00")fee = Decimal("25.50")remaining = available - fee # Decimal("9974.50")# Incorrect: never use float# available = float(balance["amount"]) # 10000.0 — precision loss risk
A fiat account holds balances in its designated currency. If you need to hold multiple currencies, create separate accounts for each currency and query their balances independently.
Copy
# Query balances across multiple accountsaccounts = ["acc_usd_001", "acc_gbp_001", "acc_eur_001"]for account_id in accounts: response = requests.get( f"https://sandbox.api.openfx.com/v1/accounts/{account_id}/balances", headers=headers, ) balances = response.json()["items"] available = next(b for b in balances if b["type"] == "available") print(f"{account_id}: {available['amount']} {available['currency']}")
The balances endpoint returns a point-in-time snapshot. For a detailed history of all balance-affecting events, use the transaction ledger at GET /transactions. Filter by accountId to see every debit and credit that has occurred on an account.Transactions include direction (debit/credit), type (payment_out, payment_in, conversion_debit, etc.), and linkedTransactionId to pair the debit and credit legs of the same operation.