{
  "openapi": "3.0.1",
  "info": {
    "title": "RAG-Ready Markdown Converter & Chunker",
    "description": "Convert raw HTML/text into clean Markdown and split into ready-to-ingest chunks for RAG pipelines, Vector DBs, and LLM fine-tuning workflows.",
    "version": "1.4",
    "x-build-id": "6q3KyTKt60uMyBXKx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/foxpink~apify-rag-markdown-chunker/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-foxpink-apify-rag-markdown-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/foxpink~apify-rag-markdown-chunker/runs": {
      "post": {
        "operationId": "runs-sync-foxpink-apify-rag-markdown-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/foxpink~apify-rag-markdown-chunker/run-sync": {
      "post": {
        "operationId": "run-sync-foxpink-apify-rag-markdown-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": {
          "htmlContent": {
            "title": "Raw HTML / Text Content",
            "type": "string",
            "description": "Paste raw HTML or text content here. For bulk processing, use the inputRecords array instead."
          },
          "chunkSize": {
            "title": "Chunk Size (characters or tokens)",
            "minimum": 50,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum target length of each chunk. Interpreted as tokens in Enterprise mode (with Vector DB), otherwise characters. Default: 1000.",
            "default": 1000
          },
          "chunkOverlap": {
            "title": "Chunk Overlap (characters or tokens)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Overlap between consecutive chunks. Interpreted as tokens in Enterprise mode, otherwise characters. Default: 200.",
            "default": 200
          },
          "mode": {
            "title": "Output Mode",
            "enum": [
              "both",
              "markdown",
              "chunks"
            ],
            "type": "string",
            "description": "Select what output to produce. 'both' returns cleaned Markdown plus chunked segments. Default: both.",
            "default": "both"
          },
          "urls": {
            "title": "URLs to Fetch (HTML)",
            "type": "array",
            "description": "Optional: array of URLs to fetch HTML from. Each URL is fetched and processed through the HTML-to-Markdown pipeline. Alternative to providing htmlContent, fileUrls, or inputRecords.",
            "items": {
              "type": "string"
            }
          },
          "fileUrls": {
            "title": "File URLs to Parse (PDF/DOCX)",
            "type": "array",
            "description": "Optional: array of direct download URLs to PDF (.pdf) or Word (.docx) files. Files are downloaded and parsed to text, then processed through the same chunking pipeline. No headless browser needed — pure Node.js binary parsers. Alternative to providing htmlContent, urls, or inputRecords.",
            "items": {
              "type": "string"
            }
          },
          "chunkingStrategy": {
            "title": "Chunking Strategy",
            "enum": [
              "auto",
              "character",
              "semantic"
            ],
            "type": "string",
            "description": "How to split content into chunks. 'character' uses fixed character counts. 'semantic' respects markdown headings. 'auto' picks semantic for content >5000 chars, character otherwise. Default: auto.",
            "default": "auto"
          },
          "inputRecords": {
            "title": "Bulk Input Records",
            "type": "array",
            "description": "For bulk processing: provide an array of objects with 'id' and 'html' fields. Each record is processed independently with optional per-record chunkSize and chunkOverlap.",
            "items": {
              "type": "object",
              "required": [
                "id",
                "html"
              ],
              "properties": {
                "id": {
                  "title": "Record ID",
                  "type": "string",
                  "description": "Unique record identifier"
                },
                "html": {
                  "title": "HTML Content",
                  "type": "string",
                  "description": "Raw HTML content to process"
                },
                "chunkSize": {
                  "title": "Chunk Size Override",
                  "type": "integer",
                  "minimum": 50,
                  "maximum": 10000,
                  "description": "Optional per-record chunk size override"
                },
                "chunkOverlap": {
                  "title": "Chunk Overlap Override",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 5000,
                  "description": "Optional per-record chunk overlap override"
                }
              }
            }
          },
          "embeddingModel": {
            "title": "Embedding Model",
            "enum": [
              "text-embedding-3-small",
              "text-embedding-3-large",
              "text-embedding-ada-002"
            ],
            "type": "string",
            "description": "OpenAI embedding model to use. text-embedding-3-small is default (fast, cheap, 1536-dim). text-embedding-3-large (3072-dim) for higher accuracy. text-embedding-ada-002 (1536-dim) legacy.",
            "default": "text-embedding-3-small"
          },
          "batchSize": {
            "title": "Embedding Batch Size",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Number of chunks to embed per API call. Lower to avoid rate limits, higher for throughput. Default: 20.",
            "default": 20
          },
          "openaiApiKey": {
            "title": "OpenAI API Key (Enterprise)",
            "type": "string",
            "description": "Required for Enterprise mode. Used for token-aware chunking and generating Vector Embeddings via text-embedding-3-small."
          },
          "pineconeApiKey": {
            "title": "Pinecone API Key",
            "type": "string",
            "description": "Pinecone API key. Provide with pineconeIndex + openaiApiKey to auto-upsert vectors to Pinecone."
          },
          "pineconeIndex": {
            "title": "Pinecone Index Name",
            "type": "string",
            "description": "Name of the Pinecone index (must match 1536-dimension for text-embedding-3-small)."
          },
          "qdrantUrl": {
            "title": "Qdrant Cluster URL",
            "type": "string",
            "description": "Qdrant cluster URL (e.g. https://xxx.cloud.qdrant.io). Provide with qdrantApiKey + qdrantCollection + openaiApiKey to auto-upsert vectors to Qdrant."
          },
          "qdrantApiKey": {
            "title": "Qdrant API Key",
            "type": "string",
            "description": "API key from your Qdrant Cloud console."
          },
          "qdrantCollection": {
            "title": "Qdrant Collection Name",
            "type": "string",
            "description": "Name of the Qdrant collection. Must have a 1536-dimension vector configured."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}