{
  "openapi": "3.0.1",
  "info": {
    "title": "Markdown RAG Chunker: Document Text Splitter",
    "description": "RAG chunking for PDFs, Word, PowerPoint, Excel, EPUB and web pages. A header-aware text splitter keeps each chunk inside one section, caps it at 512 tokens by default, and adds its header path, source, stable ID and exact token count. Ready to embed into Pinecone, Qdrant or pgvector.",
    "version": "1.3",
    "x-build-id": "WWwsZltPqQ4bOfxKz"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/codepoetry~markdown-rag-chunker/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-codepoetry-markdown-rag-chunker",
        "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/codepoetry~markdown-rag-chunker/runs": {
      "post": {
        "operationId": "runs-sync-codepoetry-markdown-rag-chunker",
        "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/codepoetry~markdown-rag-chunker/run-sync": {
      "post": {
        "operationId": "run-sync-codepoetry-markdown-rag-chunker",
        "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": {
          "markdown_file": {
            "title": "Document URL",
            "type": "string",
            "description": "One document per run: the HTTP(S) URL of a PDF, webpage (HTML), Word, Excel, PowerPoint, EPUB, CSV, JSON, XML, Markdown or text file, up to 25 MB. To chunk several documents, start one run per URL. Or kvs://KEY to read a record from the store selected under Key-value store."
          },
          "markdown_text": {
            "title": "Markdown text",
            "type": "string",
            "description": "Or paste Markdown directly. Use either this or Document URL; if both are set, choose one with Input mode."
          },
          "input_mode": {
            "title": "Input mode",
            "enum": [
              "file",
              "text"
            ],
            "type": "string",
            "description": "Optional. Detected automatically from whichever source you fill in; set it only when both Document URL and Markdown text are filled."
          },
          "source_id": {
            "title": "Source ID",
            "maxLength": 2000,
            "type": "string",
            "description": "Optional stable ID for this document, e.g. the page URL when you paste crawled Markdown. It scopes chunk_id, fills each chunk's source, and keys Skip if unchanged, so editing one section keeps the other sections' IDs. Defaults to the Document URL."
          },
          "kvs_store": {
            "title": "Key-value store",
            "type": "string",
            "description": "Only for kvs://KEY sources: the key-value store holding the record. The run gets read-only access to this store."
          },
          "headers_to_split_on": {
            "title": "Headers to split on",
            "type": "array",
            "description": "Markdown header levels that start a new chunk. ['#', '##', '###'] gives section-level chunks for most documents; deeper headers stay inside their parent section.",
            "default": [
              "#",
              "##",
              "###"
            ],
            "items": {
              "type": "string"
            }
          },
          "max_chunk_tokens": {
            "title": "Max chunk size (tokens)",
            "minimum": 50,
            "maximum": 8192,
            "type": "integer",
            "description": "Sections longer than this many tokens are re-split on paragraph, line, sentence and word boundaries with 10% overlap; shorter sections stay whole. 512 suits modern embedding models (OpenAI, Voyage, Cohere, Gemini, Jina, Qwen3); use 256 for short factual lookups and 1024 for long analytical answers. To keep sections whole regardless of size, send null via the API.",
            "default": 512
          },
          "tokenizer": {
            "title": "Tokenizer",
            "enum": [
              "cl100k_base",
              "o200k_base"
            ],
            "type": "string",
            "description": "Encoding used to measure chunks and fill token_count. cl100k_base matches OpenAI text-embedding-3 models; o200k_base matches GPT-4o-era models and counts non-English text more compactly.",
            "default": "cl100k_base"
          },
          "strip_headers": {
            "title": "Move headers to metadata",
            "type": "boolean",
            "description": "On: header text lives only in each chunk's metadata (best for embeddings). Off: chunks also keep their header line (best for human-readable output).",
            "default": true
          },
          "max_chunk_chars": {
            "title": "Max chunk size (characters)",
            "minimum": 100,
            "maximum": 100000,
            "type": "integer",
            "description": "Optional. Cap chunks by characters instead of tokens; when set, it overrides Max chunk size (tokens)."
          },
          "skip_if_unchanged": {
            "title": "Skip if unchanged",
            "type": "boolean",
            "description": "For scheduled pipelines: when the document and chunking settings match the previous run, nothing is pushed and the run costs only the $0.001 start fee. An unchanged file is not even re-converted. The run Output reports unchanged=true.",
            "default": false
          },
          "cache_namespace": {
            "title": "Cache namespace",
            "maxLength": 100,
            "type": "string",
            "description": "Optional. Keeps Skip if unchanged state separate for pipelines that chunk the same document, e.g. 'dev' and 'prod', so one never skips the other."
          },
          "max_input_chars": {
            "title": "Max document size (characters)",
            "minimum": 1,
            "maximum": 5000000,
            "type": "integer",
            "description": "Runs whose converted document is longer than this fail fast, before any chunks are billed.",
            "default": 2000000
          },
          "max_chunks": {
            "title": "Max chunks per run",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Runs that would produce more chunks fail before pushing any, so you are never billed for a runaway split.",
            "default": 5000
          },
          "use_apify_proxy": {
            "title": "Use Apify Proxy",
            "type": "boolean",
            "description": "Download the document through Apify Proxy (datacenter) when a site blocks direct requests. Included in the price.",
            "default": false
          },
          "proxy_url": {
            "title": "Custom proxy URL",
            "type": "string",
            "description": "Or use your own proxy: http://user:pass@host:8080, https://host:8080 or socks5://host:1080. Stored encrypted. Not combinable with Use Apify Proxy."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}