{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Text Extractor & OCR to Markdown for RAG",
    "description": "Extract text from PDFs, scanned PDFs, images, Word, Excel and PowerPoint into clean Markdown for RAG. Real tables, two-column reading order, headers/footers removed, chunks with page numbers. OCR only where needed. From $0.001 per page. No third-party AI APIs: results stay in your Apify storage.",
    "version": "0.0",
    "x-build-id": "eRRNZVUZFseebkcND"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/lif_manager~documents-to-markdown-rag/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-lif_manager-documents-to-markdown-rag",
        "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/lif_manager~documents-to-markdown-rag/runs": {
      "post": {
        "operationId": "runs-sync-lif_manager-documents-to-markdown-rag",
        "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/lif_manager~documents-to-markdown-rag/run-sync": {
      "post": {
        "operationId": "run-sync-lif_manager-documents-to-markdown-rag",
        "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": {
          "documents": {
            "title": "Documents (files or URLs)",
            "type": "array",
            "description": "Upload files or paste public URLs. Formats: PDF (text or scanned), PNG, JPG, WEBP, TIFF, BMP, DOCX, XLSX, PPTX, TXT, MD, CSV. Up to 50 MB per file. If you upload files here, also select the storage they went to below. Leave empty to see a demo."
          },
          "storage": {
            "title": "Storage with uploaded files",
            "type": "string",
            "description": "The key-value store where your uploaded files are. This Actor runs with limited permissions and can only read the storage you pick here. If you leave the list above empty, every supported document in this storage is converted."
          },
          "output_mode": {
            "title": "Output: one item per",
            "enum": [
              "document",
              "chunks",
              "pages"
            ],
            "type": "string",
            "description": "document: one item with Markdown, tables and chunks. chunks: one item per chunk, ready for a vector database. pages: one item per page.",
            "default": "document"
          },
          "chunk_tokens": {
            "title": "Chunk size (tokens, approx.)",
            "minimum": 0,
            "maximum": 8000,
            "type": "integer",
            "description": "Target chunk size, estimated as 4 characters per token. Chunks follow section boundaries and never split a table without repeating its header row. 0 = no chunks.",
            "default": 800
          },
          "chunk_overlap": {
            "title": "Chunk overlap (tokens, approx.)",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Text repeated at the start of the next chunk when a section is split by size.",
            "default": 80
          },
          "ocr": {
            "title": "OCR",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "auto: OCR only pages without a usable text layer (and images). always: OCR every page (for PDFs with broken text). never: faster and cheaper, scanned pages come out empty.",
            "default": "auto"
          },
          "ocr_languages": {
            "title": "OCR languages",
            "enum": [
              "spa+eng",
              "eng",
              "eng+spa+por",
              "por+eng",
              "fra+eng",
              "deu+eng",
              "ita+eng"
            ],
            "type": "string",
            "description": "Languages in the scanned documents. The first one has priority.",
            "default": "spa+eng"
          },
          "pages": {
            "title": "Page range",
            "type": "string",
            "description": "Pages or slides to convert, e.g. 1-5, 8, 12-. Empty = all."
          },
          "max_pages": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Safety limit per document (cost control).",
            "default": 200
          },
          "include_pages": {
            "title": "Include per-page Markdown (document mode)",
            "type": "boolean",
            "description": "Adds a 'pages' array with the Markdown, method (text/ocr) and OCR confidence of each page.",
            "default": false
          },
          "save_markdown_files": {
            "title": "Save a .md file per document",
            "type": "boolean",
            "description": "Also saves each document's Markdown as a file in the run's key-value store, with a download link in the result.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}