{
  "openapi": "3.0.1",
  "info": {
    "title": "OCR: Image and Scanned PDF to Text",
    "description": "OCR for images and scanned PDFs, run inside the Actor with no outside service. PNG, JPEG, WebP, TIFF, BMP, GIF and PDF in; text per file and page out, with confidence and optional word or line boxes. 30 languages, auto-rotation, OCR only on PDF pages that lack a text layer.",
    "version": "0.1",
    "x-build-id": "jideqwhaZWICr6RQp"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/antsonahill~ocr-image-pdf-to-text/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-antsonahill-ocr-image-pdf-to-text",
        "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/antsonahill~ocr-image-pdf-to-text/runs": {
      "post": {
        "operationId": "runs-sync-antsonahill-ocr-image-pdf-to-text",
        "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/antsonahill~ocr-image-pdf-to-text/run-sync": {
      "post": {
        "operationId": "run-sync-antsonahill-ocr-image-pdf-to-text",
        "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": {
          "fileUrls": {
            "title": "Image and PDF URLs",
            "type": "array",
            "description": "Direct links to images (PNG, JPEG, WebP, TIFF, BMP, GIF) or PDFs, one per line. Redirects are followed. The kind of file is read from its first bytes, so a link without a file extension works. A link that returns a web page is reported and not charged.",
            "items": {
              "type": "string"
            }
          },
          "files": {
            "title": "Upload images or PDFs",
            "type": "array",
            "description": "Upload files from your computer instead of, or in addition to, giving URLs. Each file can be up to 100 MB."
          },
          "languages": {
            "title": "Languages",
            "maxItems": 5,
            "uniqueItems": true,
            "type": "array",
            "description": "The languages the text is written in, main language first. Choose only the ones that occur: every extra language slows recognition down and can make it worse. Up to 5.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "spa",
                "fra",
                "deu",
                "ita",
                "por",
                "nld",
                "pol",
                "ces",
                "hun",
                "ron",
                "swe",
                "dan",
                "nor",
                "fin",
                "tur",
                "ell",
                "rus",
                "ukr",
                "bul",
                "ara",
                "heb",
                "hin",
                "tha",
                "vie",
                "ind",
                "chi_sim",
                "chi_tra",
                "jpn",
                "kor"
              ],
              "enumTitles": [
                "English",
                "Spanish",
                "French",
                "German",
                "Italian",
                "Portuguese",
                "Dutch",
                "Polish",
                "Czech",
                "Hungarian",
                "Romanian",
                "Swedish",
                "Danish",
                "Norwegian",
                "Finnish",
                "Turkish",
                "Greek",
                "Russian",
                "Ukrainian",
                "Bulgarian",
                "Arabic",
                "Hebrew",
                "Hindi",
                "Thai",
                "Vietnamese",
                "Indonesian",
                "Chinese (Simplified)",
                "Chinese (Traditional)",
                "Japanese",
                "Korean"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "autoRotate": {
            "title": "Correct orientation and skew",
            "type": "boolean",
            "description": "Straighten pages scanned at an angle, and read pages that lie on their side or upside down. A page that reads well as it is costs nothing extra; only a page that reads badly is tried another way up. Turn this off if your images are always upright and you want the page taken exactly as it is.",
            "default": true
          },
          "pdfOcrMode": {
            "title": "PDF pages to recognise",
            "enum": [
              "auto",
              "all"
            ],
            "type": "string",
            "description": "Many PDFs are part text, part scan. By default a page that has a text layer is read from it, which is exact and nearly free, and only pages without one are recognised. Choose every page to ignore text layers, for instance when a PDF carries a poor text layer from an earlier OCR pass.",
            "default": "auto"
          },
          "pageRange": {
            "title": "Pages",
            "type": "string",
            "description": "Pages to read from every PDF and multi-page TIFF, for example 1-5, 8, 12- (12 to the end). Pages are numbered from 1. Leave empty for all pages."
          },
          "maxPagesPerFile": {
            "title": "Maximum pages per file",
            "minimum": 1,
            "type": "integer",
            "description": "Stop reading a file after this many pages. Every recognised page is charged, so this caps what one long scan can cost. Leave empty for no limit."
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for PDFs that need one to open. It is tried on every protected PDF in the run. PDFs that only restrict printing or copying open without it."
          },
          "boxes": {
            "title": "Positions of the text",
            "enum": [
              "none",
              "lines",
              "words"
            ],
            "type": "string",
            "description": "Add the rectangle of every line or every word, in pixels of the page image, with its confidence. Use this to highlight text on the image, to read fields by position or to check doubtful words. Word boxes make the result several times larger.",
            "default": "none"
          },
          "keepLineBreaks": {
            "title": "Keep the line breaks of the page",
            "type": "boolean",
            "description": "By default the lines of a paragraph are joined and words hyphenated at a line end are put back together, which is what you want for search, for an LLM or for reading. Turn this on to get every line as it stands on the page, which suits receipts, forms and anything laid out in rows.",
            "default": false
          },
          "keyValueStoreId": {
            "title": "Key-value store with files",
            "type": "string",
            "description": "Read images and PDFs that another Actor or your own code saved as records in a key-value store, for example screenshots or files downloaded by a crawler. By default every record whose key ends in .pdf, .png, .jpg, .jpeg, .webp, .tif, .tiff, .bmp or .gif is read."
          },
          "recordKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Keys of the records to read from the key-value store, whatever their names look like. Leave empty to read every record whose key ends like an image or a PDF.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}