# REST reference

_Documents gateway spec version `1.8.0`._

Generated from the public OpenAPI spec; the machine-readable source is served at [`/openapi.json`](/openapi.json) (SDK generators and try-it tools read that). Every money, price, rate, duration and count field crosses the wire as a decimal **string**, and its unit (`x-hardbasis-unit`) is shown beside it (see [Wire encoding](/api/wire-encoding)). Base URL and auth are on the [Overview](/api/) and [Authentication](/api/authentication) pages.

## System

### `GET /healthz`

Check liveness

**Auth:** none (public)

**Responses**

- **200**: OK
  - `ok` · boolean · required
  - `db` · boolean · required
  - `tsMs` · string · unit `ms` · required
- **503**: Service Unavailable
  - `ok` · boolean · required
  - `db` · boolean · required
  - `tsMs` · string · unit `ms` · required

Example `200` response:

```json
{
  "ok": true,
  "db": true,
  "tsMs": "100000"
}
```

---

### `GET /deployment`

Get deployment posture

**Auth:** none (public)

**Responses**

- **200**: OK
  - `deployment` · enum(`prod`, `testnet`) · required
  - `buildSha` · string \| null · optional

Example `200` response:

```json
{
  "deployment": "prod",
  "buildSha": "string"
}
```

---

### `GET /v1/limits`

Get my rate limits

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
  - `tier` · string · required
  - `budgets` · map(enum(`read`, `order`, `withdraw`) → object) · required
    - each enum(`read`, `order`, `withdraw`) key → object:
      - `limitPerMin` · integer · required
      - `burst` · integer · required
      - `remaining` · integer · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "tier": "string",
  "budgets": {
    "read": {
      "limitPerMin": 0,
      "burst": 0,
      "remaining": 0
    }
  }
}
```

## Proof of Reserves

### `GET /por`

Get the Proof of Reserves snapshot

**Auth:** none (public)

**Responses**

- **200**: OK
  - `tsMs` · string · unit `ms` · required
  - `ageMs` · string · unit `ms` · required
  - `stale` · boolean · required
  - `staleAfterMs` · string · unit `ms` · required
  - `status` · enum(`clean`, `warn`, `page`) · required
  - `driftMsat` · string · unit `msat` · required
  - `consolidationVerified` · boolean · required
  - `snapshot` · any · required
  - `history` · object[] · required
    - `tsMs` · string · unit `ms` · required
    - `status` · string · required
    - `driftMsat` · string · unit `msat` · required
  - `liability` · object · required
    - `rootHash` · string · required
    - `totalMsat` · string · unit `msat` · required
    - `leafCount` · integer · required
    - `rootSaltHex` · string · required
    - `tsMs` · string · unit `ms` · required
  - `liabilityUsdhb` · object · required
    - `rootHash` · string · required
    - `totalMicro` · string · unit `int` · required
    - `leafCount` · integer · required
    - `rootSaltHex` · string · required
    - `tsMs` · string · unit `ms` · required
  - `vaultExposure` · object · required
    - `netPctOfEquityQ9` · string \| null · unit `q9` · required
    - `quantumQ9` · string · unit `q9` · required
    - `tsMs` · string · unit `ms` · required
    - `consolidationVerified` · boolean · required
- **404**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "tsMs": "100000",
  "ageMs": "100000",
  "stale": true,
  "staleAfterMs": "100000",
  "status": "clean",
  "driftMsat": "100000",
  "consolidationVerified": true,
  "snapshot": null,
  "history": [
    {
      "tsMs": "100000",
      "status": "string",
      "driftMsat": "100000"
    }
  ],
  "liability": {
    "rootHash": "string",
    "totalMsat": "100000",
    "leafCount": 0,
    "rootSaltHex": "string",
    "tsMs": "100000"
  },
  "liabilityUsdhb": {
    "rootHash": "string",
    "totalMicro": "100000",
    "leafCount": 0,
    "rootSaltHex": "string",
    "tsMs": "100000"
  },
  "vaultExposure": {
    "netPctOfEquityQ9": "100000",
    "quantumQ9": "100000",
    "tsMs": "100000",
    "consolidationVerified": true
  }
}
```

---

### `GET /por/dashboard`

View the Proof of Reserves dashboard

**Auth:** none (public)

**Responses**

- **200**: OK

---

### `GET /v1/por/proof`

Get my liability proof

**Auth:** API key (`x-api-key`)

**Parameters**

- `asset` (query): enum(`msat`, `usdhb`)

**Responses**

- **200**: OK
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **404**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "asset": "msat",
  "rootHash": "string",
  "totalMsat": "100000",
  "rootSaltHex": "string",
  "treeTsMs": "100000",
  "leaf": {
    "accountTag": "string",
    "freeMsat": "100000",
    "reservedMsat": "100000",
    "hash": "string",
    "sumMsat": "100000"
  },
  "path": [
    {
      "side": "left",
      "hash": "string",
      "sumMsat": "100000"
    }
  ]
}
```

## Markets

### `GET /v1/markets`

List markets

**Auth:** none (public)

**Responses**

- **200**: OK

Example `200` response:

```json
[
  {
    "marketId": "string",
    "underlying": "string",
    "contractType": "inverse",
    "oracleFeedId": "string",
    "quantoMultiplierMsat": "100000",
    "shareScale": "string",
    "status": "live",
    "tickSizeQ8": "100000",
    "priceDp": "100000",
    "minOrderContracts": "100000",
    "maxOrderContracts": "100000",
    "takerFeeQ9": "100000",
    "maxLeverage": "100000",
    "imRateQ9": "100000",
    "mmRateQ9": "100000",
    "baseSpreadQ9": "100000",
    "fundingRateHourlyQ9": "100000",
    "nextFundingTsMs": "100000",
    "session": {
      "open": true,
      "changesAtTsMs": "100000"
    },
    "oracleStalenessMs": "100000",
    "openInterestContracts": "100000",
    "skewQ9": "100000",
    "lastPrice": {
      "midQ8": "100000",
      "tsMs": "100000"
    },
    "fundingInterestTerm": "configured",
    "indexSource": "string",
    "indexStaleLegs": "equity",
    "indexLegTsMs": {
      "equity": "100000",
      "btc": "100000"
    }
  }
]
```

---

### `GET /v1/markets/{id}`

Get a market

**Auth:** none (public)

**Parameters**

- `id` (path), required: string

**Responses**

- **200**: OK
  - `marketId` · string · required
  - `underlying` · string · required
  - `contractType` · enum(`inverse`, `quanto`, `linear_sats`) · required
  - `oracleFeedId` · string · required
  - `quantoMultiplierMsat` · string \| null · unit `msat` · required
  - `shareScale` · string \| null · optional
  - `status` · enum(`live`, `reduce_only`, `halted`) · required
  - `tickSizeQ8` · string · unit `q8` · required
  - `priceDp` · string · unit `int` · required
  - `minOrderContracts` · string · unit `contracts` · required
  - `maxOrderContracts` · string · unit `contracts` · required
  - `takerFeeQ9` · string · unit `q9` · required
  - `maxLeverage` · string · unit `int` · required
  - `imRateQ9` · string · unit `q9` · required
  - `mmRateQ9` · string · unit `q9` · required
  - `baseSpreadQ9` · string · unit `q9` · required
  - `fundingRateHourlyQ9` · string · unit `q9` · required
  - `nextFundingTsMs` · string · unit `ms` · required
  - `session` · object \| null · optional
  - `oracleStalenessMs` · string · unit `ms` · required
  - `openInterestContracts` · string · unit `contracts` · required
  - `skewQ9` · string · unit `q9` · required
  - `lastPrice` · object \| null · required
  - `fundingInterestTerm` · enum(`configured`, `none_by_contract_type`) · optional
  - `indexSource` · string · optional
  - `indexStaleLegs` · enum(`equity`, `btc`, `both`) \| null · optional
  - `indexLegTsMs` · object \| null · optional
- **404**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "marketId": "string",
  "underlying": "string",
  "contractType": "inverse",
  "oracleFeedId": "string",
  "quantoMultiplierMsat": "100000",
  "shareScale": "string",
  "status": "live",
  "tickSizeQ8": "100000",
  "priceDp": "100000",
  "minOrderContracts": "100000",
  "maxOrderContracts": "100000",
  "takerFeeQ9": "100000",
  "maxLeverage": "100000",
  "imRateQ9": "100000",
  "mmRateQ9": "100000",
  "baseSpreadQ9": "100000",
  "fundingRateHourlyQ9": "100000",
  "nextFundingTsMs": "100000",
  "session": {
    "open": true,
    "changesAtTsMs": "100000"
  },
  "oracleStalenessMs": "100000",
  "openInterestContracts": "100000",
  "skewQ9": "100000",
  "lastPrice": {
    "midQ8": "100000",
    "tsMs": "100000"
  },
  "fundingInterestTerm": "configured",
  "indexSource": "string",
  "indexStaleLegs": "equity",
  "indexLegTsMs": {
    "equity": "100000",
    "btc": "100000"
  }
}
```

---

### `GET /v1/markets/{id}/funding`

List funding boundaries

**Auth:** none (public)

**Parameters**

- `id` (path), required: string

**Responses**

- **200**: OK

Example `200` response:

```json
[
  {
    "tsMs": "100000",
    "rateQ9": "100000",
    "skewQ9": "100000"
  }
]
```

---

### `GET /v1/markets/{id}/stats24h`

Get 24h stats

**Auth:** none (public)

**Parameters**

- `id` (path), required: string

**Responses**

- **200**: OK
  - `marketId` · string · required
  - `windowMs` · string · unit `ms` · required
  - `basis` · const `fills` · required
  - `fills` · integer · required
  - `volumeContracts` · string · unit `contracts` · required
  - `hiQ8` · string \| null · unit `q8` · required
  - `loQ8` · string \| null · unit `q8` · required
  - `truncated` · boolean · required
- **404**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "marketId": "string",
  "windowMs": "100000",
  "basis": "fills",
  "fills": 0,
  "volumeContracts": "100000",
  "hiQ8": "100000",
  "loQ8": "100000",
  "truncated": true
}
```

---

### `GET /v1/markets/{id}/print-map`

Get the print map

**Auth:** none (public)

**Parameters**

- `id` (path), required: string

**Responses**

- **200**: OK
  - `marketId` · string · required
  - `tsMs` · string · unit `ms` · required
  - `lastMidQ8` · string · unit `q8` · required
  - `bandBps` · integer · required: Band width, in basis points of lastMidQ8.
  - `windowBps` · integer · required: Window each side of lastMidQ8, in basis points. Bands outside it are not served.
  - `grid` · const `0.05` · required: The quantization step, as a share of openInterestContracts: the same grid as every public skew figure.
  - `floors` · object · required: The aggregation floors a band must meet to be served.
    - `minAccounts` · integer · required: A band placed by fewer distinct accounts (triggers and positions together) folds its flow into the adjacent band nearer the print and is served empty.
  - `bands` · object[] · required: Ascending by price. Empty when nothing in the window reaches one grid step: render that as a sentence, never as bars.
    - `loQ8` · string · unit `q8` · required
    - `hiQ8` · string · unit `q8` · required
    - `sellSteps` · integer · required: Sells that would execute against the vault if the next verified print landed in this band, in grid steps of openInterestContracts, floored. User triggers and forced closes are merged.
    - `buySteps` · integer · required: Buys that would execute against the vault if the next verified print landed in this band, in grid steps of openInterestContracts, floored. User triggers and forced closes are merged.
    - `skewAfterQ9` · string · unit `q9` · required
  - `windowSellSteps` · integer · required: All sells served in the window, in grid steps, floored from the unquantized sum (not the sum of the bands' steps).
  - `windowBuySteps` · integer · required: All buys served in the window, in grid steps, floored from the unquantized sum (not the sum of the bands' steps).
  - `capReached` · object · required: Per side of the print, the band where the map stops counting closes: the served closes reach the most the public skew allows, so beyond it the true flow is at least what is shown. Null when the map counts every close in the window. It marks where the cap is reached, not how much it held back.
    - `below` · object \| null · required
    - `above` · object \| null · required
- **404**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **503**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "marketId": "string",
  "tsMs": "100000",
  "lastMidQ8": "100000",
  "bandBps": 0,
  "windowBps": 0,
  "grid": "0.05",
  "floors": {
    "minAccounts": 0
  },
  "bands": [
    {
      "loQ8": "100000",
      "hiQ8": "100000",
      "sellSteps": 0,
      "buySteps": 0,
      "skewAfterQ9": "100000"
    }
  ],
  "windowSellSteps": 0,
  "windowBuySteps": 0,
  "capReached": {
    "below": {
      "band": 0,
      "loQ8": "100000",
      "hiQ8": "100000"
    },
    "above": {}
  }
}
```

