{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF OCR: Scanned PDF & Image to Text, Searchable PDF",
    "description": "PDF OCR for scanned PDFs and images: text per page, RAG chunks with page numbers, word boxes and a searchable PDF. Pages that already have text are read without OCR at a lower price; blank pages are free. Tesseract runs inside the Actor. From $1.20 per 1,000 OCR pages ($2 on Free).",
    "version": "0.1",
    "x-build-id": "9shfir8zLLyquWNhA"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tamatama~image-pdf-ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tamatama-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/tamatama~image-pdf-ocr/runs": {
      "post": {
        "operationId": "runs-sync-tamatama-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/tamatama~image-pdf-ocr/run-sync": {
      "post": {
        "operationId": "run-sync-tamatama-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 URLs",
            "type": "array",
            "description": "Links to images (PNG, JPEG, TIFF incl. multi-page, WebP, GIF, BMP) or PDF files (scanned or mixed). The type is detected from the content, so links without an extension work. Up to 50 MB per file. You can also link a text file that lists URLs (up to 1,000), e.g. https://example.com/scans.txt.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "languages": {
            "title": "Languages",
            "type": "array",
            "description": "Languages of the text, up to 3 (more languages make OCR slower). English is used if empty.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "deu",
                "fra",
                "spa",
                "por",
                "ita",
                "nld",
                "pol",
                "tur",
                "rus",
                "ukr",
                "jpn",
                "chi_sim",
                "kor"
              ],
              "enumTitles": [
                "English",
                "German",
                "French",
                "Spanish",
                "Portuguese",
                "Italian",
                "Dutch",
                "Polish",
                "Turkish",
                "Russian",
                "Ukrainian",
                "Japanese",
                "Chinese (Simplified)",
                "Korean"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "text",
              "chunks"
            ],
            "type": "string",
            "description": "Text: one dataset row per file with the full text and a list of pages (method, confidence, text). RAG chunks: one row per chunk with page numbers, ready for a vector database.",
            "default": "text"
          },
          "searchablePdf": {
            "title": "Create a searchable PDF",
            "type": "boolean",
            "description": "Save one PDF per file with an invisible text layer over the page images (select and search the text in any PDF viewer). The link is in searchablePdfUrl. No extra charge.",
            "default": false
          },
          "includeWords": {
            "title": "Include word boxes",
            "type": "boolean",
            "description": "Add every recognized word with its confidence (0-100) and position (left, top, width, height in pixels of the original image; for PDF pages, pixels at 300 DPI; measured after the page orientation is fixed) to each page. Makes the output much larger. Text format only.",
            "default": false
          },
          "autoRotate": {
            "title": "Fix page orientation",
            "type": "boolean",
            "description": "Detect pages that are upside down or sideways and turn them before OCR.",
            "default": true
          },
          "ocrAllPages": {
            "title": "OCR pages that already have text",
            "type": "boolean",
            "description": "By default, PDF pages that already have a text layer are read directly (cheaper and exact). Turn on to OCR every page anyway, e.g. when the existing text layer is garbage.",
            "default": false
          },
          "maxPagesPerDocument": {
            "title": "Max pages per file",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Process only the first N pages of each PDF or multi-page TIFF. 0 = all (up to 500).",
            "default": 0
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "Maximum characters per chunk (RAG chunks only). Chunks break at paragraphs first, then lines and sentences.",
            "default": 2000
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Characters repeated from the end of the previous chunk (RAG chunks only). At most half of the chunk size.",
            "default": 200
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}