IDX Exchange exposes REST endpoints for market data, account state, and order management. Private routes require an API key pair and ed25519 request signatures.
Base URL: https://api.dex.idxsolana.io
Authenticated requests use the ed25519 curve. Build a message by concatenating (no separators):
/v1/orders?symbol=PERP_BTC_USDC)Sign the message with your API secret, encode the signature as base64url, and attach the headers below. Requests older than 300 seconds from server time are rejected.
| Header | Description |
|---|---|
| idx-timestamp | Unix timestamp in milliseconds |
| idx-account-id | Your IDX Exchange account ID |
| idx-api-key | Public API key (ed25519:<base58>) |
| idx-signature | ed25519 signature, base64url-encoded |
Place a market order with @noble/curves and @scure/base:
import { ed25519 } from "@noble/curves/ed25519";
import { base58 } from "@scure/base";
async function placeMarketOrder() {
const accountId = process.env.IDX_ACCOUNT_ID!;
const secretKey = base58.decode(process.env.IDX_API_SECRET!);
const baseUrl = "https://api.dex.idxsolana.io";
const url = new URL(`${baseUrl}/v1/order`);
const method = "POST";
const body = JSON.stringify({
symbol: "PERP_ETH_USDC",
order_type: "MARKET",
order_quantity: 0.01,
side: "BUY",
});
const timestamp = Date.now();
const message = `${timestamp}${method}${url.pathname}${url.search}${body}`;
const signatureBytes = ed25519.sign(
new TextEncoder().encode(message),
secretKey,
);
const publicKeyBytes = ed25519.getPublicKey(secretKey);
const response = await fetch(url, {
method,
body,
headers: {
"Content-Type": "application/json",
"idx-timestamp": String(timestamp),
"idx-account-id": accountId,
"idx-api-key": `ed25519:${base58.encode(publicKeyBytes)}`,
"idx-signature": Buffer.from(signatureBytes).toString(
"base64url",
),
},
});
console.log(await response.json());
}Market metadata and tickers do not require signing. Examples:
WebSocket streams for live order book and account updates follow the same IDX Exchange API host. Detailed stream catalog will be expanded in a future docs revision.
Account setup: Portfolio & funds