---

### `GET /v1/markets/{id}/candles`

Get candles

**Auth:** none (public)

**Parameters**

- `id` (path), required: string
- `interval` (query): enum(`60`, `3600`, `86400`)
- `limit` (query): string

**Responses**

- **200**: OK
  - `interval` · const `60` \| const `3600` \| const `86400` · required
  - `candles` · object[] · required
    - `tsMs` · string · unit `ms` · required
    - `oQ8` · string · unit `q8` · required
    - `hQ8` · string · unit `q8` · required
    - `lQ8` · string · unit `q8` · required
    - `cQ8` · string · unit `q8` · required
    - `prints` · integer · required
    - `seeded` · boolean · optional
    - `volumeContracts` · string · unit `contracts` · optional
- **404**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "interval": 60,
  "candles": [
    {
      "tsMs": "100000",
      "oQ8": "100000",
      "hQ8": "100000",
      "lQ8": "100000",
      "cQ8": "100000",
      "prints": 0,
      "seeded": true,
      "volumeContracts": "100000"
    }
  ]
}
```

---

### `GET /v1/public/ticker`

Get the public ticker

**Auth:** none (public)

**Responses**

- **200**: OK
  - `asOfMs` · string · unit `ms` · required
  - `tickers` · object[] · required
    - `marketId` · string · required
    - `last` · object \| null · required
    - `stalenessMs` · string · unit `ms` · required

Example `200` response:

```json
{
  "asOfMs": "100000",
  "tickers": [
    {
      "marketId": "string",
      "last": {
        "midQ8": "100000",
        "tsMs": "100000"
      },
      "stalenessMs": "100000"
    }
  ]
}
```

## Account

### `GET /v1/account`

Get my account

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
  - `accountId` · string · required
  - `userId` · string · required
  - `railAddress` · string · required
  - `autoSweepThresholdMsat` · string \| null · unit `msat` · required: Not an account movement: a configured threshold; null when auto-sweep is off.
  - `freeMsat` · string · unit `msat` · required: Not an account movement: a balance, the withdrawable funds held by the account (>= 0). Fills, funding and liquidations that credit the account raise it; debits lower it.
  - `reservedMsat` · string · unit `msat` · required: Not an account movement: a balance, the margin held against open positions (>= 0), including funding already settled into position margin.
  - `depositFees` · object[] · required
    - `path` · enum(`spark`, `l1`, `lightning`) · required
    - `description` · string · required
    - `recommendedMinimumSats` · string · unit `sats` · optional: Not an account movement: an advisory minimum deposit for this path, in whole sats.
  - `usdhb` · string · optional
  - `usdhbPending` · string · optional
  - `susdhb` · string · optional
  - `susdhbCooling` · string · optional
  - `cooling` · object[] · optional
    - `unstakeId` · string · required
    - `susdhb` · string · required
    - `releaseAtMs` · string · unit `ms` · required
  - `binaryValueAtMarkMsat` · string \| null · unit `msat` · optional: Not an account movement: the account's open YES/NO positions valued at mark, per the PoR claim rule; null when any open position has no fresh mark.
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "accountId": "string",
  "userId": "string",
  "railAddress": "string",
  "autoSweepThresholdMsat": "100000",
  "freeMsat": "100000",
  "reservedMsat": "100000",
  "depositFees": [
    {
      "path": "spark",
      "description": "string",
      "recommendedMinimumSats": "100000"
    }
  ],
  "usdhb": "string",
  "usdhbPending": "string",
  "susdhb": "string",
  "susdhbCooling": "string",
  "cooling": [
    {
      "unstakeId": "string",
      "susdhb": "string",
      "releaseAtMs": "100000"
    }
  ],
  "binaryValueAtMarkMsat": "100000"
}
```

---

### `GET /v1/positions`

List positions

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
[
  {
    "marketId": "string",
    "side": "long",
    "contracts": "100000",
    "sizeShares": "string",
    "entryPriceQ8": "100000",
    "marginMsat": "100000",
    "fundingClockTsMs": "100000"
  }
]
```

---

### `GET /v1/fills`

List fills

**Auth:** API key (`x-api-key`)

**Parameters**

- `limit` (query): string
- `beforeSeq` (query): string

**Responses**

- **200**: OK
  - `fills` · object[] · required
    - `orderId` · string · required
    - `accountId` · string · required
    - `marketId` · string · required
    - `side` · enum(`buy`, `sell`) · required
    - `closedContracts` · string · unit `contracts` · required
    - `openedContracts` · string · unit `contracts` · required
    - `execPriceQ8` · string · unit `q8` · required: Execution price: oracle midQ8 moved by spreadQ9 against the taker (buys above, sells below), snapped to the market's tick grid. Price impact is NOT included in this price: it is charged separately as impactMsat. The taker fee is also charged separately (feeMsat).
    - `oracle` · object · required
    - `spreadQ9` · string · unit `q9` · required
    - `tradeNotionalMsat` · string · unit `msat` · required: Not an account movement: the notional of closedContracts + openedContracts at execPriceQ8, always >= 0. feeMsat and margin are computed from it.
    - `feeMsat` · string · unit `msat` · required: Taker fee actually charged, after any referral discount. Charged separately from the price (not included in execPriceQ8). Positive means debited from the account's free balance; never negative.
    - `impactMsat` · string · unit `msat` · required: Signed price-impact charge, charged separately: NOT included in execPriceQ8. Positive means debited from the account (an impact fee paid to the vault); negative means credited to the account (an impact rebate, capped at the impact the account paid over the trailing window; any excess is rebateDivertedMsat).
    - `rebateDivertedMsat` · string · unit `msat` · required: Not an account movement: the part of an earned impact rebate withheld by the anti-cycling cap and routed to the insurance fund. Never credited to the account; >= 0.
    - `realizedPnlMsat` · string · unit `msat` · required: Realized PnL of closedContracts at execPriceQ8 against the entry price. Positive means credited to the account's free balance; negative means debited from the account (released margin first, then the position's remaining margin; any loss beyond that is deficitMsat). Fee, impact and funding are charged separately and not included.
    - `fundingSettledMsat` · string · unit `msat` · required: Funding accrued since the position's funding clock, settled into position margin at this fill before execution. Positive means credited to the account (received into position margin); negative means debited from the account (paid out of position margin, moved only up to that margin). Charged separately: not included in realizedPnlMsat, feeMsat or execPriceQ8. 0 when no position was open.
    - `releasedMarginMsat` · string · unit `msat` · required: Margin released for the closed portion. Positive means credited to the account's free balance, moved from its own reserved margin (an internal transfer, not new money); >= 0.
    - `reservedMarginMsat` · string · unit `msat` · required: Initial margin reserved for openedContracts. Positive means debited from the account's free balance into its reserved margin (an internal transfer); >= 0.
    - `deficitMsat` · string · unit `msat` · required: Not an account movement: loss the account's margin could not cover on a bankrupt close, absorbed by the insurance fund. Never debited from the account; >= 0.
    - `referral` · object \| null · optional
    - `positionAfter` · object \| null · required
    - `sizeShares` · string \| null · optional
    - `seq` · string · unit `seq` · required
    - `tsMs` · string · unit `ms` · required
  - `nextBeforeSeq` · string \| null · unit `seq` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "fills": [
    {
      "orderId": "string",
      "accountId": "string",
      "marketId": "string",
      "side": "buy",
      "closedContracts": "100000",
      "openedContracts": "100000",
      "execPriceQ8": "100000",
      "oracle": {
        "midQ8": "100000",
        "confQ9": "100000",
        "tsMs": "100000"
      },
      "spreadQ9": "100000",
      "tradeNotionalMsat": "100000",
      "feeMsat": "100000",
      "impactMsat": "100000",
      "rebateDivertedMsat": "100000",
      "realizedPnlMsat": "100000",
      "fundingSettledMsat": "100000",
      "releasedMarginMsat": "100000",
      "reservedMarginMsat": "100000",
      "deficitMsat": "100000",
      "referral": {
        "code": "string",
        "grossFeeMsat": "100000",
        "discountMsat": "100000",
        "rewardMsat": "100000",
        "policyVersion": "100000"
      },
      "positionAfter": {
        "side": "long",
        "contracts": "100000",
        "entryPriceQ8": "100000",
        "marginMsat": "100000"
      },
      "sizeShares": "string",
      "seq": "100000",
      "tsMs": "100000"
    }
  ],
  "nextBeforeSeq": "100000"
}
```

## Deposits

### `POST /v1/deposit-invoices`

Create a deposit invoice

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `amountMsat` · string · unit `msat` · optional
- `expirySeconds` · integer · optional
- `memo` · string · optional

```json
{
  "amountMsat": "100000",
  "expirySeconds": 0,
  "memo": "string"
}
```

**Responses**

- **201**: Created
  - `invoice` · string · required
  - `paymentRef` · string · required
  - `expiresAtMs` · string · unit `ms` · required
  - `depositFees` · object[] · required
    - `path` · enum(`spark`, `l1`, `lightning`) · required
    - `description` · string · required
    - `recommendedMinimumSats` · string · unit `sats` · optional: Not an account movement: an advisory minimum deposit for this path, in whole sats.
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "invoice": "string",
  "paymentRef": "string",
  "expiresAtMs": "100000",
  "depositFees": [
    {
      "path": "spark",
      "description": "string",
      "recommendedMinimumSats": "100000"
    }
  ]
}
```

---

### `GET /v1/deposits`

List deposits

**Auth:** API key (`x-api-key`)

**Parameters**

- `limit` (query): string
- `beforeSeq` (query): string

**Responses**

- **200**: OK
  - `deposits` · object[] · required
    - `accountId` · string · required
    - `amountMsat` · string · unit `msat` · required
    - `feeMsat` · string · unit `msat` · required
    - `railRef` · string · required
    - `seq` · string · unit `seq` · required
    - `tsMs` · string · unit `ms` · required
  - `nextBeforeSeq` · string \| null · unit `seq` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "deposits": [
    {
      "accountId": "string",
      "amountMsat": "100000",
      "feeMsat": "100000",
      "railRef": "string",
      "seq": "100000",
      "tsMs": "100000"
    }
  ],
  "nextBeforeSeq": "100000"
}
```

## Sessions & keys

### `GET /v1/sessions`

