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

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

Response fields

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

Examples

Example response:

GET /public/markets/:id

Fetches a single market by its numeric ID, ticker ID, or slug.

Path parameters

string
required
The market’s numeric id (e.g., 781), tickerId (e.g., BF-0781), or slug. All three are accepted.

Response fields

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

Examples


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

string
required
The market question. Should be phrased as a binary yes/no question. Maximum 280 characters.
string
Additional context about the market. Markdown supported. Maximum 2000 characters.
string
required
Clear, unambiguous criteria that define how the market resolves. The AI oracle uses this text. Maximum 1000 characters.
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.
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.
integer
The new market’s numeric identifier.
string
The URL slug generated from the question.
string
Always open on creation.

Examples

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

string
required
The market ID or slug.

Query parameters

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

Response fields

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

Examples

Example response:

Additional endpoints

The following endpoints are available but covered in detail in Authentication. The auth flow is two-step/auth/challenge must be called before /auth/token:
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).