API Reference
Markets API
Endpoints for listing and querying markets
Markets API
GET /api/markets
List markets with filters.
Query
state: Active | Ended | Resolved | Invalid | allcategory: Crypto | Sports | Weather | Politics | Finance | Other | allsortBy: volume | created | ending | betslimit,offset
Example
GET /api/markets?state=Active&limit=20Response
{
"success": true,
"markets": [
{
"id": "1",
"question": "Will BTC reach $100k by end of 2025?",
"category": "Crypto",
"state": "Active",
"yes_pool": "5000000000000000000",
"no_pool": "3000000000000000000",
"volume": "8000000000000000000",
"odds": { "yes": 62.5, "no": 37.5 },
"roi": { "yes": 28.0, "no": 66.67 },
"bet_count": 42,
"participant_count": 15,
"created_at": "2025-10-28T12:00:00Z",
"end_time": "2025-11-15T12:00:00Z"
}
],
"total": 125,
"limit": 20,
"offset": 0
}GET /api/markets/:id
Get one market by ID.
Example
GET /api/markets/1Response
{
"success": true,
"market": {
"id": "1",
"question": "Will BTC reach $100k in 2025?",
"creator": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"category": "Crypto",
"state": "Active",
"yes_pool": "5000000000000000000",
"no_pool": "3000000000000000000",
"volume": "8000000000000000000",
"odds": { "yes": 62.5, "no": 37.5 },
"roi": { "yes": 28.0, "no": 66.67 },
"created_at": "2025-10-07T12:00:00Z",
"end_time": "2025-10-08T12:00:00Z"
}
}GET /api/markets/:id/bets
List bets for a market.
Query
limit,offset,outcome
Example
GET /api/markets/1/bets?limit=20&outcome=trueResponse
{
"success": true,
"bets": [
{
"id": "abc-123-def",
"market_id": "1",
"user_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"outcome": true,
"amount": "1000000000000000000",
"odds": 62.5,
"timestamp": 1696700400000
}
],
"total": 42
}