{
  "openapi": "3.0.1",
  "info": {
    "title": "🧩 RAG Dataset Builder - Crawl to Embedding-Ready Chunks",
    "description": "🧩 Crawl a site and get back a FINISHED, embedding-ready RAG dataset — not just clean text. ✅ Semantic chunking on heading boundaries, never mid-code-block or mid-table. ✅ Token estimator, configurable overlap, near-duplicate removal, full provenance per chunk.",
    "version": "1.0",
    "x-build-id": "Svpj8hqEGAMj489jy"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/that_red_bird~rag-dataset-builder/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-that_red_bird-rag-dataset-builder",
        "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/that_red_bird~rag-dataset-builder/runs": {
      "post": {
        "operationId": "runs-sync-that_red_bird-rag-dataset-builder",
        "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/that_red_bird~rag-dataset-builder/run-sync": {
      "post": {
        "operationId": "run-sync-that_red_bird-rag-dataset-builder",
        "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": [
          "siteUrl"
        ],
        "properties": {
          "siteUrl": {
            "title": "Site URL",
            "type": "string",
            "description": "The site to crawl, e.g. https://docs.example.com. Pages are discovered from its sitemap, or by following same-origin links if there is no sitemap.",
            "default": "https://docs.apify.com"
          },
          "maxPages": {
            "title": "Max pages",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Upper bound on pages to crawl and chunk.",
            "default": 100
          },
          "useSitemap": {
            "title": "Use sitemap.xml",
            "type": "boolean",
            "description": "Prefer the site's sitemap (including sitemap indexes) for discovery. Falls back to following same-origin links automatically if none is found.",
            "default": true
          },
          "includePatterns": {
            "title": "Only URLs containing",
            "type": "array",
            "description": "Keep only URLs containing one of these substrings, e.g. /docs/, /guides/.",
            "items": {
              "type": "string"
            }
          },
          "excludePatterns": {
            "title": "Skip URLs containing",
            "type": "array",
            "description": "Drop URLs containing any of these, e.g. /tag/, /author/, ?page=.",
            "items": {
              "type": "string"
            }
          },
          "targetTokens": {
            "title": "Target tokens per chunk",
            "minimum": 20,
            "maximum": 4000,
            "type": "integer",
            "description": "Preferred chunk size. Chunk packing tries to land near this when a section has to be split, and a whole section under maxTokens is always kept as one chunk even if it's smaller or larger than this target.",
            "default": 350
          },
          "maxTokens": {
            "title": "Max tokens per chunk",
            "minimum": 20,
            "maximum": 8000,
            "type": "integer",
            "description": "Hard cap. No chunk exceeds this except the rare case where a single code block or table is itself bigger than the cap — it is kept whole rather than corrupted (see README limits). Must be >= targetTokens.",
            "default": 512
          },
          "overlapTokens": {
            "title": "Overlap between adjacent chunks (tokens)",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "How much of the end of one chunk is repeated at the start of the next chunk from the same page, so retrieval doesn't lose context at a chunk boundary. Overlap always lands on a whole sentence or block, never mid-word. Set to 0 to disable.",
            "default": 40
          },
          "minChunkTokens": {
            "title": "Minimum tokens to keep a chunk",
            "minimum": 0,
            "maximum": 200,
            "type": "integer",
            "description": "Chunks estimated below this many tokens are dropped as too small to be useful on their own (e.g. a lone short heading with no body).",
            "default": 15
          },
          "dedupThreshold": {
            "title": "Near-duplicate similarity threshold (0-100)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Two chunks anywhere in the crawl are treated as near-duplicates and merged into one when their shingle-based Jaccard similarity is at or above this. Higher = fewer false merges, more repeated boilerplate left in. Expressed 0-100; 85 means 0.85.",
            "default": 85
          },
          "shingleSize": {
            "title": "Shingle size (words)",
            "minimum": 2,
            "maximum": 12,
            "type": "integer",
            "description": "Length of the word n-grams used to fingerprint each chunk for near-duplicate detection. Smaller catches shorter overlaps but is noisier; larger is stricter.",
            "default": 5
          },
          "includeLinks": {
            "title": "Keep markdown links",
            "type": "boolean",
            "description": "Preserve [text](url) links in the extracted markdown. Turn off for pure prose with no link noise.",
            "default": true
          },
          "includeDuplicateRows": {
            "title": "Include removed-duplicate rows",
            "type": "boolean",
            "description": "Emit one row per removed near-duplicate chunk (type: \"duplicate\") showing which surviving chunk it matched and the similarity score. Off by default so the dataset stays a clean, ready-to-embed corpus.",
            "default": false
          },
          "concurrency": {
            "title": "Concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many pages to fetch in parallel.",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional Apify proxy configuration."
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}