{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown, Tables & OCR for RAG",
    "description": "Turn PDFs into clean Markdown, plain text, per-table JSON and RAG chunks with page numbers. OCR runs only on scanned pages. Public URLs or Key-value store files. Pay per page, no subscription.",
    "version": "1.0",
    "x-build-id": "sTgXXjiaKKppjXqtN"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/mzansi-dataworks~pdf-to-markdown-tables-ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-mzansi-dataworks-pdf-to-markdown-tables-ocr",
        "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/mzansi-dataworks~pdf-to-markdown-tables-ocr/runs": {
      "post": {
        "operationId": "runs-sync-mzansi-dataworks-pdf-to-markdown-tables-ocr",
        "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/mzansi-dataworks~pdf-to-markdown-tables-ocr/run-sync": {
      "post": {
        "operationId": "run-sync-mzansi-dataworks-pdf-to-markdown-tables-ocr",
        "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": {
          "pdfUrls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Links to the PDF files (http or https). Paste one link, or several, or upload a text file with one link per line. The link must lead straight to the file, not to a web page that contains it. Public pages only: private addresses and local networks are refused.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "outputMode": {
            "title": "Output shape",
            "enum": [
              "document",
              "pages",
              "chunks"
            ],
            "type": "string",
            "description": "Document: one dataset item per PDF with the whole Markdown and all tables. Pages: one item per page. Chunks: ready-made pieces of text for a vector database, each with its page numbers and the heading it sits under.",
            "default": "document"
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Only read these pages, for example 1-10,15 or 20- (page 20 to the end) or -5 (the first five). Page 1 is the first page of the file. Leave empty for all pages. You are charged only for the pages that are read."
          },
          "extractTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Detect tables and return them as Markdown tables inside the text and as separate JSON (rows, header, row objects). Works best on tables with ruled lines or clear column alignment. Switch off to get plain running text only.",
            "default": true
          },
          "ocr": {
            "title": "OCR for scanned pages",
            "enum": [
              "auto",
              "off",
              "force"
            ],
            "type": "string",
            "description": "Auto: OCR only the pages that have no usable text (scans, photos of documents), and read every other page from its text layer. Off: never OCR. Force: OCR every page. OCR reads printed English and Chinese text and digits. Accented letters are often returned without accents. It does not read handwriting or right-to-left, Cyrillic, Greek or Indic scripts. OCR pages cost more than text pages (see Pricing).",
            "default": "auto"
          },
          "includeMarkdown": {
            "title": "Include Markdown",
            "type": "boolean",
            "description": "Return the text as Markdown (headings, lists, GitHub tables). In chunk mode the chunks are Markdown when this is on.",
            "default": true
          },
          "includeText": {
            "title": "Include plain text",
            "type": "boolean",
            "description": "Also return the same content as plain text without Markdown symbols. In chunk mode the chunks are plain text when Markdown is off.",
            "default": false
          },
          "includePageMarkers": {
            "title": "Page markers in the text",
            "type": "boolean",
            "description": "In one-item-per-PDF mode, add a marker before the first text of each page (an HTML comment in Markdown: <!-- page 3 -->).",
            "default": true
          },
          "removeHeadersFooters": {
            "title": "Remove running headers, footers and page numbers",
            "type": "boolean",
            "description": "Drop lines that repeat at the top or bottom of most pages (document title, confidentiality notice, page numbers).",
            "default": true
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "Target maximum length of one chunk in characters, not tokens. About 4 characters make one English token, so 1500 characters is roughly 375 tokens. Used in chunk mode.",
            "default": 1500
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "How much text from the end of one chunk is repeated at the start of the next. Must not be more than half the chunk size. Used in chunk mode.",
            "default": 200
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for encrypted PDFs. The same password is tried on every PDF in the run. Stored as a secret and never written to the log or the dataset."
          },
          "ocrMinChars": {
            "title": "Pages with fewer characters than this are OCR'd",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "In Auto mode a page is sent to OCR when its text layer has fewer readable characters than this, or when the text layer is garbled (broken font encoding).",
            "default": 25
          },
          "maxPagesPerDocument": {
            "title": "Max pages per PDF",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Longer PDFs are cut after this many pages and marked as partial. Use a page range to read the rest.",
            "default": 500
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger files are refused before they are fully downloaded and are not charged.",
            "default": 50
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}