{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF & Image to Text / Markdown (with OCR)",
    "description": "Convert PDFs and images to clean Markdown and text for RAG, AI agents and automations. Keeps headings, lists, tables and page breaks; OCRs scanned pages and images automatically (28 languages). Pay only for pages that produce text.",
    "version": "0.1",
    "x-build-id": "sAkn6Ag9yXxjzkki7"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/singgendarhan~pdf-image-to-text-markdown-ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-singgendarhan-pdf-image-to-text-markdown-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/singgendarhan~pdf-image-to-text-markdown-ocr/runs": {
      "post": {
        "operationId": "runs-sync-singgendarhan-pdf-image-to-text-markdown-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/singgendarhan~pdf-image-to-text-markdown-ocr/run-sync": {
      "post": {
        "operationId": "run-sync-singgendarhan-pdf-image-to-text-markdown-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": {
          "fileUrls": {
            "title": "PDF or image URLs",
            "type": "array",
            "description": "Public http(s) links to PDF files or images (PNG, JPEG, TIFF incl. multi-page, WebP, BMP, GIF), one per line. Google Drive, Dropbox and GitHub 'view' links are converted to direct downloads automatically. Objects like {\"url\": \"...\"} are accepted too.",
            "items": {
              "type": "string"
            }
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "Auto (recommended): read the PDF's own text layer and run OCR only on pages without usable text (scans, photos of documents, unreadable fonts) and on images. Always: OCR every page and ignore the text layer (use it for scans whose existing OCR layer is poor). Never: text layer only; pages without one come back empty and images fail.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages of the scanned text (up to 4). Picking the right language noticeably improves accuracy; every extra language makes OCR slower. Not used for pages that have a text layer.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "deu",
                "fra",
                "spa",
                "ita",
                "por",
                "nld",
                "pol",
                "ces",
                "slk",
                "swe",
                "dan",
                "nor",
                "fin",
                "ron",
                "hun",
                "tur",
                "ell",
                "rus",
                "ukr",
                "ara",
                "hin",
                "vie",
                "ind",
                "chi_sim",
                "chi_tra",
                "jpn",
                "kor"
              ],
              "enumTitles": [
                "English",
                "German",
                "French",
                "Spanish",
                "Italian",
                "Portuguese",
                "Dutch",
                "Polish",
                "Czech",
                "Slovak",
                "Swedish",
                "Danish",
                "Norwegian",
                "Finnish",
                "Romanian",
                "Hungarian",
                "Turkish",
                "Greek",
                "Russian",
                "Ukrainian",
                "Arabic",
                "Hindi",
                "Vietnamese",
                "Indonesian",
                "Chinese (Simplified)",
                "Chinese (Traditional)",
                "Japanese",
                "Korean"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "perPageOutput": {
            "title": "Also output one row per page",
            "type": "boolean",
            "description": "Adds a second dataset ('pages') with one row per page: page number, method (text layer or OCR), Markdown and text. Handy for RAG chunking and page citations.",
            "default": false
          },
          "keyValueStoreId": {
            "title": "Key-value store with files",
            "type": "string",
            "description": "Optional. ID or name of an Apify key-value store that holds PDFs or images to process (use together with 'Record keys')."
          },
          "keyValueStoreKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Keys of the PDF or image records in the key-value store above, one per line (for example contract-001.pdf). Without a store ID, the run's default store is used.",
            "items": {
              "type": "string"
            }
          },
          "detectTables": {
            "title": "Detect tables",
            "type": "boolean",
            "description": "Turn tables in PDFs with a text layer into Markdown tables (ruled grids and clearly aligned columns). Turn off to get tables as plain lines of text.",
            "default": true
          },
          "removeHeadersFooters": {
            "title": "Remove running headers, footers and page numbers",
            "type": "boolean",
            "description": "Drops text that repeats at the top or bottom of most pages (document titles, confidentiality notes) and bare page numbers. Recommended for RAG and summaries.",
            "default": true
          },
          "pageSeparator": {
            "title": "Page markers in Markdown",
            "enum": [
              "comment",
              "rule",
              "none"
            ],
            "type": "string",
            "description": "How page breaks appear in the Markdown. 'Comment' puts an invisible <!-- page N --> line before every page (easy to split on); 'Rule' puts a horizontal rule (---) between pages. The .txt output always separates pages with a form feed character.",
            "default": "comment"
          },
          "maxCharsInDataset": {
            "title": "Max characters inline in the dataset",
            "minimum": 0,
            "maximum": 1000000,
            "type": "integer",
            "description": "The full Markdown and text are always saved as files. The dataset row also carries them inline, up to this many characters each (longer documents are cut and flagged with inlineTextTruncated). Use 0 to keep only the file links.",
            "default": 200000
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Only the first N pages of each document are processed (and billed). Raise it for long documents.",
            "default": 300
          },
          "maxFileSizeMb": {
            "title": "Max file size",
            "minimum": 0.1,
            "maximum": 300,
            "type": "number",
            "description": "Files larger than this are skipped with a FILE_TOO_LARGE error (no charge).",
            "default": 50
          },
          "documentTimeoutSecs": {
            "title": "Timeout per document",
            "minimum": 30,
            "maximum": 7200,
            "type": "integer",
            "description": "Processing time limit for one file. When it is hit, the pages finished so far are returned (status 'partial') and only those are billed.",
            "default": 600
          },
          "ocrDpi": {
            "title": "OCR resolution",
            "minimum": 150,
            "maximum": 400,
            "type": "integer",
            "description": "Resolution used to render PDF pages for OCR. 300 is the sweet spot; use 400 for very small print or 200 for speed. Very large pages are rendered at a lower resolution automatically.",
            "default": 300
          },
          "pdfPassword": {
            "title": "PDF password",
            "type": "string",
            "description": "Optional password for password-protected PDFs (the same password is tried for every PDF in the run). Stored encrypted."
          },
          "downloadTimeoutSecs": {
            "title": "Download timeout",
            "minimum": 5,
            "maximum": 600,
            "type": "integer",
            "description": "Connect / read timeout for each download attempt (a slow but steady download is not cut off). Failed downloads are retried up to 3 times with backoff (honoring Retry-After).",
            "default": 30
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}