{
  "openapi": "3.0.1",
  "info": {
    "title": "Prediction Markets Scraper – Kalshi + Polymarket Odds & Prices",
    "description": "Kalshi + Polymarket markets in one table: odds, bid/ask, volume, result. Price history for both (Kalshi since 2021, Polymarket since 2024), candlesticks, order book depth, trades, Polymarket comments and top holders. Politics, sports, crypto, economics, weather. Public APIs. Pay per record.",
    "version": "0.5",
    "x-build-id": "pbLPCWRTM35PZIOtf"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/gratified_ashram~prediction-markets-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-gratified_ashram-prediction-markets-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/gratified_ashram~prediction-markets-scraper/runs": {
      "post": {
        "operationId": "runs-sync-gratified_ashram-prediction-markets-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/gratified_ashram~prediction-markets-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-gratified_ashram-prediction-markets-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "platforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Which exchanges to pull from. Both by default.",
            "items": {
              "type": "string",
              "enum": [
                "kalshi",
                "polymarket"
              ],
              "enumTitles": [
                "Kalshi",
                "Polymarket"
              ]
            },
            "default": [
              "kalshi",
              "polymarket"
            ]
          },
          "status": {
            "title": "Market status",
            "enum": [
              "open",
              "settled",
              "both"
            ],
            "type": "string",
            "description": "Open = currently tradeable markets with live prices. Settled = resolved markets with results (Kalshi: within the lookback window, up to 5 years back; Polymarket: most recently ended first). Both = open then settled.",
            "default": "open"
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Keep only markets whose question, event title or ticker contains any of these words (case-insensitive). Empty = keep everything.",
            "items": {
              "type": "string"
            }
          },
          "categories": {
            "title": "Categories",
            "type": "array",
            "description": "Keep only markets whose category or tag contains any of these words, e.g. politics, sports, crypto, economics, weather, entertainment, science. Matches Kalshi categories and Polymarket tags.",
            "items": {
              "type": "string"
            }
          },
          "minVolume": {
            "title": "Minimum total volume (USD / contracts)",
            "type": "integer",
            "description": "Drop markets with less lifetime volume than this. Useful to skip toy markets.",
            "default": 0
          },
          "minLiquidity": {
            "title": "Minimum liquidity (USD)",
            "type": "integer",
            "description": "Drop markets with thinner books than this.",
            "default": 0
          },
          "maxItems": {
            "title": "Maximum records",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard cap on records pushed to the dataset per run. Controls cost: 1,000 records = $1.",
            "default": 500
          },
          "includeOrderbook": {
            "title": "Attach order book depth (top 10 levels)",
            "type": "boolean",
            "description": "Adds the top 10 bid/ask levels per open market (one extra API call per market, slower, +$1 per 1,000 order books). Kalshi: yes and no bids. Polymarket: yes-token bids and asks.",
            "default": false
          },
          "lookbackDays": {
            "title": "Settled lookback (days, Kalshi) — up to 5 years",
            "minimum": 1,
            "maximum": 1825,
            "type": "integer",
            "description": "For status = settled/both: how many days back of Kalshi settlements to pull (by close time). 1–1825. Beyond the live window (~3 months) markets come from Kalshi's public /historical archive, which reaches back to July 2021 and carries result and expiration value. Same record format.",
            "default": 7
          },
          "settledAfter": {
            "title": "Settled after (Kalshi)",
            "type": "string",
            "description": "Optional start of the settled window by close time, ISO date (2022-06-01) or unix seconds. Overrides lookbackDays. Use with settledBefore to pull one slice of the 2021–today archive instead of always starting from today (results are newest first)."
          },
          "settledBefore": {
            "title": "Settled before (Kalshi)",
            "type": "string",
            "description": "Optional end of the settled window by close time, ISO date or unix seconds. Default: now."
          },
          "candlesticks": {
            "title": "Candlesticks / price history",
            "enum": [
              "none",
              "1m",
              "1h",
              "1d"
            ],
            "type": "string",
            "description": "Attach price history to every market record. Kalshi: OHLC candlesticks from the public archive back to 2021 (1-minute, hourly or daily). Polymarket: the yes-token price series from the CLOB (daily = whole life in one call, hourly and 1-minute in 15-day chunks back to 2024), only the close field is filled. No extra charge.",
            "default": "none"
          },
          "maxCandlesPerMarket": {
            "title": "Max candles per market",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard cap on candles attached to one record (default 5,000 = one API call). When a market has more, the most recent candles are kept and candlesTruncated is true. A 1-minute series over a month is ~43,000 candles; raise this only if you need it.",
            "default": 5000
          },
          "candlesFrom": {
            "title": "Candles from",
            "type": "string",
            "description": "Optional start of the candle window, ISO date (2024-11-01) or unix seconds. Default: the market's open time."
          },
          "candlesTo": {
            "title": "Candles to",
            "type": "string",
            "description": "Optional end of the candle window, ISO date or unix seconds. Default: the market's close time (or now for open markets)."
          },
          "includeTrades": {
            "title": "Attach trades",
            "type": "boolean",
            "description": "Attach the most recent trades of each market as a trades array. Kalshi: time, yes/no price, contracts, taker side, back to 2021 via the historical trade tape. Polymarket: time, side, outcome, price, size, wallet, tx hash from the public Data API. One or more extra API calls per market; no extra charge.",
            "default": false
          },
          "maxTradesPerMarket": {
            "title": "Max trades per market",
            "minimum": 1,
            "maximum": 20000,
            "type": "integer",
            "description": "Cap on trades attached to one record (default 1,000 = one API call; tradesTruncated flags when more exist).",
            "default": 1000
          },
          "excludeMultiLeg": {
            "title": "Exclude Kalshi multi-leg (parlay) markets",
            "type": "boolean",
            "description": "Kalshi lists thousands of auto-generated parlay combinations (KXMVE…). They are excluded by default because they drown out real markets.",
            "default": true
          },
          "kalshiSeriesTickers": {
            "title": "Kalshi series tickers",
            "type": "array",
            "description": "Restrict Kalshi to specific series. Exact tickers (KXBTC, KXFED, KXNBA) or a prefix with a trailing * that expands to every matching series: KXHIGH* = all daily-high temperature cities, KXLOW* = all daily-low cities (add category \"weather\" to exclude the Lowe's earnings series KXLOW). Empty = all series.",
            "items": {
              "type": "string"
            }
          },
          "polymarketTagIds": {
            "title": "Polymarket tag IDs",
            "type": "array",
            "description": "Restrict Polymarket to tag IDs from https://gamma-api.polymarket.com/tags (e.g. 2 = politics, 100639 = crypto). Empty = all markets, sorted by 24h volume. Prefer the Categories filter above unless you need a precise tag.",
            "items": {
              "type": "string"
            }
          },
          "polymarketSortBy": {
            "title": "Polymarket order",
            "enum": [
              "volume24hr",
              "volume",
              "liquidity",
              "commentCount"
            ],
            "type": "string",
            "description": "Which Polymarket markets come first when maxItems cuts the list: by 24-hour volume (default), total volume, liquidity or number of comments (most discussed first).",
            "default": "volume24hr"
          },
          "includeComments": {
            "title": "Attach comments (Polymarket)",
            "type": "boolean",
            "description": "Attach the comment thread of each Polymarket market's event: body, wallet, display name, time, reactions, replies (parentCommentId), newest first. Fetched once per event; other markets of the same event carry commentsAttachedTo instead. Every record also has commentCount. No extra charge.",
            "default": false
          },
          "maxCommentsPerEvent": {
            "title": "Max comments per event",
            "minimum": 1,
            "maximum": 20000,
            "type": "integer",
            "description": "Cap on comments (top-level plus replies) attached to one event (default 500 ≈ 2–5 API calls; commentsTruncated flags when more exist). Hard stop near 5,000 top-level comments.",
            "default": 500
          },
          "includeHolders": {
            "title": "Attach top holders (Polymarket)",
            "type": "boolean",
            "description": "Attach the largest positions per outcome from Polymarket's public data API: wallet, display name, shares, outcome. One extra API call per market, works for settled markets too. No extra charge.",
            "default": false
          },
          "maxHoldersPerOutcome": {
            "title": "Top holders per outcome",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many of the largest holders to list for each outcome (default 20, up to 100).",
            "default": 20
          },
          "language": {
            "title": "Market text language (Kalshi)",
            "enum": [
              "en",
              "es",
              "pt"
            ],
            "type": "string",
            "description": "Kalshi serves market titles and rules in Spanish or Portuguese as well as English. Polymarket is English only.",
            "default": "en"
          },
          "archiveDatasetName": {
            "title": "Archive dataset name",
            "type": "string",
            "description": "Also append every record to a named dataset in your account (e.g. kalshi-weather-history). Run on a schedule and the dataset becomes a price and settlement history that outlives Kalshi's ~68-day API window. No extra charge; the dataset is yours."
          },
          "archiveOnly": {
            "title": "Archive only",
            "type": "boolean",
            "description": "With an archive dataset set: write only to the archive, not to this run's dataset. Halves storage writes on scheduled runs. Records are still charged.",
            "default": false
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}