{
  "openapi": "3.0.1",
  "info": {
    "title": "Document to Markdown: PDF, DOCX & HTML for RAG",
    "description": "Convert PDF, Word (DOCX), HTML pages, CSV and text into clean Markdown + JSON for LLMs and RAG: headings, tables, links, metadata and ready-to-embed chunks with heading paths and page numbers. URLs, Drive/Dropbox links or base64. No OCR, no AI cost.",
    "version": "0.0",
    "x-build-id": "Zrb8SwU8C86BmJSK0"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/dodiabak~document-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-dodiabak-document-to-markdown",
        "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/dodiabak~document-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-dodiabak-document-to-markdown",
        "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/dodiabak~document-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-dodiabak-document-to-markdown",
        "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": [
          "sources"
        ],
        "properties": {
          "sources": {
            "title": "Documents",
            "type": "array",
            "description": "Documents to convert. Each item is a URL string or an object: {\"url\": \"https://…/file.pdf\"}, {\"base64\": \"…\", \"fileName\": \"report.docx\"}, {\"html\": \"<h1>…</h1>\"}, {\"text\": \"…\"} or {\"markdown\": \"…\"}. Optional per item: \"type\" (pdf, docx, html, csv, markdown, text), \"password\" (encrypted PDF) and \"id\" (your own reference, copied to the output). Google Drive, Google Docs, Dropbox and GitHub share links are converted to direct downloads automatically. Max 1,000 per run."
          },
          "outputMode": {
            "title": "Output mode",
            "enum": [
              "document",
              "chunks"
            ],
            "type": "string",
            "description": "\"document\": one dataset item per document (Markdown, tables, links, metadata, optional chunks). \"chunks\": one dataset item per RAG chunk, ready to embed and load into a vector database.",
            "default": "document"
          },
          "includeChunks": {
            "title": "Add chunks to document items",
            "type": "boolean",
            "description": "In \"document\" mode, also add a \"chunks\" array to each item. Always on in \"chunks\" mode.",
            "default": false
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "Target maximum chunk length in characters (about 4 characters per token). Chunks break at headings and paragraphs and never split a table row or code block unless a single block is too long.",
            "default": 2000
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Characters of the previous chunk repeated at the start of the next one (cut at a word boundary). The overlap resets at H1/H2 headings.",
            "default": 200
          },
          "mainContentOnly": {
            "title": "Web pages: main content only",
            "type": "boolean",
            "description": "For HTML pages, keep only the main article (Mozilla Readability), removing navigation, footers, cookie banners and ads. Turn this off to convert the whole <body>.",
            "default": true
          },
          "linkStyle": {
            "title": "Links in Markdown",
            "enum": [
              "inline",
              "text"
            ],
            "type": "string",
            "description": "\"inline\" keeps [text](url) links. \"text\" keeps only the link text: shorter, cleaner input for LLMs and embeddings (URLs stay available in the \"links\" array).",
            "default": "inline"
          },
          "detectTables": {
            "title": "PDF: detect tables",
            "type": "boolean",
            "description": "Rebuild tables from column-aligned text in PDFs and output them as Markdown tables and JSON rows. This uses layout heuristics: complex tables (merged cells, ruled grids with wrapped text) may come out partly as text.",
            "default": true
          },
          "pageMarkers": {
            "title": "PDF: page markers",
            "type": "boolean",
            "description": "Insert <!-- page N --> comments between PDF pages so chunks keep their page number (useful for citations).",
            "default": true
          },
          "maxPages": {
            "title": "PDF: max pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Only the first N pages of each PDF are converted and billed.",
            "default": 300
          },
          "includeTables": {
            "title": "Include tables as JSON",
            "type": "boolean",
            "description": "Add a \"tables\" array (rows of cell strings) to document items.",
            "default": true
          },
          "includeLinks": {
            "title": "Include links",
            "type": "boolean",
            "description": "Add a \"links\" array (text + absolute URL) to document items.",
            "default": true
          },
          "includeText": {
            "title": "Include plain text",
            "type": "boolean",
            "description": "Also add a \"text\" field with plain text (no Markdown syntax).",
            "default": false
          },
          "saveMarkdownFiles": {
            "title": "Save .md files",
            "type": "boolean",
            "description": "Also save each document as a .md file in the run's key-value store and return its download URL as \"markdownUrl\".",
            "default": false
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Larger downloads are rejected with FILE_TOO_LARGE.",
            "default": 25
          },
          "requestTimeoutSecs": {
            "title": "Download timeout (seconds)",
            "minimum": 5,
            "maximum": 300,
            "type": "integer",
            "description": "How long to wait for each URL download before failing it with FETCH_FAILED.",
            "default": 60
          },
          "concurrency": {
            "title": "Parallel documents",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many documents are processed at the same time. Use 1–2 for very large PDFs with low memory.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}