NYXANCE API

Welcome to the NYXANCE API documentation. Our REST API provides programmatic access to market data, trading, and account management for crypto perpetual futures.

Quick Reference

Base URLhttps://api.nyxance.com
ProtocolHTTPS (TLS 1.2+)
Content Typeapplication/json
TimestampsMilliseconds (Unix epoch)
PrecisionPrices and sizes are strings in JSON responses
WebSocketwss://api.nyxance.com/ws

Rate Limits

Public API60 requests / minute per IP
Auth API10 requests / minute per IP
Trading API30 requests / minute per user

Rate limit headers are included in all responses: X-RateLimit-Limit, X-RateLimit-Remaining, Retry-After

Authentication

NYXANCE uses JWT (JSON Web Tokens) for authentication. Obtain a token via the Register or Login endpoints, then include it in the Authorization header for all authenticated requests.

Steps
  1. Create account: POST /api/v1/register
  2. Or log in: POST /api/v1/login
  3. Include token in header: Authorization: Bearer <token>
  4. Tokens expire in 24 hours
bash
# Example: Authenticated request
curl https://api.nyxance.com/api/v1/balance \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
Security Note: If 2FA is enabled on your account, you must provide a valid TOTP code in the totp_code field when logging in. Account locks after 5 failed login attempts for 15 minutes.

Public API

Market data endpoints. No authentication required. Rate limit: 60 req/min per IP.

Auth Endpoints

Registration and login. Rate limit: 10 req/min per IP (stricter to prevent brute force).

Trading API

Order and position management. Requires JWT authentication. Rate limit: 30 req/min per user.

Account API

2FA, notification settings, and referral system. Requires JWT authentication.

WebSocket API

Connection

Connect to the WebSocket endpoint to receive real-time market data. No authentication is required. The server automatically pushes ticker and orderbook updates for all trading pairs.

javascript
// WebSocket endpoint
wss://api.nyxance.com/ws

// JavaScript example
const ws = new WebSocket('wss://api.nyxance.com/ws');

ws.onopen = () => {
  console.log('Connected to NYXANCE WebSocket');

  // Subscribe to a specific trading pair
  ws.send(JSON.stringify({ subscribe: 'BTC-USDT' }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log(data.type, data);
};

ws.onclose = () => {
  console.log('Disconnected');
};

Subscribe / Unsubscribe

Send JSON messages to subscribe or unsubscribe from specific trading pairs.

json
// Subscribe to a pair
{ "subscribe": "BTC-USDT" }

// Unsubscribe from a pair
{ "unsubscribe": "BTC-USDT" }

Ticker Stream

Pushes real-time ticker updates for all subscribed trading pairs. Updates are sent whenever the price changes (typically every 100-500ms).

json
{
  "type": "ticker",
  "data": {
    "symbol": "BTC-USDT",
    "last": "98450.50",
    "bid": "98449.00",
    "ask": "98451.00",
    "high24h": "99200.00",
    "low24h": "97100.00",
    "vol24h": "1284567.50",
    "change24h": "1.42",
    "markPrice": "98448.20",
    "indexPrice": "98452.10"
  }
}
Ticker Fields
NameTypeRequiredDescription
symbolstringYesTrading pair
laststringYesLast traded price
bidstringYesBest bid price
askstringYesBest ask price
high24hstringYes24-hour high price
low24hstringYes24-hour low price
vol24hstringYes24-hour volume in USDT
change24hstringYes24-hour price change percentage
markPricestringYesMark price used for PnL/liquidation
indexPricestringYesComposite index price from spot exchanges

Orderbook Stream

Pushes real-time order book snapshots for subscribed pairs. Asks are sorted ascending by price, bids are sorted descending by price. Each level includes price and quantity.

json
{
  "type": "orderbook",
  "symbol": "BTC-USDT",
  "data": {
    "asks": [
      {
        "price": "98451.00",
        "qty": "0.52"
      },
      {
        "price": "98455.00",
        "qty": "1.20"
      }
    ],
    "bids": [
      {
        "price": "98449.00",
        "qty": "0.48"
      },
      {
        "price": "98445.00",
        "qty": "1.05"
      }
    ]
  }
}

Rate Limits

CategoryLimitScopeEndpoints
Public API60 / minPer IPGET /tickers, /orderbook, /klines, etc.
Auth API10 / minPer IPPOST /register, /login
Trading API30 / minPer UserPOST /order/*, DELETE /order/*, GET /positions, etc.
StatusUnlimited-GET /status

When you exceed the rate limit, the API returns HTTP 429 Too Many Requests. The Retry-After header indicates how many seconds to wait before retrying.

http
HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
Retry-After: 45

{ "error": "rate limit exceeded" }

Error Codes

All errors return a JSON object with an error field describing the issue.

HTTP CodeMeaningExample
400Bad RequestInvalid parameters, missing required fields
401UnauthorizedMissing or expired JWT token
403ForbiddenAccount locked, insufficient permissions
404Not FoundEndpoint or resource does not exist
409ConflictDuplicate registration, order already cancelled
422UnprocessableInsufficient balance, max leverage exceeded
429Rate LimitedToo many requests, check Retry-After header
500Server ErrorInternal error, contact support
json
// Error response format
{
  "error": "insufficient balance"
}

// With details
{
  "error": "validation failed",
  "details": "size must be between 1 and 1000000"
}
© 2026 NYXANCE