{
  "openapi": "3.0.1",
  "info": {
    "title": "Wikipedia Knowledge & RAG Markdown Scraper (API)",
    "description": "Query Wikimedia REST Summary and MediaWiki Action APIs across any language edition. Outputs clean RAG Markdown, structured infobox JSON, Wikidata Q-IDs, section outlines, visible categories, and external links.",
    "version": "1.0",
    "x-build-id": "79hbjgZcGzzwVfyYv"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tsun_tsun~wikipedia-rag-knowledge-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tsun_tsun-wikipedia-rag-knowledge-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/tsun_tsun~wikipedia-rag-knowledge-scraper/runs": {
      "post": {
        "operationId": "runs-sync-tsun_tsun-wikipedia-rag-knowledge-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/tsun_tsun~wikipedia-rag-knowledge-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-tsun_tsun-wikipedia-rag-knowledge-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",
        "properties": {
          "pageInputs": {
            "title": "Wikipedia Pages (URLs, Titles, or Lang-Prefixed Tokens)",
            "type": "array",
            "description": "Direct Wikipedia targets to scrape. Accepts full Wikipedia URLs (e.g. 'https://en.wikipedia.org/wiki/Python_(programming_language)', 'https://simple.wikipedia.org/wiki/Computer'), plain article titles resolved against the default language (e.g. 'Web scraping'), or language-prefixed tokens (e.g. 'de:Web_Scraping', 'th:ปัญญาประดิษฐ์', 'zh-min-nan:Tâi-oân'). At least one of pageInputs or searchQueries must be provided.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Wikipedia Search Queries",
            "type": "array",
            "description": "Keyword search queries executed against MediaWiki's search API (list=search) in the configured language edition (e.g. 'Model Context Protocol', 'Retrieval-augmented generation'). Matched articles are deduplicated and scraped. At least one of pageInputs or searchQueries must be provided.",
            "items": {
              "type": "string"
            }
          },
          "language": {
            "title": "Default Wikipedia Language Code",
            "pattern": "^(?:simple|[a-zA-Z]{2,3}(?:-[a-zA-Z0-9]{2,9}){0,2})$",
            "type": "string",
            "description": "Default Wikipedia language subdomain used for searchQueries and plain article titles without a URL or language prefix (e.g. 'en', 'de', 'fr', 'es', 'ja', 'th', 'simple', 'zh-yue', 'zh-min-nan', 'zh-classical'). Overridden by language-prefixed tokens or full Wikipedia URLs.",
            "default": "en"
          },
          "maxResultsPerQuery": {
            "title": "Max Results Per Search Query",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Maximum number of Wikipedia articles fetched per keyword in searchQueries (1 to 50).",
            "default": 5
          },
          "includeMarkdown": {
            "title": "Extract Clean RAG Markdown",
            "type": "boolean",
            "description": "Convert the article body into clean Markdown with headings, lists, blockquotes, tables, and code blocks while stripping navboxes, infoboxes, edit links, reference superscripts, and trailing citation boilerplate.",
            "default": true
          },
          "includeInfobox": {
            "title": "Extract Structured Infobox JSON",
            "type": "boolean",
            "description": "Parse the article's Wikipedia infobox table into a key-value JSON object with reference markers, hidden sortkeys, and inline styles removed.",
            "default": true
          },
          "includeSections": {
            "title": "Extract Section Outline",
            "type": "boolean",
            "description": "Include the article's table-of-contents section hierarchy (index, level, number, title, anchor).",
            "default": true
          },
          "includeCategories": {
            "title": "Extract Clean Categories",
            "type": "boolean",
            "description": "Include visible Wikipedia categories with hidden maintenance categories filtered out and underscores replaced by spaces.",
            "default": true
          },
          "includeExternalLinks": {
            "title": "Extract External Links",
            "type": "boolean",
            "description": "Include deduplicated outbound external HTTP/HTTPS URLs referenced by the article.",
            "default": true
          },
          "maxMarkdownChars": {
            "title": "Max Markdown Characters (0 = Full Article)",
            "minimum": 0,
            "maximum": 200000,
            "type": "integer",
            "description": "Optional character cap applied at a word or paragraph boundary for token-budgeted RAG pipelines. Set to 0 to return the complete article Markdown without truncation.",
            "default": 0
          },
          "concurrency": {
            "title": "Request Concurrency",
            "minimum": 1,
            "maximum": 6,
            "type": "integer",
            "description": "Number of Wikipedia articles processed concurrently (1 to 6). Keep at 3 or lower to stay polite to Wikimedia APIs and avoid HTTP 429 rate limits.",
            "default": 3
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}