API
API
REST under /v1 and one WebSocket: values, paging, session keys and signed actions.
The API is REST under /v1 and one WebSocket at /ws, on the same host: https://api-production-b8f20900.up.railway.app. This page covers what every call shares. REST and WebSocket list every route, channel and field, and Errors lists every error code. These pages describe contract version 0.2.0.
Values on the wire
- Prices, sizes, USDC amounts, PnL and funding are decimal strings, such as
"72.720". Parse them as decimals, not floats. - Latency is an integer number of microseconds.
- Times are epoch milliseconds in fields named
ator ending inAt, with an ISO 8601 UTC twin (time,expiresTime) wherever a screen prints the time. - Ids the engine assigns (orders, trades) are integers sent as strings.
Responses can gain fields and enum values in later versions, so ignore what you don't recognise. Requests are strict: a field the API doesn't define is refused with VALIDATION_ERROR.
Reads
Every read is public and needs no key. Account reads take the wallet address in the path, as in /v1/accounts/<address>/positions. Lists come in pages:
| Field | Type | Description |
|---|---|---|
cursoroptional | string | The nextCursor of the previous page. |
limitoptional | integer | 1 to 100. Default 24. |
A page answers items, page.nextCursor (null on the last page), page.hasMore and asOf.
Writes
A wallet writes in two steps.
Register a session key
GET /v1/sessions/noncereturns the fields of a Sign-In With Solana message. The wallet signs that message once, andPOST /v1/sessionsregisters the session key it names for 7 days. On the wallet's first entry the message also carries an invite code, and the response returns the wallet's own codes.Sign actions with the session key
Each order, cancel, leverage change, faucet claim or revocation is an action envelope signed by the session key. Send it inside an
actionmessage on the WebSocket, or toPOST /v1/actions, which answers with the same ack.
Deposits and withdrawals are Solana transactions: the API builds them, the wallet signs, and the API relays them (/v1/deposits/build, /v1/withdrawals/build, /v1/transactions/submit). They answer CHAIN_OFF while the chain is off in Season Zero.
The session message
The text the wallet signs, line for line. domain, statement, uri, chainId, nonce, issuedAt and sessionExpiresAt come from GET /v1/sessions/nonce, and the invite line is left out after the first entry.
<domain> wants you to sign in with your Solana account:
<wallet address>
<statement>
URI: <uri>
Version: 1
Chain ID: <chainId>
Nonce: <nonce>
Issued At: <issuedAt>
Expiration Time: <sessionExpiresAt>
Resources:
- urn:strobe:session-key:<session key address>
- urn:strobe:invite:<invite code>Wallets with Sign-In With Solana (solana:signIn) produce this text from the same fields. Send its bytes as signedMessage and the wallet's ed25519 signature as signature, both base64, with the nonceToken from the nonce response.
The action envelope
| Field | Type | Description |
|---|---|---|
account | address | the trading wallet |
sessionKey | address | the session key that signs; registered to `account` |
id | string | the client's id for this action, echoed on its ack or reject 1 to 64 letters, digits, - or _. |
nonce | integer | epoch ms at signing; accepted within ±ACTION_WINDOW_MS of the server clock, once per session key |
action | object, one of several shapes | |
signature | base64 | the session key's ed25519 signature over actionMessage(unsigned), base64 |
| Field | Type | Description |
|---|---|---|
type | "place_order" | |
market | SOL-PERP | BTC-PERP | ETH-PERP | |
side | buy | sell | |
kind | limit | market | |
size | decimal | |
priceoptional | decimal | limit orders only |
timeInForceoptional | gtc | ioc | post_only | limit orders only; absent = gtc |
reduceOnlyoptional | boolean | |
clientOrderIdoptional | string | 1 to 64 letters, digits, - or _. |
| Field | Type | Description |
|---|---|---|
type | "cancel_order" | |
market | SOL-PERP | BTC-PERP | ETH-PERP | |
orderId | id |
| Field | Type | Description |
|---|---|---|
type | "cancel_all" | |
marketoptional | SOL-PERP | BTC-PERP | ETH-PERP |
| Field | Type | Description |
|---|---|---|
type | "close_position" | |
market | SOL-PERP | BTC-PERP | ETH-PERP | |
sizeoptional | decimal |
| Field | Type | Description |
|---|---|---|
type | "set_leverage" | |
market | SOL-PERP | BTC-PERP | ETH-PERP | |
leverage | integer |
| Field | Type | Description |
|---|---|---|
type | "claim_faucet" |
| Field | Type | Description |
|---|---|---|
type | "revoke_session" |
The session key signs the UTF-8 bytes of strobe:action:v1, a newline, then the canonical JSON of account, sessionKey, id, nonce and action: keys sorted, no whitespace, undefined members left out, numbers only as integers. nonce is the time of signing in epoch ms. The API accepts it within 60 seconds of its own clock and once per session key, and answers REPLAYED_ACTION otherwise.
A first order
A bot holding its own keys, in TypeScript with @noble/curves and bs58:
$ npm install @noble/curves bs58import { ed25519 } from '@noble/curves/ed25519.js'
import bs58 from 'bs58'
const API = process.env.STROBE_API! // the API's base URL
const INVITE = process.env.STROBE_INVITE! // your invite code; sent on the wallet's first entry only
const b64 = (bytes: Uint8Array) => Buffer.from(bytes).toString('base64')
const post = async (path: string, body: unknown) => (await fetch(API + path, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })).json()
// JSON with keys sorted, no whitespace, undefined members left out.
function canonical(value: unknown): string {
if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`
if (value && typeof value === 'object') {
const entries = Object.entries(value).filter(([, v]) => v !== undefined).sort(([a], [b]) => (a < b ? -1 : 1))
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`).join(',')}}`
}
return JSON.stringify(value)
}
const walletSecret = ed25519.utils.randomSecretKey() // in practice, your wallet signs
const sessionSecret = ed25519.utils.randomSecretKey()
const wallet = bs58.encode(ed25519.getPublicKey(walletSecret))
const sessionKey = bs58.encode(ed25519.getPublicKey(sessionSecret))
// 1. The session message, signed once by the wallet.
const c = await (await fetch(`${API}/v1/sessions/nonce`)).json()
const message = [
`${c.domain} wants you to sign in with your Solana account:`,
wallet,
'',
c.statement,
'',
`URI: ${c.uri}`,
'Version: 1',
`Chain ID: ${c.chainId}`,
`Nonce: ${c.nonce}`,
`Issued At: ${c.issuedAt}`,
`Expiration Time: ${c.sessionExpiresAt}`,
'Resources:',
`- urn:strobe:session-key:${sessionKey}`,
`- urn:strobe:invite:${INVITE}`,
].join('\n')
const signed = new TextEncoder().encode(message)
const registered = await post('/v1/sessions', {
wallet,
sessionKey,
signedMessage: b64(signed),
signature: b64(ed25519.sign(signed, walletSecret)),
nonceToken: c.nonceToken,
})
console.log(JSON.stringify(registered, null, 2))
// 2. Every action after that, signed by the session key.
async function act(id: string, action: Record<string, unknown>) {
const unsigned = { account: wallet, sessionKey, id, nonce: Date.now(), action }
const bytes = new TextEncoder().encode(`strobe:action:v1\n${canonical(unsigned)}`)
return post('/v1/actions', { ...unsigned, signature: b64(ed25519.sign(bytes, sessionSecret)) })
}
console.log(JSON.stringify(await act('buy-1', { type: 'place_order', market: 'SOL-PERP', side: 'buy', kind: 'market', size: '1' }), null, 2))POST /v1/sessions answered:
{
"session": {
"wallet": "BzvfCwNterYYZMLNmknAaFHdQoa6KydFmrx6ScMk71j5",
"sessionKey": "APBrpiLQaJRjMUdnFfcntwYRMPKVQ8e4eM58VEFKPUvW",
"status": "active",
"expiresAt": 1796056156979,
"expiresTime": "2026-11-30T16:29:16.979Z",
"createdAt": 1795451357015
},
"admittedNow": true,
"invites": [
{
"code": "3AP75FMJ",
"status": "valid",
"usedBy": null,
"usedAt": null
},
{
"code": "295MSTCZ",
"status": "valid",
"usedBy": null,
"usedAt": null
},
{
"code": "B6BZZZ9X",
"status": "valid",
"usedBy": null,
"usedAt": null
}
]
}The order's answer is an ack with the fills, the arrival price and the engine's ack time.
Errors
Every failure, REST or WebSocket, carries one error object. Branch on code; message is a sentence you can show as it is.
| Field | Type | Description |
|---|---|---|
error | object | |
error.code | string, one of 39 codes | |
error.message | string | |
error.retryable | boolean | |
error.stage | validation | auth | read | engine | upload | build | wallet | co_sign | simulation | send | confirmation | |
error.fieldErrorsoptional | Record<string, string[]> | |
error.programErroroptional | object | |
error.programError.programId | address | |
error.programError.name | string | |
error.programError.numberoptional | integer | |
error.retryAfterSecondsoptional | integer | |
error.requestIdoptional | string |
Routes
| Route | What it answers |
|---|---|
GET /health | Liveness: 200 { status } always. |
GET /v1/status | Mode, chain mode, program id, withdrawals and faucet switches, engine state, last batch. |
GET /v1/markets | The three markets with their rules and live ticker. |
GET /v1/markets/{market}/book | Order book levels with sequence number. |
GET /v1/markets/{market}/trades | Recent trades, newest first, each with the taker order ack time. |
GET /v1/markets/{market}/candles | Candles by interval, oldest first. |
GET /v1/markets/{market}/ticker | Index, mark, funding, 24 h volume and change, open interest. |
GET /v1/latency | Engine receive-to-ack p50/p99 in microseconds over a window. |
GET /v1/batches | Settlement batches, newest first. |
GET /v1/leaderboard | Season Zero standings, plus the rank of wallet. |
GET /v1/invites/{code} | Whether an invite code is valid, used or unknown. |
GET /v1/accounts/{address} | Equity, margins, leverage, points, rank and faucet state. |
GET /v1/accounts/{address}/positions | Open positions with live PnL and liquidation price. |
GET /v1/accounts/{address}/orders | Resting orders. |
GET /v1/accounts/{address}/fills | Fills, newest first, with ack time and the price at the click. |
GET /v1/accounts/{address}/funding | Hourly funding payments, newest first. |
GET /v1/accounts/{address}/transfers | Deposits, withdrawals and faucet claims, newest first. |
GET /v1/accounts/{address}/liquidations | Liquidations, newest first. |
GET /v1/accounts/{address}/equity | Equity points over time for the portfolio chart. |
GET /v1/accounts/{address}/invites | The wallet's own three invite codes. |
GET /v1/sessions/nonce | A nonce and the fields of the session message the wallet signs. |
POST /v1/sessions | Verify the signed session message, admit the wallet with its invite code, register the session key. |
GET /v1/sessions/{sessionKey} | A session key: active, expired or revoked. |
POST /v1/actions | A signed trading action (the WebSocket takes the same envelope). |
POST /v1/deposits/build | Build a deposit transaction for the wallet to sign (chain on). |
POST /v1/withdrawals/build | Build a withdrawal the engine co-signs (chain on). |
POST /v1/transactions/submit | Relay signed bytes, or report a wallet-sent signature. |
GET /v1/transactions/{id} | A built transaction: submitted, confirmed, failed or expired. |