{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown & Text Extractor (with OCR)",
    "description": "Convert PDFs from URLs into clean Markdown and plain text, page by page, with optional OCR for scanned pages. Output goes to the dataset and a Markdown file per PDF.",
    "version": "1.0",
    "x-build-id": "vQGedgMTRgUDR8WTp"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/busy_courtyard~pdf-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-busy_courtyard-pdf-to-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/busy_courtyard~pdf-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-busy_courtyard-pdf-to-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/busy_courtyard~pdf-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-busy_courtyard-pdf-to-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",
        "required": [
          "startUrls"
        ],
        "properties": {
          "startUrls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Public links to PDF files. Each PDF becomes one dataset row, or one row per page in 'page' mode.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "markdown",
              "text",
              "both"
            ],
            "type": "string",
            "description": "Markdown keeps headings, lists and tables. Text is the plain reading-order text.",
            "default": "markdown"
          },
          "outputMode": {
            "title": "Rows",
            "enum": [
              "document",
              "page"
            ],
            "type": "string",
            "description": "'document' gives one row per PDF with the full content. 'page' gives one row per page, which suits RAG chunking.",
            "default": "document"
          },
          "ocrMode": {
            "title": "OCR",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "'auto' OCRs only pages with no usable text layer (scans). 'always' OCRs every page. 'never' uses the text layer only. OCR pages cost more.",
            "default": "auto"
          },
          "ocrLanguage": {
            "title": "OCR language",
            "type": "string",
            "description": "Tesseract language code. This build includes English ('eng').",
            "default": "eng"
          },
          "ocrDpi": {
            "title": "OCR resolution (DPI)",
            "minimum": 72,
            "maximum": 400,
            "type": "integer",
            "description": "Higher reads small print better but is slower.",
            "default": 200
          },
          "minTextChars": {
            "title": "Min characters for a text page",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "In auto mode, a page with fewer characters than this that also contains an image counts as scanned and is OCR'd.",
            "default": 25
          },
          "pageRange": {
            "title": "Pages",
            "type": "string",
            "description": "Optional, e.g. '1-3,7,10-'. Leave empty for all pages."
          },
          "maxPages": {
            "title": "Max pages per PDF",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Safety cap for very long documents.",
            "default": 500
          },
          "maxFileMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Bigger files are rejected while downloading.",
            "default": 50
          },
          "respectRobotsTxt": {
            "title": "Respect robots.txt",
            "type": "boolean",
            "description": "Skip PDFs that the site's robots.txt disallows. Turn it off only for files you own or have permission to fetch.",
            "default": true
          },
          "maxConcurrency": {
            "title": "Parallel downloads",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Downloads run in parallel. Conversion runs one PDF at a time.",
            "default": 2
          },
          "minDelayBetweenRequestsSecs": {
            "title": "Min delay per site (s)",
            "minimum": 0,
            "maximum": 60,
            "type": "number",
            "description": "A robots.txt Crawl-delay overrides it if it is longer.",
            "default": 1
          },
          "requestTimeoutSecs": {
            "title": "Download timeout (s)",
            "minimum": 10,
            "maximum": 600,
            "type": "integer",
            "description": "Maximum time for downloading one file.",
            "default": 120
          },
          "maxRetries": {
            "title": "Retries",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Retries for timeouts, 429 and 5xx errors. Retries use exponential backoff.",
            "default": 2
          },
          "selfTest": {
            "title": "Self-test mode",
            "type": "boolean",
            "description": "Ignore the other fields (startUrls is still required by the form, any URL will do) and convert page 1 of the IRS Form W-9, then fail the run if the Markdown is missing or empty. Meant for a daily health-check schedule.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}