List sessions

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
  - `tsMs` · string · unit `ms` · required
  - `sessions` · object[] · required
    - `keyId` · string · required
    - `accountId` · string · required
    - `label` · string · required
    - `scopes` · enum(`read`, `trade`, `withdraw`, `admin-sessions`)[] · required
    - `uaClass` · string \| null · required
    - `ipCountryFirst` · string \| null · required
    - `createdTsMs` · string · unit `ms` · required
    - `lastSeenTsMs` · string \| null · unit `ms` · required
    - `revokedTsMs` · string \| null · unit `ms` · required
    - `revokedBy` · string \| null · required
    - `revokeReason` · string \| null · required
    - `current` · boolean · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "tsMs": "100000",
  "sessions": [
    {
      "keyId": "string",
      "accountId": "string",
      "label": "string",
      "scopes": [
        "read"
      ],
      "uaClass": "string",
      "ipCountryFirst": "string",
      "createdTsMs": "100000",
      "lastSeenTsMs": "100000",
      "revokedTsMs": "100000",
      "revokedBy": "string",
      "revokeReason": "string",
      "current": true
    }
  ]
}
```

---

### `POST /v1/sessions`

Mint a session key

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `label` · string · optional
- `scopes` · enum(`read`, `trade`, `withdraw`, `admin-sessions`)[] · optional

```json
{
  "label": "string",
  "scopes": [
    "read"
  ]
}
```

**Responses**

- **201**: Created
  - `apiKey` · string · optional
  - `keyId` · string · required
  - `scopes` · enum(`read`, `trade`, `withdraw`, `admin-sessions`)[] · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "apiKey": "string",
  "keyId": "string",
  "scopes": [
    "read"
  ]
}
```

---

### `POST /v1/sessions/revoke`

Revoke sessions

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `keyId` · string · optional
- `allButCurrent` · boolean · optional

```json
{
  "keyId": "string",
  "allButCurrent": true
}
```

**Responses**

- **200**: OK
  - `revoked` · string[] · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **404**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "revoked": [
    "string"
  ]
}
```

## Liquidations

### `GET /v1/liquidations`

List liquidations

**Auth:** API key (`x-api-key`)

**Parameters**

- `limit` (query): string
- `beforeSeq` (query): string

**Responses**

- **200**: OK
  - `liquidations` · object[] · required
    - `accountId` · string · required
    - `positionId` · string · required
    - `marketId` · string · required
    - `side` · enum(`long`, `short`) · required
    - `closedContracts` · string · unit `contracts` · required
    - `partial` · boolean · required
    - `execPriceQ8` · string · unit `q8` · required: Close price: oracle midQ8 moved by spreadQ9 against the closed position (the same spread convention as fills). The liquidation penalty is NOT included in this price: it is charged separately as penaltyMsat.
    - `oracle` · object · required
    - `spreadQ9` · string · unit `q9` · required
    - `realizedPnlMsat` · string · unit `msat` · required: PnL of closedContracts at execPriceQ8 against the entry price. Positive means credited to the account (into position margin); negative means debited from the account's position margin, up to that margin (any loss beyond it is deficitMsat). The penalty and funding are charged separately and not included.
    - `fundingSettledMsat` · string · unit `msat` · required: Funding accrued since the position's funding clock, settled into position margin at this liquidation before the close. Positive means credited to the account (received into position margin); negative means debited from the account (paid out of position margin, moved only up to that margin). Charged separately: not included in realizedPnlMsat, feeMsat or execPriceQ8. 0 when no position was open.
    - `penaltyMsat` · string · unit `msat` · required: Liquidation penalty actually paid to the insurance fund, charged separately (not included in execPriceQ8). Positive means debited from the account's position margin, capped at the margin left; >= 0.
    - `remainderMsat` · string · unit `msat` · optional: Margin returned on a full close: positive means credited to the account's free balance (from its own position margin); 0 on partial closes.
    - `deficitMsat` · string · unit `msat` · required: Not an account movement: loss beyond the position's margin, covered by the insurance fund (insuranceCoveredMsat) and then ADL. Never debited from the account; >= 0.
    - `insuranceCoveredMsat` · string · unit `msat` · required: Not an account movement: the part of deficitMsat the insurance fund covered; >= 0.
    - `adlTriggered` · boolean · required
    - `remainingContracts` · string · unit `contracts` · required
    - `remainingMarginMsat` · string · unit `msat` · required: Not an account movement: a balance, the margin still held on the position after a partial close (0 on a full close), after realizedPnlMsat, fundingSettledMsat and penaltyMsat were applied.
    - `sizeShares` · string \| null · optional
    - `remainingSizeShares` · string \| null · optional
    - `seq` · string · unit `seq` · required
    - `tsMs` · string · unit `ms` · required
  - `nextBeforeSeq` · string \| null · unit `seq` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "liquidations": [
    {
      "accountId": "string",
      "positionId": "string",
      "marketId": "string",
      "side": "long",
      "closedContracts": "100000",
      "partial": true,
      "execPriceQ8": "100000",
      "oracle": {
        "midQ8": "100000",
        "confQ9": "100000",
        "tsMs": "100000"
      },
      "spreadQ9": "100000",
      "realizedPnlMsat": "100000",
      "fundingSettledMsat": "100000",
      "penaltyMsat": "100000",
      "remainderMsat": "100000",
      "deficitMsat": "100000",
      "insuranceCoveredMsat": "100000",
      "adlTriggered": true,
      "remainingContracts": "100000",
      "remainingMarginMsat": "100000",
      "sizeShares": "string",
      "remainingSizeShares": "string",
      "seq": "100000",
      "tsMs": "100000"
    }
  ],
  "nextBeforeSeq": "100000"
}
```

## Funding

### `GET /v1/funding`

List funding flows

**Auth:** API key (`x-api-key`)

**Parameters**

- `limit` (query): string
- `beforeSeq` (query): string

**Responses**

- **200**: OK
  - `funding` · object[] · required
    - `seq` · string · unit `seq` · required
    - `boundaryTsMs` · string · unit `ms` · required
    - `marketId` · string · required
    - `rateQ9` · string · unit `q9` · required
    - `flowMsat` · string · unit `msat` · required: Signed funding owed at this boundary (same value as the WS FundingSettled flow). Positive means credited to the account (the position received, into position margin); negative means debited from the account (the position paid; a short pays under a negative rate). Charged separately: not included in any fill price or fee.
    - `paidMsat` · string · unit `msat` · required: Millisats actually moved, same sign as flowMsat: positive means credited to the account, negative means debited from the account. Equals flowMsat except where a pay was capped at the position's available margin.
    - `positionId` · string · required
  - `nextBeforeSeq` · string \| null · unit `seq` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "funding": [
    {
      "seq": "100000",
      "boundaryTsMs": "100000",
      "marketId": "string",
      "rateQ9": "100000",
      "flowMsat": "100000",
      "paidMsat": "100000",
      "positionId": "string"
    }
  ],
  "nextBeforeSeq": "100000"
}
```

## Orders

### `GET /v1/orders`

List orders

**Auth:** API key (`x-api-key`)

**Parameters**

- `state` (query): enum(`resting`, `armed`)
- `status` (query): enum(`accepted`, `filled`, `canceled`, `rejected`)[]
- `limit` (query): string
- `beforeSeq` (query): string

**Responses**

- **200**: OK
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **402**: Reserved for L402/Lightning-metered access (PAPI-8). Not returned today; documented so it lands additively.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "orders": [
    {
      "orderId": "string",
      "marketId": "string",
      "side": "buy",
      "type": "market",
      "contracts": "100000",
      "sizeShares": "string",
      "status": "accepted",
      "reason": "string",
      "heldUntilTsMs": "100000"
    }
  ],
  "nextBeforeSeq": "100000"
}
```

---

### `POST /v1/orders`

Place an order

**Auth:** API key (`x-api-key`)

**Idempotency key:** `order-id`: the client order id; it becomes the order's id

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `marketId` · string · required
- `side` · enum(`buy`, `sell`) · required
- `type` · enum(`market`, `limit`, `stop_market`, `take_profit_market`) · required
- `contracts` · string · unit `contracts` · optional
- `sizeShares` · string · optional
- `limitPriceQ8` · string · unit `q8` · optional
- `triggerPriceQ8` · string · unit `q8` · optional
- `maxSlippageQ9` · string · unit `q9` · optional
- `reduceOnly` · boolean · required
- `trigger` · object · optional
  - `kind` · enum(`entry`, `stop`, `take_profit`) · required
  - `level` · string · unit `q8` · required
- `bracket` · object · optional
  - `entryKind` · enum(`market`, `trigger`) · required
  - `entryLevel` · string · unit `q8` · optional
  - `stopLevel` · string · unit `q8` · optional
  - `takeProfitLevel` · string · unit `q8` · optional
  - `stopContracts` · string · unit `contracts` · optional
  - `takeProfitContracts` · string · unit `contracts` · optional

```json
{
  "marketId": "string",
  "side": "buy",
  "type": "market",
  "contracts": "100000",
  "sizeShares": "string",
  "limitPriceQ8": "100000",
  "triggerPriceQ8": "100000",
  "maxSlippageQ9": "100000",
  "reduceOnly": true,
  "trigger": {
    "kind": "entry",
    "level": "100000"
  },
  "bracket": {
    "entryKind": "market",
    "entryLevel": "100000",
    "stopLevel": "100000",
    "takeProfitLevel": "100000",
    "stopContracts": "100000",
    "takeProfitContracts": "100000"
  }
}
```

**Responses**

- **201**: Created
  - `orderId` · string · required
  - `status` · enum(`accepted`, `filled`, `canceled`, `rejected`, `resting`, `working`) · required
  - `heldUntilTsMs` · string \| null · unit `ms` · optional: Set when what was just placed cannot fill before this instant, the next session open: an opening limit order, an entry trigger or a bracket whose entry is a trigger, placed while its NASDAQ-calendar market is outside regular hours. Evaluated at the time of the request. Absent otherwise.
- **400**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **402**: Reserved for L402/Lightning-metered access (PAPI-8). Not returned today; documented so it lands additively.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "orderId": "string",
  "status": "accepted",
  "heldUntilTsMs": "100000"
}
```

---

### `GET /v1/orders/{id}`

Get an order

**Auth:** API key (`x-api-key`)

**Parameters**

- `id` (path), required: string

**Responses**

- **200**: OK
  - `orderId` · string · required
  - `marketId` · string · required
  - `side` · enum(`buy`, `sell`) · required
  - `type` · enum(`market`, `limit`, `stop_market`, `take_profit_market`) · required
  - `contracts` · string · unit `contracts` · required
  - `sizeShares` · string \| null · optional
  - `status` · enum(`accepted`, `filled`, `canceled`, `rejected`) · required
  - `reason` · string \| null · required
  - `heldUntilTsMs` · string \| null · unit `ms` · optional: Set only while the order is held: it is an accepted limit order, on an account that is not under an admin orders block, its market follows the NASDAQ calendar and is outside regular trading hours, and a fill would open or increase exposure against the account's current position. A held order is not evaluated against prices until this instant, the next session open, and is neither filled nor rejected meanwhile. null when the order is not held. Evaluated at the time of the request; no WebSocket frame carries it, so refetch the order when this instant passes.
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **404**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "orderId": "string",
  "marketId": "string",
  "side": "buy",
  "type": "market",
  "contracts": "100000",
  "sizeShares": "string",
  "status": "accepted",
  "reason": "string",
  "heldUntilTsMs": "100000"
}
```

---

### `DELETE /v1/orders/{id}`

Cancel an order

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `id` (path), required: string
- `idempotency-key` (header), required: string

**Responses**

- **200**: OK
  - `orderId` · string · required
  - `canceled` · boolean · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "orderId": "string",
  "canceled": true
}
```

---

### `POST /v1/cancel-all-after`

Cancel all after

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `timeoutMs` · string · unit `ms` · required

```json
{
  "timeoutMs": "100000"
}
```

**Responses**

- **200**: OK
  - `armed` · boolean · required
  - `deadlineTsMs` · string \| null · unit `ms` · required
- **400**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "armed": true,
  "deadlineTsMs": "100000"
}
```

## Withdrawals

### `POST /v1/withdrawals/quote`

Quote a withdrawal

**Auth:** API key (`x-api-key`)

**Request body**

- `invoice` · string · optional
- `toAddress` · string · optional
- `amountMsat` · string · unit `msat` · optional

```json
{
  "invoice": "string",
  "toAddress": "string",
  "amountMsat": "100000"
}
```

