OANDA v20 REST API explorer
33 documented OANDA API endpoints, grouped by what they do. Each has its method, path, parameters and the source it was read from.
Independent and unofficialNewest check
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.
Accounts
- GET/v3/accountsList every account your token can access. Start here to find your accountID.
- GET/v3/accounts/{accountID}Full account state: balance, NAV, margin, plus open trades, positions and pending orders.
- GET/v3/accounts/{accountID}/changesPoll an account for its current state and for what has changed since a transaction you name. This is the documented way to keep a local copy of an account up to date.
- PATCH/v3/accounts/{accountID}/configurationChange the parts of an account its owner may set: the alias and the margin rate.
- GET/v3/accounts/{accountID}/summaryAccount summary without the trade, position and order lists. Cheap balance and margin check.
Instruments
Orders
- GET/v3/accounts/{accountID}/ordersList orders, pending by default. Filter by ids, state or instrument; paginate with beforeID.
- POST/v3/accounts/{accountID}/ordersCreate an order. Market, limit, stop, market if touched and dependent orders all go through this one endpoint. Returns 201.
- GET/v3/accounts/{accountID}/orders/{orderSpecifier}The details of one order on the account, whatever its state.
- PUT/v3/accounts/{accountID}/orders/{orderSpecifier}Replace a pending order: the old order is cancelled and a new one created from the specification you send, in a single call. Returns 201.
- PUT/v3/accounts/{accountID}/orders/{orderSpecifier}/cancelCancel a pending order by ID or by your client ID prefixed with @.
- PUT/v3/accounts/{accountID}/orders/{orderSpecifier}/clientExtensionsUpdate the client extensions on an order: your own ID, tag and comment, for the order and for the trade it will open. OANDA says not to use them on an account linked to MT4.
- GET/v3/accounts/{accountID}/pendingOrdersEvery pending order on the account, in one call with no filters.
Positions
- GET/v3/accounts/{accountID}/openPositionsPositions with open trades, netted per instrument with long and short sides.
- GET/v3/accounts/{accountID}/positionsEvery position the account has ever held, one per instrument, including those now flat. For open positions only there is a separate call.
- GET/v3/accounts/{accountID}/positions/{instrument}The position in one instrument on the account, whether it is open or not.
- PUT/v3/accounts/{accountID}/positions/{instrument}/closeClose out the long side, the short side or both for one instrument.
Pricing
- GET/v3/accounts/{accountID}/candles/latestThe candle still forming and the most recently completed ones, for several combinations of instrument, granularity and price component in one call.
- GET/v3/accounts/{accountID}/instruments/{instrument}/candlesHistorical candlesticks for one instrument, requested through an account. Up to 5000 candles per request.
- GET/v3/accounts/{accountID}/pricingCurrent bid and ask for a list of instruments. A snapshot, not a stream.
- GET/v3/accounts/{accountID}/pricing/streamStreaming prices over one long lived HTTP connection. Newline delimited JSON: PRICE and HEARTBEAT objects.
Trades
- GET/v3/accounts/{accountID}/openTradesAll open trades on the account.
- GET/v3/accounts/{accountID}/tradesTrades on the account, filtered by state, instrument or ID. Open trades are returned unless you ask for another state.
- GET/v3/accounts/{accountID}/trades/{tradeSpecifier}The details of one trade on the account.
- PUT/v3/accounts/{accountID}/trades/{tradeSpecifier}/clientExtensionsUpdate the client extensions on a trade: your own ID, tag and comment. OANDA says not to use them on an account linked to MT4.
- PUT/v3/accounts/{accountID}/trades/{tradeSpecifier}/closeClose a trade in full or in part.
- PUT/v3/accounts/{accountID}/trades/{tradeSpecifier}/ordersCreate, replace or cancel the orders that hang off a trade: take profit, stop loss, trailing stop loss and guaranteed stop loss. This is how a stop or limit is moved on an open trade.
Transactions
- GET/v3/accounts/{accountID}/transactionsTransaction history for a time range, returned as page URLs to fetch next.
- GET/v3/accounts/{accountID}/transactions/{transactionID}The details of one transaction on the account, by its ID.
- GET/v3/accounts/{accountID}/transactions/idrangeThe transactions between two transaction IDs, both included, returned in full.
- GET/v3/accounts/{accountID}/transactions/sinceidEvery transaction newer than the one you name, returned in full. Useful for catching up after a gap.
- GET/v3/accounts/{accountID}/transactions/streamStreaming account activity (fills, cancels, funding) from the moment you connect. Newline delimited JSON.