{
  "openapi": "3.0.1",
  "info": {
    "title": "Coinglass Liquidation Heatmap Scraper",
    "description": "Crypto liquidation data from Coinglass: per-event liquidations (exchange, symbol, side, USD size, price, time) over 1h/4h/12h/24h windows with exchange, symbol and threshold filters, plus per-exchange long/short heatmap buckets. Optional Telegram alerts. Snapshot per run.",
    "version": "0.2",
    "x-build-id": "iTmSLGj1kOimEjzOs"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/barefoot_grade~coinglass-liquidation-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-barefoot_grade-coinglass-liquidation-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/barefoot_grade~coinglass-liquidation-scraper/runs": {
      "post": {
        "operationId": "runs-sync-barefoot_grade-coinglass-liquidation-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/barefoot_grade~coinglass-liquidation-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-barefoot_grade-coinglass-liquidation-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": {
          "exchanges": {
            "title": "Exchange filter",
            "maxItems": 20,
            "type": "array",
            "description": "Optional exchange allow-list (case-insensitive: Binance, OKX, Bybit, Bitget, Gate, HTX, Hyperliquid, Bitmex, Aster, Lighter ...). Empty = all exchanges.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "symbols": {
            "title": "Watchlist",
            "maxItems": 100,
            "type": "array",
            "description": "Optional symbol watchlist (case-insensitive; 'BTC', 'btc' and 'BTCUSDT' all select BTC). Empty = every symbol.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "timeWindow": {
            "title": "Time window",
            "enum": [
              "1h",
              "4h",
              "12h",
              "24h"
            ],
            "type": "string",
            "description": "Lookback window for the event feed. The feed retains roughly the last 2-3h of events server-side; a wider window reports the span actually covered in the run summary.",
            "default": "1h"
          },
          "minUsd": {
            "title": "Per-event USD floor",
            "minimum": 0,
            "maximum": 1000000000,
            "type": "number",
            "description": "Optional minimum liquidation size in USD (the feed's own collector floor is ~$1k per event).",
            "default": 0
          },
          "maxEvents": {
            "title": "Event cap",
            "minimum": 100,
            "maximum": 5000,
            "type": "integer",
            "description": "Upper bound on collected events per run (bounds the paged walk; the feed pages 1000 rows at a time).",
            "default": 2000
          },
          "alertUsd": {
            "title": "Alert threshold (USD per event)",
            "minimum": 0,
            "maximum": 1000000000,
            "type": "number",
            "description": "When > 0, every liquidation event at or above this USD size sends one inline Telegram alert ('🚨 BTC long liquidation ~$900k at 2486 (Binance)'). Symmetric: large long and short liquidations both alert. 0 (the default) disables alerts entirely.",
            "default": 0
          },
          "telegramBotToken": {
            "title": "Telegram bot token (secret)",
            "type": "string",
            "description": "Bot token for the liquidation alerts — a secret: never share runs or datasets that expose it. Falls back to the TELEGRAM_BOT_TOKEN secret environment variable when empty. Never printed; masked in any warning line."
          },
          "telegramChatId": {
            "title": "Telegram chat id",
            "type": "string",
            "description": "Telegram chat id for the liquidation alerts. With telegramBotToken (or TELEGRAM_BOT_TOKEN) and alertUsd > 0, each threshold-clearing event sends one inline message (largest first, budget 25 per run). A failed or skipped send is a warning, never a failed run."
          },
          "requestDelaySecs": {
            "title": "Delay between pages",
            "minimum": 0,
            "maximum": 10,
            "type": "number",
            "description": "Polite pause between the paged feed requests.",
            "default": 0.3
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}