Broker API HubMenu

OANDA API GET /v3/accounts/{accountID}

GET/v3/accounts/{accountID}version v3Accounts

Full account state: balance, NAV, margin, plus open trades, positions and pending orders.

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.

Independent and unofficialdeveloper.oanda.comchecked

Confirmed on the official account endpoints page. Method, path and request parameters were re-read on that page on 12 Oct 2026 and agree with this record; the mock reply was not compared field by field. Heavy response; prefer /summary if you only need balances.

Parameters

NameInTypeDescription
Accept-Datetime-FormatheaderstringOptional. RFC3339 (default) or UNIX for epoch seconds in datetime fields.
accountIDrequiredpathstringAccount ID from GET /v3/accounts. Mock value shown.

Authentication headers

NameTypeDescription
AuthorizationrequiredstringSend Bearer followed by your personal access token. 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 OANDA_TOKEN, OANDA_ACCOUNT_ID as environment variables first. Never paste real values into code.
# Optional and not shown: headers Accept-Datetime-Format.
import os
import requests

BASE_URL = "https://api-fxpractice.oanda.com"  # the demo host
headers = {
    "Authorization": "Bearer " + os.environ["OANDA_TOKEN"],
}
resp = requests.get(BASE_URL + "/v3/accounts/" + os.environ["OANDA_ACCOUNT_ID"], headers=headers, timeout=10)
resp.raise_for_status()
print(resp.json())
JavaScript
// Set OANDA_TOKEN, OANDA_ACCOUNT_ID as environment variables first. Never paste real values into code.
// Optional and not shown: headers Accept-Datetime-Format.
// Run as a module, for example a .mjs file, on a Node version that has fetch built in.
const BASE_URL = "https://api-fxpractice.oanda.com"; // the demo host
const res = await fetch(BASE_URL + "/v3/accounts/" + process.env.OANDA_ACCOUNT_ID, {
  method: "GET",
  headers: {
    "Authorization": "Bearer " + process.env.OANDA_TOKEN,
  },
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());
curl
# Set OANDA_TOKEN, OANDA_ACCOUNT_ID as environment variables first. Never paste real values into code.
# Optional and not shown: headers Accept-Datetime-Format.
curl -X GET "https://api-fxpractice.oanda.com/v3/accounts/$OANDA_ACCOUNT_ID" \
  -H "Authorization: Bearer $OANDA_TOKEN"

Response

A mock response. The values are invented, so check field names against the official reference.

{
  "_mock": true,
  "account": {
    "id": "101-004-MOCK-001",
    "alias": "Mock practice account",
    "currency": "GBP",
    "balance": "10000.0000",
    "NAV": "10012.5000",
    "unrealizedPL": "12.5000",
    "pl": "0.0000",
    "marginUsed": "66.6700",
    "marginAvailable": "9945.8300",
    "marginRate": "0.0333",
    "openTradeCount": 1,
    "openPositionCount": 1,
    "pendingOrderCount": 1,
    "hedgingEnabled": false,
    "lastTransactionID": "9001",
    "trades": [
      {
        "id": "MOCK-T-001",
        "instrument": "EUR_USD",
        "price": "1.10000",
        "openTime": "2026-09-18T08:00:00.000000000Z",
        "state": "OPEN",
        "initialUnits": "1000",
        "currentUnits": "1000",
        "realizedPL": "0.0000",
        "unrealizedPL": "1.2500",
        "marginUsed": "33.3300"
      }
    ],
    "positions": [],
    "orders": []
  },
  "lastTransactionID": "9001"
}

Response schema, HTTP 200

Every field this site's OpenAPI file for OANDA declares for this response.

FieldTypeDescription
accountobjectNot recorded
idstringNot recorded
aliasstringNot recorded
currencystringNot recorded
balancestringNot recorded
NAVstringNot recorded
unrealizedPLstringNot recorded
plstringNot recorded
marginUsedstringNot recorded
marginAvailablestringNot recorded
marginRatestringNot recorded
openTradeCountnumberNot recorded
openPositionCountnumberNot recorded
pendingOrderCountnumberNot recorded
hedgingEnabledbooleanNot recorded
lastTransactionIDstringNot recorded
tradesarray of objectsNot recorded
idstringNot recorded
instrumentstringNot recorded
pricestringNot recorded
openTimestringNot recorded
statestringNot recorded
initialUnitsstringNot recorded
currentUnitsstringNot recorded
realizedPLstringNot recorded
unrealizedPLstringNot recorded
marginUsedstringNot recorded
positionsarray of valuesNot recorded
ordersarray of valuesNot recorded
lastTransactionIDstringNot recorded

Unverifiedno source opened This schema is not sourced to a page of the provider's own that we opened, so check field names against the official reference.

Limits that apply at OANDA

LimitValueScopeSource
Headline limit120/s per IP address, HTTP 429 above itipdeveloper.oanda.comchecked

OANDA API errors you may meet

All OANDA API error codes, including 236 more not listed here.