{
  "openapi": "3.0.1",
  "info": {
    "title": "Time Series Forecasting - AI Sales & Demand Forecast",
    "description": "Forecast sales, demand, traffic or any time series from CSV, a Google Sheet or JSON with Mistral AI's Timestral model: median forecast, prediction intervals, future dates and an optional backtest. Runs inside the Actor. $0.02 per series; too-short series are free.",
    "version": "0.1",
    "x-build-id": "RLE8HthtEpinqKn9J"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tidytools~time-series-forecast/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tidytools-time-series-forecast",
        "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/tidytools~time-series-forecast/runs": {
      "post": {
        "operationId": "runs-sync-tidytools-time-series-forecast",
        "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/tidytools~time-series-forecast/run-sync": {
      "post": {
        "operationId": "run-sync-tidytools-time-series-forecast",
        "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": {
          "data": {
            "title": "Data (CSV, spreadsheet paste or JSON)",
            "type": "string",
            "description": "Paste your history. CSV or tab-separated with a header: a date column plus one column per series (\"date,sales,visits\"), or long format \"id,date,value\" (one series per id). Also accepted: plain numbers (\"12, 15, 14, 18…\"), a JSON array of numbers, or JSON series. Each series needs at least 8 values; shorter ones get a free error row."
          },
          "dataUrl": {
            "title": "Or a file or link (CSV or JSON)",
            "type": "string",
            "description": "Upload a CSV/TSV/JSON file (up to 50 MB) or paste a link: a Google Sheets link (shared with \"anyone with the link\"), a GitHub file link, Dropbox, or any direct CSV/JSON URL. Excel files: save as CSV first."
          },
          "horizon": {
            "title": "Forecast horizon (steps)",
            "minimum": 1,
            "maximum": 1024,
            "type": "integer",
            "description": "How many future steps to forecast (e.g. 12 months, 30 days, 13 weeks). Empty = by frequency: 12 months, 30 days, 13 weeks, 8 quarters, 5 years, 48 hours."
          },
          "frequency": {
            "title": "Frequency",
            "enum": [
              "auto",
              "minute",
              "5min",
              "10min",
              "15min",
              "30min",
              "hour",
              "day",
              "businessDay",
              "week",
              "month",
              "quarter",
              "year"
            ],
            "type": "string",
            "description": "Step of the series. Choosing a coarser step than your data aggregates it (e.g. daily orders → weekly totals, see \"Combine values\"). Without dates, set it to get dates on the forecast (JSON series with \"start\").",
            "default": "auto"
          },
          "quantiles": {
            "title": "Prediction interval quantiles",
            "type": "array",
            "description": "Quantiles to return besides the median, between 0.01 and 0.99 (0.1 and 0.9 = an 80% interval; 0.025 and 0.975 = 95%). Output keys are q10, q90, q2.5…",
            "default": [
              0.1,
              0.9
            ]
          },
          "model": {
            "title": "Model",
            "enum": [
              "timestral-123m",
              "timestral-28m"
            ],
            "type": "string",
            "description": "Mistral AI's Timestral zero-shot forecasting models, run on CPU inside this Actor. Same price for both.",
            "default": "timestral-123m"
          },
          "evaluate": {
            "title": "Backtest against a simple baseline",
            "type": "boolean",
            "description": "Also forecast the last part of the history as if it were unknown and compare the error with a seasonal-naive forecast (repeat last season). Adds a \"backtest\" object to each row; no extra charge, about twice the run time.",
            "default": false
          },
          "series": {
            "title": "Or JSON series (API)",
            "type": "array",
            "description": "For API and AI-agent use: [{\"id\": \"sku-1\", \"values\": [12, 15, 14], \"timestamps\": [\"2026-01-01\", …]}] or with \"start\": \"2026-01-01\" and \"freq\": \"D\" | \"W\" | \"M\" | \"Q\" | \"Y\" | \"H\". Also [[date, value], …] pairs and plain arrays of numbers."
          },
          "dateColumn": {
            "title": "Date column",
            "type": "string",
            "description": "Header name or column number (1 = first) of the dates. Empty = detect (a column named date, month, ds, period… or the one that reads as dates)."
          },
          "valueColumns": {
            "title": "Value columns",
            "type": "array",
            "description": "Columns to forecast (header names or numbers). Empty = every numeric column except id-like ones (each is one charged series); in long format the column named value/sales/y…, else the last numeric one.",
            "items": {
              "type": "string"
            }
          },
          "idColumn": {
            "title": "Series id column (long format)",
            "type": "string",
            "description": "Column that names the series in long data (e.g. store, sku, region). Empty = detect when dates repeat."
          },
          "aggregation": {
            "title": "Combine values in the same step",
            "enum": [
              "sum",
              "mean",
              "last",
              "min",
              "max"
            ],
            "type": "string",
            "description": "When several rows fall into one step (duplicate dates, or a coarser Frequency than the data).",
            "default": "sum"
          },
          "fillMissing": {
            "title": "Missing steps",
            "enum": [
              "missing",
              "zero",
              "previous"
            ],
            "type": "string",
            "description": "Steps between the first and last date that have no value.",
            "default": "missing"
          },
          "maxSeries": {
            "title": "Max series",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Cost cap: at most this many series are forecast in one run (the rest are listed in SUMMARY, not charged).",
            "default": 1000
          },
          "maxHistory": {
            "title": "Max history (steps)",
            "minimum": 64,
            "maximum": 32768,
            "type": "integer",
            "description": "Only the most recent steps of each series are used (more history rarely helps and takes longer). Timestral reads up to 32,768.",
            "default": 4096
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}