# RAG Knowledge Loader (`botflowtech/rag-knowledge-loader`) Actor

Scrapes documentation sites (GitBook, ReadTheDocs, Notion public pages) and converts them into vector-ready JSON format for RAG applications.

- **URL**: https://apify.com/botflowtech/rag-knowledge-loader.md
- **Developed by:** [BotFlowTech](https://apify.com/botflowtech) (community)
- **Categories:** AI, Developer tools, Lead generation
- **Features:** Limited permissions
- **Stats:** 3 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## RAG Knowledge Loader

Scrapes documentation sites (GitBook, ReadTheDocs, Notion public pages) and converts them into vector-ready JSON format for RAG applications.

### Features

- Crawls entire documentation sites recursively
- Extracts clean, structured content
- Removes navigation, headers, footers automatically
- Outputs vector-ready JSON format
- Supports GitBook, ReadTheDocs, Notion, and custom doc sites

### Use Cases

- Build "Chat with Docs" chatbots
- Feed LLMs with up-to-date documentation
- Create knowledge bases for RAG pipelines
- Automated documentation updates for vector databases

### Input Parameters

#### Required

- **Start URLs** (required): Array of documentation site URLs to scrape
  - Example: `https://docs.apify.com/`, `https://your-gitbook-site.com`

#### Optional Configuration

- **Max pages to crawl** (default: 1000): Maximum number of pages to scrape
  - Minimum: 1

- **Include URL patterns (globs)** (default: \[]): Only crawl URLs matching these patterns
  - Example: `["**/api/**", "**/guides/**"]`

- **Exclude URL patterns (globs)** (default: `["**/*.pdf", "**/*.zip", "**/login**", "**/signup**"]`): Skip URLs matching these patterns

- **Content CSS Selectors** (default: `"article, main, .content, .markdown-body, #content, [role='main']"`): Comma-separated CSS selectors for main content area

- **Remove CSS Selectors** (default: `"nav, header, footer, .sidebar, #sidebar, .navigation, .cookie-banner, script, style, iframe"`): Selectors for elements to remove like navigation and headers

- **Output Format** (default: `"vector-ready"`):
  - `"vector-ready"`: Flat structure optimized for embeddings
  - `"hierarchical"`: Nested structure with full metadata

- **Crawler Type** (default: `"cheerio"`):
  - `"cheerio"`: Fast HTTP crawler for static sites
  - `"playwright"`: Browser-based crawler for JavaScript-heavy sites

#### Example Input JSON

{
"startUrls": \[
{ "url": "https://docs.example.com/" },
{ "url": "https://your-gitbook.com/docs" }
],
"maxPages": 500,
"excludeUrlGlobs": \["/\*.pdf", "/login\*\*", "/signup"],
"includeUrlGlobs": \["/docs/"],
"contentSelectors": "article, main, .markdown-body",
"removeSelectors": "nav, footer, .sidebar",
"outputFormat": "vector-ready",
"crawlerType": "cheerio"
}

#### Minimal Input Example

{
"startUrls": \[
{ "url": "https://docs.example.com/" }
]
}

### Output Format

#### Vector-Ready Format (Default)

Optimized for direct ingestion into vector databases:

{
"metadata": {
"crawledAt": "2025-12-06T08:11:00.000Z",
"totalPages": 150,
"startUrls": \["https://docs.example.com/"],
"readyForEmbedding": true
},
"documents": \[
{
"id": "unique-doc-id-123",
"text": "Full page content with all text extracted and cleaned...",
"metadata": {
"source": "https://docs.example.com/page",
"title": "Page Title",
"url": "https://docs.example.com/page",
"scrapedAt": "2025-12-06T08:11:00.000Z",
"wordCount": 1234
}
}
]
}

#### Hierarchical Format

Includes full document structure with headings and metadata:

{
"metadata": {
"crawledAt": "2025-12-06T08:11:00.000Z",
"totalPages": 150,
"startUrls": \["https://docs.example.com/"]
},
"documents": \[
{
"id": "unique-doc-id-123",
"url": "https://docs.example.com/page",
"title": "Page Title",
"content": "Full page content...",
"metadata": {
"description": "Page meta description",
"keywords": "api, documentation",
"scrapedAt": "2025-12-06T08:11:00.000Z",
"headings": \[
{ "level": 1, "text": "Introduction" },
{ "level": 2, "text": "Getting Started" }
],
"wordCount": 1234,
"characterCount": 5678
}
}
]
}

### Integration with Vector Databases

The output is ready to use with popular RAG frameworks:

- **LangChain**: Use JSONLoader to load documents
- **LlamaIndex**: Import as Document objects
- **Pinecone/Weaviate**: Batch upsert with metadata
- **Chroma**: Add to collection with embeddings

# Actor input Schema

## `startUrls` (type: `array`):

URLs of documentation sites to scrape (e.g., https://docs.example.com)

## `crawlLinkedPages` (type: `boolean`):

Enable to crawl all internal links found on pages. Disable to only scrape the provided start URLs.

## `maxCrawlDepth` (type: `integer`):

Maximum depth to follow links (1 = only start URLs, 2 = start URLs + direct links, etc.). Only applies if 'Crawl Linked Pages' is enabled.

## `maxPages` (type: `integer`):

Maximum number of pages to scrape

## `includeUrlGlobs` (type: `array`):

Only crawl URLs matching these patterns (e.g., **/docs/**, **/blog/**)

## `excludeUrlGlobs` (type: `array`):

Skip URLs matching these patterns

## `contentSelectors` (type: `string`):

CSS selectors for main content area (comma-separated)

## `removeSelectors` (type: `string`):

CSS selectors to remove (navigation, headers, footers, etc.)

## `outputFormat` (type: `string`):

Choose output structure

## `crawlerType` (type: `string`):

Cheerio for fast static sites, Playwright for JavaScript-heavy sites

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.apify.com/"
    }
  ],
  "crawlLinkedPages": true,
  "maxCrawlDepth": 99,
  "maxPages": 1000,
  "includeUrlGlobs": [],
  "excludeUrlGlobs": [
    "**/*.pdf",
    "**/*.zip",
    "**/login**",
    "**/signup**"
  ],
  "contentSelectors": "article, main, .content, .markdown-body, #content, [role=\"main\"]",
  "removeSelectors": "nav, header, footer, .sidebar, #sidebar, .navigation, .cookie-banner, script, style, iframe",
  "outputFormat": "vector-ready",
  "crawlerType": "cheerio"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://docs.apify.com/"
        }
    ],
    "excludeUrlGlobs": [
        "**/*.pdf",
        "**/*.zip",
        "**/login**",
        "**/signup**"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("botflowtech/rag-knowledge-loader").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startUrls": [{ "url": "https://docs.apify.com/" }],
    "excludeUrlGlobs": [
        "**/*.pdf",
        "**/*.zip",
        "**/login**",
        "**/signup**",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("botflowtech/rag-knowledge-loader").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://docs.apify.com/"
    }
  ],
  "excludeUrlGlobs": [
    "**/*.pdf",
    "**/*.zip",
    "**/login**",
    "**/signup**"
  ]
}' |
apify call botflowtech/rag-knowledge-loader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,botflowtech/rag-knowledge-loader"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ZOVNWGA2H3acK4mfw/builds/0LxVjBnhYY5nC6oO0/openapi.json
