build/metadata-api/openapi.json.
High-Level Model
Events group one or more markets. Each market has onchain accounts (mints and a ledger), and produces orderbook and trade data. The API does not expose a dedicated “Order” schema; order intent is represented in the orderbook payloads.Example (Red Sox vs Yankees)
Event: “Will the Boston Red Sox win the World Series?”Market: A single YES/NO market under that event.
Orderbook: The current bid/ask ladders for that market.
Trade: Executed trades for that market ticker. In practice:
- You discover the event and its markets.
- You look up market accounts (yes/no mints, ledger).
- You pull orderbook and trade history by market ticker or mint.
Trading Flow (Spot → Outcome Token)
The Trade API/order endpoint can trade
from any spot token to a prediction market outcome token. The transaction
always routes through the settlement mint as an intermediate step:
- Input Token → Settlement Mint
- Settlement Mint → Outcome Token
/order response returns a single transaction that executes both swaps.
Market Initialization Behavior
The Trading API automatically detects whether the market is initialized:- Initialized markets: the two-step swap path executes directly.
- Uninitialized markets: the transaction includes on-demand market tokenization before executing the swap path.
On-demand market tokenization incurs a small fee, which is included in the
transaction when trading into an uninitialized market.
Checking Initialization Status (Optional)
You can checkisInitialized in the market response from the
Markets API, but you
do not need to do this ahead of time, because the Trading API handles it automatically.
Entity Reference
Event (SingleEventResponse)
| Field | Type | Notes |
|---|---|---|
ticker | string | Event ticker |
seriesTicker | string | Series identifier |
title | string | Event title |
subtitle | string | Event subtitle |
competition | string | null | Competition name |
competitionScope | string | null | Scope of competition |
imageUrl | string | null | Image URL |
liquidity | integer | null | Aggregate liquidity |
openInterest | integer | null | Aggregate open interest |
volume | integer | null | Total volume |
volume24h | integer | null | 24h volume |
strikeDate | integer | null | Unix timestamp |
strikePeriod | string | null | Strike period label |
settlementSources | array | null | Settlement sources |
markets | array | null | Array of markets (if included) |
| Field | Type | Notes |
|---|---|---|
name | string | Source name |
url | string | Source URL |
Market (SingleMarketResponse)
| Field | Type | Notes |
|---|---|---|
ticker | string | Market ticker |
eventTicker | string | Parent event ticker |
marketType | string | Market type |
title | string | Market title |
subtitle | string | Market subtitle |
yesSubTitle | string | YES outcome label |
noSubTitle | string | NO outcome label |
openTime | integer | Unix timestamp |
closeTime | integer | Unix timestamp |
expirationTime | integer | Unix timestamp |
status | string | Market status |
result | string | Resolution outcome |
volume | integer | Market volume |
openInterest | integer | Market open interest |
canCloseEarly | boolean | Early close enabled |
earlyCloseCondition | string | null | Early close condition |
rulesPrimary | string | Primary rules |
rulesSecondary | string | null | Secondary rules |
yesBid | string | null | Best bid (YES) |
yesAsk | string | null | Best ask (YES) |
noBid | string | null | Best bid (NO) |
noAsk | string | null | Best ask (NO) |
accounts | object | Map of account info |
| Field | Type | Notes |
|---|---|---|
marketLedger | string | Market ledger mint |
yesMint | string | YES outcome mint |
noMint | string | NO outcome mint |
isInitialized | boolean | Account initialized |
redemptionStatus | string | null | Redemption state |
scalarOutcomePct | integer | null | Scalar outcome % |
Trade (SingleTradeResponse)
| Field | Type | Notes |
|---|---|---|
tradeId | string | Trade identifier |
ticker | string | Market ticker |
price | integer | Price (0-10000 scale) |
count | integer | Quantity |
yesPrice | integer | YES price |
noPrice | integer | NO price |
yesPriceDollars | string | YES price in dollars |
noPriceDollars | string | NO price in dollars |
takerSide | string | Buyer/seller side |
createdTime | integer | Unix timestamp |
Orderbook
Orderbook responses include a sequence number and bid ladders for YES and NO. Each ladder is a map of price strings (4‑decimal probability) to size integers.| Field | Type | Notes |
|---|---|---|
sequence | integer | Monotonic sequence id |
yes_bids | object | Map of price → size |
no_bids | object | Map of price → size |
GET /api/v1/orderbook/{market_ticker}GET /api/v1/orderbook/by-mint/{mint_address}
Need Help?
Join Our Discord
Connect with other developers, get help, and stay updated on the latest
DFlow developments.
Dev Notifications
Join the DFlow Dev Notifications Telegram group to stay in the loop on
new features and other announcements.