Register your account and obtain your account ID. The registration steps are provided here.
Add your account ID to the request header as orderly-account-id.
2
Orderly Key
Add your Orderly public key to the request header as orderly-key. To generate and add a new Orderly Key, see the documentation.
You can also obtain Orderly keys from frontend builders like WOOFi Pro.
3
Timestamp
Take the current timestamp in milliseconds and add it as orderly-timestamp to the request header.
4
Normalize request content
Normalize the message to a string by concatenating the following:
Current timestamp in milliseconds, e.g. 1649920583000
HTTP method in uppercase, e.g. POST
Request path including query parameters (without base URL), e.g. /v1/orders?symbol=PERP_BTC_USDC
(Optional) If the request has a body, JSON stringify it and append
Sign the normalized content using the ed25519 algorithm, encode the signature in base64 url-safe format, and add the result to the request header as orderly-signature.
6
Content type
Set the Content-Type header:
GET and DELETE: application/x-www-form-urlencoded
POST and PUT: application/json
7
Send the request
The final request should have the following headers:
Header
Description
Content-Type
Request content type
orderly-account-id
Your Orderly account ID
orderly-key
Your Orderly public key
orderly-signature
ed25519 signature (base64url)
orderly-timestamp
Request timestamp (ms)
The Orderly Key should be used without the ed25519: prefix when used in code samples below.
This is a concise, single-file TypeScript example that demonstrates how to sign and send a request to the Orderly API using the @noble/ed25519 library.
import bs58 from 'bs58';import { config } from 'dotenv';import { webcrypto } from 'node:crypto';import { signAndSendRequest } from "./signer";// this is only necessary in Node.js to make `@noble/ed25519` dependency workif (!globalThis.crypto) globalThis.crypto = webcrypto as any;config();async function main() {const baseUrl = 'https://testnet-api.orderly.org';const orderlyAccountId = '<orderly-account-id>';const orderlyKey = bs58.decode(process.env.ORDERLY_SECRET!);const res = await signAndSendRequest(orderlyAccountId, orderlyKey, `${baseUrl}/v1/order`, {method: 'POST',body: JSON.stringify({symbol: 'PERP_ETH_USDC',order_type: 'MARKET',order_quantity: 0.01,side: 'BUY'})});const response = await res.json();console.log(response);}main();