{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown with OCR, Tables and RAG Chunks",
    "description": "Turn PDF links into Markdown with headings, lists and tables, OCR for scanned pages (English and Arabic built in), a quality report per file and heading-based RAG chunks. No browser. Pay per PDF plus per OCR page.",
    "version": "0.1",
    "x-build-id": "WAXQ3EjFSvAj7welG"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/leadharbor~pdf-to-markdown-ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-leadharbor-pdf-to-markdown-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/leadharbor~pdf-to-markdown-ocr/runs": {
      "post": {
        "operationId": "runs-sync-leadharbor-pdf-to-markdown-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/leadharbor~pdf-to-markdown-ocr/run-sync": {
      "post": {
        "operationId": "run-sync-leadharbor-pdf-to-markdown-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",
        "required": [
          "urls"
        ],
        "properties": {
          "urls": {
            "title": "PDF links",
            "type": "array",
            "description": "Public links to PDF files (up to 100 per run, 25 MB each). Google Drive and Dropbox share links are turned into direct download links; any other link must point straight at the PDF. Links to private networks, localhost and pages that need a login are refused.",
            "items": {
              "type": "string"
            }
          },
          "enableOcr": {
            "title": "OCR for scanned pages",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "'auto' reads a page with OCR only when it has no usable text layer (a page made of an image, or a text layer full of unreadable characters). 'always' runs OCR on every page. 'never' reads text layers only. Each page read by OCR is billed as an OCR page ($0.007); pages whose OCR text is unreliable are delivered but not billed.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Language codes of the text on scanned pages, at most 3, for example [\"eng\"], [\"ara\", \"eng\"] or [\"deu\", \"fra\"]. English (eng) and Arabic (ara) are built in; every other official Tesseract 'tessdata_fast' language is downloaded when needed. List the main language first. Right-to-left languages are returned in logical reading order. Only English and Arabic were benchmarked: any other language is marked experimental in the quality report.",
            "default": [
              "eng"
            ],
            "items": {
              "type": "string"
            }
          },
          "outputFormat": {
            "title": "Output",
            "enum": [
              "all",
              "markdown",
              "per_page",
              "chunks"
            ],
            "type": "string",
            "description": "'all' returns the Markdown, one entry per page and the chunks. 'markdown' returns only the whole-document Markdown. 'per_page' returns one entry per page with its source (text layer or OCR) and confidence. 'chunks' returns only the heading-based chunks for RAG. Fields you do not ask for are null.",
            "default": "all"
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Pages to convert, for example 1-5, 8, 12- (an open end means to the last page). Leave empty for the whole document. Page numbers in the output are the numbers of the original document.",
            "default": ""
          },
          "maxPages": {
            "title": "Maximum pages per PDF",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "At most this many of the selected pages are converted per PDF. The row says so in its warnings when pages were left out. Above 300 every row carries a warning that a long OCR job can reach the 30 minute limit and come back as a partial result.",
            "default": 100
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Opens password-protected PDFs. The same password is tried on every link in the run. It is never stored in the output."
          },
          "maxChunkTokens": {
            "title": "Maximum tokens per chunk",
            "minimum": 100,
            "maximum": 8000,
            "type": "integer",
            "description": "Longer sections are split at paragraph boundaries so no chunk goes over this size. Tokens are approximate (characters divided by 4).",
            "default": 800
          },
          "includePageMarkers": {
            "title": "Keep page markers",
            "type": "boolean",
            "description": "Adds <!-- page N --> before each page in the Markdown. Chunks keep their page numbers either way.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}