The CLOB API and the AMM Trade API are different APIs with different
endpoints, payloads, and semantics. The AMM API lives under
/trade/*; the
CLOB API lives under /v1/*. They are not interchangeable.Base URL
/v1. The realtime gateway is
at wss://api.foresight.now/v1/ws.
Network
The CLOB currently runs on BNB Smart Chain (BSC) mainnet.| Field | Value |
|---|---|
chain_id | 56 |
| Collateral decimals | 18 |
Core concepts
A market is a (condition_id, chain_id) pair
A market is a (condition_id, chain_id) pair
Every CLOB call identifies a market by its on-chain
condition_id
(ConditionalTokens condition hash) plus chain_id. Internal database
identifiers are never exposed.Outcomes and tokens
Outcomes and tokens
Each market has two outcomes:
1 = YES and 0 = NO. Each outcome
maps to an ERC-1155 token_id returned by the /tokens endpoint. You sign
orders against a specific outcome’s token_id.Orders are signed off-chain, matched asynchronously
Orders are signed off-chain, matched asynchronously
You sign an order with your wallet (EIP-712) and
POST it. The API
always returns status: OPEN — matching runs in a background worker.
Matched, partial, and failed transitions arrive on the private user
WebSocket channel, not in the POST response.Prices are 2-decimal probability ticks
Prices are 2-decimal probability ticks
A price is a YES probability in
[0.01, 1.00], quantized to 2 decimal
places (100 ticks). 0.55 means a 55% implied probability. Sub-tick
precision is rejected.Amounts are BigInt, integer-tick math
Amounts are BigInt, integer-tick math
maker_amount and taker_amount are raw token wei (BigInt strings) derived
from integer-tick math — BUY ceils collateral, SELL floors it. Float
arithmetic drifts and gets rejected. See the
Signing orders guide.Authentication tiers
| Tier | Who | Credentials |
|---|---|---|
| L0 | Anyone | None — all market-data routes are public |
| L1 | Logged-in users | Privy JWT (Authorization: Bearer …) — manage API keys |
| L2 | Bots or users | Privy JWT or fs-api-key + fs-api-secret — trading and private reads |
A typical trading flow
Create an API key
With a logged-in Privy JWT, call
POST /v1/auth/api-keys to mint a key with
["read", "trade"] permissions. The secret is shown once.Find a market
GET /v1/markets?chain_id=56 lists open markets. Read ctf_exchange_address
and the outcome token_ids you’ll need to sign.Sign and place an order
Build the EIP-712 order, sign it with your wallet, and
POST /v1/orders.
See Signing orders.Track fills in real time
Get a WS token (
POST /v1/auth/ws-token), connect to /v1/ws, and subscribe
to the user channel for order-lifecycle and fill events. See
WebSocket.Reference
The full interactive endpoint reference is under CLOB API Reference in the sidebar. Continue with:- Authentication — API keys, tiers, permissions
- Signing orders — EIP-712 domain, struct, and amount math
- WebSocket — realtime book, ticker, trades, and user events
- Errors — error envelope and codes