**Responses**

- **200**: OK
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "path": "spark",
  "feeMsat": "100000",
  "firstSeen": true,
  "confirmRequired": true,
  "confirmThresholdMsat": "100000",
  "confirmToken": "string"
}
```

---

### `GET /v1/withdrawals`

List withdrawals

**Auth:** API key (`x-api-key`)

**Parameters**

- `limit` (query): string
- `beforeSeq` (query): string

**Responses**

- **200**: OK
  - `withdrawals` · object[] · required
    - `idempotencyKey` · string · required
    - `amountMsat` · string · unit `msat` · required
    - `feeMsat` · string \| null · unit `msat` · required
    - `state` · enum(`requested`, `queued`, `paid`, `returned`) · required
    - `path` · enum(`spark`, `lightning`) · required
    - `queuedReason` · string \| null · required
    - `railRef` · string \| null · required
    - `requestedTsMs` · string · unit `ms` · required
    - `paidTsMs` · string \| null · unit `ms` · required
    - `autoRefundAfterTsMs` · string \| null · unit `ms` · optional: Set only while a Lightning withdrawal is queued with queuedReason lightning_in_doubt and the engine knows both the invoice's expiry and when the provider began reporting the payment failed. From this time the engine returns the withdrawal in full if the provider still reports it failed. It is a condition, not a promise: a success answer pays instead, and any other answer clears the time. null on every other row.
  - `nextBeforeSeq` · string \| null · unit `seq` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **402**: Reserved for L402/Lightning-metered access (PAPI-8). Not returned today; documented so it lands additively.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "withdrawals": [
    {
      "idempotencyKey": "string",
      "amountMsat": "100000",
      "feeMsat": "100000",
      "state": "requested",
      "path": "spark",
      "queuedReason": "string",
      "railRef": "string",
      "requestedTsMs": "100000",
      "paidTsMs": "100000",
      "autoRefundAfterTsMs": "100000"
    }
  ],
  "nextBeforeSeq": "100000"
}
```

---

### `POST /v1/withdrawals`

Withdraw sats

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `amountMsat` · string · unit `msat` · required
- `toAddress` · string · optional
- `confirmToken` · string · optional

```json
{
  "amountMsat": "100000",
  "toAddress": "string",
  "confirmToken": "string"
}
```

**Responses**

- **201**: Created
  - `railRef` · string · required
  - `queued` · boolean · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **402**: Reserved for L402/Lightning-metered access (PAPI-8). Not returned today; documented so it lands additively.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **409**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **428**: Confirmation Required
  - `error` · const `confirmation_required` · required
  - `code` · const `confirmation_required` · optional
  - `reason` · string · required
  - `firstSeen` · const `true` · required
  - `confirmThresholdMsat` · string · unit `msat` · required
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "railRef": "string",
  "queued": true
}
```

## Usdhb

### `GET /v1/usdhb`

Get USDhb state

**Auth:** none (public)

**Responses**

- **200**: OK
  - `tsMs` · string · unit `ms` · required
  - `params` · object · required
    - `baseFeeQ9` · string · unit `q9` · required
    - `spreadQ9` · string · unit `q9` · required
    - `reserveTargetQ9` · string · unit `q9` · required
    - `reserveFloorQ9` · string · unit `q9` · required
    - `dynFeeCurve` · object[] · required
    - `hardCap` · string · required
    - `quoteTtlMs` · string · unit `ms` · required
    - `mintVelocityQ9PerH` · string · unit `q9` · required
    - `mintVelocityFloor` · string · required
    - `requoteToleranceQ9` · string · unit `q9` · required
  - `supply` · string · required
  - `hedge` · object · required
    - `contracts` · string · unit `contracts` · required
    - `entryPriceQ8` · string \| null · unit `q8` · required
    - `marginMsat` · string · unit `msat` · required
    - `equityMsat` · string \| null · unit `msat` · required
  - `backingIdentityHolds` · boolean · required
  - `reserveMsat` · string · unit `msat` · required
  - `reserveTargetMsat` · string \| null · unit `msat` · required
  - `reserveFloorMsat` · string \| null · unit `msat` · required
  - `markQ8` · string \| null · unit `q8` · required
  - `indicative` · object \| null · required
  - `oracleFresh` · boolean · required
  - `mintedLastHour` · string · required
  - `redeemedLastHour` · string · required
  - `capacity` · object · required
    - `headroom` · string \| null · required
    - `limit` · enum(`organic_oi`, `hard_cap`, `oi_cap`, `skew`, `velocity`) \| null · required
    - `perLimit` · object \| null · required
  - `mintsHalted` · boolean · required: Halts user mints AND stakes (a stake is a mint-class flow; stakeUsdhb refuses with usdhb_mints_halted). Redemptions, unstake releases and the waterfall's yield mints continue, so supply can move while this is true.
  - `mintsHaltedReason` · string \| null · required
  - `lastAttestation` · object \| null · required
  - `attestationIntervalMs` · string · unit `ms` · required
  - `attestationSweepMs` · string \| null · unit `ms` · required
  - `features` · object · required
    - `mint` · boolean · required
    - `redeem` · boolean · required
    - `stake` · boolean · required
    - `withdraw` · boolean · required
  - `staking` · object · required
    - `sharePriceQ9` · string · unit `q9` · required
    - `staked` · string · required
    - `susdhbSupply` · string · required
    - `yieldEscrowMsat` · string · unit `msat` · required
    - `uncoveredShortfallMsat` · string · unit `msat` · required
    - `unstakeCooldownMs` · string · unit `ms` · required
    - `lastWaterfall` · object \| null · required
  - `tokenIdentifier` · string \| null · required
  - `freezeCount` · integer · required
  - `frozenCount` · integer · required
  - `supplyLedger` · object \| null · required
  - `walletsDisplayingTokens` · string[] · required

Example `200` response:

```json
{
  "tsMs": "100000",
  "params": {
    "baseFeeQ9": "100000",
    "spreadQ9": "100000",
    "reserveTargetQ9": "100000",
    "reserveFloorQ9": "100000",
    "dynFeeCurve": [
      {
        "xQ9": "100000",
        "yQ9": "100000"
      }
    ],
    "hardCap": "string",
    "quoteTtlMs": "100000",
    "mintVelocityQ9PerH": "100000",
    "mintVelocityFloor": "string",
    "requoteToleranceQ9": "100000"
  },
  "supply": "string",
  "hedge": {
    "contracts": "100000",
    "entryPriceQ8": "100000",
    "marginMsat": "100000",
    "equityMsat": "100000"
  },
  "backingIdentityHolds": true,
  "reserveMsat": "100000",
  "reserveTargetMsat": "100000",
  "reserveFloorMsat": "100000",
  "markQ8": "100000",
  "indicative": {
    "bidQ8": "100000",
    "askQ8": "100000",
    "spreadQ9": "100000",
    "oracleTsMs": "100000"
  },
  "oracleFresh": true,
  "mintedLastHour": "string",
  "redeemedLastHour": "string",
  "capacity": {
    "headroom": "string",
    "limit": "organic_oi",
    "perLimit": {
      "organic_oi": "string",
      "hard_cap": "string",
      "oi_cap": "string",
      "skew": "string",
      "velocity": "string"
    }
  },
  "mintsHalted": true,
  "mintsHaltedReason": "string",
  "lastAttestation": {
    "asOfTsMs": "100000",
    "issuerSupply": "string",
    "issuerIssued": "string",
    "issuerBurned": "string",
    "issuerCustody": "string",
    "ledgerSupply": "string",
    "ledgerCustody": "string",
    "ok": true
  },
  "attestationIntervalMs": "100000",
  "attestationSweepMs": "100000",
  "features": {
    "mint": true,
    "redeem": true,
    "stake": true,
    "withdraw": true
  },
  "staking": {
    "sharePriceQ9": "100000",
    "staked": "string",
    "susdhbSupply": "string",
    "yieldEscrowMsat": "100000",
    "uncoveredShortfallMsat": "100000",
    "unstakeCooldownMs": "100000",
    "lastWaterfall": {
      "boundaryTsMs": "100000",
      "markQ8": "100000",
      "flowMsat": "100000",
      "toReserveMsat": "100000",
      "toStakersMsat": "100000",
      "overflowMsat": "100000",
      "shortfallMsat": "100000",
      "markdown": "string",
      "yieldMinted": "string",
      "sharePriceQ9Before": "100000",
      "sharePriceQ9After": "100000"
    }
  },
  "tokenIdentifier": "string",
  "freezeCount": 0,
  "frozenCount": 0,
  "supplyLedger": {
    "mintedQ6": "100000",
    "burnedQ6": "100000",
    "outstandingQ6": "100000",
    "asOfMs": "100000",
    "issuerSupplyQ6": "100000",
    "reconciled": true,
    "reconciledAtMs": "100000"
  },
  "walletsDisplayingTokens": [
    "string"
  ]
}
```

---

### `POST /v1/usdhb/quotes`

Quote a mint or redeem

**Auth:** API key (`x-api-key`)

**Quote expiry:** the response's `expiresAtMs` (epoch ms)

**Request body**

- `side` · enum(`mint`, `redeem`) · required
- `usdhb` · string · required

```json
{
  "side": "mint",
  "usdhb": "string"
}
```

**Responses**

- **201**: Created
  - `quoteId` · string · required
  - `side` · enum(`mint`, `redeem`) · required
  - `usdhb` · string · required
  - `contracts` · string · unit `contracts` · required
  - `priceQ8` · string · unit `q8` · required
  - `spreadQ9` · string · unit `q9` · required
  - `feeMsat` · string · unit `msat` · required
  - `dynFeeMsat` · string · unit `msat` · required
  - `impactMsat` · string · unit `msat` · required
  - `satsMsat` · string · unit `msat` · required
  - `expiresAtMs` · string · unit `ms` · required
  - `oracleTsMs` · string · unit `ms` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **409**: Conflict
  - `error` · string · required
  - `code` · string · required
  - `reason` · string · optional
  - `headroom` · string · optional
  - `limit` · enum(`organic_oi`, `hard_cap`, `oi_cap`, `skew`, `velocity`) · optional
  - `quote` · object · optional
    - `quoteId` · string · required
    - `side` · enum(`mint`, `redeem`) · required
    - `usdhb` · string · required
    - `contracts` · string · unit `contracts` · required
    - `priceQ8` · string · unit `q8` · required
    - `spreadQ9` · string · unit `q9` · required
    - `feeMsat` · string · unit `msat` · required
    - `dynFeeMsat` · string · unit `msat` · required
    - `impactMsat` · string · unit `msat` · required
    - `satsMsat` · string · unit `msat` · required
    - `expiresAtMs` · string · unit `ms` · required
    - `oracleTsMs` · string · unit `ms` · required
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "quoteId": "string",
  "side": "mint",
  "usdhb": "string",
  "contracts": "100000",
  "priceQ8": "100000",
  "spreadQ9": "100000",
  "feeMsat": "100000",
  "dynFeeMsat": "100000",
  "impactMsat": "100000",
  "satsMsat": "100000",
  "expiresAtMs": "100000",
  "oracleTsMs": "100000"
}
```

---

### `POST /v1/usdhb/mints`

Mint USDhb

**Auth:** API key (`x-api-key`)

**Idempotency key:** `quote-id`: the body's `quoteId`; any other value is refused (400)

**Accepts a quote from:** `usdhb.quote`

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `quoteId` · string · required

```json
{
  "quoteId": "string"
}
```

**Responses**

