{
  "openapi": "3.0.1",
  "info": {
    "title": "Notion Page, Wiki & Database Scraper - Markdown, JSON & RAG",
    "description": "Scrape public or token-connected Notion pages, wikis, and databases recursively via fast API-first extraction with Playwright fallback. Export Markdown, HTML, structured DB rows, RAG chunks, offline ZIPs, and incremental syncs.",
    "version": "0.2",
    "x-build-id": "vaXSRg122MYuqbFCn"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/forlex~notion-page-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-forlex-notion-page-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/forlex~notion-page-scraper/runs": {
      "post": {
        "operationId": "runs-sync-forlex-notion-page-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/forlex~notion-page-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-forlex-notion-page-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",
        "required": [
          "startUrls"
        ],
        "properties": {
          "startUrls": {
            "title": "🌐 Start URLs",
            "type": "array",
            "description": "List of Notion page, wiki, or database URLs to scrape.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "maxItems": {
            "title": "📄 Max Pages",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of Notion pages to scrape per run.",
            "default": 20
          },
          "crawlSubpages": {
            "title": "🕸️ Crawl Subpages Recursively",
            "type": "boolean",
            "description": "Automatically discover and scrape child Notion pages linked inside each page.",
            "default": true
          },
          "maxDepth": {
            "title": "🪜 Max Crawl Depth",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Maximum subpage recursion depth (0 = start URLs only).",
            "default": 2
          },
          "extractDatabases": {
            "title": "📊 Extract Notion Databases",
            "type": "boolean",
            "description": "Extract inline and full-page Notion databases into structured rows and Markdown tables.",
            "default": true
          },
          "crawlDatabasePages": {
            "title": "📑 Crawl Database Row Pages",
            "type": "boolean",
            "description": "Also follow and scrape the body content of each row page inside discovered Notion databases.",
            "default": false
          },
          "outputMode": {
            "title": "📦 Output Mode",
            "enum": [
              "pages",
              "chunks",
              "databaseRows"
            ],
            "type": "string",
            "description": "Choose dataset output format. PPE bills per emitted dataset record: Full Pages emits 1 record per page (including embedded databases), RAG Chunks emits 1 record per chunk, and Database Rows emits 1 record per row.",
            "default": "pages"
          },
          "includeHtml": {
            "title": "🌐 Include HTML Output",
            "type": "boolean",
            "description": "Include rendered HTML alongside clean Markdown in page results.",
            "default": false
          },
          "downloadImages": {
            "title": "🖼️ Download & Host Images",
            "type": "boolean",
            "description": "Download Notion images into Apify Key-Value Store so links do not expire. Off by default for faster, lower-cost AI/RAG runs.",
            "default": false
          },
          "relativeImagePaths": {
            "title": "🗂️ Offline ZIP Bundle (Relative Image Paths)",
            "type": "boolean",
            "description": "Bundle each page's Markdown and downloaded images into a portable .zip file with ./images/ relative paths (implies downloading images and triggers the optional offline-zip-bundle PPE event).",
            "default": false
          },
          "targetChunkTokens": {
            "title": "Target Tokens per Chunk",
            "minimum": 100,
            "maximum": 4000,
            "type": "integer",
            "description": "Approximate target size of each RAG chunk in tokens (~4 chars/token).",
            "default": 700
          },
          "overlapTokens": {
            "title": "Overlap Tokens",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Approximate semantic token overlap between adjacent chunks from the same section.",
            "default": 80
          },
          "syncKey": {
            "title": "Sync Key",
            "type": "string",
            "description": "Optional persistent sync namespace (e.g. 'company-wiki-prod')."
          },
          "emitOnlyChanges": {
            "title": "Emit Only New & Changed Content",
            "type": "boolean",
            "description": "Requires Sync Key. Skips pushing unchanged pages while still traversing child pages.",
            "default": false
          },
          "notionToken": {
            "title": "Notion Integration Token (Optional)",
            "type": "string",
            "description": "Encrypted read-only Notion integration token (secret_... or ntn_...) for private/shared pages. Leave empty for public URLs."
          },
          "usePlaywrightFallback": {
            "title": "Enable Playwright Browser Fallback",
            "type": "boolean",
            "description": "Automatically fall back to Playwright headless Chromium if a custom domain or protected page cannot be read via fast HTTP API.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "🛡️ Proxy Configuration",
            "type": "object",
            "description": "Proxy settings for Playwright fallback requests.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}