Trade
API

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 at or ending in At, 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:

Page query
FieldTypeDescription
cursoroptionalstringThe nextCursor of the previous page.
limitoptionalinteger1 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.

  1. Register a session key

    GET /v1/sessions/nonce returns the fields of a Sign-In With Solana message. The wallet signs that message once, and POST /v1/sessions registers 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.

  2. 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 action message on the WebSocket, or to POST /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.

Text
<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

SignedAction
FieldTypeDescription
accountaddressthe trading wallet
sessionKeyaddressthe session key that signs; registered to `account`
idstringthe client's id for this action, echoed on its ack or reject 1 to 64 letters, digits, - or _.
nonceintegerepoch ms at signing; accepted within ±ACTION_WINDOW_MS of the server clock, once per session key
actionobject, one of several shapes
signaturebase64the session key's ed25519 signature over actionMessage(unsigned), base64
type: "place_order"
FieldTypeDescription
type"place_order"
marketSOL-PERP | BTC-PERP | ETH-PERP
sidebuy | sell
kindlimit | market
sizedecimal
priceoptionaldecimallimit orders only
timeInForceoptionalgtc | ioc | post_onlylimit orders only; absent = gtc
reduceOnlyoptionalboolean
clientOrderIdoptionalstring1 to 64 letters, digits, - or _.
type: "cancel_order"
FieldTypeDescription
type"cancel_order"
marketSOL-PERP | BTC-PERP | ETH-PERP
orderIdid
type: "cancel_all"
FieldTypeDescription
type"cancel_all"
marketoptionalSOL-PERP | BTC-PERP | ETH-PERP
type: "close_position"
FieldTypeDescription
type"close_position"
marketSOL-PERP | BTC-PERP | ETH-PERP
sizeoptionaldecimal
type: "set_leverage"
FieldTypeDescription
type"set_leverage"
marketSOL-PERP | BTC-PERP | ETH-PERP
leverageinteger
type: "claim_faucet"
FieldTypeDescription
type"claim_faucet"
type: "revoke_session"
FieldTypeDescription
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:

Shell
$ npm install @noble/curves bs58
TypeScript
import { 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:

JSON
{
  "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.

Error envelope
FieldTypeDescription
errorobject
error.codestring, one of 39 codes
error.messagestring
error.retryableboolean
error.stagevalidation | auth | read | engine | upload | build | wallet | co_sign | simulation | send | confirmation
error.fieldErrorsoptionalRecord<string, string[]>
error.programErroroptionalobject
error.programError.programIdaddress
error.programError.namestring
error.programError.numberoptionalinteger
error.retryAfterSecondsoptionalinteger
error.requestIdoptionalstring

Routes

RouteWhat it answers
GET /healthLiveness: 200 { status } always.
GET /v1/statusMode, chain mode, program id, withdrawals and faucet switches, engine state, last batch.
GET /v1/marketsThe three markets with their rules and live ticker.
GET /v1/markets/{market}/bookOrder book levels with sequence number.
GET /v1/markets/{market}/tradesRecent trades, newest first, each with the taker order ack time.
GET /v1/markets/{market}/candlesCandles by interval, oldest first.
GET /v1/markets/{market}/tickerIndex, mark, funding, 24 h volume and change, open interest.
GET /v1/latencyEngine receive-to-ack p50/p99 in microseconds over a window.
GET /v1/batchesSettlement batches, newest first.
GET /v1/leaderboardSeason 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}/positionsOpen positions with live PnL and liquidation price.
GET /v1/accounts/{address}/ordersResting orders.
GET /v1/accounts/{address}/fillsFills, newest first, with ack time and the price at the click.
GET /v1/accounts/{address}/fundingHourly funding payments, newest first.
GET /v1/accounts/{address}/transfersDeposits, withdrawals and faucet claims, newest first.
GET /v1/accounts/{address}/liquidationsLiquidations, newest first.
GET /v1/accounts/{address}/equityEquity points over time for the portfolio chart.
GET /v1/accounts/{address}/invitesThe wallet's own three invite codes.
GET /v1/sessions/nonceA nonce and the fields of the session message the wallet signs.
POST /v1/sessionsVerify 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/actionsA signed trading action (the WebSocket takes the same envelope).
POST /v1/deposits/buildBuild a deposit transaction for the wallet to sign (chain on).
POST /v1/withdrawals/buildBuild a withdrawal the engine co-signs (chain on).
POST /v1/transactions/submitRelay signed bytes, or report a wallet-sent signature.
GET /v1/transactions/{id}A built transaction: submitted, confirmed, failed or expired.