Skip to main content

Overview

Mobula’s Prediction Markets APIs provide a complete interface to interact with prediction markets (currently supporting Polymarket on Polygon):

Market Data

Read Markets
  • Market details & prices
  • OHLCV candlesticks
  • Order book depth
  • Trade history
  • Live short-duration markets

Search & Discovery

Find Markets
  • Full-text search
  • Trending markets
  • Category browsing
  • Volume/liquidity filters

Execution

Trade Markets
  • Account setup & auth
  • Order building & signing
  • Order submission
  • Deposits, withdrawals & redemptions

How It Works

Prediction markets let users trade on the outcome of real-world events. Each market has outcomes (e.g., “Yes” / “No”) represented as conditional tokens priced between 0and0 and 1. If your predicted outcome occurs, your tokens are redeemable for $1 each.

Architecture

Your App → Mobula PM API → Polymarket CLOB (Polygon)
Mobula abstracts the complexity of interacting with Polymarket’s Central Limit Order Book (CLOB):
  • EIP-712 typed data is built server-side — you only need to sign
  • Account deployment (Safe wallet) is handled via simple build/submit endpoints
  • Token approvals are pre-built as ready-to-send calldata
  • Order matching goes through Polymarket’s CLOB for best execution

Trading Flow

1

Setup Account

Check if your wallet has a deployed Safe account via GET /api/2/wallet/pm/status. If not, deploy one using the /api/2/pm/deploy/build and /api/2/pm/deploy/submit endpoints.
2

Authenticate

Build auth typed data via POST /api/2/pm/auth/build, sign it with your wallet, then derive CLOB API credentials via POST /api/2/pm/auth/derive.
3

Approve Tokens

Build approval transactions via POST /api/2/pm/approval/build and submit them on-chain. This allows the exchange contracts to transfer your USDC and conditional tokens.
4

Place Orders

Build an order via POST /api/2/pm/order/build, sign the returned EIP-712 typed data, then submit via POST /api/2/pm/order/submit.

Data Conventions

  • Dates (creation, end, resolution): ISO 8601 strings with Z suffix (e.g., "2026-03-15T10:30:00.000Z")
  • Timestamps (trade events, price snapshots, candles): Unix milliseconds as number (e.g., 1709913600000)
  • Monetary values: Always suffixed with USD (e.g., volume24hUSD, liquidityUSD, amountUSD)
  • Probabilities: priceUSD field, range 0 to 1 (consistent USD suffix convention)

Supported Platforms

PlatformChainStatus
PolymarketPolygon (137)Live

API Endpoints

Market Details

Get full details for a specific market.

Search Markets

Search and filter prediction markets.

Market OHLCV

Get candlestick price data for an outcome.

Order Build

Build an order for signing.
Getting Started: You can query market data endpoints using demo-api.mobula.io without signup. For execution endpoints, generate a free API key to use api.mobula.io.
PM endpoints follow the same conventions as the spot API: authentication, rate limiting, and data response envelope. WebSocket streams require a Growth or Enterprise plan.

Error Responses

All PM endpoints return errors in the standard NestJS format:
Status CodeMeaning
400Bad Request — invalid or missing parameters
401Unauthorized — missing or invalid API key
404Not Found — market or resource does not exist
429Too Many Requests — rate limit exceeded
500Internal Server Error
502Bad Gateway — upstream platform (e.g., Polymarket CLOB) is unavailable
Error response body:
{
  "error": "Missing required parameter: marketId",
  "statusCode": 400
}