Skip to main content
The BlockForecast public REST API exposes prediction market data and trading functionality over standard HTTP. All endpoints live under https://blockforecast.io/api/v2/public/ and require an X-API-Key header. This page documents every endpoint with full parameter descriptions, response field definitions, and working code examples in curl, Python, and TypeScript. If you have not yet obtained an API key, start with Authentication.
All monetary values are returned as floating-point USD (e.g., 18420.50) in the REST API. On-chain, amounts are USDC with 6-decimal precision — keep this in mind if you are reconciling against on-chain data.

GET /public/markets

Returns a paginated, filterable list of prediction markets.

Query parameters

status
string
Filter by market status. One of active, resolved, cancelled. Omit to return all statuses.
category
string
Filter by category slug. Common values: crypto, sports, politics, science, entertainment. Omit to return all categories.
limit
integer
Number of markets to return per page. Maximum 100. Default 20.
offset
integer
Pagination offset. Default 0.
sort
string
Sort order. One of volume_desc (default), created_desc, resolve_asc.

Response fields

markets
array
Array of market objects.
total
integer
Total number of markets matching the query (before pagination).
limit
integer
The effective limit applied.
offset
integer
The effective offset applied.

Examples

curl "https://blockforecast.io/api/v2/public/markets?status=active&category=crypto&limit=5" \
  -H "X-API-Key: $BLOCKFORECAST_API_KEY"
Example response:
{
  "markets": [
    {
      "id": "mkt_01hx9z3kqb8v2wyn4rfpje5d7t",
      "slug": "btc-above-150k-dec-2026",
      "question": "Will BTC close above $150k on Dec 31, 2026?",
      "category": "crypto",
      "status": "active",
      "yesPrice": 0.34,
      "noPrice": 0.66,
      "volume": 18420.50,
      "liquidity": 4100.00,
      "resolveDate": "2026-12-31T23:59:59Z",
      "createdAt": "2026-01-15T10:22:00Z"
    }
  ],
  "total": 142,
  "limit": 5,
  "offset": 0
}

GET /public/markets/:id

Fetches a single market by its ID.

Path parameters

id
string
required
The market ID (with mkt_ prefix) or the market slug. Both are accepted.

Response fields

Returns a single market object with all the fields described in GET /markets, plus:
resolutionCriteria
string
The plain-text criteria the AI oracle uses to resolve the market.
creator
object
Creator metadata.
resolution
object
Present only on resolved markets.

Examples

curl "https://blockforecast.io/api/v2/public/markets/mkt_01hx9z3kqb8v2wyn4rfpje5d7t" \
  -H "X-API-Key: $BLOCKFORECAST_API_KEY"

POST /public/markets

Creates a new prediction market. Requires your wallet to have approved creator status. Apply for creator access — applications are reviewed within 24 hours.

Request body

question
string
required
The market question. Should be phrased as a binary yes/no question. Maximum 280 characters.
description
string
Additional context about the market. Markdown supported. Maximum 2000 characters.
resolutionCriteria
string
required
Clear, unambiguous criteria that define how the market resolves. The AI oracle uses this text. Maximum 1000 characters.
resolveDate
string
required
ISO 8601 date-time for when the market is eligible for resolution (e.g., 2026-12-31T23:59:59Z). Must be at least 1 hour in the future.
category
string
required
Category slug. One of: crypto, sports, politics, science, entertainment, other.

Response fields

Returns the newly created market object with all fields from GET /markets/:id.
id
string
The new market’s unique identifier.
slug
string
The URL slug generated from the question.
status
string
Always active on creation.

Examples

curl -X POST "https://blockforecast.io/api/v2/public/markets" \
  -H "X-API-Key: $BLOCKFORECAST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "Will ETH surpass $10,000 before July 2027?",
    "description": "Tracks ETH/USD price on Coinbase Pro at any point before the resolution date.",
    "resolutionCriteria": "Resolves YES if ETH/USD closes above $10,000 on Coinbase Pro on any day before July 1, 2027. Resolves NO otherwise.",
    "resolveDate": "2027-07-01T00:00:00Z",
    "category": "crypto"
  }'
If your API key’s wallet does not have creator status, this endpoint returns 403 Forbidden with code INSUFFICIENT_PERMISSIONS. Apply at blockforecast.io/apply — the same approval covers both the public API and the x402 Agent API.

GET /public/markets/:id/trades

Returns a paginated list of trades for a specific market, ordered from most recent to oldest.

Path parameters

id
string
required
The market ID or slug.

Query parameters

limit
integer
Number of trades to return. Maximum 100. Default 20.
offset
integer
Pagination offset. Default 0.
side
string
Filter by trade side. One of YES, NO. Omit to return both.

Response fields

trades
array
Array of trade objects.
total
integer
Total number of trades for this market.

Examples

curl "https://blockforecast.io/api/v2/public/markets/mkt_01hx9z3kqb8v2wyn4rfpje5d7t/trades?limit=10" \
  -H "X-API-Key: $BLOCKFORECAST_API_KEY"
Example response:
{
  "trades": [
    {
      "id": "trd_01hz4m7pqk9c3xbn6sgwre2f8v",
      "marketId": "mkt_01hx9z3kqb8v2wyn4rfpje5d7t",
      "side": "YES",
      "shares": 50.0,
      "pricePerShare": 0.341,
      "totalCost": 17.05,
      "traderAddress": "0x1a2b...f9e0",
      "createdAt": "2026-04-27T14:35:12Z"
    }
  ],
  "total": 1204,
  "limit": 10,
  "offset": 0
}

Additional endpoints

The following endpoints are available but covered separately in the authentication and trading documentation:
MethodPathDescription
POST/api/v2/auth/challengeIssue a single-use nonce for a wallet-signed action (issue / revoke / regenerate).
POST/api/v2/auth/tokenExchange a wallet signature + nonce for a bf_… API key.
GET/api/v2/auth/keys?address=List active keys (prefixes only) for a wallet.
POST/api/v2/auth/keys/:id/revokeRevoke a specific key by id.
POST/api/v2/auth/keys/:id/regenerateAtomically rotate — old revoked, new issued.
GET/api/v2/public/markets/:id/priceCurrent LSMR price and price impact for a given quote size.
GET/api/v2/public/markets/:id/historyOHLC price history.
POST/api/v2/public/markets/:id/tradePlace a trade on a market.
GET/api/v2/public/positionsOpen positions for your wallet.
GET/api/v2/public/positions/historyTrade history for your wallet.
GET/api/v2/public/balanceYour USDC balance on BlockForecast.
To create markets programmatically without the manual creator approval flow, see the x402 Agent API — autonomous agents can pay $1 USDC per market with no signup required (creator approval still needed, but the flow is fully programmatic).