{
  "openapi": "3.0.1",
  "info": {
    "title": "Homebrew Formula Install Rankings & Change Monitor",
    "description": "Monitor Homebrew formula install-on-request rankings. Track rank, install share and new/exited formulae via the official Formulae JSON API.",
    "version": "0.1",
    "x-build-id": "AAkYKPd3pjmapE3Xh"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/automa-flow~homebrew-formula-install-rankings-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-automa-flow-homebrew-formula-install-rankings-monitor",
        "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/automa-flow~homebrew-formula-install-rankings-monitor/runs": {
      "post": {
        "operationId": "runs-sync-automa-flow-homebrew-formula-install-rankings-monitor",
        "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/automa-flow~homebrew-formula-install-rankings-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-automa-flow-homebrew-formula-install-rankings-monitor",
        "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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "snapshot",
              "monitor"
            ],
            "type": "string",
            "description": "Get current rankings returns every selected formula and writes no history. Monitor changes compares this successful run with the last successful run of the same query in the same state namespace.",
            "default": "snapshot"
          },
          "outputMode": {
            "title": "Formula output",
            "enum": [
              "all",
              "changesOnly"
            ],
            "type": "string",
            "description": "All formulae returns every current row. Changes only omits UNCHANGED rows. Snapshot plus changesOnly is rejected before any Homebrew request.",
            "default": "all"
          },
          "stateNamespace": {
            "title": "State namespace",
            "minLength": 1,
            "maxLength": 64,
            "type": "string",
            "description": "Isolates monitor history. Use a stable name per watch, for example onrequest-30d. Letters, numbers, '_' and '-', 1-64 characters. Snapshot mode ignores it.",
            "default": "default"
          },
          "metric": {
            "title": "Analytics metric",
            "enum": [
              "installOnRequest",
              "install"
            ],
            "type": "string",
            "description": "installOnRequest counts installs people asked for. install also counts dependency installs and is inflated by packages such as ca-certificates.",
            "default": "installOnRequest"
          },
          "period": {
            "title": "Window",
            "enum": [
              "30d",
              "90d",
              "365d"
            ],
            "type": "string",
            "description": "Homebrew analytics window. These are rolling 30, 90 or 365-day aggregates, not a native history series.",
            "default": "30d"
          },
          "topN": {
            "title": "Top N",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "How many ranked formulae to keep when watchlist is empty. 1-200, default 20. Ignored for filtering when watchlist is set; rank still comes from the full window. Watchlist history is keyed without topN, so changing topN does not reset a named watch.",
            "default": 20
          },
          "watchlist": {
            "title": "Formula watchlist",
            "minItems": 0,
            "maxItems": 50,
            "type": "array",
            "description": "Optional Homebrew formula names, tap-qualified names (user/tap/formula), or https://formulae.brew.sh/formula/{name} URLs, 0-50. Empty means use topN. A name missing from a populated analytics window is delivered as an unranked SUCCESS row (rank null), not NOT_FOUND. Duplicates keep the first name.",
            "items": {
              "type": "string"
            }
          },
          "includeFormulaMetadata": {
            "title": "Include formula metadata",
            "type": "boolean",
            "description": "If true, fetch each selected core formula's /api/formula/{name}.json for desc, homepage and license. Tap-qualified analytics ids skip this request. Default off. Never downloads the full formula catalog.",
            "default": false
          },
          "maxFormulaRows": {
            "title": "Max formula rows",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Cap on delivered formula_observation rows, including EXITED. Status rows are free. Default 400 so a full top-200 window plus exits still fits. If the window does not fit, the run is PARTIAL/OUTPUT_LIMIT and previous state is kept.",
            "default": 400
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}