{
  "openapi": "3.0.1",
  "info": {
    "title": "Kalshi & Polymarket Election Odds History Scraper",
    "description": "The whole odds history of settled Kalshi and Polymarket election markets: daily or hourly candles with bid/ask, volume and open interest, every candidate and the result. 2024, 2026 and live 2028 races.",
    "version": "0.0",
    "x-build-id": "OBxTQd7dKUzPK6JU8"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapebench~kalshi-election-odds-history-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapebench-kalshi-election-odds-history-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/scrapebench~kalshi-election-odds-history-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapebench-kalshi-election-odds-history-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/scrapebench~kalshi-election-odds-history-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapebench-kalshi-election-odds-history-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": {
          "queries": {
            "title": "Keywords (any of)",
            "type": "array",
            "description": "Races to pull, as words in the race's title: 'arizona senate', 'oregon governor', 'presidential election winner'. Every word must appear. Kalshi is matched on its election series titles, Polymarket through its own search. Polymarket is only read when you give a keyword.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "query": {
            "title": "Keyword",
            "type": "string",
            "description": "One keyword. Kept alongside 'Keywords' for saved tasks and API callers."
          },
          "seriesTickers": {
            "title": "Kalshi series tickers",
            "type": "array",
            "description": "Exact Kalshi series, e.g. SENATEAZ, GOVPARTYOR, HOUSEPA7, SENATENM. One series holds every cycle of that race (2024, 2026, 2028...).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "seriesTicker": {
            "title": "Kalshi series ticker",
            "type": "string",
            "description": "One series ticker. Kept alongside 'Kalshi series tickers' for saved tasks and API callers."
          },
          "tags": {
            "title": "Kalshi tags",
            "type": "array",
            "description": "Every Kalshi election series carrying any of these tags: Senate, House, Governor, Primaries, US Elections, Referendums, Local, 2028, International. Broad: combine with 'Cycle' and 'Maximum races per venue'.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "venues": {
            "title": "Venues",
            "enum": [
              "both",
              "kalshi",
              "polymarket"
            ],
            "type": "string",
            "description": "Kalshi, Polymarket or both. Both returns the same race from each venue as separate rows with a 'venue' field.",
            "default": "both"
          },
          "cycle": {
            "title": "Cycle",
            "enum": [
              "any",
              "2024",
              "2025",
              "2026",
              "2027",
              "2028"
            ],
            "type": "string",
            "description": "Election year. Kalshi's year comes from the race ticker (SENATEAZ-24), Polymarket's from the market's end date.",
            "default": "any"
          },
          "status": {
            "title": "Race status",
            "enum": [
              "settled",
              "open",
              "all"
            ],
            "type": "string",
            "description": "Settled races (the default) carry the result and their whole history. Open races give the history so far.",
            "default": "settled"
          },
          "granularity": {
            "title": "Candle size",
            "enum": [
              "daily",
              "hourly"
            ],
            "type": "string",
            "description": "One row per day or per hour of each candidate's odds. Hourly is 24 times the rows (and the cost).",
            "default": "daily"
          },
          "from": {
            "title": "From date",
            "type": "string",
            "description": "Only candles and trades from this date (YYYY-MM-DD). Empty = from the day the market opened."
          },
          "to": {
            "title": "To date",
            "type": "string",
            "description": "Only candles and trades up to this date (YYYY-MM-DD). Empty = until the market settled, or today if it is open."
          },
          "includeTrades": {
            "title": "Include the trade tape (Kalshi)",
            "type": "boolean",
            "description": "Every Kalshi trade: time, yes/no price, size and taker side. A busy race has tens of thousands; set dates or 'Maximum rows' to bound it.",
            "default": false
          },
          "maxRaces": {
            "title": "Maximum races per venue",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Stop after this many races from each venue.",
            "default": 10
          },
          "maxResults": {
            "title": "Maximum candle and trade rows",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "A cap on the whole RUN for candles plus trades: your spend control. Race and candidate rows are not counted. When it cuts the run short, a free 'truncated' row says so.",
            "default": 5000
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional and off by default: both venues are public, keyless APIs.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}