Skip to main content
POST
/
2
/
pm
/
order
/
build
Build prediction market order
curl --request POST \
  --url https://demo-api.mobula.io/api/2/pm/order/build \
  --header 'Content-Type: application/json' \
  --data '
{
  "maker": "<string>",
  "tokenId": "<string>",
  "side": "BUY",
  "price": 123,
  "size": 123,
  "signer": "<string>",
  "isNegRisk": false,
  "feeRateBps": 0,
  "nonce": 0,
  "expiration": 0,
  "tickSize": 123,
  "signatureType": 0
}
'
{
  "data": {
    "typedData": {},
    "tickSize": 123,
    "feeRateBps": 123,
    "safeAddress": "<string>"
  },
  "hostname": "<string>",
  "took": 123
}

Request Body

maker
string
required
Your EOA wallet address. The Safe trading address is derived automatically and returned in safeAddress.
signer
string
Signer address. For Safe wallets (signatureType 2), this is your EOA address. Defaults to maker if not provided.
tokenId
string
required
The outcome token ID to trade.
side
string
required
Order side: BUY or SELL.
price
number
required
Order price (must be greater than 0 and at most 1).
size
number
required
Number of tokens to buy or sell. Must be positive.
isNegRisk
boolean
default:false
Set to true for neg-risk (multi-outcome) markets.
feeRateBps
number
default:0
Fee rate in basis points (0 = no fee).
nonce
number
default:0
Order nonce for replay protection.
expiration
number
default:0
Expiration timestamp in seconds. 0 means no expiration.
tickSize
number
Tick size for rounding. If omitted, uses market default.
signatureType
number
default:0
Signature type. Use 0 for EOA signatures, 2 for EIP-1271 (Safe wallet) signatures.

Response

data
object
Order typed data and metadata.
hostname
string
Server node identifier.
took
number
Request processing time in milliseconds.

Usage Example

curl -X POST "https://api.mobula.io/api/2/pm/order/build" \
  -H "Content-Type: application/json" \
  -d '{
    "maker": "0xYourWalletAddress",
    "tokenId": "71321045533314185944161150504789982525459828614995786377552078351132518100924",
    "side": "BUY",
    "price": 0.35,
    "size": 100,
    "isNegRisk": false
  }'

Integration Example

// 1. Build order
const buildRes = await fetch('https://api.mobula.io/api/2/pm/order/build', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    maker: walletAddress,
    tokenId: outcomeTokenId,
    side: 'BUY',
    price: 0.35,
    size: 100
  })
});
const { data: { typedData } } = await buildRes.json();

// 2. Sign the order
const signature = await walletClient.signTypedData(typedData);

// 3. Submit the signed order (see Order Submit)
The makerAmount and takerAmount in the order message are computed from price and size:
  • BUY: makerAmount = price * size (USDC you pay), takerAmount = size (tokens you receive)
  • SELL: makerAmount = size (tokens you give), takerAmount = price * size (USDC you receive)
Both amounts are in 6-decimal fixed-point format (multiplied by 10^6).
Order endpoints currently support Polymarket only. The platform parameter is not required — all orders are routed to Polymarket’s CLOB on Polygon.

Body

application/json
maker
string
required

Maker wallet address

tokenId
string
required

Outcome token ID

side
enum<string>
required
Available options:
BUY,
SELL
price
number
required

Price (0-1)

size
number
required

Trade size in shares

signer
string

Optional signer address

isNegRisk
boolean
default:false
feeRateBps
number
default:0
nonce
number
default:0
expiration
number
default:0
tickSize
number
signatureType
number
default:0

Response

200 - application/json

Order typed data

data
object
hostname
string
took
number