- **201**: Created
  - `sagaId` · string · required
  - `side` · enum(`mint`, `redeem`) · required
  - `state` · enum(`hedging`, `minted`, `queued`, `redeeming`, `paid`) · required
  - `usdhb` · string · required
  - `contracts` · string · unit `contracts` · required
  - `satsMsat` · string · unit `msat` · required
  - `priceQ8` · string \| null · unit `q8` · required
  - `queuedReason` · string \| null · required
  - `queuedSinceMs` · string \| null · unit `ms` · required
  - `createdTsMs` · string · unit `ms` · required
  - `updatedTsMs` · string · unit `ms` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **409**: Conflict
  - `error` · string · required
  - `code` · string · required
  - `reason` · string · optional
  - `headroom` · string · optional
  - `limit` · enum(`organic_oi`, `hard_cap`, `oi_cap`, `skew`, `velocity`) · optional
  - `quote` · object · optional
    - `quoteId` · string · required
    - `side` · enum(`mint`, `redeem`) · required
    - `usdhb` · string · required
    - `contracts` · string · unit `contracts` · required
    - `priceQ8` · string · unit `q8` · required
    - `spreadQ9` · string · unit `q9` · required
    - `feeMsat` · string · unit `msat` · required
    - `dynFeeMsat` · string · unit `msat` · required
    - `impactMsat` · string · unit `msat` · required
    - `satsMsat` · string · unit `msat` · required
    - `expiresAtMs` · string · unit `ms` · required
    - `oracleTsMs` · string · unit `ms` · required
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "sagaId": "string",
  "side": "mint",
  "state": "hedging",
  "usdhb": "string",
  "contracts": "100000",
  "satsMsat": "100000",
  "priceQ8": "100000",
  "queuedReason": "string",
  "queuedSinceMs": "100000",
  "createdTsMs": "100000",
  "updatedTsMs": "100000"
}
```

---

### `POST /v1/usdhb/redemptions`

Redeem USDhb

**Auth:** API key (`x-api-key`)

**Idempotency key:** `quote-id`: the body's `quoteId`; any other value is refused (400)

**Accepts a quote from:** `usdhb.quote`

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `quoteId` · string · required

```json
{
  "quoteId": "string"
}
```

**Responses**

- **201**: Created
  - `sagaId` · string · required
  - `side` · enum(`mint`, `redeem`) · required
  - `state` · enum(`hedging`, `minted`, `queued`, `redeeming`, `paid`) · required
  - `usdhb` · string · required
  - `contracts` · string · unit `contracts` · required
  - `satsMsat` · string · unit `msat` · required
  - `priceQ8` · string \| null · unit `q8` · required
  - `queuedReason` · string \| null · required
  - `queuedSinceMs` · string \| null · unit `ms` · required
  - `createdTsMs` · string · unit `ms` · required
  - `updatedTsMs` · string · unit `ms` · required
- **202**: Accepted
  - `sagaId` · string · required
  - `side` · enum(`mint`, `redeem`) · required
  - `state` · enum(`hedging`, `minted`, `queued`, `redeeming`, `paid`) · required
  - `usdhb` · string · required
  - `contracts` · string · unit `contracts` · required
  - `satsMsat` · string · unit `msat` · required
  - `priceQ8` · string \| null · unit `q8` · required
  - `queuedReason` · string \| null · required
  - `queuedSinceMs` · string \| null · unit `ms` · required
  - `createdTsMs` · string · unit `ms` · required
  - `updatedTsMs` · string · unit `ms` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **409**: Conflict
  - `error` · string · required
  - `code` · string · required
  - `reason` · string · optional
  - `headroom` · string · optional
  - `limit` · enum(`organic_oi`, `hard_cap`, `oi_cap`, `skew`, `velocity`) · optional
  - `quote` · object · optional
    - `quoteId` · string · required
    - `side` · enum(`mint`, `redeem`) · required
    - `usdhb` · string · required
    - `contracts` · string · unit `contracts` · required
    - `priceQ8` · string · unit `q8` · required
    - `spreadQ9` · string · unit `q9` · required
    - `feeMsat` · string · unit `msat` · required
    - `dynFeeMsat` · string · unit `msat` · required
    - `impactMsat` · string · unit `msat` · required
    - `satsMsat` · string · unit `msat` · required
    - `expiresAtMs` · string · unit `ms` · required
    - `oracleTsMs` · string · unit `ms` · required
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "sagaId": "string",
  "side": "mint",
  "state": "hedging",
  "usdhb": "string",
  "contracts": "100000",
  "satsMsat": "100000",
  "priceQ8": "100000",
  "queuedReason": "string",
  "queuedSinceMs": "100000",
  "createdTsMs": "100000",
  "updatedTsMs": "100000"
}
```

---

### `GET /v1/usdhb/sagas`

List mint and redeem sagas

**Auth:** API key (`x-api-key`)

**Parameters**

- `limit` (query): string
- `beforeTsMs` (query): string

**Responses**

- **200**: OK
  - `sagas` · object[] · required
    - `sagaId` · string · required
    - `side` · enum(`mint`, `redeem`) · required
    - `state` · enum(`hedging`, `minted`, `queued`, `redeeming`, `paid`) · required
    - `usdhb` · string · required
    - `contracts` · string · unit `contracts` · required
    - `satsMsat` · string · unit `msat` · required
    - `priceQ8` · string \| null · unit `q8` · required
    - `queuedReason` · string \| null · required
    - `queuedSinceMs` · string \| null · unit `ms` · required
    - `createdTsMs` · string · unit `ms` · required
    - `updatedTsMs` · string · unit `ms` · required
  - `nextBeforeTsMs` · string \| null · unit `ms` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "sagas": [
    {
      "sagaId": "string",
      "side": "mint",
      "state": "hedging",
      "usdhb": "string",
      "contracts": "100000",
      "satsMsat": "100000",
      "priceQ8": "100000",
      "queuedReason": "string",
      "queuedSinceMs": "100000",
      "createdTsMs": "100000",
      "updatedTsMs": "100000"
    }
  ],
  "nextBeforeTsMs": "100000"
}
```

---

### `GET /v1/usdhb/sagas/{id}`

Get a saga

**Auth:** API key (`x-api-key`)

**Parameters**

- `id` (path), required: string

**Responses**

- **200**: OK
  - `sagaId` · string · required
  - `side` · enum(`mint`, `redeem`) · required
  - `state` · enum(`hedging`, `minted`, `queued`, `redeeming`, `paid`) · required
  - `usdhb` · string · required
  - `contracts` · string · unit `contracts` · required
  - `satsMsat` · string · unit `msat` · required
  - `priceQ8` · string \| null · unit `q8` · required
  - `queuedReason` · string \| null · required
  - `queuedSinceMs` · string \| null · unit `ms` · required
  - `createdTsMs` · string · unit `ms` · required
  - `updatedTsMs` · string · unit `ms` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "sagaId": "string",
  "side": "mint",
  "state": "hedging",
  "usdhb": "string",
  "contracts": "100000",
  "satsMsat": "100000",
  "priceQ8": "100000",
  "queuedReason": "string",
  "queuedSinceMs": "100000",
  "createdTsMs": "100000",
  "updatedTsMs": "100000"
}
```

---

### `POST /v1/usdhb/stake`

Stake USDhb

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `usdhb` · string · required

```json
{
  "usdhb": "string"
}
```

**Responses**

- **201**: Created
  - `usdhb` · string · required
  - `susdhb` · string · required
  - `sharePriceQ9` · string · unit `q9` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **409**: Conflict
  - `error` · string · required
  - `code` · string · required
  - `reason` · string · optional
  - `headroom` · string · optional
  - `limit` · enum(`organic_oi`, `hard_cap`, `oi_cap`, `skew`, `velocity`) · optional
  - `quote` · object · optional
    - `quoteId` · string · required
    - `side` · enum(`mint`, `redeem`) · required
    - `usdhb` · string · required
    - `contracts` · string · unit `contracts` · required
    - `priceQ8` · string · unit `q8` · required
    - `spreadQ9` · string · unit `q9` · required
    - `feeMsat` · string · unit `msat` · required
    - `dynFeeMsat` · string · unit `msat` · required
    - `impactMsat` · string · unit `msat` · required
    - `satsMsat` · string · unit `msat` · required
    - `expiresAtMs` · string · unit `ms` · required
    - `oracleTsMs` · string · unit `ms` · required
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "usdhb": "string",
  "susdhb": "string",
  "sharePriceQ9": "100000"
}
```

---

### `POST /v1/usdhb/unstake`

Unstake USDhb

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `susdhb` · string · required

```json
{
  "susdhb": "string"
}
```

**Responses**

- **202**: Accepted
  - `unstakeId` · string · required
  - `susdhb` · string · required
  - `requestedTsMs` · string · unit `ms` · required
  - `releaseAtMs` · string · unit `ms` · required
  - `state` · enum(`cooling`, `released`) · required
  - `releasedUsdhb` · string \| null · required
  - `releasedTsMs` · string \| null · unit `ms` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **409**: Conflict
  - `error` · string · required
  - `code` · string · required
  - `reason` · string · optional
  - `headroom` · string · optional
  - `limit` · enum(`organic_oi`, `hard_cap`, `oi_cap`, `skew`, `velocity`) · optional
  - `quote` · object · optional
    - `quoteId` · string · required
    - `side` · enum(`mint`, `redeem`) · required
    - `usdhb` · string · required
    - `contracts` · string · unit `contracts` · required
    - `priceQ8` · string · unit `q8` · required
    - `spreadQ9` · string · unit `q9` · required
    - `feeMsat` · string · unit `msat` · required
    - `dynFeeMsat` · string · unit `msat` · required
    - `impactMsat` · string · unit `msat` · required
    - `satsMsat` · string · unit `msat` · required
    - `expiresAtMs` · string · unit `ms` · required
    - `oracleTsMs` · string · unit `ms` · required
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `202` response:

```json
{
  "unstakeId": "string",
  "susdhb": "string",
  "requestedTsMs": "100000",
  "releaseAtMs": "100000",
  "state": "cooling",
  "releasedUsdhb": "string",
  "releasedTsMs": "100000"
}
```

---

### `GET /v1/usdhb/unstakes`

List unstake requests

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
  - `unstakes` · object[] · required
    - `unstakeId` · string · required
    - `susdhb` · string · required
    - `requestedTsMs` · string · unit `ms` · required
    - `releaseAtMs` · string · unit `ms` · required
    - `state` · enum(`cooling`, `released`) · required
    - `releasedUsdhb` · string \| null · required
    - `releasedTsMs` · string \| null · unit `ms` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "unstakes": [
    {
      "unstakeId": "string",
      "susdhb": "string",
      "requestedTsMs": "100000",
      "releaseAtMs": "100000",
      "state": "cooling",
      "releasedUsdhb": "string",
      "releasedTsMs": "100000"
    }
  ]
}
```

---

### `GET /v1/usdhb/activity`

List USDhb activity

**Auth:** API key (`x-api-key`)

**Parameters**

- `limit` (query): string
- `beforeSeq` (query): string

**Responses**

