{
  "openapi": "3.0.1",
  "info": {
    "title": "OCR to Markdown: Scanned PDFs & Images to Text for AI",
    "description": "OCR scanned PDFs and images (PNG, JPG, TIFF) into clean Markdown or text for LLMs and RAG. 26 languages, auto-rotation, noise and table-line cleanup, smart mode that only OCRs pages that need it. Failed files are not charged.",
    "version": "0.0",
    "x-build-id": "9NKQwW7W8ACRP9WQD"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/bigochelo~ocr-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-bigochelo-ocr-to-markdown",
        "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/bigochelo~ocr-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-bigochelo-ocr-to-markdown",
        "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/bigochelo~ocr-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-bigochelo-ocr-to-markdown",
        "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",
        "required": [
          "fileUrls"
        ],
        "properties": {
          "fileUrls": {
            "title": "File URLs (PDF or images)",
            "type": "array",
            "description": "Public links to scanned PDFs or images (PNG, JPG, TIFF, WEBP, GIF, BMP), one per line. Example: [\"https://example.com/scan.pdf\"]. Google Drive, Dropbox and GitHub share links are converted automatically.",
            "items": {
              "type": "string"
            }
          },
          "languages": {
            "title": "Document languages",
            "type": "array",
            "description": "Languages in the documents (combine them for mixed documents). Accepts codes or names, e.g. [\"eng\", \"spa\"] or [\"en\", \"es\"]. Available: eng, spa, por, fra, deu, ita, nld, dan, swe, nor, fin, pol, ces, ron, hun, tur, rus, ukr, ell, ara, hin, chi_sim, jpn, kor, vie, ind.",
            "default": [
              "eng"
            ],
            "items": {
              "type": "string"
            }
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "always"
            ],
            "type": "string",
            "description": "\"auto\" (default): pages that already contain digital text are read directly (cheaper, exact) and only scanned pages are OCR'd. \"always\": OCR every page.",
            "default": "auto"
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "markdown",
              "text",
              "both"
            ],
            "type": "string",
            "description": "\"markdown\" (default, keeps headings and lists; best for LLMs), \"text\" (plain text) or \"both\".",
            "default": "markdown"
          },
          "includePages": {
            "title": "Include per-page results",
            "type": "boolean",
            "description": "If true, adds a 'pages' array with each page's text, method (ocr or text-layer) and OCR confidence.",
            "default": false
          },
          "chunking": {
            "title": "Split into RAG chunks",
            "type": "boolean",
            "description": "If true, adds a 'chunks' array: heading-aware pieces ready for embeddings / vector databases.",
            "default": false
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "Maximum characters per chunk (about 4 characters per token).",
            "default": 1500
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Characters repeated between consecutive chunks.",
            "default": 150
          },
          "aiSafety": {
            "title": "AI safety scan (prompt injection)",
            "type": "boolean",
            "description": "Removes text a human cannot see (white-on-white, tiny or off-page text in digital PDF pages) and reports hidden instructions aimed at AI, invisible characters and data-exfiltration links in an 'aiSafety' object. OCR only reads what is visible on scanned pages. Free and on by default.",
            "default": true
          },
          "wrapAsUntrusted": {
            "title": "Wrap output as untrusted data",
            "type": "boolean",
            "description": "If true, the Markdown is wrapped in <untrusted_content> tags telling the LLM to treat it as data, not instructions.",
            "default": false
          },
          "autoRotate": {
            "title": "Fix rotated pages",
            "type": "boolean",
            "description": "Detects pages scanned sideways or upside down and straightens them before OCR.",
            "default": true
          },
          "dpi": {
            "title": "Scan resolution for PDFs (DPI)",
            "minimum": 150,
            "maximum": 400,
            "type": "integer",
            "description": "Resolution used to render scanned PDF pages. 300 is best for most documents; use 400 for very small print.",
            "default": 300
          },
          "maxPages": {
            "title": "Max pages per file",
            "minimum": 0,
            "type": "integer",
            "description": "Only process the first N pages of each file. 0 = all pages.",
            "default": 300
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for protected PDFs (applied to all files in this run)."
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Larger files are skipped and 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}