Skip to main content
POST
/
v2
/
markets
/
{id}
/
buy
curl -X POST https://api.pmx.trade/v2/markets/1/buy \
  -H "Content-Type: application/json" \
  -d '{
    "wallet": "7xKXabc123...",
    "side": "UP",
    "amount": 100000000
  }'
{
  "success": true,
  "data": {
    "transaction": "AQAAAAAAA...base64...",
    "quote": {
      "side": "YES",
      "action": "buy",
      "inputAmount": 100000000,
      "outputAmount": 146500000,
      "effectivePrice": 0.6826,
      "priceImpactBps": 120,
      "tradeFee": 2000000,
      "liquidityFee": 1500000,
      "preOdds": { "yes": 0.50, "no": 0.50 },
      "postOdds": { "yes": 0.65, "no": 0.35 }
    }
  }
}
Returns an unsigned Solana transaction that the caller must sign locally and submit to the network. The API never holds private keys.

Path parameters

id
integer
required
The market ID.

Request body

wallet
string
required
The buyer’s Solana wallet address (public key).
side
string
required
Which outcome to buy. Use the market’s ticker name (e.g. UP, DOWN, FLIP, NOFLIP). The canonical YES/NO values are also accepted.
amount
integer
required
USDC amount to spend in raw units (1 USDC = 1,000,000). Minimum: 100,000 ($0.10).

Response

success
boolean
data
object
curl -X POST https://api.pmx.trade/v2/markets/1/buy \
  -H "Content-Type: application/json" \
  -d '{
    "wallet": "7xKXabc123...",
    "side": "UP",
    "amount": 100000000
  }'
{
  "success": true,
  "data": {
    "transaction": "AQAAAAAAA...base64...",
    "quote": {
      "side": "YES",
      "action": "buy",
      "inputAmount": 100000000,
      "outputAmount": 146500000,
      "effectivePrice": 0.6826,
      "priceImpactBps": 120,
      "tradeFee": 2000000,
      "liquidityFee": 1500000,
      "preOdds": { "yes": 0.50, "no": 0.50 },
      "postOdds": { "yes": 0.65, "no": 0.35 }
    }
  }
}
The side parameter accepts the market’s custom ticker names. For example, if a market uses UP/DOWN tickers, pass "side": "UP" or "side": "DOWN". You can also always use the canonical YES/NO.
Always get a quote first to preview the trade. All amounts are in raw units (6 decimals, matching USDC).
If you attempt to buy on a non-active market (resolved, cancelled), you’ll receive a 409 Conflict response including marketStatus and winningSide (if resolved) so you can handle it without a separate API call.
{
  "success": false,
  "error": "Market is resolved, not active. Cannot trade.",
  "marketStatus": "resolved",
  "winningSide": "YES"
}