{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Text Extractor with OCR: PDF, DOCX & Images",
    "description": "Extract text from PDF, Word (DOCX) and image files by URL; scanned pages are read with OCR (7 languages). Use to turn documents into text for search or LLMs; optional tables to CSV/JSON. Input: fileUrls. Output per file: status, text, per-page text, page count, OCR pages, metadata, tables.",
    "version": "0.1",
    "x-build-id": "kQcSrKcADp4WPX9ch"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/phaux~pdf-docx-ocr-text-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-phaux-pdf-docx-ocr-text-extractor",
        "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/phaux~pdf-docx-ocr-text-extractor/runs": {
      "post": {
        "operationId": "runs-sync-phaux-pdf-docx-ocr-text-extractor",
        "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/phaux~pdf-docx-ocr-text-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-phaux-pdf-docx-ocr-text-extractor",
        "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": {
          "fileUrls": {
            "title": "File URLs",
            "type": "array",
            "description": "Public http(s) links to PDF, DOCX or image files (PNG, JPEG, TIFF, GIF, BMP, WEBP). Each URL is checked against its site's robots.txt and must resolve to a public IP. Leave empty and add no key-value store files to run the small example PDF.",
            "items": {
              "type": "string"
            }
          },
          "keyValueStore": {
            "title": "Key-value store with your files",
            "type": "string",
            "description": "Optional. Pick (or give the ID or name of) a key-value store you uploaded files to. The Actor gets read-only access to this store only. Each record's content must be the raw file. Example: \"my-documents\" (a store name or ID in your account)."
          },
          "keyValueStoreKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Record keys of the files in that store, e.g. 'scan.pdf'. Leave empty to process every record in the store (up to 1,000).",
            "items": {
              "type": "string"
            }
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "Auto OCRs a PDF page only when its text layer has fewer than 'Min text characters per page'. Images are always OCR'd unless Never. Default: \"auto\".",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "string",
            "description": "Tesseract language codes joined with '+', e.g. 'eng' or 'eng+deu'. Installed: eng, deu, fra, spa, por, ita, nld. Default: \"eng\".",
            "default": "eng"
          },
          "ocrDpi": {
            "title": "OCR resolution (DPI)",
            "minimum": 100,
            "maximum": 400,
            "type": "integer",
            "description": "Resolution scanned PDF pages are rendered at before OCR. 300 is Tesseract's sweet spot; lower is faster but less accurate. Default: 300.",
            "default": 300
          },
          "minTextCharsPerPage": {
            "title": "Min text characters per page (auto OCR)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "In auto mode, a PDF page whose text layer has fewer letters/digits than this is OCR'd. Default: 25.",
            "default": 25
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger files are refused before download (not charged). Default: 50.",
            "default": 50
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Only the first N pages are extracted; the item is marked truncated. Default: 200.",
            "default": 200
          },
          "maxOcrPagesPerDocument": {
            "title": "Max OCR pages per document",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Caps OCR work (and OCR charges) per document. Extra scanned pages are left empty and listed in warnings. Default: 50.",
            "default": 50
          },
          "includePageTexts": {
            "title": "Include per-page texts",
            "type": "boolean",
            "description": "Add the 'pages' array (text per page). The full text is always in 'text'. Default: true.",
            "default": true
          },
          "extractTables": {
            "title": "Extract tables to CSV / JSON",
            "type": "boolean",
            "description": "Off by default. When on, tables in PDF text layers (pdfplumber) and DOCX files are also returned: each table as JSON rows in the item's 'tables' field plus a CSV file in the key-value store (csvUrl). Scanned/OCR pages and images are skipped. No extra charge: the document price is the same.",
            "default": false
          },
          "tableStrategy": {
            "title": "Table detection",
            "enum": [
              "lines",
              "text"
            ],
            "type": "string",
            "description": "PDF only. 'lines' finds tables drawn with borders or rules. 'text' guesses columns from text alignment for borderless tables; check the result. Default: \"lines\".",
            "default": "lines"
          },
          "maxConcurrency": {
            "title": "Documents in parallel",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "How many documents are downloaded and processed at once. OCR inside a document uses all CPU cores (~1 core per 4 GB memory). Default: 2.",
            "default": 2
          },
          "timeBudgetSecs": {
            "title": "Time budget (seconds)",
            "minimum": 0,
            "maximum": 86400,
            "type": "integer",
            "description": "Stop starting new work after this many seconds and finish SUCCEEDED with what is done. 0 = automatic (run timeout minus a safety margin). Default: 0.",
            "default": 0
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}