Trading API Documentation
The REST API enables programmatic trading: placing orders (limit / market, open / close), cancelling orders, and querying positions / orders / wallet / symbols / tickers. All endpoints return JSON; timestamps are Unix seconds or milliseconds (noted per field). API orders share the same matching and risk engine as web orders.
| Base URL | https://api.alveroxa.com/api/v1 |
| Content type | application/json (UTF-8) |
| Authentication | X-API-KEY request header |
Authentication
Generate an API key under User Menu > API Management (one key per account; the key is shown only once, store it securely). Every request must include the header:
X-API-KEY: tk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Failed authentication returns 401 API_KEY_MISSING / API_KEY_INVALID; a disabled account returns 403 ACCOUNT_DISABLED. Never hardcode your key in browser-side code.
Rate Limits & Security
- More than 20 authentication failures (missing / invalid key) per minute from one IP returns 429 RATE_LIMITED and temporarily blocks the IP.
- Order rate limits are shared with the web client; exceeding them returns 422 ORDER_RATE_LIMIT.
- All calls are written to the API log; view your call history under User Menu > API Management.
- For high-frequency market data polling, use the Market Data Cluster endpoints below (no key, no rate limit); use /api/v1 for trading operations.
Live Tester
After entering your API key, use the Try this endpoint panel under each endpoint to fire real requests (real orders will really execute — use with care). The key is stored in page memory only, cleared on refresh, and never written to browser storage.
/api/v1/order— Place OrderOpen (buy) or close (sell) a position with limit / market orders. API orders share all risk controls with web orders (order rate limits, price deviation, margin checks, etc.) and are flagged with an API source in the order history.
Request parameters (JSON body)
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbolId | string | Yes | Symbol ID, see /api/v1/symbols (alias: symbol) |
| side | string | Yes | buy = open position; sell = close position |
| type | string | Yes | limit / market |
| price | number | No | Required for limit orders; ignored for market orders |
| qty | number | Yes | Quantity; must be an integer when buying |
| leverage | number | No | Leverage 1-50, buy side only, default 1 |
Response example
{ "ok": true }
// Business validation failure (HTTP 422):
{ "ok": false, "error": "MARGIN_INSUFFICIENT" }/api/v1/order/cancel— Cancel OrderCancel a pending order in your own account. Calling this on filled / cancelled orders has no effect.
Request parameters (JSON body)
| Parameter | Type | Required | Description |
|---|---|---|---|
| orderId | string | Yes | Order ID, see /api/v1/orders |
Response example
{ "ok": true }/api/v1/positions— Get PositionsReturns all current positions with the latest price, average cost, unrealized PnL, leveraged borrowing and estimated liquidation price.
Request parameters (query)
No parameters. Send the request with the auth header only.
Response example
{
"ok": true,
"positions": [
{
"symbolId": "btc",
"position": 100, // total position
"available": 80, // closable quantity (not locked by open orders)
"avgCost": 64500.5,
"lastPrice": 65100.2,
"marketValue": 6510020,
"unrealizedPnl": 59970,
"leverage": 10,
"borrowed": 580504.5,
"margin": 64500.5,
"liqPrice": 61234.5
}
],
"serverTime": 1751600000
}/api/v1/orders— Get OrdersQuery open and historical orders. The source field identifies the origin (web / api).
Request parameters (query)
| Parameter | Type | Required | Description |
|---|---|---|---|
| status | string | No | open / history / all (default) |
Response example
{
"ok": true,
"open": [
{
"id": "o_xxxxxxxx",
"symbolId": "btc",
"side": "buy",
"type": "limit",
"price": 65000,
"qty": 100,
"filled": 0,
"avgFillPrice": null,
"status": "pending",
"leverage": 10,
"fee": 0,
"source": "api",
"ts": 1751600000000
}
],
"history": [],
"serverTime": 1751600000
}/api/v1/wallet— Get WalletReturns available cash, cumulative traded volume and account level.
Request parameters (query)
No parameters. Send the request with the auth header only.
Response example
{
"ok": true,
"cash": 100000.0,
"tradedVolume": 2500000.0,
"level": 3,
"serverTime": 1751600000
}/api/v1/symbols— Get SymbolsReturns all currently tradable pairs with precision and fee rules. Call this first to obtain valid symbolId values before placing orders.
Request parameters (query)
No parameters. Send the request with the auth header only.
Response example
{
"ok": true,
"symbols": [
{
"symbolId": "btc",
"symbol": "BTC/USD",
"base": "BTC",
"quote": "USD",
"name": "Bitcoin",
"pricePrecision": 2,
"qtyPrecision": 3,
"openFeePct": 0.1,
"closeFeePct": 0.1,
"custom": false
}
],
"serverTime": 1751600000
}/api/v1/ticker— Get TickersReturns the latest price, 24h high/low and volume for all tradable symbols, plus order precision / quantity limits. For high-frequency polling, prefer the market data cluster endpoints below.
Request parameters (query)
No parameters. Send the request with the auth header only.
Response example
{
"ok": true,
"tickers": [
{
"symbolId": "btc",
"base": "BTC",
"quote": "USD",
"lastPrice": 65100.2,
"high": 65900,
"low": 64100,
"volume": 1234567,
"pricePrecision": 2,
"qtyPrecision": 3,
"minQty": 10,
"maxQty": 10000
}
],
"serverTime": 1751600000
}Market Data Cluster Public API (recommended for high frequency)
No API key required, no rate limit, and both primary and backup nodes are available. The symbol parameter accepts formats such as TEST, TEST/USD, TESTUSD and test/usd.
GET {md-server}/api/md/symbols Listed symbols
GET {md-server}/api/md/ticker?symbol=TEST 24h summary (last price / change / volume)
GET {md-server}/api/md/depth?symbol=TEST&limit=20 Full order book depth (bids/asks)
GET {md-server}/api/md/trades?symbol=TEST&limit=50 Latest trades
GET {md-server}/api/md/kline?symbol=TEST&step=60&limit=500
Candlesticks (Binance-style arrays, step in seconds: 60/300/900/3600/14400/86400)
# Example response /api/md/ticker
{ "ok": true, "symbol": "TEST", "last": 50.92, "open24h": 49.4,
"high24h": 50.92, "low24h": 49.44, "volume24h": 4000,
"changePct": 3.08, "time": 1751600000000 }Contact the administrator for the market data server address. All cluster nodes serve consistent data; if one node fails, switch to another. Data refreshes every second.
Error Codes
| HTTP | Error code | Meaning |
|---|---|---|
| 401 | API_KEY_MISSING / API_KEY_INVALID | Missing or invalid API key |
| 403 | ACCOUNT_DISABLED | Account has been disabled |
| 404 | API_DOMAIN_REQUIRED | Use the dedicated API domain configured by the administrator |
| 422 | QTY_MIN / QTY_MAX | Quantity below minimum / above maximum |
| 422 | QTY_INTEGER | Buy quantity must be an integer |
| 422 | PRICE_DEVIATION | Limit price deviates too far from the last price |
| 422 | MARGIN_INSUFFICIENT / CASH_INSUFFICIENT | Insufficient available funds (margin) |
| 422 | POSITION_INSUFFICIENT | Insufficient closable position |
| 422 | ORDER_RATE_LIMIT | Order rate limit exceeded |
| 422 | LEVERAGE_MAX / LEVERAGE_MIN_CASH | Leverage above limit / funds below leverage threshold |
| 422 | FEED_GUARD_BLOCKED | Abnormal market data; opening/closing temporarily suspended |
| 429 | RATE_LIMITED | Too many authentication failures; IP temporarily throttled |
Code Examples
curl
# Market buy
curl -X POST https://api.alveroxa.com/api/v1/order \
-H "Content-Type: application/json" \
-H "X-API-KEY: tk_live_your_key" \
-d '{"symbolId":"btc","side":"buy","type":"market","qty":100}'
# Get positions
curl https://api.alveroxa.com/api/v1/positions -H "X-API-KEY: tk_live_your_key"Python (requests)
import requests
BASE = "https://api.alveroxa.com"
HEADERS = {"X-API-KEY": "tk_live_your_key"}
# Limit buy
r = requests.post(f"{BASE}/api/v1/order", headers=HEADERS, json={
"symbolId": "btc", "side": "buy", "type": "limit",
"price": 65000, "qty": 100, "leverage": 1,
})
print(r.status_code, r.json())
# Get open orders
print(requests.get(f"{BASE}/api/v1/orders?status=open", headers=HEADERS).json())Node.js (fetch)
const BASE = "https://api.alveroxa.com";
const HEADERS = { "X-API-KEY": "tk_live_your_key", "Content-Type": "application/json" };
// Cancel order
const res = await fetch(BASE + "/api/v1/order/cancel", {
method: "POST",
headers: HEADERS,
body: JSON.stringify({ orderId: "o_xxxxxxxx" }),
});
console.log(await res.json());