API overview
HTTP and WebSocket interface for the Nexus chain. Sessions are signed by your MAIN wallet directly, or — for programmatic trading — by an API key (a delegate signing key derived from your wallet via a one-time signature). No Bearer tokens, no shared secrets, no HMAC. The same interface powers the web UI, programmatic trading bots, indexers, and admin tooling.
Base URL: https://api.bitnxs.com · WebSocket: wss://api.bitnxs.com/ws
Quick Start
Section titled “Quick Start”- Connect your wallet (MetaMask or any EIP-1193 provider) in the web UI to derive your on-chain address (0xABC).
- Open the “More → API Keys” page and create an API key for programmatic trading. Copy the value shown in the one-time modal.
- Open a session: POST /session/start → sign the returned challenge with the API key → POST /session/complete → receive a sessionId.
- Submit orders, cancels, leverage updates and TP/SL triggers using the sessionId.
Minimal Python flow
Section titled “Minimal Python flow”import requestsfrom eth_account import Accountfrom eth_utils import keccak
USER = "0xABC..." # MAIN wallet address — the session is bound to thisAPI_KEY = "0x..." # API key from "More → API Keys" (shown once)BASE = "https://api.bitnxs.com" # Nexus API base URL
# 1. Open sessionchal = requests.post(f"{BASE}/session/start", json={"user": USER}).json()
# 2. Sign challenge with the API key (raw keccak, NOT EIP-191 / personal_sign)sig = Account.unsafe_sign_hash( keccak(chal["challenge"].encode()), private_key=API_KEY,)
ses = requests.post(f"{BASE}/session/complete", json={ "challengeId": chal["challengeId"], "signature": {"r": hex(sig.r), "s": hex(sig.s), "v": sig.v - 27},}).json()SESSION_ID = ses["sessionId"]
# 3. Submit a limit orderprint(requests.post(f"{BASE}/session/order", json={ "sessionId": SESSION_ID, "asset": 1, "isBuy": True, "limitPx": "65000.00", "sz": "0.01", "reduceOnly": False, "orderType": {"type": "limit", "tif": "Gtc"},}).json())