{
  "openapi": "3.0.1",
  "info": {
    "title": "Document to Markdown & JSON for AI/RAG",
    "description": "Convert PDF, Word (DOCX), PowerPoint (PPTX), Excel (XLSX), HTML web pages, EPUB and text files into clean Markdown, plain text and metadata, with tables as Markdown and RAG-ready chunks with token counts and page numbers. Optional OCR.",
    "version": "1.0",
    "x-build-id": "pvpnApaZw0kxLUPo6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/arpitgoriya~document-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-arpitgoriya-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/arpitgoriya~document-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-arpitgoriya-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/arpitgoriya~document-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-arpitgoriya-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",
        "properties": {
          "startUrls": {
            "title": "Document or web page URLs",
            "type": "array",
            "description": "Links to files (PDF, DOCX, PPTX, XLSX, CSV, EPUB, Markdown, TXT, JSON; images with OCR) or to web pages. The file type is detected from the content, so URLs without an extension work too. Add them one by one, paste a list, or upload a text file with one URL per line. Duplicates are converted (and charged) only once.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "uploadedFile": {
            "title": "Or upload a file",
            "type": "string",
            "description": "Upload one document from your computer instead of giving a URL. It is stored in your Apify storage and converted like any URL."
          },
          "chunking": {
            "title": "RAG chunking",
            "enum": [
              "inline",
              "separate",
              "none"
            ],
            "type": "string",
            "description": "Split each document into chunks for embeddings / vector databases. 'Inside each document item' adds a `chunks` array to the document's result. 'As separate dataset items' adds one row per chunk (handy for direct import into a vector DB); document rows are still written. Chunking is free.",
            "default": "inline"
          },
          "chunkSize": {
            "title": "Chunk size (tokens)",
            "minimum": 64,
            "maximum": 8192,
            "type": "integer",
            "description": "Maximum chunk length in tokens, counted with OpenAI's cl100k_base tokenizer (used by text-embedding-3 models). 256–1024 suits most embedding models.",
            "default": 512
          },
          "chunkOverlap": {
            "title": "Chunk overlap (tokens)",
            "minimum": 0,
            "maximum": 2048,
            "type": "integer",
            "description": "Tokens from the end of a chunk that are repeated at the start of the next one when a long section is split, so sentences that span a boundary keep their context. At most half of the chunk size.",
            "default": 64
          },
          "headingAwareChunking": {
            "title": "Start new chunks at headings",
            "type": "boolean",
            "description": "Begin a new chunk at each heading (once the current chunk holds a quarter of the chunk size), so chunks follow the document's sections. Every chunk always lists its heading path and page range.",
            "default": true
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "off",
              "auto",
              "always"
            ],
            "type": "string",
            "description": "OCR reads text from scanned PDFs and images with Tesseract. 'Off' is cheapest: scanned pages are reported as having no text. 'Auto' OCRs only pages without a text layer (and image files). 'Always' OCRs every PDF page, for PDFs with a broken text layer. Each OCR'd page is charged as a 'page-ocr' event.",
            "default": "off"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "string",
            "description": "Tesseract language codes, joined with '+'. Available: eng, deu, fra, spa, por, ita, nld, pol, hin. Example: 'eng+deu'.",
            "default": "eng"
          },
          "includeMarkdown": {
            "title": "Include Markdown",
            "type": "boolean",
            "description": "Add the full document as Markdown (headings, lists, bold/italic, tables) in the `markdown` field.",
            "default": true
          },
          "includePlainText": {
            "title": "Include plain text",
            "type": "boolean",
            "description": "Add the document as plain text (no Markdown syntax; tables as tab-separated lines) in the `text` field.",
            "default": true
          },
          "includeTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Convert tables to Markdown tables. In PDFs this finds ruled tables and 'booktabs' tables (horizontal rules only). Turn off for faster PDF processing.",
            "default": true
          },
          "pageMarkers": {
            "title": "Add page markers",
            "type": "boolean",
            "description": "Insert `<!-- page N -->` comments (or slide/sheet/chapter) into the Markdown where each page starts. Chunks carry page numbers either way.",
            "default": false
          },
          "removeHeadersFooters": {
            "title": "Remove repeated page headers and footers (PDF)",
            "type": "boolean",
            "description": "Drop page numbers and running headers/footers that repeat on most pages, so they don't pollute your chunks.",
            "default": true
          },
          "htmlExtraction": {
            "title": "Web page extraction",
            "enum": [
              "main",
              "full"
            ],
            "type": "string",
            "description": "'Main content' keeps the article/body text and drops navigation, menus, cookie banners, footers and ads (trafilatura). 'Whole page' converts everything visible in the HTML. Pages that need JavaScript to show their text are not supported.",
            "default": "main"
          },
          "includeLinks": {
            "title": "Keep links (HTML, DOCX, EPUB)",
            "type": "boolean",
            "description": "Keep hyperlinks as Markdown links [text](url). Off by default because link URLs add tokens without adding meaning for most RAG uses.",
            "default": false
          },
          "includeSpeakerNotes": {
            "title": "Include speaker notes (PPTX)",
            "type": "boolean",
            "description": "Add each slide's speaker notes as a quote below the slide content.",
            "default": true
          },
          "saveMarkdownFiles": {
            "title": "Also save .md files",
            "type": "boolean",
            "description": "Save each converted document as a .md file in the run's key-value store, with a download link in `markdownFileUrl`.",
            "default": false
          },
          "keyValueStoreId": {
            "title": "Key-value store with files",
            "type": "string",
            "description": "Convert files stored in one of your Apify key-value stores (for example the output of another Actor). Give the store ID or name."
          },
          "keyValueStoreKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Keys of the records to convert from the key-value store above. Leave empty to convert every record in the store.",
            "items": {
              "type": "string"
            }
          },
          "maxPagesPerDocument": {
            "title": "Max pages per PDF",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Convert at most this many pages of each PDF (or frames of a multi-page image). The first 50 pages of every PDF are included in the document price; each further page is charged as 'extra-page'.",
            "default": 1000
          },
          "maxRowsPerSheet": {
            "title": "Max rows per sheet (XLSX/CSV)",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Rows kept per spreadsheet sheet or CSV file. Larger sheets are cut and a warning is added.",
            "default": 5000
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Files larger than this are skipped with an error (not charged).",
            "default": 100
          },
          "maxConcurrency": {
            "title": "Parallel downloads",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "How many documents are downloaded at the same time.",
            "default": 4
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. Use Apify Proxy if a site blocks downloads from data-center IPs.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}