{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown for RAG & LLMs: OCR, DOCX, Excel",
    "description": "Convert PDF (native or scanned), DOCX, XLSX, PPTX, HTML and images, by URL or upload, to Markdown, JSON or RAG chunks with page numbers and headings. Tesseract OCR with per-page confidence. $2 per 1,000 documents + $0.0003/page; failures are free. 50 files per run by default. MCP tool for AI agents.",
    "version": "1.2",
    "x-build-id": "pRXu3A2MOcGs2r09Z"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/rigel~doc-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-rigel-doc-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/rigel~doc-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-rigel-doc-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/rigel~doc-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-rigel-doc-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": {
          "sources": {
            "title": "Document URLs",
            "type": "array",
            "description": "Direct http(s) links to files you are allowed to fetch. Each item is {\"url\": \"...\"}. A requestsFromUrl list of links is accepted. {\"kvKey\": \"...\"} is not valid here: the platform rejects it before the run because this list only accepts URLs. Put that object in the dataset selected by datasetId, and select the store with keyValueStoreId. Private and loopback addresses are refused.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "files": {
            "title": "Upload files",
            "type": "array",
            "description": "One or more files from your computer. The Console stores each file and passes its signed record URL. From the API, pass that recordPublicUrl (https://api.apify.com/v2/key-value-stores/<store>/records/<fileName>?signature=…). The record key is the original file name. Document URLs in sources keep working."
          },
          "datasetId": {
            "title": "Source dataset",
            "type": "string",
            "description": "Optional dataset to read. Each item is one source: a url string, or an object with url, base64, kvKey, or requestsFromUrl. Under limited permissions the run can read only the dataset selected here."
          },
          "keyValueStoreId": {
            "title": "Source key-value store",
            "type": "string",
            "description": "Key-value store read for dataset items {\"kvKey\": \"report.pdf\"}. Those items belong in the dataset selected by datasetId, not in sources. storeId on an item, when set, must be this same id. When storeId is omitted, this store is used. Under limited permissions the run can read only the store selected here."
          },
          "output": {
            "title": "Output",
            "enum": [
              "markdown",
              "json",
              "text",
              "chunks"
            ],
            "type": "string",
            "description": "markdown: one row with Markdown. json: Markdown plus per-page text. text: plain text. chunks: one row per RAG chunk with page numbers and heading path.",
            "default": "markdown"
          },
          "ocr": {
            "title": "OCR",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "auto OCRs only pages that have no usable text layer. always OCRs every PDF page and is the only mode for images. never stays on the text layer.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Tesseract language codes.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "fra",
                "deu",
                "spa",
                "ita",
                "por",
                "nld"
              ]
            },
            "default": [
              "eng",
              "fra"
            ]
          },
          "maxOcrPages": {
            "title": "Max OCR pages per document",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Cap on pages read with Tesseract in one document. Extra scanned pages are skipped, flagged truncated-ocr, and not charged. 40 fits the default 300 second limit.",
            "default": 40
          },
          "ocrDpi": {
            "title": "OCR resolution",
            "minimum": 120,
            "maximum": 300,
            "type": "integer",
            "description": "Raster DPI for scanned PDF pages. 200 balances accuracy and compute. Large pages are scaled down automatically.",
            "default": 200
          },
          "pages": {
            "title": "Pages",
            "type": "string",
            "description": "PDF, PowerPoint or TIFF page range, for example 1-5,8. Omitted pages are not charged. Leave empty for every page."
          },
          "tables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Write tables as Markdown. CSV files are separate and off unless tableCsv is true.",
            "default": true
          },
          "tableCsv": {
            "title": "Table CSV export",
            "type": "boolean",
            "description": "Also store one ZIP of CSV files per document in the key-value store. Off by default. Markdown tables are unchanged.",
            "default": false
          },
          "excelOutput": {
            "title": "Excel output",
            "enum": [
              "markdown",
              "rows",
              "both"
            ],
            "type": "string",
            "description": "Spreadsheets only (XLSX and XLS). markdown keeps one document row with Markdown tables. rows writes one JSON item per data row (sheet, rowIndex, values by column). both keeps the Markdown row and adds the row items. A sheet is still one billed page. Other file types ignore this field.",
            "default": "markdown"
          },
          "includePageMarkers": {
            "title": "Page markers",
            "type": "boolean",
            "description": "Insert <!-- page: N --> so a citation can point at the source page.",
            "default": true
          },
          "includeNotes": {
            "title": "PowerPoint notes",
            "type": "boolean",
            "description": "Include speaker notes under each slide.",
            "default": true
          },
          "chunkSize": {
            "title": "Chunk size",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "Characters per chunk when output is chunks, including overlap. Long paragraphs are cut on a sentence or a word. A long table is cut between rows and each piece repeats the header. One table row longer than this stays whole.",
            "default": 1500
          },
          "chunkOverlap": {
            "title": "Chunk overlap",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Characters repeated from the previous chunk. Capped at half of chunkSize.",
            "default": 150
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Safety cap. 500 text pages finish inside the default 300 second timeout at 1024 MB. Extra pages are skipped, the row is partial, and they are not charged.",
            "default": 500
          },
          "maxRowsPerSheet": {
            "title": "Max rows per sheet",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Spreadsheet row cap. A truncated sheet is flagged truncated-rows and still charged as one sheet.",
            "default": 20000
          },
          "maxFileMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Files above this size are refused and not charged. 100 MB is the hard maximum.",
            "default": 100
          },
          "maxDocuments": {
            "title": "Max documents",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many URLs or files to process. 50 fits the 3600 second run limit for typical documents. Documents already finished are kept and charged if the run stops; the rest are not. Maximum 1000.",
            "default": 50
          },
          "timeoutSecs": {
            "title": "Timeout per document (seconds)",
            "minimum": 10,
            "maximum": 900,
            "type": "integer",
            "description": "Stop reading this document after this many seconds. Pages already converted are kept and charged; the rest are not. 300 seconds covers the default 500 text pages and 40 OCR pages at 1024 MB.",
            "default": 300
          },
          "headers": {
            "title": "HTTP headers",
            "type": "object",
            "description": "Optional headers for YOUR files (for example Authorization). They are not logged. They are dropped if a redirect changes host."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}