- **200**: OK
  - `activity` · object[] · required
    - when `type` = `UsdhbMintAccepted`:
      - `seq` · string · unit `seq` · required
      - `tsMs` · string · unit `ms` · required
      - `type` · const `UsdhbMintAccepted` · required
      - `payload` · object · required
        - `quoteId` · string · required
        - `accountId` · string · required
        - `usdhbMicro` · string · unit `int` · required
        - `contracts` · string · unit `contracts` · required
        - `priceQ8` · string · unit `q8` · required
        - `execPriceQ8` · string · unit `q8` · required: The venue's hedge-short fill price (oracle midQ8 moved by the spread). Impact is not included in this price; see impactMsat.
        - `satsInMsat` · string · unit `msat` · required: Total sats debited from the account's free balance for this mint (the quoted amount): margin + feeMsat + the quoted positive impact. Fee and impact are included in satsInMsat, never charged on top.
        - `feeMsat` · string · unit `msat` · required: Not an account movement on its own: the mint base fee, included in satsInMsat (not charged separately).
        - `impactMsat` · string · unit `msat` · required: Not an account movement: the hedge open's signed price impact at execution (< 0 is a rebate the reserve keeps). The account pays only satsInMsat, which included the QUOTED impact; any difference is gapMsat or edgeMsat, borne by the venue.
        - `gapMsat` · string · unit `msat` · required: Not an account movement: what the reserve covered because the mark moved against the venue since the quote. Never debited from the account; >= 0.
        - `edgeMsat` · string · unit `msat` · required: Not an account movement: the quote surplus the reserve kept because the mark moved in the venue's favour. Never credited to the account; >= 0.
        - `usdhbBalanceAfterMicro` · string · unit `int` · required
    - when `type` = `UsdhbRedeemQueued`:
      - `seq` · string · unit `seq` · required
      - `tsMs` · string · unit `ms` · required
      - `type` · const `UsdhbRedeemQueued` · required
      - `payload` · object · required
        - `quoteId` · string · required
        - `accountId` · string · required
        - `usdhbMicro` · string · unit `int` · required
        - `contracts` · string · unit `contracts` · required
        - `satsOutQuotedMsat` · string · unit `msat` · required: Not an account movement yet: the quoted payout, net of the quoted fees and impact (they are included in this figure, not charged on top). Nothing is credited until UsdhbRedeemed.
        - `reason` · string · required
        - `usdhbBalanceAfterMicro` · string · unit `int` · required
        - `usdhbPendingAfterMicro` · string · unit `int` · required
    - when `type` = `UsdhbRedeemed`:
      - `seq` · string · unit `seq` · required
      - `tsMs` · string · unit `ms` · required
      - `type` · const `UsdhbRedeemed` · required
      - `payload` · object · required
        - `quoteId` · string · required
        - `accountId` · string · required
        - `satsOutMsat` · string · unit `msat` · required: Sats paid out: positive means credited to the account's free balance. Net figure: the base fee, dynamic fee and positive impact are already deducted (included in this amount, not charged separately).
        - `usdhbBalanceAfterMicro` · string · unit `int` · required
        - `usdhbPendingAfterMicro` · string · unit `int` · required
    - when `type` = `UsdhbStaked`:
      - `seq` · string · unit `seq` · required
      - `tsMs` · string · unit `ms` · required
      - `type` · const `UsdhbStaked` · required
      - `payload` · object · required
        - `accountId` · string · required
        - `usdhbMicro` · string · unit `int` · required
        - `sharesMicro` · string · unit `int` · required
        - `sharePriceQ9` · string · unit `q9` · required
        - `susdhbBalanceAfterMicro` · string · unit `int` · required
    - when `type` = `UsdhbUnstakeRequested`:
      - `seq` · string · unit `seq` · required
      - `tsMs` · string · unit `ms` · required
      - `type` · const `UsdhbUnstakeRequested` · required
      - `payload` · object · required
        - `unstakeId` · string · required
        - `accountId` · string · required
        - `sharesMicro` · string · unit `int` · required
        - `releaseAtMs` · string · unit `ms` · required
    - when `type` = `UsdhbUnstaked`:
      - `seq` · string · unit `seq` · required
      - `tsMs` · string · unit `ms` · required
      - `type` · const `UsdhbUnstaked` · required
      - `payload` · object · required
        - `unstakeId` · string · required
        - `accountId` · string · required
        - `sharesMicro` · string · unit `int` · required
        - `usdhbMicro` · string · unit `int` · required
        - `sharePriceQ9` · string · unit `q9` · required
        - `usdhbBalanceAfterMicro` · string · unit `int` · required
    - when `type` = `UsdhbWithdrawalRequested`:
      - `seq` · string · unit `seq` · required
      - `tsMs` · string · unit `ms` · required
      - `type` · const `UsdhbWithdrawalRequested` · required
      - `payload` · object · required
        - `withdrawalId` · string · required
        - `accountId` · string · required
        - `usdhbMicro` · string · unit `int` · required
        - `toAddress` · string · required
        - `usdhbBalanceAfterMicro` · string · unit `int` · required
        - `usdhbPendingAfterMicro` · string · unit `int` · required
    - when `type` = `UsdhbWithdrawalPaid`:
      - `seq` · string · unit `seq` · required
      - `tsMs` · string · unit `ms` · required
      - `type` · const `UsdhbWithdrawalPaid` · required
      - `payload` · object · required
        - `withdrawalId` · string · required
        - `accountId` · string · required
        - `usdhbMicro` · string · unit `int` · required
        - `toAddress` · string · required
        - `issuerRef` · string · required
    - when `type` = `UsdhbDepositCredited`:
      - `seq` · string · unit `seq` · required
      - `tsMs` · string · unit `ms` · required
      - `type` · const `UsdhbDepositCredited` · required
      - `payload` · object · required
        - `accountId` · string · required
        - `usdhbMicro` · string · unit `int` · required
        - `txId` · string · required
        - `fromAddress` · string · required
        - `usdhbBalanceAfterMicro` · string · unit `int` · required
  - `nextBeforeSeq` · string \| null · unit `seq` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "activity": [
    {
      "seq": "100000",
      "tsMs": "100000",
      "type": "UsdhbMintAccepted",
      "payload": {
        "quoteId": "string",
        "accountId": "string",
        "usdhbMicro": "100000",
        "contracts": "100000",
        "priceQ8": "100000",
        "execPriceQ8": "100000",
        "satsInMsat": "100000",
        "feeMsat": "100000",
        "impactMsat": "100000",
        "gapMsat": "100000",
        "edgeMsat": "100000",
        "usdhbBalanceAfterMicro": "100000"
      }
    }
  ],
  "nextBeforeSeq": "100000"
}
```

---

### `GET /v1/usdhb/history`

List waterfall history

**Auth:** none (public)

**Parameters**

- `limit` (query): string
- `beforeTsMs` (query): string

**Responses**

- **200**: OK
  - `waterfalls` · object[] · required
    - `boundaryTsMs` · string · unit `ms` · required
    - `markQ8` · string · unit `q8` · required
    - `flowMsat` · string · unit `msat` · required
    - `toReserveMsat` · string · unit `msat` · required
    - `toStakersMsat` · string · unit `msat` · required
    - `overflowMsat` · string · unit `msat` · required
    - `shortfallMsat` · string · unit `msat` · required
    - `markdown` · string · required
    - `yieldMinted` · string · required
    - `sharePriceQ9Before` · string · unit `q9` · required
    - `sharePriceQ9After` · string · unit `q9` · required
  - `nextBeforeTsMs` · string \| null · unit `ms` · required

Example `200` response:

```json
{
  "waterfalls": [
    {
      "boundaryTsMs": "100000",
      "markQ8": "100000",
      "flowMsat": "100000",
      "toReserveMsat": "100000",
      "toStakersMsat": "100000",
      "overflowMsat": "100000",
      "shortfallMsat": "100000",
      "markdown": "string",
      "yieldMinted": "string",
      "sharePriceQ9Before": "100000",
      "sharePriceQ9After": "100000"
    }
  ],
  "nextBeforeTsMs": "100000"
}
```

---

### `GET /v1/usdhb/deposit-address`

Get my USDhb deposit address

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
  - `address` · string · required
  - `accountNumber` · string · unit `int` · required
  - `tokenIdentifier` · string \| null · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "address": "string",
  "accountNumber": "100000",
  "tokenIdentifier": "string"
}
```

---

### `POST /v1/usdhb/withdrawals/quote`

Quote a USDhb withdrawal

**Auth:** API key (`x-api-key`)

**Request body**

- `sparkAddress` · string · required
- `usdhb` · string · optional

```json
{
  "sparkAddress": "string",
  "usdhb": "string"
}
```

**Responses**

- **200**: OK
  - `firstSeen` · boolean · required
  - `confirmRequired` · boolean · required
  - `confirmThresholdUsdhb` · string · required
  - `confirmToken` · string · optional
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "firstSeen": true,
  "confirmRequired": true,
  "confirmThresholdUsdhb": "string",
  "confirmToken": "string"
}
```

---

### `GET /v1/usdhb/withdrawals`

List USDhb withdrawals

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
  - `withdrawals` · object[] · required
    - `withdrawalId` · string · required
    - `usdhb` · string · required
    - `sparkAddress` · string · required
    - `state` · enum(`requested`, `paid`) · required
    - `issuerRef` · string \| null · required
    - `requestedTsMs` · string · unit `ms` · required
    - `paidTsMs` · string \| null · unit `ms` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "withdrawals": [
    {
      "withdrawalId": "string",
      "usdhb": "string",
      "sparkAddress": "string",
      "state": "requested",
      "issuerRef": "string",
      "requestedTsMs": "100000",
      "paidTsMs": "100000"
    }
  ]
}
```

---

### `POST /v1/usdhb/withdrawals`

Withdraw USDhb

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `usdhb` · string · required
- `sparkAddress` · string · required
- `confirmToken` · string · optional

```json
{
  "usdhb": "string",
  "sparkAddress": "string",
  "confirmToken": "string"
}
```

**Responses**

- **201**: Created
  - `withdrawalId` · string · required
  - `usdhb` · string · required
  - `sparkAddress` · string · required
  - `state` · enum(`requested`, `paid`) · required
  - `issuerRef` · string \| null · required
  - `requestedTsMs` · string · unit `ms` · required
  - `paidTsMs` · string \| null · unit `ms` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **409**: Conflict
  - `error` · string · required
  - `code` · string · required
  - `reason` · string · optional
  - `headroom` · string · optional
  - `limit` · enum(`organic_oi`, `hard_cap`, `oi_cap`, `skew`, `velocity`) · optional
  - `quote` · object · optional
    - `quoteId` · string · required
    - `side` · enum(`mint`, `redeem`) · required
    - `usdhb` · string · required
    - `contracts` · string · unit `contracts` · required
    - `priceQ8` · string · unit `q8` · required
    - `spreadQ9` · string · unit `q9` · required
    - `feeMsat` · string · unit `msat` · required
    - `dynFeeMsat` · string · unit `msat` · required
    - `impactMsat` · string · unit `msat` · required
    - `satsMsat` · string · unit `msat` · required
    - `expiresAtMs` · string · unit `ms` · required
    - `oracleTsMs` · string · unit `ms` · required
