Basemarket API Reference
Full API reference for Basemarket market data, trade operations, signing flow, and dashboard data.
All monetary values are micro-USDC strings (6 decimals). Public market and health endpoints are open; wallet-scoped trade endpoints enforce wallet and access checks.
Base API URL: https://api.basemarket.fun
Authentication & Signing
Buy orders use USDC EIP-3009 signatures. Sell orders use claim-transfer typed signatures against the orderbook contract.
TypeScript: build buy authorization
TypeScript (ethers v6)
import { ethers } from "ethers";
const domain = {
name: "USD Coin",
version: "2",
chainId: 8453,
verifyingContract: USDC_ADDRESS,
};
const types = {
TransferWithAuthorization: [
{ name: "from", type: "address" },
{ name: "to", type: "address" },
{ name: "value", type: "uint256" },
{ name: "validAfter", type: "uint256" },
{ name: "validBefore", type: "uint256" },
{ name: "nonce", type: "bytes32" },
],
};
const message = {
from: maker,
to: ORDERBOOK_ADDRESS,
value: usdcAmountMicro,
validAfter: 0,
validBefore: Math.floor(Date.now() / 1000) + 300,
nonce: ethers.hexlify(ethers.randomBytes(32)),
};
const signature = await signer.signTypedData(domain, types, message);
Python: build buy authorization
Python (eth-account)
from eth_account import Account
from eth_account.messages import encode_typed_data
import secrets, time
typed_data = {
"types": {
"EIP712Domain": [
{"name":"name","type":"string"},
{"name":"version","type":"string"},
{"name":"chainId","type":"uint256"},
{"name":"verifyingContract","type":"address"},
],
"TransferWithAuthorization": [
{"name":"from","type":"address"},
{"name":"to","type":"address"},
{"name":"value","type":"uint256"},
{"name":"validAfter","type":"uint256"},
{"name":"validBefore","type":"uint256"},
{"name":"nonce","type":"bytes32"},
],
},
"primaryType": "TransferWithAuthorization",
"domain": {
"name": "USD Coin",
"version": "2",
"chainId": 8453,
"verifyingContract": USDC_ADDRESS,
},
"message": {
"from": MAKER,
"to": ORDERBOOK_ADDRESS,
"value": int(USDC_AMOUNT_MICRO),
"validAfter": 0,
"validBefore": int(time.time()) + 300,
"nonce": "0x" + secrets.token_hex(32),
},
}
msg = encode_typed_data(full_message=typed_data)
sig = Account.sign_message(msg, PRIVATE_KEY).signature.hex()
Market API
GET/api/market/snapshot
Returns current event/market context, orderbooks, and live BTC metadata.
Request
curl https://api.basemarket.fun/api/market/snapshot
Live Response (sample)
{
"current": {
"event": { "id": "event-389", "ticker": "BTC5M-389", "active": true },
"market": { "id": "round-389", "question": "Will BTC close up in this 5 minute window?" },
"tokenIds": ["YES", "NO"],
"orderbook": { "up": { "asset_id": "YES" }, "down": { "asset_id": "NO" } }
},
"events": [],
"btcPrice": "…",
"priceToBeat": "…"
}
Click "Try it" to fetch live JSON.
GET/api/market/orderbook?outcome=YES
Request
curl "https://api.basemarket.fun/api/market/orderbook?outcome=YES"
Live Response
{
"market": "basemarket",
"asset_id": "YES",
"timestamp": "2026-02-28T17:35:55.296Z",
"bids": [],
"asks": [{ "price": "0.500000", "size": "5000000" }],
"min_order_size": "1",
"tick_size": "0.0001"
}
Click "Try it" to fetch live JSON.
GET/api/market/events
Request
curl https://api.basemarket.fun/api/market/events
Live Response (sample)
{
"events": [
{
"type": "SELL_PLACED",
"orderId": 790,
"outcome": "NO",
"amountMicro": "5000000",
"priceMicro": "500000",
"roundId": 389
}
],
"rounds": [389, 388],
"hasMore": true,
"nextCursorRoundId": 388
}
Click "Try it" to fetch live JSON.
Trade API
POST/api/trade/buy
Places a buy using USDC transfer authorization (EIP-3009 typed signature).
Request Body (example)
{
"maker": "0xYourWallet",
"outcome": "YES",
"isMarket": false,
"limitPrice": "500000",
"usdcAmount": "5000000",
"auth": {
"validAfter": "0",
"validBefore": "1772301000",
"nonce": "0x...",
"signature": "0x..."
}
}
POST/api/trade/sell
Places a sell using claim transfer authorization (BasemarketClaims typed signature).
Claim typed data fields
ClaimTransferWithAuthorization: [
{ name: "from", type: "address" },
{ name: "to", type: "address" },
{ name: "outcome", type: "uint8" }, // YES=0, NO=1
{ name: "roundId", type: "uint64" },
{ name: "value", type: "uint256" },
{ name: "validAfter", type: "uint256" },
{ name: "validBefore", type: "uint256" },
{ name: "nonce", type: "bytes32" }
]
GET/api/trade/access-status?address=...
Request
curl "https://api.basemarket.fun/api/trade/access-status?address=0x926947ffddae36992c2365c03394c6373d4f5529"
Live Response
{
"connected": false,
"eligible": false,
"message": "Connect your wallet to use this platform"
}
GET/api/trade/current-round
Request
curl https://api.basemarket.fun/api/trade/current-round
Live Response
{ "currentRound": "389" }
Click "Try it" to fetch live JSON.
Dashboard API
GET/api/dashboard/state?user=...
Returns composed dashboard data (market + trade + lp + generatedAt). Requires user context.
Sample keys from live payload
{
"market": { "...": "..." },
"trade": { "...": "..." },
"lp": { "...": "..." },
"generatedAt": "2026-02-28T17:39:14.718Z"
}
GET/api/dashboard/all-trade-history?limitRounds=2
Live summary
{
"rounds": [389, 388],
"events_count": 4,
"hasMore": true,
"nextCursorRoundId": 388
}
Click "Try it" to fetch live JSON.
Health
GET/api/health
Request
curl https://api.basemarket.fun/api/health
Live Response
{
"status": "ok",
"service": "basemarket-api",
"timestamp": "2026-02-28T17:35:53.958Z"
}
Click "Try it" to fetch live JSON.