{
  "openapi": "3.0.1",
  "info": {
    "title": "Image to Text OCR: Images & Scanned PDFs to Text (Tesseract)",
    "description": "OCR text from images, screenshots and scanned PDFs by URL or from a dataset: full text, lines and words with confidence and position, 17 built-in languages plus 100+ on demand. Blank pages and failed files are free. $1.50 per 1,000 pages.",
    "version": "1.0",
    "x-build-id": "86zTAJpz55AB42llA"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/best_apis~image-to-text-ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-best_apis-image-to-text-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/best_apis~image-to-text-ocr/runs": {
      "post": {
        "operationId": "runs-sync-best_apis-image-to-text-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/best_apis~image-to-text-ocr/run-sync": {
      "post": {
        "operationId": "run-sync-best_apis-image-to-text-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",
        "properties": {
          "urls": {
            "title": "Image or PDF URLs",
            "type": "array",
            "description": "Direct links to images (PNG, JPG, WebP, GIF, TIFF, BMP, AVIF, SVG) or PDFs (scanned or digital). Leave empty (and no dataset) for a demo on two public test images.",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Read URLs from a dataset (optional)",
            "type": "string",
            "description": "ID or name of an Apify dataset (for example the output of another scraper). Every item's URL field (see URL field) is OCR'd and the item itself is kept in sourceItem. The Actor gets read-only access to this dataset only."
          },
          "urlField": {
            "title": "URL field in dataset items",
            "type": "string",
            "description": "Field holding the image or PDF URL in each dataset item. Dotted paths like images.0 or image.url work.",
            "default": "url"
          },
          "languages": {
            "title": "Languages",
            "type": "array",
            "description": "Tesseract language codes, combined for mixed documents. Built in: eng, deu, fra, spa, ita, por, nld, pol, rus, ukr, tur, ara, hin, chi_sim, jpn, kor, vie. Any other code from the official tessdata list (e.g. ces, swe, heb, tha, chi_tra, ell) is downloaded on demand. Fewer languages = faster and more accurate.",
            "default": [
              "eng"
            ],
            "items": {
              "type": "string"
            }
          },
          "pdfMode": {
            "title": "PDF pages",
            "enum": [
              "auto",
              "ocr"
            ],
            "type": "string",
            "description": "Auto reads digital pages exactly from the PDF's own text (much cheaper, $0.10 per 1,000) and OCRs only scanned pages.",
            "default": "auto"
          },
          "maxPdfPages": {
            "title": "Max pages per PDF",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Only the first N pages of each PDF are processed.",
            "default": 100
          },
          "dpi": {
            "title": "PDF render resolution (DPI)",
            "minimum": 100,
            "maximum": 400,
            "type": "integer",
            "description": "Resolution used to render scanned PDF pages for OCR. 200 suits normal text; use 300 for small print.",
            "default": 200
          },
          "pageSegmentation": {
            "title": "Layout mode",
            "enum": [
              "3",
              "4",
              "6",
              "11",
              "7"
            ],
            "type": "string",
            "description": "Tesseract page segmentation mode. Automatic works for most pages; Sparse text finds scattered words in screenshots and photos.",
            "default": "3"
          },
          "includeLines": {
            "title": "Include lines with position",
            "type": "boolean",
            "description": "Add a lines array: text, confidence and bounding box (x, y, width, height in pixels) for every text line.",
            "default": true
          },
          "includeWords": {
            "title": "Include words with position",
            "type": "boolean",
            "description": "Add a words array with every word's confidence and bounding box. Large output on dense pages.",
            "default": false
          },
          "minConfidence": {
            "title": "Minimum word confidence",
            "minimum": 0,
            "maximum": 99,
            "type": "integer",
            "description": "Drop words recognised with lower confidence (0-99) from text and lines. 0 keeps everything; 40-60 removes noise from photos.",
            "default": 0
          },
          "enhance": {
            "title": "Enhance images before OCR",
            "type": "boolean",
            "description": "Auto-rotate by EXIF, convert to grayscale, upscale small images and normalise contrast. Usually improves accuracy on screenshots and photos.",
            "default": true
          },
          "maxFiles": {
            "title": "Max files",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on files per run, so cost stays predictable.",
            "default": 1000
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger files are skipped and not charged.",
            "default": 50
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. Only needed if a site blocks direct downloads.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}