Skip to content

API reference

Base URLs, request signing, order and account endpoints, WebSocket streams, rate limits and errors for trading Nexwest with an API key.

Updated Nov 14, 2026Traders, bot builders & market makers8 min read
On this page

Nexwest's markets run on a shared order book operated by its settlement network. Your API keys are registered on that network under your Nexwest account, so your code talks to its API directly: the lowest latency, and IP allow lists that see your servers' real addresses. New to the API? Start with the Trading API overview, create a key on the API keys page, and follow the trading bot guide for a complete example.

Base URLs

ServiceURL
RESThttps://api.orderly.org
Public WebSocketwss://ws-evm.orderly.org/ws/stream/{account_id}
Private WebSocketwss://ws-private-evm.orderly.org/v2/ws/private/stream/{account_id}

{account_id} is the account ID shown on the API keys page. Symbols look like PERP_BTC_USDC, PERP_ETH_USDC, PERP_NVDA_USDC, PERP_XAU_USDC (gold) and PERP_EURUSD_USDC.

Authentication

Public market data needs no key. Every private request carries four headers:

HeaderValue
orderly-account-idYour account ID
orderly-keyYour API key, ed25519: followed by base58
orderly-timestampThe current time in milliseconds
orderly-signatureThe signature described below

To sign a request:

  1. Join, with no separators: the timestamp, the HTTP method in capitals, the path including its query string, and the JSON body if there is one. For example: 1731571200000POST/v1/order{"symbol":"PERP_BTC_USDC",...}
  2. Sign the UTF-8 bytes with your API secret (an ed25519 private key, base58).
  3. Encode the signature as base64url and send it as orderly-signature.

Send Content-Type: application/json with POST and PUT, and application/x-www-form-urlencoded with GET and DELETE. Sign the exact body string you send. A timestamp more than 300 seconds away from server time is rejected, so keep your clock synced.

Keep the secret secret

The secret signs orders for your account. Load it from a secrets manager or environment variable, never commit it, and remove the key on the API keys page if it leaks. Keys cannot withdraw funds.

Python

Requires requests, base58 and cryptography.

code
import base64, json, os, time
 
import base58
import requests
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
 
BASE_URL = "https://api.orderly.org"
ACCOUNT_ID = os.environ["NEXWEST_ACCOUNT_ID"]
API_KEY = os.environ["NEXWEST_API_KEY"]  # ed25519:...
SECRET = base58.b58decode(os.environ["NEXWEST_API_SECRET"].removeprefix("ed25519:"))
PRIVATE_KEY = Ed25519PrivateKey.from_private_bytes(SECRET)
 
 
def signed(method, path, body=None):
    payload = "" if body is None else json.dumps(body, separators=(",", ":"))
    timestamp = str(int(time.time() * 1000))
    signature = PRIVATE_KEY.sign(f"{timestamp}{method}{path}{payload}".encode())
    headers = {
        "orderly-account-id": ACCOUNT_ID,
        "orderly-key": API_KEY,
        "orderly-timestamp": timestamp,
        "orderly-signature": base64.urlsafe_b64encode(signature).decode(),
        "Content-Type": "application/json"
        if method in ("POST", "PUT")
        else "application/x-www-form-urlencoded",
    }
    response = requests.request(method, BASE_URL + path, headers=headers, data=payload or None, timeout=10)
    return response.json()
 
 
print(signed("GET", "/v1/positions"))
print(signed("POST", "/v1/order", {
    "symbol": "PERP_BTC_USDC",
    "order_type": "POST_ONLY",
    "side": "BUY",
    "order_price": 60000,
    "order_quantity": 0.001,
    "client_order_id": "mm-btc-bid-1",
}))

TypeScript

Requires @noble/curves and @scure/base. Runs on Node.js 18 or later.

code
import { ed25519 } from "@noble/curves/ed25519";
import { base58 } from "@scure/base";
 
const BASE_URL = "https://api.orderly.org";
const accountId = process.env.NEXWEST_ACCOUNT_ID!;
const apiKey = process.env.NEXWEST_API_KEY!; // ed25519:...
const secret = base58.decode(process.env.NEXWEST_API_SECRET!.replace(/^ed25519:/, ""));
 
type Method = "GET" | "POST" | "PUT" | "DELETE";
 
export async function signed(method: Method, path: string, body?: unknown) {
  const payload = body === undefined ? "" : JSON.stringify(body);
  const timestamp = Date.now().toString();
  const message = new TextEncoder().encode(timestamp + method + path + payload);
  const signature = Buffer.from(ed25519.sign(message, secret)).toString("base64url");
  const response = await fetch(BASE_URL + path, {
    method,
    headers: {
      "orderly-account-id": accountId,
      "orderly-key": apiKey,
      "orderly-timestamp": timestamp,
      "orderly-signature": signature,
      "Content-Type":
        method === "POST" || method === "PUT" ? "application/json" : "application/x-www-form-urlencoded",
    },
    body: payload || undefined,
  });
  return response.json();
}
 
console.log(await signed("GET", "/v1/client/holding"));

Responses and errors

Every response has a success flag. Successful calls return their result in data; failed calls return a code and a message:

code
{ "success": false, "code": -1005, "message": "order_price must be a positive number" }

HTTP 429 means a rate limit was hit: wait for the next window. Authentication failures usually mean a wrong secret, a body that differs from the signed string, a missing query string in the signed path, or a clock more than 300 seconds off.

Market data

These calls need no key.

