{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown & Text Extractor with OCR (DOCX)",
    "description": "PDF to Markdown converter and PDF text extractor for RAG and AI agents. Turn PDFs, scanned PDFs, DOCX, HTML and images into clean Markdown or text with page-aware chunks. OCR runs only on scanned pages. $3 per 1,000 documents, failed files free.",
    "version": "1.0",
    "x-build-id": "Gr0dBR2fxjyN7Avw9"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/hanielazevedo~document-to-markdown-ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-hanielazevedo-document-to-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/hanielazevedo~document-to-markdown-ocr/runs": {
      "post": {
        "operationId": "runs-sync-hanielazevedo-document-to-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/hanielazevedo~document-to-markdown-ocr/run-sync": {
      "post": {
        "operationId": "run-sync-hanielazevedo-document-to-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": {
          "urls": {
            "title": "Document URLs",
            "maxItems": 10000,
            "type": "array",
            "description": "Public http(s) links to documents: PDF, DOCX, ODT, RTF, EPUB, HTML, TXT/MD, PNG, JPG, TIFF, WEBP, BMP, GIF. Format is detected from the file content, not the extension. Private/internal addresses are blocked.",
            "items": {
              "type": "string"
            }
          },
          "files": {
            "title": "Upload files",
            "type": "array",
            "description": "Upload one or more files (stored in your key-value store) or paste file URLs."
          },
          "keyValueStoreId": {
            "title": "Key-value store (convert all its files)",
            "type": "string",
            "description": "Pick one of your key-value stores. Every record in it is converted (up to 1,000), unless you list specific keys below. The Actor gets read-only access to this store only."
          },
          "keyValueStoreKeys": {
            "title": "Keys in that store",
            "type": "array",
            "description": "Optional: only convert these record keys from the selected key-value store.",
            "items": {
              "type": "string"
            }
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "markdown",
              "text"
            ],
            "type": "string",
            "description": "Markdown keeps headings, lists, tables (GitHub-flavored) and links. Plain text strips all markup (tables become tab-separated).",
            "default": "markdown"
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "auto = use the PDF text layer and OCR only pages that are scanned/image-only or have broken text (recommended). always = OCR every PDF page (for PDFs with garbage text layers). never = never OCR (scanned pages produce no text; images fail with NO_TEXT_FOUND). Each OCRed page is billed as one ocr-page event.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "string",
            "description": "Tesseract language codes joined with +. Installed: eng, por, spa, fra, deu, ita, nld. Fewer languages = faster and more accurate.",
            "default": "eng+por"
          },
          "maxPages": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Only convert the first N pages of each PDF / multi-page TIFF. Empty = all pages (hard limit 2,000). Useful to cap OCR cost."
          },
          "enableChunking": {
            "title": "Split into RAG chunks",
            "type": "boolean",
            "description": "Add heading-aware chunks (with heading path, character offsets and page range) to each item, ready for embedding.",
            "default": false
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "Target 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 from the end of the previous chunk.",
            "default": 150
          },
          "includeContentInDataset": {
            "title": "Include full content in dataset",
            "type": "boolean",
            "description": "Put the Markdown/text into the dataset item. The full file is always saved to the key-value store (link in outputFileUrl). Turn off for very large documents if you only need the files.",
            "default": true
          },
          "maxFileSizeMb": {
            "title": "Max file size",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Larger files are rejected with FILE_TOO_LARGE (not charged).",
            "default": 50
          },
          "timeoutSecondsPerDocument": {
            "title": "Timeout per document",
            "minimum": 30,
            "maximum": 3600,
            "type": "integer",
            "description": "Download + conversion time limit per document. If OCR runs out of time, the pages done so far are returned with a TIMEOUT_PARTIAL_OUTPUT warning.",
            "default": 600
          },
          "maxConcurrency": {
            "title": "Parallel documents",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "How many documents are processed at the same time.",
            "default": 2
          },
          "keyValueStoreRecords": {
            "title": "Key-value store records (advanced)",
            "type": "array",
            "description": "Advanced: records as \"storeId/key\" strings. Stores must be readable by the run (prefer the key-value store picker above).",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}