{
  "openapi": "3.0.1",
  "info": {
    "title": "Rank-Drop Alerts: Predictive SEO Intelligence",
    "description": "Rank-drop alerts from your OpenSEO (or any) rank history: find which keywords are falling and which pages to refresh first. Paste OpenSEO get_rank_history output directly.",
    "version": "0.1",
    "x-build-id": "2tBqTT1fyEqHlzkxr"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/solutionssmart~predictive-seo-intelligence/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-solutionssmart-predictive-seo-intelligence",
        "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/solutionssmart~predictive-seo-intelligence/runs": {
      "post": {
        "operationId": "runs-sync-solutionssmart-predictive-seo-intelligence",
        "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/solutionssmart~predictive-seo-intelligence/run-sync": {
      "post": {
        "operationId": "run-sync-solutionssmart-predictive-seo-intelligence",
        "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": [
          "sourceType",
          "timestampField",
          "groupBy",
          "metrics",
          "forecastHorizon"
        ],
        "properties": {
          "records": {
            "title": "📋 Records (paste OpenSEO rank history)",
            "type": "array",
            "description": "Paste OpenSEO get_rank_history output (or any JSON array of rows with a date, keyword, and position) directly. Rows with checkedAt are read as timestamps automatically, and an optional url per row is carried through to the action list. When set, the data source fields below are ignored."
          },
          "sourceType": {
            "title": "📥 Data source",
            "enum": [
              "dataset",
              "csv",
              "json"
            ],
            "type": "string",
            "description": "Where your rank history comes from when Records is empty: an Apify dataset, a CSV URL, or a JSON URL.",
            "default": "dataset"
          },
          "datasetId": {
            "title": "🗃️ Apify Dataset ID",
            "type": "string",
            "description": "The Apify Dataset ID containing your historical SEO records. Leave empty to run the built-in demo history."
          },
          "csvUrl": {
            "title": "📄 CSV URL",
            "type": "string",
            "description": "An HTTPS URL for a CSV file containing historical SEO records."
          },
          "jsonUrl": {
            "title": "🧾 JSON URL",
            "type": "string",
            "description": "An HTTPS URL for a JSON array of historical SEO records."
          },
          "timestampField": {
            "title": "🕒 Date or timestamp field",
            "type": "string",
            "description": "The record field containing an ISO date, datetime, or Unix timestamp. For OpenSEO get_rank_history output pasted directly, use checkedAt (also picked automatically when the field set here is missing).",
            "default": "date"
          },
          "groupBy": {
            "title": "🔎 Group records by",
            "minItems": 1,
            "type": "array",
            "description": "Add fields that identify each series, for example keyword or keyword and domain. For OpenSEO get_rank_history output pasted directly, use keyword.",
            "items": {
              "type": "string"
            },
            "default": [
              "keyword"
            ]
          },
          "metrics": {
            "title": "📊 Metrics to forecast",
            "minItems": 1,
            "type": "array",
            "description": "Add one row for each numeric metric. Choose whether higher or lower values are better. For OpenSEO get_rank_history output pasted directly, forecast position (lower is better); its single current searchVolume is constant and never charged. Records may also carry an optional url (landing page) field, which is copied to every output row and action.",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "title": "Metric field",
                  "description": "The numeric field to forecast, such as searchVolume or position.",
                  "type": "string",
                  "editor": "textfield"
                },
                "type": {
                  "title": "Metric meaning",
                  "description": "How the Actor should interpret movement in this metric. Rank position is lower_is_better. If omitted, fields named like position or rank default to lower_is_better.",
                  "type": "string",
                  "enum": [
                    "higher_is_better",
                    "lower_is_better",
                    "neutral"
                  ],
                  "default": "higher_is_better",
                  "editor": "select"
                },
                "lowerIsBetter": {
                  "title": "Lower is better",
                  "description": "Shortcut for type lower_is_better (true) or higher_is_better (false). Wins over type when both are set.",
                  "type": "boolean",
                  "editor": "checkbox"
                }
              },
              "required": [
                "field"
              ]
            },
            "default": [
              {
                "field": "searchVolume",
                "type": "higher_is_better"
              },
              {
                "field": "position",
                "type": "lower_is_better"
              }
            ]
          },
          "forecastHorizon": {
            "title": "📅 Forecast days or periods",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many future observations to forecast.",
            "default": 30
          },
          "frequency": {
            "title": "⏱️ Data frequency",
            "enum": [
              "auto",
              "hourly",
              "daily",
              "weekly",
              "monthly"
            ],
            "type": "string",
            "description": "Choose Auto to infer the interval from your timestamps.",
            "default": "auto"
          },
          "forecastEngine": {
            "title": "🧠 Forecast model",
            "enum": [
              "timesfm",
              "baseline"
            ],
            "type": "string",
            "description": "TimesFM is the production model. Baseline runs instantly with no model download; the example input uses it for a fast first run. Series with fewer than 32 points use the baseline even when TimesFM is selected (noted in engineNote), and TimesFM is not loaded at all if every series is that short.",
            "default": "timesfm"
          },
          "allowFallback": {
            "title": "🔁 Allow baseline fallback",
            "type": "boolean",
            "description": "Use the baseline only when TimesFM cannot load.",
            "default": false
          },
          "maxTrackedPosition": {
            "title": "📏 Deepest tracked rank position",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Optional. The deepest position your rank tracker records. Rank forecasts and intervals are capped at it and never go below 1. When empty, the cap is 100 or the deepest position seen in the history, whichever is larger."
          },
          "maxSeries": {
            "title": "🛑 Maximum series",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Stop the run if the input contains more valid grouped metric series than this limit.",
            "default": 5000
          },
          "minHistoryPoints": {
            "title": "📚 Minimum history points",
            "minimum": 3,
            "maximum": 1000,
            "type": "integer",
            "description": "Minimum valid observations required for each grouped metric series. Seven points is the default; more history usually improves reliability.",
            "default": 7
          },
          "tasks": {
            "title": "🧩 Post-forecast tasks",
            "type": "array",
            "description": "Optional task names, one per line. Valid: intent_classification, volatility_flagging, anomaly_detection, opportunity_refinement, joint_demand_ranking, group_summary, action_prioritization. Canonical order applies regardless of selection order. Empty keeps legacy default (forecast + joint demand/ranking signal).",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "classificationMode": {
            "title": "🏷️ Intent classification mode",
            "enum": [
              "heuristic",
              "jev",
              "auto"
            ],
            "type": "string",
            "description": "Heuristic is free/offline regex. Jev uses TypeSafe Jev judgments. Auto tries Jev, falls back to heuristic.",
            "default": "heuristic"
          },
          "enableJev": {
            "title": "✨ Enable Jev judgments",
            "type": "boolean",
            "description": "Allow Jev-backed refinement of intent/action. Off means heuristic only, no API key needed.",
            "default": false
          },
          "jevModel": {
            "title": "🤖 Jev model",
            "type": "string",
            "description": "TypeSafe Jev model id used when enableJev is on.",
            "default": "jev-latest"
          },
          "jevConfidenceThreshold": {
            "title": "🎯 Jev confidence threshold",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "Keep the Jev label only at/above this confidence (0-1); otherwise keep heuristic.",
            "default": 0.6
          },
          "maxJevGroups": {
            "title": "🔢 Max Jev series",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Cap on series sent to Jev per run (cost control). Remaining series use heuristic.",
            "default": 200
          },
          "maxActions": {
            "title": "🎬 Max prioritized actions",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Top-N actions emitted by action_prioritization.",
            "default": 50
          },
          "backtest": {
            "title": "🧪 Backtest each forecast",
            "type": "boolean",
            "description": "Hide the last part of each series (up to the forecast horizon, at most a third of the history), forecast it from the earlier data, and report how often the actual values fell inside the predicted range. Free. With TimesFM, each backtest is a second forecast, so only an evenly spread sample of up to 100 series per run is backtested.",
            "default": true
          },
          "saveHistory": {
            "title": "🗂️ Save prediction history",
            "type": "boolean",
            "description": "Save this run's predictions to a named key-value store so later runs can show past predictions next to the actual values and keep a running tally of how they turned out. Use the same store name for the same client or project.",
            "default": true
          },
          "historyStoreName": {
            "title": "🏷️ History store name",
            "type": "string",
            "description": "Name of the key-value store that keeps prediction history across runs (letters, digits and hyphens). History is kept per keyword and metric, plus the site's host name when your rows have a url field. Without a url field, use a different name per client to keep their track records apart.",
            "default": "seo-predictor-history"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}