{
  "openapi": "3.0.1",
  "info": {
    "title": "Image to Text OCR – Bulk Text Extraction, 100+ Languages",
    "description": "Extract text from images in bulk with Tesseract 5 OCR: PNG, JPG, WebP, TIFF (multi-page), GIF, BMP, HEIC. 120+ languages, auto-rotation, dark-mode screenshots, small-text upscaling. Text, confidence, lines and words with bounding boxes, hOCR. $0.0025 per image.",
    "version": "0.1",
    "x-build-id": "BddrFRFelV6uODsG3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/gazidev~image-ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-gazidev-image-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/gazidev~image-ocr/runs": {
      "post": {
        "operationId": "runs-sync-gazidev-image-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/gazidev~image-ocr/run-sync": {
      "post": {
        "operationId": "run-sync-gazidev-image-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": [
          "imageUrls"
        ],
        "properties": {
          "imageUrls": {
            "title": "Image URLs",
            "type": "array",
            "description": "Direct links to images: PNG, JPEG, WebP, TIFF (multi-page too), GIF, BMP, HEIC/HEIF (iPhone photos) or AVIF. One per line. `data:image/...;base64,` URIs also work (handy for AI agents). PDFs are not images: use [Document & Invoice to JSON](https://apify.com/gazidev/document-invoice-to-json) for those.",
            "default": [
              "https://upload.wikimedia.org/wikipedia/commons/5/55/A_text-book_of_agricultural_entomology_%28Page_192%29_BHL9798403.jpg"
            ],
            "items": {
              "type": "string"
            }
          },
          "languages": {
            "title": "Languages",
            "type": "array",
            "description": "Tesseract language codes of the text, e.g. `eng`, `deu`, `fra`, `spa`, `ita`, `por`, `nld`, `tur`, `pol`, `rus`, `ukr`, `ara`, `hin`, `chi_sim`, `chi_tra`, `jpn`, `kor` (preinstalled). ISO codes (`en`, `de`, `zh`, `ja`) and names (`German`) work too. Any other of the 120+ Tesseract languages (`ell`, `heb`, `tha`, `vie`, `swe`...) is downloaded automatically on first use. Use 1–3 languages that actually appear in the images. `auto` detects the script per image (Latin → English, Cyrillic → Russian, Arabic, Han → Chinese, Japanese, Korean, Devanagari → Hindi, Greek, Hebrew, Thai...).",
            "default": [
              "eng"
            ],
            "items": {
              "type": "string"
            }
          },
          "outputLevel": {
            "title": "Output detail",
            "enum": [
              "text",
              "lines",
              "words"
            ],
            "type": "string",
            "description": "`text`: the full text plus confidence and counts. `lines`: also every line with its bounding box and confidence. `words`: also every word with bounding box and confidence (largest output). Bounding boxes are in pixels of the original image.",
            "default": "text"
          },
          "includeHocr": {
            "title": "Include hOCR",
            "type": "boolean",
            "description": "Add the raw hOCR (HTML with layout and word boxes) produced by Tesseract, e.g. to build searchable PDFs or for layout tools. Coordinates in hOCR refer to the processed image (see `preprocessing`).",
            "default": false
          },
          "pageSegmentationMode": {
            "title": "Page layout",
            "enum": [
              "auto",
              "3",
              "4",
              "6",
              "11",
              "7",
              "1"
            ],
            "type": "string",
            "description": "`auto` (recommended): automatic layout with orientation detection; if a large region was skipped (typical on receipts), it re-reads the image as one block and keeps the better result. Or force a Tesseract mode: `3` automatic, `4` single column of varying sizes, `6` one uniform block (receipts, forms, tables), `11` sparse text in no particular order (screenshots, signs, product photos), `7` a single text line, `1` automatic + orientation.",
            "default": "auto"
          },
          "autoRotate": {
            "title": "Auto-rotate (90° / 180° / 270°)",
            "type": "boolean",
            "description": "Detect and fix sideways or upside-down pages and photos. EXIF orientation from phones is always applied.",
            "default": true
          },
          "preprocessing": {
            "title": "Preprocessing",
            "enum": [
              "auto",
              "threshold",
              "none"
            ],
            "type": "string",
            "description": "`auto`: grayscale, transparent background flattened to white, dark-mode screenshots inverted, contrast stretched. `threshold`: `auto` plus black/white binarization (Otsu), sometimes better for noisy or unevenly lit scans. `none`: the image as is.",
            "default": "auto"
          },
          "upscaleSmallImages": {
            "title": "Adaptive scaling",
            "type": "boolean",
            "description": "Measure the text height first and enlarge small text (thumbnails, 1080p screenshots, low-resolution scans) up to 3x, or shrink huge photos with very large text, so Tesseract sees ~20–40 px lines. Usually raises accuracy a lot on screenshots.",
            "default": true
          },
          "minWordConfidence": {
            "title": "Minimum word confidence (0–100)",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Drop words recognized with lower confidence from text, lines and words (0 = keep all). 50–60 removes most noise from photos and borders.",
            "default": 0
          },
          "preserveInterwordSpaces": {
            "title": "Preserve spaces between words",
            "type": "boolean",
            "description": "Keep runs of spaces in the text (helps keep receipt and table columns aligned).",
            "default": false
          },
          "maxPagesPerImage": {
            "title": "Max pages per image",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "For multi-page TIFF files: OCR at most this many pages per file. Each page is billed as one image.",
            "default": 10
          },
          "ocrAllAnimationFrames": {
            "title": "OCR every frame of animated GIF / WebP / PNG",
            "type": "boolean",
            "description": "By default only the first frame of an animation is read. On: each frame (up to the page limit) is OCRed and billed like a page.",
            "default": false
          },
          "maxImageSizeMb": {
            "title": "Max image size (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Larger downloads are stopped and reported as errors (not charged).",
            "default": 25
          },
          "requestTimeoutSecs": {
            "title": "Download timeout (seconds)",
            "minimum": 5,
            "maximum": 300,
            "type": "integer",
            "description": "Per download attempt. Failed downloads are retried 3 times with backoff.",
            "default": 45
          },
          "ocrTimeoutSecs": {
            "title": "OCR timeout per page (seconds)",
            "minimum": 20,
            "maximum": 900,
            "type": "integer",
            "description": "A page that takes longer is reported as an error (not charged).",
            "default": 180
          },
          "maxConcurrency": {
            "title": "Parallel OCR workers",
            "minimum": 0,
            "maximum": 32,
            "type": "integer",
            "description": "0 = automatic: one worker per CPU core you get (Apify gives 1 core per 4 GB of memory). For big batches, run with 4–8 GB memory: it is several times faster for the same price per image.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}