{
  "openapi": "3.0.1",
  "info": {
    "title": "OCR API (Image to Text, Searchable PDF, 20 Languages)",
    "description": "Extract text from images and scanned PDFs with OCR: plain text, Markdown, word boxes with confidence, or a searchable PDF. Each row has page, text, confidence, wordCount, rotation and method. Pages that already have text are read free. 20 languages, no API key. $3 per 1,000 OCR pages.",
    "version": "0.1",
    "x-build-id": "WrzAA1feZ96sHaDWW"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/locaihost~ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-locaihost-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/locaihost~ocr/runs": {
      "post": {
        "operationId": "runs-sync-locaihost-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/locaihost~ocr/run-sync": {
      "post": {
        "operationId": "run-sync-locaihost-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": {
          "startUrls": {
            "title": "Image or PDF URLs",
            "type": "array",
            "description": "Links to images (PNG, JPG, WebP, TIFF incl. multi-page, GIF, BMP, HEIC/HEIF, AVIF) or PDFs (scanned, mixed or born-digital). Public URLs or signed links (S3, GCS, Azure, Dropbox). Google Drive and Dropbox share links are turned into direct downloads. Up to 1,000 files per run.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "uploadedFile": {
            "title": "Upload a file",
            "type": "string",
            "description": "Or upload one image or PDF from your computer."
          },
          "keyValueStore": {
            "title": "Key-value store with your files",
            "type": "string",
            "description": "OCR files already stored on Apify. Pick the store; the Actor gets read-only access to it for this run."
          },
          "keyValueStoreRecords": {
            "title": "Record keys",
            "type": "array",
            "description": "Keys of the files in the store above. Leave empty to OCR every record in the store.",
            "items": {
              "type": "string"
            }
          },
          "languages": {
            "title": "Languages",
            "type": "array",
            "description": "The languages on the page, up to 4. More languages make each page slower, so pick only what the documents use.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "spa",
                "fra",
                "deu",
                "por",
                "ita",
                "nld",
                "pol",
                "rus",
                "ukr",
                "tur",
                "ara",
                "hin",
                "chi_sim",
                "chi_tra",
                "jpn",
                "kor",
                "vie",
                "ind",
                "tha"
              ],
              "enumTitles": [
                "English",
                "Spanish",
                "French",
                "German",
                "Portuguese",
                "Italian",
                "Dutch",
                "Polish",
                "Russian",
                "Ukrainian",
                "Turkish",
                "Arabic",
                "Hindi",
                "Chinese (Simplified)",
                "Chinese (Traditional)",
                "Japanese",
                "Korean",
                "Vietnamese",
                "Indonesian",
                "Thai"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "outputMode": {
            "title": "Output",
            "enum": [
              "text",
              "markdown",
              "boxes"
            ],
            "type": "string",
            "description": "Every row has the page's plain text. Markdown adds a `markdown` field. Boxes adds `lines`, each with its words, pixel boxes [x0, y0, x1, y1] on the original page and a 0-100 confidence.",
            "default": "text"
          },
          "layout": {
            "title": "Page layout",
            "enum": [
              "auto",
              "block",
              "sparse"
            ],
            "type": "string",
            "description": "Auto runs full layout analysis (columns, paragraphs) and reads a narrow column such as a receipt line by line. Pick a fixed layout when you know what your images look like.",
            "default": "auto"
          },
          "searchablePdf": {
            "title": "Also make a searchable PDF",
            "type": "boolean",
            "description": "Saves one PDF per file with an invisible text layer over each OCR'd page, so you can search and copy text. Pages that already had text are kept as they were. The link is in each row (`searchablePdfUrl`) and the file is in the run's key-value store.",
            "default": false
          },
          "ocrMode": {
            "title": "Which PDF pages to OCR",
            "enum": [
              "auto",
              "always"
            ],
            "type": "string",
            "description": "Auto reads pages that already have selectable text straight from the PDF, exactly and for free, and OCRs scanned pages. Every page re-reads all pages with OCR (each one is charged), for PDFs whose text layer is broken or garbled.",
            "default": "auto"
          },
          "autoRotate": {
            "title": "Turn sideways and upside-down pages",
            "type": "boolean",
            "description": "Detects pages scanned or photographed at 90, 180 or 270 degrees and turns them upright.",
            "default": true
          },
          "deskew": {
            "title": "Straighten tilted pages",
            "type": "boolean",
            "description": "Levels pages scanned at a slight angle (up to 15 degrees).",
            "default": true
          },
          "enhance": {
            "title": "Fix lighting and faded print",
            "type": "boolean",
            "description": "Evens out shadows on phone photos, darkens faded or low-contrast print, and gives hard pages a second pass. Clean scans are left as they are.",
            "default": true
          },
          "maxPagesPerDocument": {
            "title": "Max pages per file",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Only the first N pages of each PDF or TIFF. 0 = all pages.",
            "default": 0
          },
          "maxPages": {
            "title": "Max OCR pages per run",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Stop after this many charged pages in the whole run. 0 = no limit (your maximum cost per run still applies).",
            "default": 0
          },
          "pdfDpi": {
            "title": "PDF render resolution",
            "minimum": 150,
            "maximum": 400,
            "type": "integer",
            "description": "Resolution scanned PDF pages are rendered at before OCR. 300 suits most documents; 400 can help very small print.",
            "default": 300
          },
          "maxFileSizeMb": {
            "title": "Max file size",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Larger files are skipped with a message (not charged).",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}