Which API should I use?

  • Use v20 REST API only if you have a v20 account
  • Use v1 REST API if your account id contains only digits (ie. 2534253) as it is a legacy account

Authentication


Overview

Authentication is required to access your live accounts. Personal traders can request a personal access token. If you already have an access token for use with the legacy REST API you can use it with the v20 API too.

The OAuth 2.0 flow to support Third Party Application developers is under development and coming soon. For more information email us at api@oanda.com

OANDA reserves the right to suspend personal access tokens or developer OAuth credentials if necessary based on system stability or other technical issues caused by the customer.


Personal Strategy Traders

A personal access token can be used to access your account through the OANDA v20 API. Once created, a token will grant access to all of your sub-accounts. Please note, your personal access token is like a password, so you should guard it carefully. These tokens are unique to an OANDA account and should be stored securely.

Obtaining a Personal Access Token

There is a link on your OANDA fxTrade account profile page titled “Manage API Access” (My Account -> My Services -> Manage API Access). From there, you can generate a personal access token to use with the OANDA API, as well as revoke a token you may currently have.

Using a Personal Access Token

After generating your token, you should keep it somewhere secure. OANDA does not retain your token so if it is lost or forgotten you must revoke it and generate a new one to keep API access.

In order to use a token to access API resources, you must include the token as a Bearer token in the HTTP Authorization header. As an example:

curl -H "Authorization: Bearer 12345678900987654321-abc34135acde13f13530" https://api-fxtrade.oanda.com/v3/accounts