{
  "openapi": "3.0.1",
  "info": {
    "title": "Polymarket Historical Snapshots & Delisting Tracker",
    "description": "Capture recurring Polymarket snapshots with canonical IDs, changes, lifecycle events, conservative delisting detection, and research-ready history.",
    "version": "0.1",
    "x-build-id": "19HvEbIbdwBTuwL89"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/fetchfinch~polymarket-historical-snapshot-exporter/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-fetchfinch-polymarket-historical-snapshot-exporter",
        "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/fetchfinch~polymarket-historical-snapshot-exporter/runs": {
      "post": {
        "operationId": "runs-sync-fetchfinch-polymarket-historical-snapshot-exporter",
        "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/fetchfinch~polymarket-historical-snapshot-exporter/run-sync": {
      "post": {
        "operationId": "run-sync-fetchfinch-polymarket-historical-snapshot-exporter",
        "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",
        "required": [
          "monitorKey",
          "status",
          "outputMode"
        ],
        "properties": {
          "monitorKey": {
            "title": "Monitor key",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$",
            "type": "string",
            "description": "Stable name for this monitor. Runs with the same key and scope share history and state.",
            "default": "default"
          },
          "status": {
            "title": "Market status",
            "enum": [
              "active",
              "closed",
              "all"
            ],
            "type": "string",
            "description": "Active scans open markets, closed scans closed markets, and all performs both complete scans.",
            "default": "active"
          },
          "marketIds": {
            "title": "Gamma market IDs",
            "type": "array",
            "description": "Optional exact Gamma market IDs. Exact selectors are combined with OR semantics.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "conditionIds": {
            "title": "Condition IDs",
            "type": "array",
            "description": "Optional exact condition IDs. This is the recommended stable market selector.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "slugs": {
            "title": "Market slugs",
            "type": "array",
            "description": "Optional market URL slugs. Slugs are treated as aliases, not canonical identifiers.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "tagIds": {
            "title": "Tag IDs",
            "type": "array",
            "description": "Optional Gamma tag IDs. Multiple tags use OR semantics.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "searchQueries": {
            "title": "Text filters",
            "type": "array",
            "description": "Optional case-insensitive text filters over question, description, slug, event titles, and tags. Multiple values use OR semantics.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "minVolume": {
            "title": "Minimum total volume",
            "minimum": 0,
            "type": "number",
            "description": "Local filter in USD. Markets falling below it are out of scope, never called delisted.",
            "default": 0
          },
          "minLiquidity": {
            "title": "Minimum liquidity",
            "minimum": 0,
            "type": "number",
            "description": "Local filter in USD. Markets falling below it are out of scope, never called delisted.",
            "default": 0
          },
          "maxMarkets": {
            "title": "Maximum markets",
            "minimum": 0,
            "maximum": 1000000,
            "type": "integer",
            "description": "Safety cap. Zero means unlimited. A capped run is marked incomplete and cannot confirm disappearances.",
            "default": 0
          },
          "outputMode": {
            "title": "Run dataset output",
            "enum": [
              "full_and_changes",
              "changes_only",
              "snapshots_only"
            ],
            "type": "string",
            "description": "The persistent history dataset always receives full snapshots. This controls the current run dataset.",
            "default": "full_and_changes"
          },
          "persistHistory": {
            "title": "Persist cross-run history",
            "type": "boolean",
            "description": "Append full records to a named dataset shared across runs.",
            "default": true
          },
          "historyDatasetName": {
            "title": "History dataset name",
            "type": "string",
            "description": "Optional named dataset. Defaults to polymarket-history-<monitorKey>."
          },
          "includeRaw": {
            "title": "Include raw Gamma payload",
            "type": "boolean",
            "description": "Preserve the complete upstream market object in every snapshot. This substantially increases storage.",
            "default": false
          },
          "missingConfirmationRuns": {
            "title": "Runs before confirming disappearance",
            "minimum": 2,
            "maximum": 20,
            "type": "integer",
            "description": "Number of consecutive complete runs with a direct 404 needed before MARKET_DELISTED_CONFIRMED.",
            "default": 3
          },
          "backfillPriceHistory": {
            "title": "Backfill price history for new markets",
            "type": "boolean",
            "description": "Fetch official CLOB price history the first time each market is observed.",
            "default": false
          },
          "historyInterval": {
            "title": "Price-history interval",
            "enum": [
              "1h",
              "6h",
              "1d",
              "1w",
              "1m",
              "max"
            ],
            "type": "string",
            "description": "Lookback interval requested from the official CLOB price-history endpoint.",
            "default": "max"
          },
          "historyFidelityMinutes": {
            "title": "Price-history fidelity in minutes",
            "minimum": 1,
            "maximum": 1440,
            "type": "integer",
            "description": "Requested spacing between backfilled price observations.",
            "default": 60
          },
          "maxHistoryMarkets": {
            "title": "Maximum new markets to backfill",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Limits first-seen markets whose outcome price history is fetched in one run.",
            "default": 25
          },
          "emitAlertRecords": {
            "title": "Emit semantic alert records",
            "type": "boolean",
            "description": "Write alert rows derived from lifecycle, price, volume, liquidity, metadata, and run-health changes.",
            "default": true
          },
          "alertOnInitialSnapshot": {
            "title": "Alert for every initial market",
            "type": "boolean",
            "description": "Usually leave this off to avoid a flood during the first run.",
            "default": false
          },
          "priceMoveThreshold": {
            "title": "Price move alert threshold",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "Absolute probability move, where 0.05 means five percentage points.",
            "default": 0.05
          },
          "volumeDeltaThreshold": {
            "title": "Volume delta alert threshold",
            "minimum": 0,
            "type": "number",
            "description": "Minimum increase in total USD volume between observations that emits VOLUME_SPIKE.",
            "default": 10000
          },
          "liquidityDropPctThreshold": {
            "title": "Liquidity drop alert threshold",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "Fractional drop, where 0.5 means 50%.",
            "default": 0.5
          },
          "alertWebhookUrl": {
            "title": "Alert webhook URL",
            "type": "string",
            "description": "Optional HTTP(S) endpoint that receives one batched semantic-alert POST after committed runs."
          },
          "failOnAlertDeliveryError": {
            "title": "Fail when webhook delivery fails",
            "type": "boolean",
            "description": "If enabled, a failed semantic-alert webhook makes the Actor run fail after data and state are committed.",
            "default": false
          },
          "requestTimeoutSecs": {
            "title": "Upstream request timeout",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Timeout applied to individual Gamma and CLOB HTTP requests.",
            "default": 30
          },
          "maxRequestRetries": {
            "title": "Maximum request retries",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Retries for timeouts, rate limits, and transient upstream server errors.",
            "default": 4
          },
          "pageSize": {
            "title": "Gamma page size",
            "minimum": 10,
            "maximum": 500,
            "type": "integer",
            "description": "Markets requested per Gamma pagination call.",
            "default": 500
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}