{
  "openapi": "3.0.1",
  "info": {
    "title": "AI Extract: Structured Data from Any Web Page",
    "description": "Extract structured JSON from any public web page with a plain-English prompt or a JSON schema. Input: URLs + what to extract. Output: one validated row per page (products, prices, articles, events, listings). Optional crawling. AI included, no API key needed.",
    "version": "0.1",
    "x-build-id": "dVITQBj29Al5WT7fm"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/swillz~ai-extract/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-swillz-ai-extract",
        "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/swillz~ai-extract/runs": {
      "post": {
        "operationId": "runs-sync-swillz-ai-extract",
        "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/swillz~ai-extract/run-sync": {
      "post": {
        "operationId": "run-sync-swillz-ai-extract",
        "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": [
          "startUrls"
        ],
        "properties": {
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Required. Array of objects, e.g. [{\"url\":\"https://example.com/product/1\"}]. Each page is read and turned into one JSON row by AI.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "instructions": {
            "title": "Instructions (what to extract)",
            "type": "string",
            "description": "What to extract, in plain words, e.g. \"product name, price, currency and whether it is in stock\". Give instructions, a jsonSchema, or both; the run stops with a clear error if both are empty.",
            "default": ""
          },
          "jsonSchema": {
            "title": "JSON schema (output shape)",
            "type": "object",
            "description": "Optional. A JSON Schema for the 'data' field of each row, or a shorthand like {\"title\":\"string\",\"price\":\"number\",\"tags\":\"string[]\"}. Output is validated against it; pages that don't match are retried, then returned as invalid_output and not charged."
          },
          "maxCrawlDepth": {
            "title": "Crawl depth",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "0 = only the start URLs. 1 = also pages linked from them, and so on.",
            "default": 0
          },
          "maxPages": {
            "title": "Max pages",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Stop after this many pages (default 20). AI agents: keep ≤10 for answers within ~45s. The free plan with the built-in AI processes up to 25 pages per run.",
            "default": 20
          },
          "sameDomainOnly": {
            "title": "Stay on the same website",
            "type": "boolean",
            "description": "Only follow links to the start URLs' domains.",
            "default": true
          },
          "includeUrlPatterns": {
            "title": "Only follow URLs matching",
            "type": "array",
            "description": "Regular expressions; when set, crawled links must match at least one (e.g. /catalogue/). Start URLs are always processed.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "excludeUrlPatterns": {
            "title": "Never follow URLs matching",
            "type": "array",
            "description": "Regular expressions for links to skip (e.g. /login|/cart).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "contentSelector": {
            "title": "Content CSS selector",
            "type": "string",
            "description": "Optional. Send only this part of the page to the AI (e.g. main, #content, .product). Saves tokens and improves accuracy."
          },
          "removeSelectors": {
            "title": "Remove CSS selectors",
            "type": "string",
            "description": "Optional comma-separated selectors to strip before extraction (e.g. .reviews, .related-products). Navigation, footers, scripts, cookie banners and ads are removed automatically."
          },
          "keepHeaderFooter": {
            "title": "Keep header, nav and footer",
            "type": "boolean",
            "description": "Turn on if the data you need lives in the header or footer (e.g. company address).",
            "default": false
          },
          "includeMarkdown": {
            "title": "Include page markdown in output",
            "type": "boolean",
            "description": "Add the cleaned markdown sent to the AI to each row (useful for RAG or debugging).",
            "default": false
          },
          "maxInputTokensPerPage": {
            "title": "Max input tokens per page",
            "minimum": 500,
            "maximum": 400000,
            "type": "integer",
            "description": "Longer pages are trimmed to this size (≈4 characters per token). Built-in AI: up to 16,000.",
            "default": 8000
          },
          "maxOutputTokensPerPage": {
            "title": "Max output tokens per page",
            "minimum": 64,
            "maximum": 64000,
            "type": "integer",
            "description": "Upper limit on the AI answer per page. Raise for pages with long lists. Built-in AI: up to 4,000.",
            "default": 1500
          },
          "llmApiKey": {
            "title": "Your AI API key (optional)",
            "type": "string",
            "description": "Leave empty to use the built-in AI (included in the price). Add your own OpenAI, Anthropic, Gemini, DeepSeek, Groq, OpenRouter or Together key to pay the provider directly and get the lower own-key price. Stored encrypted."
          },
          "llmProvider": {
            "title": "AI provider (own key)",
            "enum": [
              "openai",
              "anthropic",
              "gemini",
              "deepseek",
              "groq",
              "openrouter",
              "together",
              "openai-compatible"
            ],
            "type": "string",
            "description": "Provider of your own llmApiKey (ignored when using the built-in AI): openai, anthropic, gemini, deepseek, groq, openrouter, together, or openai-compatible with llmBaseUrl.",
            "default": "openai"
          },
          "llmModel": {
            "title": "AI model (own key)",
            "type": "string",
            "description": "Optional. Defaults: OpenAI gpt-6-luna, Anthropic claude-haiku-5-5, Gemini gemini-3.1-flash-lite, DeepSeek deepseek-flash, Groq openai/gpt-oss-20b."
          },
          "llmBaseUrl": {
            "title": "AI API base URL (own key)",
            "type": "string",
            "description": "Only for 'Other OpenAI-compatible API', e.g. https://api.example.com/v1"
          },
          "maxAiCostUsd": {
            "title": "Max AI spend on your key (USD)",
            "minimum": 0,
            "type": "number",
            "description": "Optional. Stops the run once the estimated cost on your own key reaches this amount."
          },
          "maxConcurrency": {
            "title": "Parallel pages",
            "minimum": 1,
            "maximum": 25,
            "type": "integer",
            "description": "Pages processed at the same time. Requests to one website are spaced out politely regardless.",
            "default": 5
          },
          "maxRetries": {
            "title": "Retries",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Retries for failed page loads and AI calls.",
            "default": 2
          },
          "requestTimeoutSecs": {
            "title": "Page timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Seconds to wait for each page to load before giving up (default 30).",
            "default": 30
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. Use Apify Proxy if a site blocks datacenter requests.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}