For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quickstart

This walks you from zero to a live order on testnet. You need an Ethereum wallet to sign the login message. All requests go to the testnet gateway:

https://exchange.nexus.xyz/api/exchange

Monetary values are decimal strings throughout the API.

1. Sign in

Authenticate with an EIP-191 personal signature over the fixed string Sign in to Nexus Exchange. Your address is recovered from the signature. The session token is only used to manage API keys — not to trade — and expires in 24 hours.

curl -X POST 'https://exchange.nexus.xyz/api/exchange/auth/login' \
  -H 'Content-Type: application/json' \
  -d '{
    "message": "Sign in to Nexus Exchange",
    "signature": "0xSIGNATURE_HEX"
  }'
# → { "token": "sess_abc123...", "address": "0xYOUR_WALLET_ADDRESS" }

2. Create an API key

Use the session token to mint an HMAC key pair. The secret is shown once — save it immediately. Keys inherit your account's rate-limit tier.

curl -X POST 'https://exchange.nexus.xyz/api/exchange/keys' \
  -H 'Authorization: Bearer sess_abc123...' \
  -H 'Content-Type: application/json' \
  -d '{"label": "my-bot"}'
# → { "key_id": "nx_7f3a1b...", "secret": "e4d2c8f1...long_hex..." }

3. Sign requests

Every authenticated request carries three headers. Build a canonical string, HMAC-SHA256 it with your secret, and attach the result.

Header
Value

X-API-Key

your key_id (nx_...)

X-Timestamp

current time in ms since epoch (must be within ±30s of server time)

X-Signature

HMAC-SHA256 hex of the canonical string

Canonical string format (note the literal newlines):

For a GET with no body, hash the empty string.

4. Fund your account

Credit synthetic USDX from the faucet. Each API key can claim up to 500 USDX per day; omit amount to claim the full remaining daily allowance. Returns 429 once the allowance is used up; it resets the next UTC day.

5. Browse markets

6. Place an order

Use "order_type": "Market" to fill immediately at the best available price. time_in_force accepts GTC, IOC, or FOK; add "reduce_only": true to only reduce an existing position. Batch multiple orders in one POST /orders/batch call — they are processed sequentially and results preserve request order.

7. Monitor positions

Next: the full REST API Reference and WebSocket API Reference.

Last updated