Quickstart

Go from zero to your first order in three steps. The read endpoints are public — you only need a key to trade.

Tip: start on the play sandbox

Examples below use the live host. For risk-free development, run them against the free play-money environment at api-play.majjha.com instead — same API, play balance. See Environments.

1. Fetch open markets

No authentication is required for market data. List active markets with a simple GET:

cURL
curl "https://api.majjha.com/api/markets?status=ACTIVE&limit=5"

Each market has a tickeryou'll use to read its order book and place orders.

2. Get an API key

Trading endpoints authenticate with a Bearer token. majjha issues service API keys prefixed with pmx_. Keep your key secret — it carries the full permissions of its account.

Where keys come from

API keys are minted by an administrator (or self-serve in the dashboard once enabled). See Authentication for the full flow and the JWT alternative.
Set your key
export PMX_API_KEY="pmx_your_key_here"

3. Place an order

Submit a limit order to buy 100 YES contracts at $0.54. Prices are dollars per contract between 0.01 and 0.99; a winning contract settles at 1.00.

cURL
curl -X POST "https://api.majjha.com/api/portfolio/orders" \
  -H "Authorization: Bearer $PMX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "ticker": "BTC-5MIN-25JUN04T0900-Y",
    "side": "yes",
    "action": "buy",
    "count": 100,
    "price": 0.54,
    "time_in_force": "GTC"
  }'

The response echoes the order with any immediate fills:

200 OK
{
  "order_id": "ord_a1b2c3",
  "ticker": "BTC-5MIN-25JUN04T0900-Y",
  "side": "yes",
  "price": "0.54",
  "count": "100",
  "fill_count": "40",
  "remaining_count": "60",
  "average_fill_price": "0.54",
  "status": "PARTIAL"
}

Next steps

That's the core loop. From here, stream live prices over the WebSocket, track open positions via the Portfolio endpoints, and learn how pagination works for large result sets.