- **428**: Confirmation Required
  - `error` · const `confirmation_required` · required
  - `code` · const `confirmation_required` · optional
  - `reason` · string · required
  - `firstSeen` · const `true` · required
  - `confirmThresholdUsdhb` · string · required
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "withdrawalId": "string",
  "usdhb": "string",
  "sparkAddress": "string",
  "state": "requested",
  "issuerRef": "string",
  "requestedTsMs": "100000",
  "paidTsMs": "100000"
}
```

---

### `GET /v1/usdhb/freezes`

List USDhb freezes

**Auth:** none (public)

**Responses**

- **200**: OK
  - `freezes` · object[] · required
    - `seq` · string · unit `seq` · required
    - `opId` · string \| null · required
    - `sparkAddress` · string · required
    - `action` · enum(`freeze`, `unfreeze`) · required
    - `state` · enum(`requested`, `applied`) · required
    - `reason` · string \| null · required
    - `issuerRef` · string \| null · required
    - `impactedMicro` · string \| null · unit `int` · required
    - `tsMs` · string · unit `ms` · required
    - `appliedTsMs` · string \| null · unit `ms` · required
    - `recovered` · boolean · required
  - `frozen` · string[] · required

Example `200` response:

```json
{
  "freezes": [
    {
      "seq": "100000",
      "opId": "string",
      "sparkAddress": "string",
      "action": "freeze",
      "state": "requested",
      "reason": "string",
      "issuerRef": "string",
      "impactedMicro": "100000",
      "tsMs": "100000",
      "appliedTsMs": "100000",
      "recovered": true
    }
  ],
  "frozen": [
    "string"
  ]
}
```

## Referral

### `GET /v1/referral`

Get my referral status

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
  - `tsMs` · string · unit `ms` · required
  - `program` · object · required
    - `enabled` · boolean · required
    - `paused` · boolean · required
    - `policyVersion` · string · unit `int` · required
  - `policy` · object · required
    - `shareQ9` · string · unit `q9` · required
    - `shareTiers` · object[] · required
    - `refereeDiscountQ9` · string · unit `q9` · required
    - `refereeDiscountWindowMs` · string · unit `ms` · required
    - `refereeDiscountVolumeCapMsat` · string \| null · unit `msat` · required
    - `rewardWindowMs` · string · unit `ms` · required
    - `holdbackMs` · string · unit `ms` · required
    - `minClaimMsat` · string · unit `msat` · required
  - `eligibility` · object · required
    - `eligible` · boolean · required
    - `gates` · object[] · required
  - `code` · object \| null · required
  - `referredBy` · object \| null · required
  - `stats` · object \| null · required
  - `bindWindow` · object \| null · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "tsMs": "100000",
  "program": {
    "enabled": true,
    "paused": true,
    "policyVersion": "100000"
  },
  "policy": {
    "shareQ9": "100000",
    "shareTiers": [
      {
        "minActiveReferees": "100000",
        "shareQ9": "100000"
      }
    ],
    "refereeDiscountQ9": "100000",
    "refereeDiscountWindowMs": "100000",
    "refereeDiscountVolumeCapMsat": "100000",
    "rewardWindowMs": "100000",
    "holdbackMs": "100000",
    "minClaimMsat": "100000"
  },
  "eligibility": {
    "eligible": true,
    "gates": [
      {
        "gate": "string",
        "met": true,
        "requiredMs": "100000",
        "currentMs": "100000",
        "requiredMsat": "100000",
        "currentMsat": "100000",
        "required": "100000",
        "current": "100000"
      }
    ]
  },
  "code": {
    "code": "string",
    "createdTsMs": "100000",
    "disabled": true
  },
  "referredBy": {
    "code": "string",
    "boundTsMs": "100000",
    "discountQ9": "100000",
    "discountExpiresTsMs": "100000",
    "discountVolumeCapMsat": "100000",
    "discountVolumeUsedMsat": "100000",
    "discountActive": true
  },
  "stats": {
    "referees": "100000",
    "activeReferees": "100000",
    "tier": {
      "shareQ9": "100000"
    },
    "lifetimeEarnedMsat": "100000",
    "earned30dMsat": "100000",
    "claimableMsat": "100000",
    "pendingHoldbackMsat": "100000",
    "claimedMsat": "100000",
    "forfeitedMsat": "100000"
  },
  "bindWindow": {
    "openUntilTsMs": "100000"
  }
}
```

---

### `POST /v1/referral/code`

Create my referral code

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `code` · string · optional

```json
{
  "code": "string"
}
```

**Responses**

- **201**: Created
  - `code` · string · required
  - `createdTsMs` · string · unit `ms` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "code": "string",
  "createdTsMs": "100000"
}
```

---

### `POST /v1/referral/bind`

Bind to a referrer

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `code` · string · required

```json
{
  "code": "string"
}
```

**Responses**

- **200**: OK
  - `bound` · const `true` · required
  - `referredBy` · object · required
    - `code` · string · required
    - `boundTsMs` · string · unit `ms` · required
    - `discountQ9` · string · unit `q9` · required
    - `discountExpiresTsMs` · string · unit `ms` · required
    - `discountVolumeCapMsat` · string \| null · unit `msat` · required
    - `discountVolumeUsedMsat` · string · unit `msat` · required
    - `discountActive` · boolean · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "bound": true,
  "referredBy": {
    "code": "string",
    "boundTsMs": "100000",
    "discountQ9": "100000",
    "discountExpiresTsMs": "100000",
    "discountVolumeCapMsat": "100000",
    "discountVolumeUsedMsat": "100000",
    "discountActive": true
  }
}
```

---

### `GET /v1/referral/earnings`

List referral earnings

**Auth:** API key (`x-api-key`)

**Parameters**

- `limit` (query): string
- `beforeSeq` (query): string

**Responses**

- **200**: OK
  - `earnings` · object[] · required
    - `seq` · string · unit `seq` · required
    - `fillSeq` · string \| null · unit `seq` · required
    - `tsMs` · string · unit `ms` · required
    - `ref` · string \| null · required
    - `grossFeeMsat` · string · unit `msat` · required
    - `netFeeMsat` · string · unit `msat` · required
    - `shareQ9` · string · unit `q9` · required
    - `rewardMsat` · string · unit `msat` · required
    - `status` · enum(`accrued`, `claimed`, `forfeited`) · required
    - `epochDay` · string · unit `ms` · required
    - `code` · string \| null · required
  - `nextBeforeSeq` · string \| null · unit `seq` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "earnings": [
    {
      "seq": "100000",
      "fillSeq": "100000",
      "tsMs": "100000",
      "ref": "string",
      "grossFeeMsat": "100000",
      "netFeeMsat": "100000",
      "shareQ9": "100000",
      "rewardMsat": "100000",
      "status": "accrued",
      "epochDay": "100000",
      "code": "string"
    }
  ],
  "nextBeforeSeq": "100000"
}
```

---

### `GET /v1/referral/referees`

List my referees

**Auth:** API key (`x-api-key`)

**Parameters**

- `limit` (query): string
- `beforeSeq` (query): string

**Responses**

- **200**: OK
  - `referees` · object[] · required
    - `ref` · string · required
    - `boundTsMs` · string · unit `ms` · required
    - `active` · boolean · required
    - `feesContributed30dMsat` · string · unit `msat` · required
    - `earnedFromMsat` · string · unit `msat` · required
    - `rewardWindowEndsTsMs` · string · unit `ms` · required
    - `sunset` · boolean · required
  - `nextBeforeSeq` · string \| null · unit `seq` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "referees": [
    {
      "ref": "string",
      "boundTsMs": "100000",
      "active": true,
      "feesContributed30dMsat": "100000",
      "earnedFromMsat": "100000",
      "rewardWindowEndsTsMs": "100000",
      "sunset": true
    }
  ],
  "nextBeforeSeq": "100000"
}
```

---

### `POST /v1/referral/claim`

Claim referral rewards

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Responses**

- **201**: Created
  - `claimedMsat` · string · unit `msat` · required
  - `accruals` · string · unit `int` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "claimedMsat": "100000",
  "accruals": "100000"
}
```

## Promoter

### `POST /v1/promoter/apply`

Apply as a promoter

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `displayName` · string · required
- `channels` · object[] · required
  - `kind` · string · required
  - `url` · string · required
  - `audience` · string · required
- `plan` · string · required
- `jurisdictions` · string[] · required
- `acceptedTermsVersion` · string · required

```json
{
  "displayName": "string",
  "channels": [
    {
      "kind": "string",
      "url": "string",
      "audience": "string"
    }
  ],
  "plan": "string",
  "jurisdictions": [
    "string"
  ],
  "acceptedTermsVersion": "string"
}
```

**Responses**

- **201**: Created
  - `promoterId` · string · required
  - `status` · const `applied` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "promoterId": "string",
  "status": "applied"
}
```

---

### `GET /v1/promoter`

Get my promoter profile

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **404**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

---

### `GET /v1/promoter/codes`

List promoter codes

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

---

### `POST /v1/promoter/codes`

Create a promoter code

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `code` · string · required
- `label` · string · required
- `kickbackQ9` · string · unit `q9` · required

```json
{
  "code": "string",
  "label": "string",
  "kickbackQ9": "100000"
}
```

**Responses**

- **201**: Created
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

---

### `GET /v1/promoter/stats`

Get promoter stats

**Auth:** API key (`x-api-key`)

**Parameters**

- `days` (query): string

**Responses**

- **200**: OK
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

---

### `GET /v1/promoter/earnings`

List promoter earnings

**Auth:** API key (`x-api-key`)

**Parameters**

- `limit` (query): string
- `beforeSeq` (query): string

**Responses**

- **200**: OK
  - `earnings` · object[] · required
    - `seq` · string · unit `seq` · required
    - `fillSeq` · string \| null · unit `seq` · required
    - `tsMs` · string · unit `ms` · required
    - `ref` · string \| null · required
    - `grossFeeMsat` · string · unit `msat` · required
    - `netFeeMsat` · string · unit `msat` · required
    - `shareQ9` · string · unit `q9` · required
    - `rewardMsat` · string · unit `msat` · required
    - `status` · enum(`accrued`, `claimed`, `forfeited`) · required
    - `epochDay` · string · unit `ms` · required
    - `code` · string \| null · required
  - `nextBeforeSeq` · string \| null · unit `seq` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "earnings": [
    {
      "seq": "100000",
      "fillSeq": "100000",
      "tsMs": "100000",
      "ref": "string",
      "grossFeeMsat": "100000",
      "netFeeMsat": "100000",
      "shareQ9": "100000",
      "rewardMsat": "100000",
      "status": "accrued",
      "epochDay": "100000",
      "code": "string"
    }
  ],
  "nextBeforeSeq": "100000"
}
```

---

### `POST /v1/promoter/claim`

Claim promoter rewards

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Responses**

- **201**: Created
  - `claimedMsat` · string · unit `msat` · required
  - `accruals` · string · unit `int` · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "claimedMsat": "100000",
  "accruals": "100000"
}
```

## Onboarding

### `POST /v1/signup`

Sign up

**Auth:** none (public)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Responses**

- **201**: Created
  - `apiKey` · string · required
  - `accountId` · string · required
  - `railAddress` · string · required
  - `referredBy` · object · optional
    - `code` · string · required
    - `boundTsMs` · string · unit `ms` · required
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **409**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "apiKey": "string",
  "accountId": "string",
  "railAddress": "string",
  "referredBy": {
    "code": "string",
    "boundTsMs": "100000"
  }
}
```

---

### `POST /v1/faucet`

Request test sats

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Responses**

- **201**: Created
  - `creditedMsat` · string · unit `msat` · required
  - `grantsRemainingThisHour` · integer · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **409**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **503**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `201` response:

```json
{
  "creditedMsat": "100000",
  "grantsRemainingThisHour": 0
}
```

## Leaderboard

### `GET /v1/leaderboard`

Get a leaderboard

**Auth:** none (public)

**Parameters**

- `board` (query): enum(`pnl`, `roi`)
- `window` (query): enum(`7d`, `30d`, `all`)
- `limit` (query): string

**Responses**

- **200**: OK
  - `board` · enum(`pnl`, `roi`) · required
  - `window` · enum(`7d`, `30d`, `all`) · required
  - `rows` · object[] · required
    - `rank` · string · unit `int` · required
    - `handle` · string · required
    - `displayName` · string \| null · required
    - `pnlMsat` · string · unit `msat` · required
    - `roiQ9` · string · unit `q9` · required
    - `volumeContracts` · string · unit `contracts` · required
    - `trades` · string · unit `int` · required
    - `winRateQ9` · string \| null · unit `q9` · required
    - `maxDrawdownQ9` · string · unit `q9` · required
  - `computedTsMs` · string \| null · unit `ms` · required
  - `cadenceMinutes` · string · unit `int` · required
  - `gates` · object · required
    - `minEquityMsat` · string · unit `msat` · required
    - `minTrades` · string · unit `int` · required
    - `minVolumeContracts` · string · unit `contracts` · required
  - `windows` · enum(`7d`, `30d`, `all`)[] · optional
  - `testnet` · boolean · required

Example `200` response:

```json
{
  "board": "pnl",
  "window": "7d",
  "rows": [
    {
      "rank": "100000",
      "handle": "string",
      "displayName": "string",
      "pnlMsat": "100000",
      "roiQ9": "100000",
      "volumeContracts": "100000",
      "trades": "100000",
      "winRateQ9": "100000",
      "maxDrawdownQ9": "100000"
    }
  ],
  "computedTsMs": "100000",
  "cadenceMinutes": "100000",
  "gates": {
    "minEquityMsat": "100000",
    "minTrades": "100000",
    "minVolumeContracts": "100000"
  },
  "windows": [
    "7d"
  ],
  "testnet": true
}
```

---

### `GET /v1/leaderboard/me`

Get my placements

**Auth:** API key (`x-api-key`)

**Responses**

- **200**: OK
  - `optedOut` · boolean · required
  - `handle` · string \| null · required
  - `displayName` · string \| null · required
  - `placements` · object[] · required
    - `board` · enum(`pnl`, `roi`) · required
    - `window` · enum(`7d`, `30d`, `all`) · required
    - `rank` · string · unit `int` · required
    - `pnlMsat` · string · unit `msat` · required
    - `roiQ9` · string · unit `q9` · required
    - `volumeContracts` · string · unit `contracts` · required
    - `trades` · string · unit `int` · required
    - `winRateQ9` · string \| null · unit `q9` · required
    - `maxDrawdownQ9` · string · unit `q9` · required
  - `eligibility` · object[] · required
    - `window` · enum(`7d`, `30d`, `all`) · required
    - `eligible` · boolean · required
    - `reason` · enum(`gates_failed`, `insufficient_history`, `coverage_gap`, `window_unserved`) \| null · optional
    - `eligibleAtMs` · string \| null · unit `ms` · optional
    - `checks` · object[] · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "optedOut": true,
  "handle": "string",
  "displayName": "string",
  "placements": [
    {
      "board": "pnl",
      "window": "7d",
      "rank": "100000",
      "pnlMsat": "100000",
      "roiQ9": "100000",
      "volumeContracts": "100000",
      "trades": "100000",
      "winRateQ9": "100000",
      "maxDrawdownQ9": "100000"
    }
  ],
  "eligibility": [
    {
      "window": "7d",
      "eligible": true,
      "reason": "gates_failed",
      "eligibleAtMs": "100000",
      "checks": [
        {
          "gate": "string",
          "ok": true,
          "thresholdMsat": "100000",
          "threshold": "100000",
          "valueMsat": "100000",
          "value": "100000"
        }
      ]
    }
  ]
}
```

