REST API
Reference
Complete HTTP API for trading operations, account management, position control, and market data.
Authentication
All requests require a valid API key
Generate your API key from the API Server modal inside Tradyn Terminal. Include the key in the Authorization header of every request:
API Key Scoping
Restrict keys to read-only, trade-only, or full access
Custom Port
Run the API server on a custom port for added security
Key Rotation
Generate new keys and revoke old ones instantly
API Reference
17 endpoints across 5 categories. Tap any row to inspect payloads.
Account
Positions
Orders
Trading
Market Data
Order Types
Use the type field for pending orders
0Buy1Sell2Buy Limit3Sell Limit4Buy Stop5Sell Stop{
"success": true,
"data": { ... }
}{
"success": false,
"error": "Insufficient margin"
}HTTP Status Codes
200OKRequest succeeded
400Bad RequestMissing or invalid parameters
401UnauthorizedMissing authorization header
403ForbiddenInvalid API key
404Not FoundResource does not exist
500Server ErrorInternal server error
503UnavailableNot connected to trading server
Quick Start
in any language
Copy-paste examples to get your first API call running in seconds. Each example covers account info, positions, and trade execution.
1import requests23API_KEY = "tk_live_a1b2c3d4e5f6"4BASE_URL = "http://127.0.0.1:8080/v1"5headers = {"Authorization": f"Bearer {API_KEY}"}67# Get account info8account = requests.get(9 f"{BASE_URL}/api/account", headers=headers10).json()1112print(f"Balance: {account['data']['balance']}")13print(f"Equity: {account['data']['equity']}")1415# Get open positions16positions = requests.get(17 f"{BASE_URL}/api/positions", headers=headers18).json()1920for pos in positions["data"]:21 print(f" {pos['symbol']} {pos['type']} {pos['volume']} lots P&L: {pos['profit']}")2223# Place a market buy24order = requests.post(f"{BASE_URL}/api/trade", headers=headers, json={25 "symbol": "EURUSD",26 "action": "buy",27 "volume": 0.10,28 "sl": 1.0800,29 "tp": 1.095030}).json()3132print(f"Filled ticket #{order['data']['ticket']} @ {order['data']['price']}")Need real-time data?
Check out our WebSocket API for live market ticks, position updates, and instant notifications.