{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown, Tables & RAG Chunks (with OCR)",
    "description": "Convert PDF, DOCX and image files to clean Markdown, tables as CSV and RAG-ready chunks with page numbers. Scanned pages are read with OCR. No API keys, pay per page, built for AI agents and LLM pipelines.",
    "version": "0.1",
    "x-build-id": "YJvrfceHCalMfdtxF"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/errandkit~pdf-to-markdown-tables/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-errandkit-pdf-to-markdown-tables",
        "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/errandkit~pdf-to-markdown-tables/runs": {
      "post": {
        "operationId": "runs-sync-errandkit-pdf-to-markdown-tables",
        "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/errandkit~pdf-to-markdown-tables/run-sync": {
      "post": {
        "operationId": "run-sync-errandkit-pdf-to-markdown-tables",
        "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": {
          "documentUrls": {
            "title": "Document URLs",
            "type": "array",
            "description": "Public links to PDF, DOCX or image files (PNG, JPEG, TIFF, GIF, BMP, WEBP). Use the direct file link, not a viewer page.",
            "items": {
              "type": "string"
            }
          },
          "uploadedFile": {
            "title": "Or upload a file",
            "type": "string",
            "description": "Upload one PDF, DOCX or image from your computer."
          },
          "documents": {
            "title": "Documents (advanced, JSON)",
            "type": "array",
            "description": "For API and agent use: [{\"name\": \"a.pdf\", \"url\": \"https://...\"}] or [{\"name\": \"a.pdf\", \"content_base64\": \"...\"}]."
          },
          "outputMode": {
            "title": "Output mode",
            "enum": [
              "documents",
              "chunks"
            ],
            "type": "string",
            "description": "documents: one dataset item per document (Markdown, tables, chunks, metadata). chunks: one item per chunk, ready for a vector database.",
            "default": "documents"
          },
          "pages": {
            "title": "Pages (PDF)",
            "type": "string",
            "description": "Page selection, 1-based, e.g. 1-3,7. Leave empty for all pages."
          },
          "ocr": {
            "title": "OCR",
            "enum": [
              "auto",
              "force",
              "off"
            ],
            "type": "string",
            "description": "auto: OCR only pages without a text layer (scans). force: OCR every page. off: never (scanned pages come back empty).",
            "default": "auto"
          },
          "ocrLanguage": {
            "title": "OCR language",
            "enum": [
              "eng",
              "spa",
              "fra",
              "deu",
              "por",
              "ita",
              "eng+spa",
              "eng+fra"
            ],
            "type": "string",
            "description": "Tesseract language code. Combine with + (e.g. eng+spa).",
            "default": "eng"
          },
          "tables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Detect tables with drawn cell borders in PDFs (and all DOCX tables) and return them as rows and CSV.",
            "default": true
          },
          "chunking": {
            "title": "Make RAG chunks",
            "type": "boolean",
            "description": "Split each document into chunks that keep the nearest heading and the page range.",
            "default": true
          },
          "chunkMaxChars": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "Target maximum characters per chunk.",
            "default": 1500
          },
          "chunkOverlapChars": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "Characters repeated from the end of the previous chunk.",
            "default": 150
          },
          "includeMarkdown": {
            "title": "Include full Markdown in results",
            "type": "boolean",
            "description": "Turn off to keep dataset items small when you only need chunks or tables.",
            "default": true
          },
          "saveMarkdownFiles": {
            "title": "Save .md files",
            "type": "boolean",
            "description": "Also save each document's Markdown as a file in the key-value store.",
            "default": true
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Pages beyond this are skipped (and not charged).",
            "default": 500
          },
          "failOnEmpty": {
            "title": "Fail the run if no text is found",
            "type": "boolean",
            "description": "Marks the run failed (not succeeded-but-empty) when no document yields any text.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}