{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown for LLMs and RAG, with OCR",
    "description": "PDF to Markdown for RAG and LLMs. Keeps headings, lists and tables, reads columns in order, and OCRs scanned pages. Give it public PDF links or saved PDF files, get Markdown back. Pay per page processed, no monthly fee.",
    "version": "0.1",
    "x-build-id": "vVNfCxAIBRxlUVEte"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/bitbotboo~pdf-to-markdown-for-llms/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-bitbotboo-pdf-to-markdown-for-llms",
        "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/bitbotboo~pdf-to-markdown-for-llms/runs": {
      "post": {
        "operationId": "runs-sync-bitbotboo-pdf-to-markdown-for-llms",
        "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/bitbotboo~pdf-to-markdown-for-llms/run-sync": {
      "post": {
        "operationId": "run-sync-bitbotboo-pdf-to-markdown-for-llms",
        "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 addresses (URLs)",
            "type": "array",
            "description": "Public http or https addresses of the PDF files to convert. Type one per line, or upload a text file with one address per line (blank lines and lines starting with # are ignored; at most 1,000 addresses are read from a file, and at most 5 such files per run). Private and internal network addresses are refused. Example: https://www.irs.gov/pub/irs-pdf/p594.pdf. Use this field or keyValueStoreKeys, or both.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "keyValueStoreKeys": {
            "title": "Files in a key-value store (record keys)",
            "type": "array",
            "description": "Record keys of PDF files you saved in a key-value store, for files that have no public address. Allowed values: a list of key names, one per line. Default: empty. Example: my-report. Use together with keyValueStore. Leave empty if you give addresses.",
            "items": {
              "type": "string"
            }
          },
          "keyValueStore": {
            "title": "Key-value store that holds your files",
            "type": "string",
            "description": "The key-value store that holds the PDF files named in keyValueStoreKeys. Picking it here is what gives the Actor permission to read it. In the API, give the store's ID. Default: empty, which means the run's own default store, and that starts empty, so set this field whenever you use keyValueStoreKeys."
          },
          "pageStart": {
            "title": "First page",
            "minimum": 1,
            "type": "integer",
            "description": "First page to convert. Whole number, 1 or more; 1 is the first page of the document. Default: 1. Example: 3 starts at page 3. Applies to every document in the run.",
            "default": 1
          },
          "pageEnd": {
            "title": "Last page",
            "minimum": 1,
            "type": "integer",
            "description": "Last page to convert. Whole number, 1 or more. Default: empty, which converts to the end of the document. Example: 12 stops after page 12. Applies to every document in the run."
          },
          "ocrMode": {
            "title": "OCR for scanned pages",
            "enum": [
              "auto",
              "off",
              "force"
            ],
            "type": "string",
            "description": "Controls OCR (reading text from page images). Allowed values: auto, off, force. auto: OCR only pages that have almost no text layer (fewer than 25 characters), so text PDFs stay cheap. off: never OCR; scanned pages come back empty with a warning and are not charged. force: OCR every page, which costs more; use it when the text layer is garbled, or when a scanned page carries a printed or stamped line of text (auto reads such a page as a text page). Default: auto.",
            "default": "auto"
          },
          "ocrLanguage": {
            "title": "OCR language",
            "enum": [
              "latin",
              "chinese",
              "korean",
              "cyrillic"
            ],
            "type": "string",
            "description": "Script of the text on scanned pages, used only when OCR runs. Allowed values: latin (English, French, German, Spanish, Italian, Portuguese, Dutch and other Latin-alphabet languages), chinese, korean, cyrillic (Russian, Ukrainian and others). Default: latin. Example: chinese for a scanned Chinese report.",
            "default": "latin"
          },
          "outputGranularity": {
            "title": "One result per",
            "enum": [
              "document",
              "page"
            ],
            "type": "string",
            "description": "How the result is split into dataset items. Allowed values: document, page. document: one item per PDF, with the whole Markdown in the markdown field. page: one item per page, ready for chunking and embedding. Default: document.",
            "default": "document"
          },
          "includePages": {
            "title": "Also list pages separately (document mode)",
            "type": "boolean",
            "description": "Only used when outputGranularity is document. true: each item also has a pages list with the Markdown of each page. false: the item has the whole-document Markdown only. Default: false.",
            "default": false
          },
          "tablesAsMarkdown": {
            "title": "Tables as Markdown tables",
            "type": "boolean",
            "description": "How tables are written. true: tables become Markdown tables. false: tables come out as tab-separated lines. Default: true.",
            "default": true
          },
          "maxPages": {
            "title": "Maximum pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Safety cap on the number of pages converted from one document. Whole number from 1 to 2000. Pages beyond the cap are skipped and a warning is added to the item. Default: 300. Example: 50.",
            "default": 300
          },
          "maxFileSizeMb": {
            "title": "Maximum file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Largest PDF file to accept, in megabytes. Whole number from 1 to 200. A larger file is not downloaded or processed and gives an error item. Default: 50. Example: 20.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}