{
  "openapi": "3.0.1",
  "info": {
    "title": "Document Ocr Scraper",
    "description": "OCR for PDFs and images that returns per-block confidence scores and coordinates, reads native PDF text layers instantly, and tells you which pages were doubtful instead of failing silently.",
    "version": "0.0",
    "x-build-id": "qqCsNDS5VWZhZMwKM"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/excellent_mustang~document-ocr-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-excellent_mustang-document-ocr-scraper",
        "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/excellent_mustang~document-ocr-scraper/runs": {
      "post": {
        "operationId": "runs-sync-excellent_mustang-document-ocr-scraper",
        "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/excellent_mustang~document-ocr-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-excellent_mustang-document-ocr-scraper",
        "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",
            "maxItems": 1000,
            "uniqueItems": true,
            "type": "array",
            "description": "Direct, publicly reachable links to the files you want read. Accepts PNG, JPEG, WebP, BMP, TIFF and PDF. PDFs are split into pages automatically. Leave this empty to run the bundled sample document instead - handy for a first look at the output, and it means the Actor always returns something.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "quality": {
            "title": "Quality",
            "enum": [
              "fast",
              "balanced"
            ],
            "type": "string",
            "description": "How much model to spend on each page. Both tiers use the same multilingual PP-OCRv6 architecture; the balanced tier is roughly four times slower and noticeably better on small print, faint scans and dense tables.",
            "default": "balanced"
          },
          "ocrLanguage": {
            "title": "Script / language",
            "enum": [
              "auto",
              "latin",
              "english",
              "cyrillic",
              "eastSlavic",
              "greek",
              "arabic",
              "devanagari",
              "tamil",
              "telugu",
              "thai",
              "korean",
              "japanese",
              "chineseTraditional"
            ],
            "type": "string",
            "description": "Leave on automatic unless your documents use a script the default model does not cover. The automatic model handles Latin alphabets, Simplified Chinese and Japanese. Cyrillic, Arabic, Devanagari, Greek, Thai, Korean, Tamil, Telugu and Traditional Chinese each need their own model - the automatic one returns empty text for those rather than guessing.",
            "default": "auto"
          },
          "imagePreprocessing": {
            "title": "Image clean-up before OCR",
            "enum": [
              "none",
              "deskew",
              "enhance"
            ],
            "type": "string",
            "description": "Applied to pages that go through OCR (not to PDF text layers). **Deskew** straightens a tilted page before reading it — the single biggest accuracy win on photos and scans, because a page rotated even 5–15° wrecks recognition while the model stays falsely confident. It is a no-op on already-straight pages, so it is on by default. **Deskew + enhance** also runs local contrast (CLAHE) for faded or unevenly-lit scans. **None** feeds the image through untouched. The applied angle is reported in each result's `skewCorrectionDeg`.",
            "default": "deskew"
          },
          "preferEmbeddedText": {
            "title": "Use the PDF text layer when there is one",
            "type": "boolean",
            "description": "Most PDFs that were exported from software (rather than scanned) already contain the exact text with exact coordinates. When this is on, those pages are read straight out of the file - no OCR, no guessing, no transcription errors, and about 100x faster. Pages without a usable text layer still go through OCR. Each result says which path it took in its `textSource` field. Turn this off to force OCR on every page.",
            "default": true
          },
          "pdfDpi": {
            "title": "PDF render DPI",
            "minimum": 72,
            "maximum": 400,
            "type": "integer",
            "description": "Resolution used when rasterising a PDF page for OCR. 200 suits most scans. Raise to 300 for small print or poor-quality faxes; lower to 150 to halve the time on large, clean documents. Ignored for pages read from the text layer.",
            "default": 200
          },
          "firstPdfPage": {
            "title": "First PDF page",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Page to start from within each PDF, 1-based. Use with the page cap below to walk through a long document in chunks.",
            "default": 1
          },
          "maxPagesPerDocument": {
            "title": "Maximum pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Hard cap on pages taken from any single PDF, so one 900-page report cannot consume the whole run.",
            "default": 20
          },
          "minConfidence": {
            "title": "Minimum confidence",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "Text blocks the model is less sure about than this are dropped. 0.5 is a sensible floor. Lower it to 0.3 to keep marginal reads on a difficult scan and filter them yourself using the `confidence` field; raise it to 0.8 when you only want text you can trust unreviewed.",
            "default": 0.5
          },
          "outputMode": {
            "title": "One item per",
            "enum": [
              "page",
              "block"
            ],
            "type": "string",
            "description": "Page mode gives you one row per page with the full text and a nested list of blocks - best for feeding an LLM or a vector database. Block mode flattens to one row per detected line, which is easier to filter, sort by confidence, or load into a spreadsheet.",
            "default": "page"
          },
          "includeBlocks": {
            "title": "Include per-block detail",
            "type": "boolean",
            "description": "Attach the `blocks` array (text, confidence and bounding box for every detected line) to each page row. Turn off for a much smaller dataset when you only need the plain text. Ignored in block mode.",
            "default": true
          },
          "includePolygons": {
            "title": "Include four-point polygons",
            "type": "boolean",
            "description": "Add the raw four-corner polygon alongside the axis-aligned bounding box. Useful for rotated or skewed text; roughly doubles the size of the blocks array.",
            "default": false
          },
          "savePageImages": {
            "title": "Save rendered page images",
            "type": "boolean",
            "description": "Store the exact image the OCR models saw in the run's key-value store, and put its URL in `pageImageUrl`. Use this to check bounding boxes against real pixels when a result looks wrong.",
            "default": false
          },
          "maxItems": {
            "title": "Maximum items",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Total rows to write across all documents. The Actor stops cleanly when it gets here, and also stops early if the run's charging limit is reached first.",
            "default": 200
          },
          "maxFileSizeMb": {
            "title": "Maximum file size",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Downloads larger than this are rejected with a FILE_TOO_LARGE error rather than exhausting the run's memory.",
            "default": 50
          },
          "maxConcurrency": {
            "title": "Download concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many documents to download in parallel. OCR itself always runs one page at a time, because the models already use every available core.",
            "default": 4
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. Route downloads through Apify Proxy when a file host blocks datacenter IP addresses. Not needed for most public file links.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}