{
  "openapi": "3.0.1",
  "info": {
    "title": "Image to Text & PDF to Text OCR (English + Arabic)",
    "description": "Extract text from images, screenshots, and scanned or digital PDFs by URL or Key-Value Store. English & Arabic OCR + digit normalization. Unreadable pages $0.",
    "version": "0.1",
    "x-build-id": "HZNMaGJ56UBZOPpSs"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/runekit~arabic-document-ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-runekit-arabic-document-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/runekit~arabic-document-ocr/runs": {
      "post": {
        "operationId": "runs-sync-runekit-arabic-document-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/runekit~arabic-document-ocr/run-sync": {
      "post": {
        "operationId": "run-sync-runekit-arabic-document-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": {
          "files": {
            "title": "File URLs",
            "type": "array",
            "description": "HTTP or HTTPS URLs of PDFs or images you supply. Supported types: PDF, JPEG, PNG, WEBP, TIFF, and BMP. Each file must be 25 MB or smaller.",
            "items": {
              "type": "string"
            },
            "default": [
              "https://raw.githubusercontent.com/py-pdf/fpdf2/master/test/text_shaping/bidi_arabic_lorem_ipsum.pdf"
            ]
          },
          "sourceKeyValueStore": {
            "title": "Key-value store with your files",
            "type": "string",
            "description": "The key-value store that holds your images and PDFs. Pick it here so a limited-permissions run can read it. The actor only reads that store and never writes to it. Leave this empty to use this run's default store."
          },
          "keyValueStoreRecords": {
            "title": "Key-value store records",
            "type": "array",
            "description": "Record keys to read. A plain key is read from the store you picked in \"Key-value store with your files\", or from this run's default store when that field is empty. storeIdOrName/recordKey (a store id, store name, or username~store-name) still works when this run can already read that store. If it cannot, that item asks you to pick the store in \"Key-value store with your files\" and the other files still run. The key must match exactly. A missing record is an error on that item. Images and PDFs are read as raw bytes. The actor does not write the file back.",
            "items": {
              "type": "string"
            }
          },
          "languages": {
            "title": "Languages",
            "enum": [
              "ara",
              "ara+eng",
              "eng"
            ],
            "type": "string",
            "description": "Tesseract traineddata. ara+eng is the default. Use ara for Arabic-only pages or eng for English-only pages.",
            "default": "ara+eng"
          },
          "preprocess": {
            "title": "Preprocess images",
            "type": "boolean",
            "description": "When on, the page is EXIF-rotated and read once as greyscale. The long side is capped at 2400 pixels and smaller images are not enlarged. A shadowed photo is illumination-corrected and, when the text is still large enough, capped at 2000 pixels. Accurate mode can still run cleanup and a second read. When off, there is no EXIF rotation and no cleanup pass. The long-side cap still applies. DPI comes from a stored density of 150 to 600, scaled when the page is reduced, from a text-line estimate, or as 300 when that estimate cannot be made. BMP files skip Sharp.",
            "default": true
          },
          "accurateMode": {
            "title": "Accurate mode",
            "type": "boolean",
            "description": "Slower, more passes. The page price is the same.",
            "default": false
          },
          "skipOcrWhenTextLayer": {
            "title": "Keep PDF text layers",
            "type": "boolean",
            "description": "When enabled, a PDF page with a non-empty text layer is copied from that layer and not OCR'd. Whitespace-only pages are still OCR'd. A non-empty text layer is kept even if the extracted text is wrong.",
            "default": true
          },
          "maxPagesPerFile": {
            "title": "Max pages per file",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Maximum pages read from each PDF or multi-page TIFF. Later pages are skipped.",
            "default": 20
          },
          "extractFields": {
            "title": "Extract field candidates",
            "type": "boolean",
            "description": "Experimental, printed invoices only. When on, adds best-effort candidate dates, Saudi VAT numbers, currency amounts, and total lines. These are pattern matches, not verified values. Leave off for ordinary text OCR.",
            "default": false
          },
          "psm": {
            "title": "Page segmentation mode",
            "minimum": 0,
            "maximum": 13,
            "type": "integer",
            "description": "Page segmentation mode passed to Tesseract. 3 is Tesseract's default; 0 is OSD-only; 2 is not implemented; 6 is a single block.",
            "default": 3
          },
          "renderDpi": {
            "title": "PDF render DPI",
            "minimum": 150,
            "maximum": 400,
            "type": "integer",
            "description": "Resolution used when a PDF page is rendered for OCR. 300 is the default. 150 to 400 are allowed.",
            "default": 300
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}