{
  "openapi": "3.0.1",
  "info": {
    "title": "Image and Scanned PDF OCR (Arabic, Cyrillic, Hindi, Latin)",
    "description": "Give it image or scanned PDF links, get the text of each page as JSON with line confidence and boxes. OCR for English, Arabic, Russian, Hindi, French, Spanish, German. AI mode turns receipts and invoices into JSON. From $1.50 per 1,000 pages.",
    "version": "0.1",
    "x-build-id": "FVH3TsZEwaY1oR1mi"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/opstoolkit~image-pdf-ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-opstoolkit-image-pdf-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/opstoolkit~image-pdf-ocr/runs": {
      "post": {
        "operationId": "runs-sync-opstoolkit-image-pdf-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/opstoolkit~image-pdf-ocr/run-sync": {
      "post": {
        "operationId": "run-sync-opstoolkit-image-pdf-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 links",
            "type": "array",
            "description": "Direct links to image or PDF files, one per item. Accepted: PNG, JPEG, WebP, TIFF, GIF, BMP, PDF. Example: [\"https://example.com/scans/invoice-2026-11.pdf\"]. A link to a web page is refused as a free row, the Actor does not crawl sites. Give at least one of urls, files or datasetId. Only OCR files you have the right to process.",
            "items": {
              "type": "string"
            }
          },
          "files": {
            "title": "Upload files",
            "type": "array",
            "description": "Images or PDFs uploaded from your computer in the Apify Console. They are stored in your key-value store and read with this run's token. Use this or urls. Leave empty when calling the Actor from the API or an AI agent, and pass urls instead."
          },
          "datasetId": {
            "title": "Read links from a dataset",
            "type": "string",
            "description": "Optional. The ID of an Apify dataset whose rows hold image or PDF links, for example the output of Bulk Image Downloader. Example: \"aBcDeFgHiJkLmNoPq\". Every row's link (field set in urlField) is read. Leave empty if you pass urls or files."
          },
          "urlField": {
            "title": "Link field in that dataset",
            "type": "string",
            "description": "Name of the field in each dataset row that holds the image or PDF link. Only used with datasetId. Use dots for nested fields, for example media.url. Default: url.",
            "default": "url"
          },
          "engine": {
            "title": "Engine",
            "enum": [
              "auto",
              "fast",
              "ai"
            ],
            "type": "string",
            "description": "How pages are read. auto: free engine first, AI only for pages under 60% confident (those are billed as AI pages). fast: free engine only, printed text in 7 languages, keeps line confidence and boxes. ai: Gemini vision model, for handwriting, photos at an angle, tables, other scripts and JSON from a schema. A schema cannot be used with fast. Default: auto.",
            "default": "auto"
          },
          "languages": {
            "title": "Languages",
            "type": "array",
            "description": "Languages to read, one per item. Accepted codes: eng, ara, rus, hin, fra, spa, deu (English, Arabic, Russian, Hindi, French, Spanish, German). Names like English or two-letter codes like fr also work. Example: [\"ara\", \"eng\"]. Leave empty to detect the script of each page. Setting it is faster and more accurate. Free engine only.",
            "items": {
              "type": "string"
            }
          },
          "minConfidence": {
            "title": "Minimum line confidence",
            "type": "string",
            "description": "Free engine only. Lines the engine is less sure about than this value are dropped from the text. A number from 0 to 1 written as text, for example \"0.5\". Use \"0\" to keep every line. Default: \"0.3\".",
            "default": "0.3"
          },
          "outputFormat": {
            "title": "Detail level",
            "enum": [
              "text",
              "lines",
              "boxes"
            ],
            "type": "string",
            "description": "How much each row carries. text: the page text only. lines: text plus every line with its confidence (0 to 1). boxes: lines with pixel boxes as well (left, top, right, bottom). Default: lines.",
            "default": "lines"
          },
          "autoRotate": {
            "title": "Fix sideways and upside-down pages",
            "type": "boolean",
            "description": "When true, the free engine detects the page rotation and turns the page upright before reading. Set false if a page is already upright and you want it read as is. Default: true.",
            "default": true
          },
          "schema": {
            "title": "JSON schema for AI extraction",
            "type": "object",
            "description": "Optional. A JSON schema object with the fields you want back, for example {\"type\":\"object\",\"properties\":{\"vendor\":{\"type\":\"string\"},\"date\":{\"type\":\"string\"},\"total\":{\"type\":\"number\"}}}. The AI model fills it in and the result goes in the structured field. Setting it switches the engine to AI (not allowed with fast), turns off the PDF text layer, and the page text is not returned. Leave empty for plain OCR."
          },
          "aiModel": {
            "title": "AI model",
            "enum": [
              "google/gemini-3.5-flash-lite",
              "google/gemini-3.1-flash-lite",
              "google/gemini-3.6-flash"
            ],
            "type": "string",
            "description": "Vision model used in AI mode, one of google/gemini-3.5-flash-lite (default, cheapest), google/gemini-3.1-flash-lite, google/gemini-3.6-flash (most accurate on hard pages). Reached through Apify's OpenRouter proxy. Its usage is billed to your Apify account at OpenRouter's price, on top of this Actor's price. Ignored when the free engine reads the page.",
            "default": "google/gemini-3.5-flash-lite"
          },
          "pdfMaxPages": {
            "title": "Max pages per PDF or TIFF",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Most pages to read from each PDF or multi-page TIFF. A whole number from 1 to 500, for example 20. Pages after this number are not read and come back as one free row. Default: 50.",
            "default": 50
          },
          "usePdfTextLayer": {
            "title": "Use the text already inside PDFs",
            "type": "boolean",
            "description": "When true, a PDF page that already has selectable text is returned as it is (engine pdf-text) instead of being re-read from a picture. It is still charged as a page. Set false to read every page from its picture. Default: true.",
            "default": true
          },
          "saveTextFiles": {
            "title": "Save a TXT file per document",
            "type": "boolean",
            "description": "When true, the text of each file is saved as a .txt in the run's key-value store and the download link is put in the textFile field of each row. Default: false.",
            "default": false
          },
          "maxFileSizeMb": {
            "title": "Largest file (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Largest file size accepted, in megabytes. A whole number from 1 to 100, for example 40. Bigger files are refused as a free row. Raise it for large PDFs and give the run more memory (2 GB or more). Default: 25.",
            "default": 25
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}