{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Text & OCR: Scanned PDF, DOCX to Markdown",
    "description": "PDF, scanned PDF, images, DOCX, XLSX and PPTX to clean Markdown and text. OCR only on pages without a text layer, tables kept, failed files are free.",
    "version": "1.0",
    "x-build-id": "yA5GTsOvrR76jbFeQ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khalilbenali~pdf-to-text-ocr-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khalilbenali-pdf-to-text-ocr-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/khalilbenali~pdf-to-text-ocr-markdown/runs": {
      "post": {
        "operationId": "runs-sync-khalilbenali-pdf-to-text-ocr-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/khalilbenali~pdf-to-text-ocr-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-khalilbenali-pdf-to-text-ocr-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",
        "properties": {
          "urls": {
            "title": "Document URLs",
            "maxItems": 5000,
            "type": "array",
            "description": "Direct links to PDF, image (PNG, JPEG, TIFF, BMP, GIF, WebP), DOCX, XLSX, XLS, ODS, CSV or PPTX files, one per line (http or https, at most 5,000). The format is detected from the file itself, not from the link. Duplicates are converted once. robots.txt is respected: a link whose site disallows bots (Google Drive, Dropbox shared links) is skipped for free; download such files and pass them in base64Files instead.",
            "items": {
              "type": "string"
            }
          },
          "base64Files": {
            "title": "Files as base64",
            "maxItems": 50,
            "type": "array",
            "description": "For API and AI-agent calls. Keep the total under about 5 MB; use URLs for bigger files. Each item is a base64 string (a data: URI prefix is allowed) or an object {\"fileName\": \"report.pdf\", \"data\": \"<base64>\"}. At most 50 files.",
            "default": []
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "force",
              "off"
            ],
            "type": "string",
            "description": "When to run OCR (text recognition). Auto reads pages with a real text layer directly and OCRs only scans, stamped scans and pages with an unreadable old OCR layer. Force OCRs every page; Off never OCRs (scanned pages then have no text). OCR pages are billed per page (ocr-page event); images are always OCRed unless OCR is off.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "minItems": 1,
            "maxItems": 2,
            "type": "array",
            "description": "The language(s) of the scanned text, one or two (for example English and German for a bilingual scan). Two languages are slower. Choosing the right language matters: accented letters and non-Latin scripts are misread by the English model. Pages read from a text layer do not need this.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "deu",
                "fra",
                "spa",
                "ita",
                "por",
                "nld",
                "pol",
                "tur",
                "rus",
                "ukr",
                "ces",
                "ron",
                "swe",
                "dan",
                "vie",
                "ara",
                "hin",
                "chi_sim",
                "jpn",
                "kor"
              ],
              "enumTitles": [
                "English",
                "German",
                "French",
                "Spanish",
                "Italian",
                "Portuguese",
                "Dutch",
                "Polish",
                "Turkish",
                "Russian",
                "Ukrainian",
                "Czech",
                "Romanian",
                "Swedish",
                "Danish",
                "Vietnamese",
                "Arabic",
                "Hindi",
                "Chinese (Simplified)",
                "Japanese",
                "Korean"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "maxOcrPagesPerDocument": {
            "title": "Max OCR pages per document",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "At most this many pages of one document are OCRed (0 = no OCR). Pages over the limit are not OCRed or charged; they get the marker <!-- page N: OCR skipped (limit) --> and the warning OCR_LIMIT.",
            "default": 50
          },
          "pageRange": {
            "title": "Page range",
            "pattern": "^\\s*$|^\\s*\\d+\\s*(-\\s*\\d*)?\\s*(,\\s*\\d+\\s*(-\\s*\\d*)?\\s*)*$",
            "type": "string",
            "description": "Convert only these pages, for example 1-5, 8, 12- (12- means page 12 to the end). Applies to PDF pages, PPTX slides and spreadsheet sheets (by position); DOCX files and images are converted whole. Empty = all pages.",
            "default": ""
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "At most this many pages, slides or sheets of one document are converted (after the page range). Extra pages are skipped with the warning PAGE_LIMIT; the document still counts as ok.",
            "default": 200
          },
          "pdfPassword": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for encrypted PDFs; it is used for every encrypted PDF of the run and is never logged or saved. Leave empty if your PDFs are not protected."
          },
          "includeText": {
            "title": "Include plain text",
            "type": "boolean",
            "description": "Add a text field with the plain text (no Markdown syntax). Pages, sheets and slides are separated by a form feed (\\f). The markdown field is always included.",
            "default": true
          },
          "includePages": {
            "title": "Include per-page results",
            "type": "boolean",
            "description": "Add a pages array with each page's number, source (text-layer, ocr, blank or skipped), character count, Markdown and OCR confidence.",
            "default": false
          },
          "extractTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Add a tables array with every detected table as rows (arrays of cell strings) and as a Markdown table. Tables always stay inside the markdown field either way. OCR pages produce no tables.",
            "default": true
          },
          "chunking": {
            "title": "Split into RAG chunks",
            "type": "boolean",
            "description": "Add a chunks array for RAG and vector databases. Each chunk has its text, the first and last page it comes from (pageStart, pageEnd) and its heading path (for example [\"Results\", \"Table 2\"]).",
            "default": false
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "Target maximum length of one chunk in characters. Chunks end at paragraph, sentence or table-row boundaries.",
            "default": 2000
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "Characters repeated from the end of one chunk at the start of the next, so a sentence cut between chunks keeps its context. Clamped to at most half the chunk size.",
            "default": 200
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Files larger than this are not downloaded or charged (error FILE_TOO_LARGE). Checked on the declared size and while downloading.",
            "default": 50
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}