---

### `GET /v1/leaderboard/trader/{handle}`

Get a trader profile

**Auth:** none (public)

**Parameters**

- `handle` (path), required: string

**Responses**

- **200**: OK
  - `handle` · string · required
  - `displayName` · string \| null · required
  - `tradingSince` · string \| null · required
  - `placements` · object[] · required
    - `board` · enum(`pnl`, `roi`) · required
    - `window` · enum(`7d`, `30d`, `all`) · required
    - `rank` · string · unit `int` · required
    - `pnlMsat` · string · unit `msat` · required
    - `roiQ9` · string · unit `q9` · required
    - `volumeContracts` · string · unit `contracts` · required
    - `trades` · string · unit `int` · required
    - `winRateQ9` · string \| null · unit `q9` · required
    - `maxDrawdownQ9` · string · unit `q9` · required
  - `equityCurve` · object[] · required
    - `dayTsMs` · string · unit `ms` · required
    - `indexQ9` · string · unit `q9` · required
  - `testnet` · boolean · required

Example `200` response:

```json
{
  "handle": "string",
  "displayName": "string",
  "tradingSince": "string",
  "placements": [
    {
      "board": "pnl",
      "window": "7d",
      "rank": "100000",
      "pnlMsat": "100000",
      "roiQ9": "100000",
      "volumeContracts": "100000",
      "trades": "100000",
      "winRateQ9": "100000",
      "maxDrawdownQ9": "100000"
    }
  ],
  "equityCurve": [
    {
      "dayTsMs": "100000",
      "indexQ9": "100000"
    }
  ],
  "testnet": true
}
```

---

### `GET /v1/leaderboard/trader/{handle}/og.png`

Get a trader's share card

**Auth:** none (public)

**Parameters**

- `handle` (path), required: string

**Responses**

- **200**: OK

---

### `POST /v1/leaderboard/settings`

Update leaderboard settings

**Auth:** API key (`x-api-key`)

**Idempotency key:** `any`: any fresh unique key, reused only to retry the same request

**Parameters**

- `idempotency-key` (header), required: string

**Request body**

- `optedOut` · boolean · optional
- `displayName` · string \| null · optional

```json
{
  "optedOut": true,
  "displayName": "string"
}
```

**Responses**

- **200**: OK
  - `optedOut` · boolean · required
  - `handle` · string \| null · required
  - `displayName` · string \| null · required
  - `placements` · object[] · required
    - `board` · enum(`pnl`, `roi`) · required
    - `window` · enum(`7d`, `30d`, `all`) · required
    - `rank` · string · unit `int` · required
    - `pnlMsat` · string · unit `msat` · required
    - `roiQ9` · string · unit `q9` · required
    - `volumeContracts` · string · unit `contracts` · required
    - `trades` · string · unit `int` · required
    - `winRateQ9` · string \| null · unit `q9` · required
    - `maxDrawdownQ9` · string · unit `q9` · required
  - `eligibility` · object[] · required
    - `window` · enum(`7d`, `30d`, `all`) · required
    - `eligible` · boolean · required
    - `reason` · enum(`gates_failed`, `insufficient_history`, `coverage_gap`, `window_unserved`) \| null · optional
    - `eligibleAtMs` · string \| null · unit `ms` · optional
    - `checks` · object[] · required
- **401**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **403**: A refusal carrying a stable machine `code` (ErrorCode) beside human `error` prose.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional
- **429**: A token bucket is exhausted.
  - `error` · string · required
  - `code` · [`ErrorCode`](#errorcode) · optional

Example `200` response:

```json
{
  "optedOut": true,
  "handle": "string",
  "displayName": "string",
  "placements": [
    {
      "board": "pnl",
      "window": "7d",
      "rank": "100000",
      "pnlMsat": "100000",
      "roiQ9": "100000",
      "volumeContracts": "100000",
      "trades": "100000",
      "winRateQ9": "100000",
      "maxDrawdownQ9": "100000"
    }
  ],
  "eligibility": [
    {
      "window": "7d",
      "eligible": true,
      "reason": "gates_failed",
      "eligibleAtMs": "100000",
      "checks": [
        {
          "gate": "string",
          "ok": true,
          "thresholdMsat": "100000",
          "threshold": "100000",
          "valueMsat": "100000",
          "value": "100000"
        }
      ]
    }
  ]
}
```

## Schemas

Types referenced by the fields above.

### ErrorCode

Enum, one of: `validation`, `unauthorized`, `insufficient_scope`, `compliance_refused`, `session_limit`, `referral_forbidden`, `not_found`, `idempotency_key_reused`, `conflict`, `confirmation_required`, `rate_limited`, `feature_unavailable`, `deposits_halted`, `unavailable`, `internal`, `tvl_cap`, `size_not_whole_contracts`, `insufficient_balance`, `insufficient_margin`, `position_limit`, `oi_cap`, `reduce_only`, `market_halted`, `oracle_stale`, `body_too_large`, `usdhb_capacity`, `usdhb_oracle_stale`, `usdhb_whole_units`, `usdhb_dust`, `usdhb_mints_halted`, `usdhb_requote`, `usdhb_quote_expired`, `token_rail_unavailable`

---

### FundingHistoryEntry

- `tsMs` · string · unit `ms` · required
- `rateQ9` · string · unit `q9` · required
- `skewQ9` · string · unit `q9` · required

---

### OrdersPage

- `orders` · object[] · required
  - `orderId` · string · required
  - `marketId` · string · required
  - `side` · enum(`buy`, `sell`) · required
  - `type` · enum(`market`, `limit`, `stop_market`, `take_profit_market`) · required
  - `contracts` · string · unit `contracts` · required
  - `sizeShares` · string \| null · optional
  - `status` · enum(`accepted`, `filled`, `canceled`, `rejected`) · required
  - `reason` · string \| null · required
  - `heldUntilTsMs` · string \| null · unit `ms` · optional: Set only while the order is held: it is an accepted limit order, on an account that is not under an admin orders block, its market follows the NASDAQ calendar and is outside regular trading hours, and a fill would open or increase exposure against the account's current position. A held order is not evaluated against prices until this instant, the next session open, and is neither filled nor rejected meanwhile. null when the order is not held. Evaluated at the time of the request; no WebSocket frame carries it, so refetch the order when this instant passes.
- `nextBeforeSeq` · string \| null · unit `seq` · required

---

### Position

- `marketId` · string · required
- `side` · enum(`long`, `short`) · required
- `contracts` · string · unit `contracts` · required
- `sizeShares` · string \| null · optional
- `entryPriceQ8` · string · unit `q8` · required: Contract-weighted average execPriceQ8 of the opening fills. Fees and impact are not included in it (they are charged separately on each fill).
- `marginMsat` · string · unit `msat` · required: Not an account movement: a balance, the margin held on this position, including funding already settled into it. Funding accrued since fundingClockTsMs is NOT included yet.
- `fundingClockTsMs` · string · unit `ms` · required: Funding accrues from this time and is not yet in marginMsat. It settles into marginMsat (positive means credited to the account, negative debited) at the next hourly boundary, fill or liquidation.

---

### PublicMarket

- `marketId` · string · required
- `underlying` · string · required
- `contractType` · enum(`inverse`, `quanto`, `linear_sats`) · required
- `oracleFeedId` · string · required
- `quantoMultiplierMsat` · string \| null · unit `msat` · required
- `shareScale` · string \| null · optional
- `status` · enum(`live`, `reduce_only`, `halted`) · required
- `tickSizeQ8` · string · unit `q8` · required
- `priceDp` · string · unit `int` · required
- `minOrderContracts` · string · unit `contracts` · required
- `maxOrderContracts` · string · unit `contracts` · required
- `takerFeeQ9` · string · unit `q9` · required
- `maxLeverage` · string · unit `int` · required
- `imRateQ9` · string · unit `q9` · required
- `mmRateQ9` · string · unit `q9` · required
- `baseSpreadQ9` · string · unit `q9` · required
- `fundingRateHourlyQ9` · string · unit `q9` · required
- `nextFundingTsMs` · string · unit `ms` · required
- `session` · object \| null · optional
- `oracleStalenessMs` · string · unit `ms` · required
- `openInterestContracts` · string · unit `contracts` · required
- `skewQ9` · string · unit `q9` · required
- `lastPrice` · object \| null · required
- `fundingInterestTerm` · enum(`configured`, `none_by_contract_type`) · optional
- `indexSource` · string · optional
- `indexStaleLegs` · enum(`equity`, `btc`, `both`) \| null · optional
- `indexLegTsMs` · object \| null · optional

---

### TriggersPage

- `triggers` · object[] · required
  - `orderId` · string · required
  - `marketId` · string · required
  - `kind` · enum(`entry`, `stop`, `take_profit`) · required
  - `side` · enum(`buy`, `sell`) · required
  - `contracts` · string · unit `contracts` · required
  - `sizeShares` · string \| null · optional
  - `triggerPriceQ8` · string · unit `q8` · required
  - `reduceOnly` · boolean · required
  - `status` · enum(`resting`, `armed`, `blocked`, `executed`, `cancelled`) · required
  - `reason` · string \| null · required
  - `ocoGroup` · string \| null · required
  - `heldUntilTsMs` · string \| null · unit `ms` · optional: Set only while the trigger is held: it is an active entry trigger (resting, armed or blocked), on an account that is not under an admin orders block, and its market is live, follows the NASDAQ calendar and is outside regular trading hours. A held trigger cannot fill before this instant, the next session open. At the first print of that session it is checked again: it arms if the price is still past its level, and fills on the next print at that print's price; otherwise it returns to resting. null when the trigger is not held, including while its market is reduce-only or halted, when no end can be promised. Evaluated at the time of the request; refetch the trigger when this instant passes.
- `nextBeforeSeq` · string \| null · unit `seq` · required
