Prediction Router
API Reference

Account

Read balances, positions, and transaction history

All account endpoints require Authorization: Bearer <key> and a connected platform account. Connect one first via POST /v1/platform-accounts.

Every endpoint below accepts an optional account_id query parameter. Pass it to read from a specific connected account; omit it to use that platform's most recently added account.

Base URL: https://prediction-router-api.kalashshah47.workers.dev


GET /v1/account/balance

Get your cash balance on a connected platform.

Query parameters

ParameterTypeRequiredDescription
platformstring✓Platform to query
account_idstringRead from a specific connected account

Example

curl "https://prediction-router-api.kalashshah47.workers.dev/v1/account/balance?platform=kalshi" \
  -H "Authorization: Bearer pr_..."

Response

{
  "balance": {
    "platform": "kalshi",
    "available": 124.50,
    "total": 250.00,
    "currency": "USD"
  }
}

Errors

StatusCodeMeaning
403PLATFORM_NOT_CONNECTEDPlatform credential not found
405UNSUPPORTED_OPERATIONPlatform does not support balance reads

GET /v1/account/positions

Get your open positions on a connected platform.

Query parameters

ParameterTypeRequiredDescription
platformstring✓Platform to query
account_idstringRead from a specific connected account

Example

curl "https://prediction-router-api.kalashshah47.workers.dev/v1/account/positions?platform=kalshi" \
  -H "Authorization: Bearer pr_..."

Response

{
  "positions": [
    {
      "platform": "kalshi",
      "marketId": "KXFED-0625",
      "marketTitle": "KXFED-0625",
      "outcomeId": "yes",
      "outcomeLabel": "Yes",
      "shares": 150.0,
      "avgPrice": 0.45,
      "currentValue": 67.50,
      "unrealizedPnl": 0
    }
  ]
}

Platform notes: Polymarket positions are marked to market (currentValue, unrealizedPnl from Polymarket). Kalshi positions are valued at cost basis: currentValue is what you paid, unrealizedPnl is 0, and marketTitle is the market ticker.


GET /v1/account/history

Get transaction history for a connected platform. Kalshi returns your fills (buy/sell); Polymarket returns trades (buy/sell) and redemptions (winnings).

Query parameters

ParameterTypeRequiredDescription
platformstring✓Platform to query
account_idstringRead from a specific connected account
fromISO 8601 datetimeStart of date range
toISO 8601 datetimeEnd of date range
limitintegerMax results. Default 20, max 100

Example

curl "https://prediction-router-api.kalashshah47.workers.dev/v1/account/history?platform=kalshi&limit=10" \
  -H "Authorization: Bearer pr_..."

Response

{
  "history": [
    {
      "id": "txn_xyz",
      "platform": "kalshi",
      "type": "buy",
      "amount": 25.00,
      "currency": "USD",
      "marketId": "KXFED-0325",
      "marketTitle": "Fed rate cut in March?",
      "timestamp": "2026-06-19T10:00:00.000Z"
    }
  ]
}

Errors

StatusCodeMeaning
403PLATFORM_NOT_CONNECTEDPlatform credential not found
405UNSUPPORTED_OPERATIONPlatform does not support history