MethodPathReturns
GET/v1/public/futuresEvery perpetual with mark and index price, funding rate, open interest and 24-hour volume
GET/v1/public/infoTrading rules per market: price and size steps, minimum order value, and margin rates (maximum leverage is 1 ÷ base_imr)
GET/v1/public/system_infoWhether the exchange is running or in maintenance

For live prices, use the WebSocket streams below instead of polling.

Orders

Order calls need the read & trade permission.

MethodPathWhat it does
POST/v1/orderPlace one order
POST/v1/batch-orderPlace up to 10 orders: {"orders": [ ... ]}
PUT/v1/orderChange an open order's price or size
DELETE/v1/order?order_id={id}&symbol={symbol}Cancel one order
DELETE/v1/batch-order?order_ids={id1},{id2}Cancel up to 10 orders
DELETE/v1/orders?symbol={symbol}Cancel all open orders in a market; leave out symbol for every market
GET/v1/orders?status=INCOMPLETEYour open orders
GET/v1/tradesYour fills

Fields for a new order:

FieldRequiredNotes
symbolYesFor example PERP_BTC_USDC
sideYesBUY or SELL
order_typeYesLIMIT, MARKET, IOC, FOK, POST_ONLY, ASK or BID
order_priceFor priced ordersNot used with MARKET, ASK and BID
order_quantityYes, or order_amountSize in the base asset, up to 8 decimals
order_amountNoSize in USDC, for MARKET, ASK and BID orders
client_order_idNoYour ID, up to 36 characters, unique among your open orders, not starting with a hyphen
reduce_onlyNotrue to only reduce a position
visible_quantityNoSize shown on the book; 0 hides the order. Not for MARKET, IOC or FOK
post_only_adjustNoFor POST_ONLY: move the price one tick from the best price instead of rejecting
slippageNoFor MARKET: stop filling beyond this slippage
margin_modeNoCROSS or ISOLATED; defaults to the market's margin mode

To change an order, send PUT /v1/order with order_id, symbol, side, order_type, order_price and order_quantity. Prices and sizes must follow the market's steps from /v1/public/info, and the order value must reach its minimum.

Account

These calls need the read permission, except the two updates, which need read & trade.

MethodPathWhat it does
GET/v1/client/holdingUSDC and other balances
GET/v1/positionsOpen positions with entry price, unrealized PnL and liquidation price
GET/v1/client/margin_modesEach market's margin mode
POST/v1/client/margin_modeSet a market's margin mode: {"symbol": "PERP_BTC_USDC", "default_margin_mode": "ISOLATED"}
GET/v1/client/leverage?symbol={symbol}&margin_mode={mode}A market's leverage for a margin mode
POST/v1/client/leveragesSet leverage: {"symbol": "PERP_BTC_USDC", "leverage": 10, "margin_mode": "CROSS"}
GET/v1/client/key_infoYour keys with their permissions, expiry and IP allow lists

A market's margin mode can change only while it has no open positions or orders in the current mode, and leverage can change up to five times a minute.

WebSocket

Connect to the public stream for market data, or to the private stream for your account. Both use the same messages.

  • Subscribe: {"id": "book-1", "event": "subscribe", "topic": "PERP_BTC_USDC@orderbook"}
  • Unsubscribe: the same message with "event": "unsubscribe".
  • Heartbeat: the server sends {"event": "ping"} every 10 seconds. Answer {"event": "pong", "ts": <milliseconds>} or the connection closes.
StreamTopicPushes
Public{symbol}@orderbookThe top 100 levels, every second
Public{symbol}@tradeEach trade
Public{symbol}@ticker24-hour statistics
Public{symbol}@markpriceMark price
Public{symbol}@kline_1mOne-minute candles
PrivateexecutionreportYour order updates and fills; add "params": {"symbol": "PERP_BTC_USDC"} to filter
PrivatepositionYour positions
PrivatebalanceYour balances

On the private stream, authenticate before you subscribe. Sign the timestamp alone, with the same key and base64url encoding as a REST request:

code
import { ed25519 } from "@noble/curves/ed25519";
import { base58 } from "@scure/base";
 
const accountId = process.env.NEXWEST_ACCOUNT_ID!;
const apiKey = process.env.NEXWEST_API_KEY!;
const secret = base58.decode(process.env.NEXWEST_API_SECRET!.replace(/^ed25519:/, ""));
 
const ws = new WebSocket(`wss://ws-private-evm.orderly.org/v2/ws/private/stream/${accountId}`);
 
ws.onopen = () => {
  const timestamp = Date.now();
  const sign = Buffer.from(ed25519.sign(new TextEncoder().encode(String(timestamp)), secret)).toString("base64url");
  ws.send(JSON.stringify({ id: "auth", event: "auth", params: { orderly_key: apiKey, sign, timestamp } }));
};
 
ws.onmessage = (event) => {
  const message = JSON.parse(String(event.data));
  if (message.event === "ping") {
    ws.send(JSON.stringify({ event: "pong", ts: Date.now() }));
  } else if (message.event === "auth" && message.success) {
    ws.send(JSON.stringify({ id: "fills", event: "subscribe", topic: "executionreport" }));
  } else if (message.topic === "executionreport") {
    console.log(message.data);
  }
};

The public stream needs no authentication: connect, then subscribe to the market topics you need.

Rate limits

Limits apply per key. Over a limit, the call gets HTTP 429.

CallLimit
POST /v1/order10 a second
POST /v1/batch-order1 a second, up to 10 orders; each order counts toward the order limit
DELETE /v1/batch-order10 a second, up to 10 orders
POST /v1/client/margin_mode10 a second
POST /v1/client/leverages5 a minute
GET /v1/client/key_info10 a minute

Was this page helpful?