Skip to main content
POST
https://api.pmx.trade
/
v2
/
markets
curl -X POST "https://api.pmx.trade/v2/markets" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Will BTC reach $100k by March 2026?",
    "description": "Resolves YES if Bitcoin price reaches $100,000 USD on any major exchange.",
    "end_date": "2026-03-31T23:59:59Z",
    "options": ["Yes", "No"],
    "creator_wallet": "YourWalletPubkey...",
    "initial_liquidity": 600,
    "image_urls": {
      "market": "https://example.com/btc.png"
    },
    "tags": ["crypto", "bitcoin"],
    "category": "crypto"
  }'
{
  "success": false,
  "error": {
    "code": "PAYMENT_REQUIRED",
    "message": "Payment required to create market"
  },
  "payment": {
    "x402Version": 1,
    "accepts": [
      {
        "network": "solana-mainnet",
        "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "amount": "600000000",
        "payTo": "PlatformFundingWallet..."
      }
    ],
    "payTo": "PlatformFundingWallet...",
    "required": {
      "usdc": 600,
      "sol": 0.3
    },
    "optionWallets": {
      "Yes": "YesOptionWallet...",
      "No": "NoOptionWallet..."
    },
    "windowSeconds": 300,
    "expiresAt": "2026-01-15T10:05:00Z"
  },
  "marketId": "uuid-here",
  "slug": "btc-100k-march-2026"
}
Creating a market uses a two-step X.402 payment flow:
  1. Step 1: Submit market details to get payment requirements (returns 402)
  2. Step 2: Complete the payment and submit again with X-PAYMENT header (returns 201)

Request Body

name
string
required
Market title/question (3-200 characters)
description
string
required
Resolution criteria and market details (10-2000 characters)
end_date
string
required
ISO 8601 datetime for market resolution
options
array
required
Array of exactly 2 option names (e.g., ["Yes", "No"])
creator_wallet
string
required
Solana wallet address of the market creator
initial_liquidity
number
default:"600"
USDC amount for initial liquidity (100-10000)
image_urls
object
required
Market images: { market: "url", option1: "url", option2: "url" }
tags
array
Optional array of tags for categorization
category
string
Optional category (e.g., “crypto”, “sports”, “politics”)
slug
string
Optional: Include in second request to match draft market

Step 1: Get Payment Requirements

curl -X POST "https://api.pmx.trade/v2/markets" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Will BTC reach $100k by March 2026?",
    "description": "Resolves YES if Bitcoin price reaches $100,000 USD on any major exchange.",
    "end_date": "2026-03-31T23:59:59Z",
    "options": ["Yes", "No"],
    "creator_wallet": "YourWalletPubkey...",
    "initial_liquidity": 600,
    "image_urls": {
      "market": "https://example.com/btc.png"
    },
    "tags": ["crypto", "bitcoin"],
    "category": "crypto"
  }'
{
  "success": false,
  "error": {
    "code": "PAYMENT_REQUIRED",
    "message": "Payment required to create market"
  },
  "payment": {
    "x402Version": 1,
    "accepts": [
      {
        "network": "solana-mainnet",
        "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "amount": "600000000",
        "payTo": "PlatformFundingWallet..."
      }
    ],
    "payTo": "PlatformFundingWallet...",
    "required": {
      "usdc": 600,
      "sol": 0.3
    },
    "optionWallets": {
      "Yes": "YesOptionWallet...",
      "No": "NoOptionWallet..."
    },
    "windowSeconds": 300,
    "expiresAt": "2026-01-15T10:05:00Z"
  },
  "marketId": "uuid-here",
  "slug": "btc-100k-march-2026"
}

Step 2: Confirm with Payment

After making the USDC + SOL payment to the payTo address:
# Create payment payload
PAYMENT_PAYLOAD=$(echo -n '{
  "x402Version": 1,
  "network": "solana-mainnet",
  "txHash": "YOUR_TX_SIGNATURE",
  "amount": 600,
  "payer": "YourWalletPubkey...",
  "payTo": "PlatformFundingWallet...",
  "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "networkId": "solana-mainnet"
}' | base64)

curl -X POST "https://api.pmx.trade/v2/markets" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-PAYMENT: $PAYMENT_PAYLOAD" \
  -d '{
    "name": "Will BTC reach $100k by March 2026?",
    "description": "Resolves YES if Bitcoin price reaches $100,000 USD on any major exchange.",
    "end_date": "2026-03-31T23:59:59Z",
    "options": ["Yes", "No"],
    "creator_wallet": "YourWalletPubkey...",
    "initial_liquidity": 600,
    "image_urls": {
      "market": "https://example.com/btc.png"
    },
    "slug": "btc-100k-march-2026"
  }'
{
  "success": true,
  "data": {
    "marketId": "uuid-here",
    "slug": "btc-100k-march-2026",
    "status": "creating",
    "message": "Market queued for pool creation",
    "paidUsdc": 600,
    "paidSol": 0.3,
    "transactionHash": "YOUR_TX_SIGNATURE",
    "network": "solana-mainnet",
    "creatorWallet": "YourWalletPubkey..."
  }
}
After creation, the market enters a creating status while the backend worker creates SPL tokens and liquidity pools. The market transitions to live status once ready for trading.