{
  "openapi": "3.0.1",
  "info": {
    "title": "Polymarket Markets Scraper",
    "description": "Prediction markets from Polymarket's public API: every active event and its Yes/No markets with live prices, bid/ask, spread, volume, liquidity, end date and resolution state, plus event tags. Walk by tag, search by text, or fetch specific events. Flags markets that have already ended.",
    "version": "0.1",
    "x-build-id": "1UHzlkVO2qTitu6MP"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapyx~polymarket-markets-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapyx-polymarket-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/scrapyx~polymarket-markets-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapyx-polymarket-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/scrapyx~polymarket-markets-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapyx-polymarket-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": {
          "tags": {
            "title": "Tags (categories)",
            "type": "array",
            "description": "Polymarket tag slugs to walk: politics, crypto, sports, business, science, pop-culture, geopolitics, elections, nba, bitcoin... Each becomes its own target. Empty (with no search terms or event slugs) walks every active event on the site, ordered by sortBy. An unknown tag returns nothing.",
            "items": {
              "type": "string"
            }
          },
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Free-text search over event titles (Polymarket's own search). Each term is its own target. Results are restricted to active events unless includeClosed is on.",
            "items": {
              "type": "string"
            }
          },
          "eventSlugs": {
            "title": "Event slugs or URLs",
            "type": "array",
            "description": "Specific events, by slug or full URL: 'fed-decision-in-september-762' or https://polymarket.com/event/fed-decision-in-september-762. One request each.",
            "items": {
              "type": "string"
            }
          },
          "includeClosed": {
            "title": "Include closed (resolved) markets",
            "type": "boolean",
            "description": "Off by default: only active, unresolved markets. On: walks closed markets too (there are far more of them).",
            "default": false
          },
          "excludeEnded": {
            "title": "Exclude markets whose end date has passed",
            "type": "boolean",
            "description": "Polymarket's 'active' set includes markets that have already ended and await resolution (17 of the top 100 by volume on the day this was built). Every row carries hasEnded; this drops them.",
            "default": false
          },
          "sortBy": {
            "title": "Order",
            "enum": [
              "volume24hr",
              "volume",
              "liquidity",
              "endDate",
              "startDate",
              "createdAt",
              "id"
            ],
            "type": "string",
            "description": "Listing order for tag walks. Descending unless ascending is on. Only these fields are accepted by the API.",
            "default": "volume24hr"
          },
          "ascending": {
            "title": "Ascending",
            "type": "boolean",
            "description": "Reverse the order (e.g. endDate ascending = markets resolving soonest first).",
            "default": false
          },
          "minVolume": {
            "title": "Min total volume (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip events with less lifetime volume than this. Applied by the API."
          },
          "minLiquidity": {
            "title": "Min liquidity (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip markets with less liquidity than this. Applied locally (the API's own liquidity filter answers HTTP 500)."
          },
          "endingAfter": {
            "title": "Ending after (date)",
            "type": "string",
            "description": "Only events ending on or after this date, YYYY-MM-DD."
          },
          "endingBefore": {
            "title": "Ending before (date)",
            "type": "string",
            "description": "Only events ending on or before this date, YYYY-MM-DD."
          },
          "includeEventRows": {
            "title": "Also emit one EVENT row per event",
            "type": "boolean",
            "description": "Off by default: rows are MARKETs (one per binary market, with its event's id, title, slug, tags and market count on every row). On: an EVENT row with the aggregate and an outcome/price summary precedes each event's markets.",
            "default": false
          },
          "maxItems": {
            "title": "Max market rows",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Overall cap on MARKET rows across every target. ~21,000 active events exist (most are single-match sports markets); a multi-outcome event alone can carry 100+ markets.",
            "default": 500
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 6,
            "type": "integer",
            "description": "Parallel requests across targets. Event pages are ~4.5 MB each.",
            "default": 2
          },
          "minRequestInterval": {
            "title": "Min seconds between requests",
            "minimum": 0,
            "maximum": 30,
            "type": "integer",
            "description": "Politeness delay between request starts. The API tolerated 40 unpaced requests in 16 s; leave at 0 unless a run reports rate limiting.",
            "default": 0
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. Not needed: the API answered from a plain IP. Enable Apify's free datacenter proxy only if a cloud run reports fetch_failed.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}