{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF OCR & Image to Text: Scanned PDFs to Text & Markdown",
    "description": "Extract text or Markdown from PDFs, scans, photos, Word, PowerPoint, Excel and EPUB files for LLM and RAG. Reads the PDF text layer first and runs OCR only on scanned pages and images, in 49 languages. One row per page, slide, sheet or chunk with token counts, plus each document's full text.",
    "version": "0.1",
    "x-build-id": "Yg5lUdyMaQl6If770"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/actorfactory~pdf-ocr-text/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-actorfactory-pdf-ocr-text",
        "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/actorfactory~pdf-ocr-text/runs": {
      "post": {
        "operationId": "runs-sync-actorfactory-pdf-ocr-text",
        "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/actorfactory~pdf-ocr-text/run-sync": {
      "post": {
        "operationId": "run-sync-actorfactory-pdf-ocr-text",
        "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": [
          "fileUrls"
        ],
        "properties": {
          "fileUrls": {
            "title": "File URLs (PDF, Word, PowerPoint, Excel, EPUB, images)",
            "type": "array",
            "description": "Direct links to the files to read, one per line: PDF; images (PNG, JPEG, WebP, GIF, BMP, TIFF); Word (DOCX), PowerPoint (PPTX), Excel (XLSX), EPUB, CSV, TXT and Markdown. Public links only (S3, Google Cloud Storage, Dropbox ?dl=1 links, Apify key-value store records, your own website). A link that opens a web page instead of the file gives a free error row, unless Convert web pages is on. Example: https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
            "items": {
              "type": "string"
            }
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "text",
              "markdown"
            ],
            "type": "string",
            "description": "text: plain text, lines and paragraphs kept (as before). markdown: PDF headings from font sizes, bullet and numbered lists, paragraphs joined across line breaks with hyphenation repaired, running headers, footers and page numbers removed; Word, PowerPoint, Excel and EPUB files keep their headings, lists and tables. Same price either way.",
            "default": "text"
          },
          "languages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages of the text, used by OCR (Tesseract). Pick the language(s) of your documents; up to 5. More languages make OCR slower. The PDF text layer is read in any language regardless of this setting.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "deu",
                "fra",
                "spa",
                "ita",
                "por",
                "nld",
                "pol",
                "ces",
                "slk",
                "hun",
                "ron",
                "bul",
                "hrv",
                "srp",
                "srp_latn",
                "slv",
                "swe",
                "dan",
                "nor",
                "fin",
                "est",
                "lav",
                "lit",
                "ell",
                "tur",
                "rus",
                "ukr",
                "cat",
                "eus",
                "glg",
                "isl",
                "gle",
                "ara",
                "heb",
                "fas",
                "urd",
                "hin",
                "ben",
                "tam",
                "tha",
                "vie",
                "ind",
                "msa",
                "tgl",
                "chi_sim",
                "chi_tra",
                "jpn",
                "kor"
              ],
              "enumTitles": [
                "English",
                "German",
                "French",
                "Spanish",
                "Italian",
                "Portuguese",
                "Dutch",
                "Polish",
                "Czech",
                "Slovak",
                "Hungarian",
                "Romanian",
                "Bulgarian",
                "Croatian",
                "Serbian (Cyrillic)",
                "Serbian (Latin)",
                "Slovenian",
                "Swedish",
                "Danish",
                "Norwegian",
                "Finnish",
                "Estonian",
                "Latvian",
                "Lithuanian",
                "Greek",
                "Turkish",
                "Russian",
                "Ukrainian",
                "Catalan",
                "Basque",
                "Galician",
                "Icelandic",
                "Irish",
                "Arabic",
                "Hebrew",
                "Persian",
                "Urdu",
                "Hindi",
                "Bengali",
                "Tamil",
                "Thai",
                "Vietnamese",
                "Indonesian",
                "Malay",
                "Tagalog",
                "Chinese (Simplified)",
                "Chinese (Traditional)",
                "Japanese",
                "Korean"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "auto (recommended): pages with a real text layer are read directly (fast, exact, cheap); scanned pages, pages whose text layer is garbled, and scans that only carry a stamp or page number as text are OCR'd. always: OCR every PDF page, e.g. when a scan's embedded text is poor. never: read only the text layer; images are skipped. Images always need OCR.",
            "default": "auto"
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Optional, PDFs only. Pages to read from each PDF, 1-based: single pages and ranges separated by commas, open-ended ranges allowed. Example: 1-3, 5, 10-. Leave empty for all pages (up to the per-file maximum)."
          },
          "maxPagesPerFile": {
            "title": "Maximum pages per file",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Stop reading a PDF after this many pages; for other documents, after this many slides, sheets or chapters.",
            "default": 200
          },
          "chunkSize": {
            "title": "RAG chunk size (tokens)",
            "minimum": 0,
            "maximum": 8192,
            "type": "integer",
            "description": "0 (default) = one row per page, slide, sheet or chapter. Set e.g. 512 to get one row per chunk instead: each document is split at headings, then paragraphs, then sentences into pieces of at most this many tokens (OpenAI o200k_base count), with the heading path in section and the page range in page and page_end. Allowed: 0 or 64-8192. Chunks are free: you still pay per page or document, never per chunk.",
            "default": 0
          },
          "chunkOverlap": {
            "title": "Chunk overlap (tokens)",
            "minimum": 0,
            "maximum": 4096,
            "type": "integer",
            "description": "Tokens repeated from the end of the previous chunk at the start of the next one when a section is split for size (at most half of the chunk size). Only used when the chunk size is set.",
            "default": 50
          },
          "convertWebPages": {
            "title": "Convert web pages (HTML)",
            "type": "boolean",
            "description": "Off (default): a link that returns a web page instead of a file gives a free error row, so a wrong viewer link is never charged. On: web pages are converted too: the main content (Mozilla Readability) as Markdown or text, charged as one document. Single pages only, no crawling; robots.txt is respected.",
            "default": false
          },
          "dpi": {
            "title": "OCR resolution (dpi)",
            "minimum": 100,
            "maximum": 400,
            "type": "integer",
            "description": "Resolution at which scanned PDF pages are rendered for OCR. 200 suits normal print; use 300 for small print, 150 for large text. Higher is slower. Not used for images or text-layer pages.",
            "default": 200
          },
          "saveFullText": {
            "title": "Save each document's full text",
            "type": "boolean",
            "description": "Also save every file's text as one record in the run's key-value store (Markdown when the output format is Markdown) and link it in full_text_url on each row. Free.",
            "default": true
          },
          "maxPages": {
            "title": "Maximum pages and documents (total)",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Stop after this many charged PDF pages, images and documents across all files. You are charged per PDF page or image with text, and per converted Word, PowerPoint, Excel, EPUB, text or web document.",
            "default": 500
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}