Workspace / Research tools
api

API documentation

The API base path is /api/v1/. All successful JSON responses contain ok: true, data and request_id. Errors contain ok: false, error.code, error.message and request_id. No endpoint accepts orders, wallet secrets or arbitrary upstream URLs.

Authentication and request format

Send exactly one authentication header: Authorization: Bearer YOUR_API_KEY or X-API-Key: YOUR_API_KEY. Keys are not accepted in URL parameters. HTTPS is required for production clients. Calculation requests use POST with Content-Type: application/json and a body no larger than 16384 bytes.

Use JSON numbers, not numeric strings or booleans. Duplicate fields, extra fields, unsupported query parameters, NaN and infinity are rejected. Nonzero numeric magnitudes below 0.000000000001 are outside the supported calculation precision range. GET /api/v1/account returns the key ID, plan, expiry and current allowances; it never returns the key itself.

Calculation routes and exact inputs

POST /api/v1/calculate/funding requires notional, rate_pct, interval_hours, days, side, fees, capital and borrow_per_day. Example: {"notional":10000,"rate_pct":0.01,"interval_hours":8,"days":7,"side":"short","fees":20,"capital":20000,"borrow_per_day":0}. Positive funding is received by the modeled short and paid by the modeled long.

POST /api/v1/calculate/position-size requires equity, risk_pct, entry, stop, side, fee_bps and slippage_bps. side is long or short; the stop must lie on the adverse side of entry. POST /api/v1/calculate/arbitrage requires quantity, buy_price, sell_price, buy_fee_bps, sell_fee_bps and fixed_cost. All monetary values in one request must use the same quote unit.

POST /api/v1/calculate/amm-swap requires reserve_in, reserve_out, amount_in, fee_bps and slippage_bps. POST /api/v1/calculate/health-factor requires debt_usd and collaterals, an array of 1–50 objects containing asset, value_usd and liquidation_threshold_pct. POST /api/v1/calculate/staking-yield requires principal, apr_pct, days, compounds_per_year and commission_pct. Full worked requests are also returned by the public capabilities endpoint.

Market requests

GET /api/v1/market/book?provider=binance&symbol=BTC retrieves a normalized snapshot when that provider is enabled. GET /api/v1/market/candles?provider=bybit&symbol=ETH&interval=1h requests completed candles. GET /api/v1/market/liquidity?provider=okx&symbol=SOL&quote_amount=1000 adds visible-depth bands and a hypothetical market-buy depth walk. quote_amount defaults to 1000 in the returned venue quote unit.

Provider values are binance, bybit, okx, kucoin and kraken. Base-symbol values are BTC, ETH, SOL, DOGE, XRP, BNB, ADA and AVAX; BNB is excluded from this Kraken adapter. Candle intervals are 1m, 5m, 15m, 1h, 4h and 1d. Actual venue listing and upstream availability can still limit a documented pair. Kraken responses use USD; the other adapters use USDT. The service does not convert between those units.

Limits and errors

Every admitted authenticated calculation or market request consumes one calendar-month unit, including invalid calculation bodies and upstream failures. Cached results also consume a unit. The account route does not consume a monthly unit but does count toward the per-minute allowance. Fixed UTC minute and calendar-month windows are enforced atomically across workers.

Inspect X-Quota-Limit, X-Quota-Remaining, X-Quota-Reset and the corresponding X-RateLimit headers. Reset values are Unix seconds. HTTP 429 includes Retry-After. Common errors include 401 invalid_api_key, 403 key_expired, 403 plan_not_allowed, 403 provider_not_enabled, 422 invalid_input, 502 invalid_provider_data and 504 provider_timeout. Repeated failures should not be retried in a tight loop.

The operator may approve additional browser origins explicitly. Wildcard origin access and credential cookies are not used. Browser CORS restrictions do not replace API-key authentication. A request ID helps identify a response, but the application does not keep a per-request history containing submitted inputs.

Primary documentation

Find a tool or research page