Skip to main content
Fetch detailed information for a specific prediction market, including optional price history and recent trades.

Endpoint

GET https://app.kash.bot/api/markets/{id}

Path Parameters

id
string
required
The unique market identifier

Query Parameters

history
boolean
default:"false"
Include price history snapshots (up to 100 data points)
trades
boolean
default:"false"
Include recent trades
trades_limit
number
default:"20"
Number of recent trades to return (max: 100). Only applies when trades=true

Response

market
object
Complete market details
priceHistory
array
Price history snapshots (only included if history=true)
recentTrades
array
Recent trades (only included if trades=true)

Rate Limit

100 requests per minute per IP address

Example Request

curl "https://app.kash.bot/api/markets/abc123"

Example Response

200 - Success
{
  "market": {
    "id": "abc123",
    "question": "Will BTC hit $100k by end of 2025?",
    "description": "Resolves YES if Bitcoin reaches $100,000 USD on any major exchange before December 31, 2025",
    "probability": 0.72,
    "yesPrice": 0.72,
    "noPrice": 0.28,
    "totalVolume": 1250000,
    "tradeCount": 450,
    "status": "OPEN",
    "endTime": 1735689600000,
    "category": "crypto",
    "createdAt": "2024-01-01T00:00:00Z",
    "sourceTweetUrl": "https://x.com/kash_bot/status/123456789"
  },
  "_meta": {
    "requestedAt": "2025-01-15T12:00:00Z",
    "includes": {
      "history": false,
      "trades": false,
      "tradesCount": 0
    }
  }
}
200 - With History & Trades
{
  "market": {
    "id": "abc123",
    "question": "Will BTC hit $100k by end of 2025?",
    "probability": 0.72,
    "priceHistory": [
      { "timestamp": 1705320000000, "probability": 0.72 },
      { "timestamp": 1705233600000, "probability": 0.68 },
      { "timestamp": 1705147200000, "probability": 0.65 }
    ]
  },
  "priceHistory": [
    { "timestamp": "2025-01-15T12:00:00Z", "price": 0.72, "probability": 0.72, "volume": 1250000 },
    { "timestamp": "2025-01-14T12:00:00Z", "price": 0.68, "probability": 0.68, "volume": 1100000 }
  ],
  "recentTrades": [
    { "id": "trade-1", "side": "YES", "amount": 5000, "price": 0.72, "timestamp": "2025-01-15T11:30:00Z" },
    { "id": "trade-2", "side": "NO", "amount": 2500, "price": 0.28, "timestamp": "2025-01-15T11:15:00Z" }
  ],
  "_meta": {
    "requestedAt": "2025-01-15T12:00:00Z",
    "includes": {
      "history": true,
      "trades": true,
      "tradesCount": 2
    }
  }
}
404 - Market Not Found
{
  "error": "Market not found"
}

Use Cases

Display Market Details

async function displayMarket(marketId) {
  const res = await fetch(`https://app.kash.bot/api/markets/${marketId}`);
  const { market } = await res.json();
  
  return {
    title: market.question,
    probability: `${(market.probability * 100).toFixed(0)}% YES`,
    volume: `$${(market.totalVolume / 100).toLocaleString()}`,
    status: market.status
  };
}

Build a Price Chart

async function getChartData(marketId) {
  const res = await fetch(`https://app.kash.bot/api/markets/${marketId}?history=true`);
  const { priceHistory } = await res.json();
  
  return priceHistory.map(point => ({
    x: new Date(point.timestamp),
    y: point.probability * 100
  }));
}