{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF & Document to Markdown - PDF, DOCX & HTML for LLMs",
    "description": "Turn any PDF, DOCX, TXT, or HTML document into clean, LLM-ready text + Markdown with metadata (title, pages, word count) and an optional AI summary. The document counterpart to a web reader — built for RAG ingestion, document Q&A, and AI agents (LangChain, LlamaIndex). Fast, structured, single-call.",
    "version": "0.0",
    "x-build-id": "8DdUBIfMQ3hbyAK9Y"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/entranced_gelato~ai-document-reader/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-entranced_gelato-ai-document-reader",
        "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/entranced_gelato~ai-document-reader/runs": {
      "post": {
        "operationId": "runs-sync-entranced_gelato-ai-document-reader",
        "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/entranced_gelato~ai-document-reader/run-sync": {
      "post": {
        "operationId": "run-sync-entranced_gelato-ai-document-reader",
        "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": {
          "url": {
            "title": "Document URL",
            "type": "string",
            "description": "URL of the document to read (PDF, DOCX, TXT, or HTML). Leave empty if you upload a file below. Only process documents you have the right to process."
          },
          "documentFile": {
            "title": "Or upload a document",
            "type": "string",
            "description": "Upload a PDF, DOCX, HTML or TXT file from your computer (or paste a link to one). When set, it is used instead of the Document URL."
          },
          "urls": {
            "title": "More document URLs",
            "type": "array",
            "description": "Optional. Read more documents in the same run: one URL per line (PDF, DOCX, TXT or HTML), up to 100 per run. Each document becomes its own row and is charged as one \"Document read\"; documents that can't be read are free. The page range, OCR and AI summary settings apply to every document, and \"Max OCR pages\" is a limit for the whole run.",
            "items": {
              "type": "string"
            }
          },
          "pageRange": {
            "title": "Page range (PDF only)",
            "type": "string",
            "description": "Optional. Which PDF pages to read, e.g. 1-3,7 or 5- (page 5 to the end). Leave empty for all pages."
          },
          "ocrMode": {
            "title": "OCR for scanned pages",
            "enum": [
              "auto",
              "off",
              "force"
            ],
            "type": "string",
            "description": "Scanned PDF pages have no text layer. Auto (default) reads only those pages with OCR (English), $0.003 per OCR page and only when OCR found text. The OCR price starts after Apify's 14-day notice (the start date is shown in the Pricing tab; free until then), and OCR runs only from that date: until then such pages come back with needsOcr: true. Off never runs OCR: such pages are returned with needsOcr: true. Force runs OCR on every selected page, e.g. when the text layer is garbled.",
            "default": "auto"
          },
          "maxOcrPages": {
            "title": "Max OCR pages",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Upper limit for pages read with OCR in one run ($0.003 per OCR page once the OCR price has started; the start date is shown in the Pricing tab). Pages beyond the limit are returned with needsOcr: true.",
            "default": 20
          },
          "summarize": {
            "title": "Generate AI summary",
            "type": "boolean",
            "description": "Adds a TL;DR and key points written by AI. Off by default. Without a key, the document's title and first 14,000 characters go to Apify's AI gateway (Apify's OpenRouter Actor, then OpenRouter, then the model provider) for $0.02 per summary, charged only when a summary is produced. Apify may bill the AI model's usage to your Apify account separately through its OpenRouter Actor, at OpenRouter's rates; free-plan accounts pay more and may be blocked. With your own OpenAI key below, the text goes straight to OpenAI and there is no AI charge. Email addresses and phone numbers are masked before sending, and documents that reserve text-and-data-mining rights are never sent. AIDevs is the provider of this AI feature and you're the deployer: AI fields are labelled (aiGenerated, aiModel, aiGeneratedAt, aiDigitalSourceType, aiNotice), so keep the label if you publish AI text.",
            "default": false
          },
          "openaiApiKey": {
            "title": "OpenAI API key (optional)",
            "type": "string",
            "description": "Optional. Use your own OpenAI API key (create one in your OpenAI dashboard) for the summary instead of Apify's AI gateway; the $0.02 AI summary charge then does not apply. Use a dedicated OpenAI project key with a spending limit. It's used only inside your run, sent only to OpenAI, and never stored or logged. You're responsible for following OpenAI's terms. Only used when 'Generate AI summary' is on."
          },
          "model": {
            "title": "LLM model",
            "enum": [
              "gpt-4o-mini",
              "gpt-4o",
              "gpt-4.1-mini"
            ],
            "type": "string",
            "description": "Model used for the summary (with your own key, or via Apify's AI gateway as openai/<model>). If you choose a model, you also accept that model provider's terms and acceptable-use policy.",
            "default": "gpt-4o-mini"
          },
          "aiModel": {
            "title": "AI model (advanced)",
            "type": "string",
            "description": "Optional model ID for the summary in OpenRouter format, e.g. openai/gpt-4o-mini (the default) or openai/gpt-4.1-mini. Leave empty to use the 'LLM model' choice above. On Apify's AI gateway only openai/... and anthropic/... models are used (no :free or stealth variants); other IDs fall back to openai/gpt-4o-mini. With your own OpenAI key only OpenAI models work. If you choose a model, you also accept that model provider's terms and acceptable-use policy."
          },
          "maxChars": {
            "title": "Max characters (0 = no limit)",
            "minimum": 0,
            "type": "integer",
            "description": "Optionally cap the length of returned content/markdown.",
            "default": 0
          },
          "respectRobotsTxt": {
            "title": "Respect robots.txt",
            "type": "boolean",
            "description": "Before downloading a document from a link, the Actor checks the site's robots.txt (the rules for AIDevsBot, otherwise those for all bots) and skips the document, free of charge, if robots.txt doesn't allow it. Uploaded files are read from your Apify storage and aren't affected. Turn this off only for sites you own or have permission to read.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Route downloads through Apify Proxy so servers that throttle data-center traffic still deliver the file. Uploaded files are read directly from Apify storage. Sites that block access are reported, never bypassed. Uses Apify's standard datacenter proxies. Residential and custom proxies aren't supported.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}