Skip to content

Authentication

All requests to the XBTFX Trading API must be authenticated using an API key passed as a Bearer token in the Authorization header.

Each API key is bound to a single trading account. Create and manage API keys in the API Console, which is part of the client portal:

https://portal.xbtfx.com

Log in with your XBTFX credentials, select your Pro account, and generate a key. The Trading API works with Pro accounts only. If you don’t have one yet, register in the portal and open a Pro account first.

When you create a key, it is associated with one trading account. All actions performed with that key operate on that specific account.

Include your API key in every request using the Authorization header:

Authorization: Bearer <your-api-key>
Terminal window
curl -X GET https://interface.xbtfx.com/v1/auth/status \
-H "Authorization: Bearer your_api_key_here"

Use this endpoint to verify your API key is valid and inspect its permissions.

GET /v1/auth/status

{
"login": 12345678,
"tier": "standard",
"status": "active",
"permissions": ["trade", "read"],
"margin_mode": "hedging"
}
FieldTypeDescription
loginintegerThe MT5 account login number bound to this key
tierstringAccount tier level
statusstringKey status (e.g., active)
permissionsarrayList of permissions granted to this key
margin_modestringAccount margin mode: hedging or netting
  • Store API keys securely. Never commit them to version control or expose them in client-side code.
  • Use environment variables or a secrets manager to inject keys at runtime.
  • Create separate keys for different applications or environments.
  • Rotate keys periodically and revoke any that are no longer in use.