{
  "openapi": "3.0.1",
  "info": {
    "title": "Image to Text OCR - Extract Text from Images & PDFs",
    "description": "Extract text from images, screenshots and scanned PDFs with OCR in 100+ languages. Returns plain text, Markdown, word confidence and bounding boxes per image or page. Bulk input from URLs, datasets or CSV. Failed downloads are not charged.",
    "version": "0.2",
    "x-build-id": "tdIEId3fnPHrDvf6F"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/zenomastro~image-ocr-text-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-zenomastro-image-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/zenomastro~image-ocr-text-extractor/runs": {
      "post": {
        "operationId": "runs-sync-zenomastro-image-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/zenomastro~image-ocr-text-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-zenomastro-image-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": {
          "imageUrls": {
            "title": "Image URLs",
            "maxItems": 1000,
            "type": "array",
            "description": "Direct HTTP/HTTPS image URLs to process. Can be combined with documentUrls.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "languages": {
            "title": "Languages",
            "type": "array",
            "description": "OCR languages. Use Tesseract codes such as eng, ita, deu, fra, spa or chi_sim; common forms like en, it, English or eng+ita are converted automatically. Unknown values are skipped with a warning instead of failing the run. Up to 8 languages.",
            "default": [
              "eng"
            ],
            "items": {
              "type": "string"
            }
          },
          "preprocessMode": {
            "title": "Preprocessing",
            "enum": [
              "auto",
              "none",
              "grayscale",
              "threshold"
            ],
            "type": "string",
            "description": "Image preprocessing strategy before OCR.",
            "default": "auto"
          },
          "segmentationMode": {
            "title": "Page segmentation",
            "enum": [
              "auto",
              "single_block",
              "sparse_text"
            ],
            "type": "string",
            "description": "Tesseract page-layout assumption.",
            "default": "auto"
          },
          "includeWords": {
            "title": "Include word-level data",
            "type": "boolean",
            "description": "Add per-word confidence and bounding boxes. Same as Layout detail = \"Words with boxes\".",
            "default": false
          },
          "outputDetail": {
            "title": "Layout detail",
            "enum": [
              "text",
              "lines",
              "paragraphs",
              "words"
            ],
            "type": "string",
            "description": "Adds the layout to each result: lines, paragraphs or words, each with text, confidence, a pixel box (bbox) and a 0–1 box (bboxNorm) that does not depend on image size. Useful for tables, forms and highlighting. \"Include word-level data\" still works and equals \"Words with boxes\".",
            "default": "text"
          },
          "maxImageSizeMb": {
            "title": "Max image size (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Reject images larger than this limit to prevent runaway memory use.",
            "default": 20
          },
          "requestTimeoutSecs": {
            "title": "Download timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Maximum time allowed for each image download.",
            "default": 30
          },
          "retries": {
            "title": "Download retries",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Retry transient download failures with exponential backoff.",
            "default": 2
          },
          "documentUrls": {
            "title": "Image or scanned PDF URLs",
            "maxItems": 1000,
            "type": "array",
            "description": "Public HTTP/HTTPS image or PDF URLs. PDFs are rasterized page by page before OCR. Also accepted: pdfUrls (the input name of PDF to Structured Data).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "imagesBase64": {
            "title": "Images or PDFs as base64",
            "type": "array",
            "description": "For files that are not online: base64 strings or data URIs (data:image/png;base64,...), one per file, up to 100. Size limits are the same as for URLs. Results have sourceType \"base64\" and sourceKey \"base64:1\", \"base64:2\"…",
            "default": []
          },
          "includeMarkdown": {
            "title": "Include Markdown",
            "type": "boolean",
            "description": "Add Markdown text; PDF pages are labeled with page headings.",
            "default": true
          },
          "maxDocumentSizeMb": {
            "title": "Max PDF/document size (MB)",
            "minimum": 1,
            "maximum": 250,
            "type": "integer",
            "description": "Maximum downloaded PDF/document size. Also accepted: maxPdfSizeMb.",
            "default": 50
          },
          "maxPdfPages": {
            "title": "Maximum PDF pages",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Maximum rasterized OCR pages per PDF. Also applies to multi-page TIFF files. Also accepted: maxPages, where 0 means all pages up to the maximum of 100.",
            "default": 25
          },
          "pdfDpi": {
            "title": "PDF render DPI",
            "minimum": 72,
            "maximum": 300,
            "type": "integer",
            "description": "Raster resolution for scanned PDF pages. Higher improves small text but costs more memory/time.",
            "default": 160
          },
          "pdfTextMode": {
            "title": "PDF text mode",
            "enum": [
              "auto",
              "ocr",
              "text_only"
            ],
            "type": "string",
            "description": "Digital PDFs already contain their text. Auto reads it directly (exact and fast) and runs OCR only on pages without usable text, such as scans. Choose OCR every page if a PDF's text layer is wrong. Each result row says textSource \"text_layer\" or \"ocr\".",
            "default": "auto"
          },
          "minTextLayerChars": {
            "title": "Minimum letters for a usable text layer",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "In Auto mode, a PDF page whose text layer has fewer letters and digits than this is treated as scanned and read with OCR.",
            "default": 40
          },
          "extractTables": {
            "title": "Extract tables from digital PDFs",
            "type": "boolean",
            "description": "PDF pages read from their text layer (textSource \"text_layer\") also get tables: the page's rows, top to bottom, split into cells by text position, as [[cell, ...], ...]. A row with one cell is a plain line. With Include Markdown, the Markdown adds the rows as a table. Same method as PDF to Structured Data: best for clean, grid-like tables. Pages read with OCR (scans) get no tables. No extra charge.",
            "default": false
          },
          "extractMetadata": {
            "title": "Include PDF metadata",
            "type": "boolean",
            "description": "Adds metadata to each PDF's document_summary row: title, author, subject, keywords, creator, producer, creation and modification dates (ISO 8601), page count, encryption, page size and PDF version. Missing values are null. No extra charge.",
            "default": false
          },
          "inputDatasetId": {
            "title": "Input Apify dataset ID",
            "type": "string",
            "description": "Optional Apify dataset whose items contain image or PDF URLs. Useful for OCR pipelines without copying URLs manually.",
            "default": ""
          },
          "datasetUrlField": {
            "title": "Dataset URL field",
            "type": "string",
            "description": "Field name read from each input dataset item, e.g. url, imageUrl or fileUrl.",
            "default": "url"
          },
          "maxDatasetItems": {
            "title": "Maximum dataset items",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Hard cap on input dataset items processed per run.",
            "default": 100
          },
          "sourceListUrls": {
            "title": "CSV, JSON, text or public Google Sheet manifests",
            "maxItems": 20,
            "type": "array",
            "description": "Optional public manifest URLs containing image/PDF URLs. Supports CSV, JSON arrays/objects, newline text, and public Google Sheets (automatically read via CSV export).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "sourceListUrlField": {
            "title": "Manifest URL field",
            "type": "string",
            "description": "Column/object field containing file URLs, e.g. url, imageUrl or fileUrl. Common URL fields are auto-detected when possible.",
            "default": "url"
          },
          "maxSourceListItems": {
            "title": "Maximum URLs per manifest",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Hard cap on URLs extracted from each external manifest.",
            "default": 1000
          },
          "minConfidence": {
            "title": "Low-confidence threshold",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Optional OCR confidence threshold. Results are never discarded; rows below the threshold are flagged lowConfidence for review.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}