{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Text Extractor: tables, OCR, Markdown, JSON per page",
    "description": "Turn PDF URLs into clean data: per-page text, tables as real rows (CSV/Excel-ready, with page numbers and Markdown), document metadata, and OCR for scanned pages with confidence scores. Chain from any dataset of URLs. Pay per page, no per-file fee.",
    "version": "0.1",
    "x-build-id": "FXDCXPxNLcPe17J5Z"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/brenton8907~pdf-text-table-ocr-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-brenton8907-pdf-text-table-ocr-extractor",
        "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/brenton8907~pdf-text-table-ocr-extractor/runs": {
      "post": {
        "operationId": "runs-sync-brenton8907-pdf-text-table-ocr-extractor",
        "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/brenton8907~pdf-text-table-ocr-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-brenton8907-pdf-text-table-ocr-extractor",
        "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": {
          "startUrls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Direct links to PDF files (one per line, or upload a text file of URLs). Apify key-value store record URLs work too.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "inputDatasetId": {
            "title": "URLs from dataset",
            "type": "string",
            "description": "Optional: read PDF URLs from an existing Apify dataset (ID or name), e.g. the output of a crawler. Combined with the URLs above."
          },
          "urlField": {
            "title": "URL field in dataset",
            "type": "string",
            "description": "Field holding the PDF URL in each dataset item. Dot paths like `file.url` are allowed.",
            "default": "url"
          },
          "outputMode": {
            "title": "Output",
            "enum": [
              "pages",
              "documents",
              "tableRows"
            ],
            "type": "string",
            "description": "Pages: one dataset row per PDF page. Documents: one row per file with the whole text and all tables. Table rows: only tables, one row per table row, with page number, header and cells.",
            "default": "pages"
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Which pages to process, 1-based, e.g. `1-3,7,10-`. Empty = all pages."
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many pages of each PDF (after the page range is applied). 0 = no limit.",
            "default": 0
          },
          "extractText": {
            "title": "Extract text",
            "type": "boolean",
            "description": "Per-page text from the PDF text layer.",
            "default": true
          },
          "extractTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Detect tables on each page and return them as rows (plus a Markdown rendering).",
            "default": true
          },
          "tableStrategy": {
            "title": "Table detection",
            "enum": [
              "auto",
              "lines",
              "text"
            ],
            "type": "string",
            "description": "`lines` finds tables drawn with borders (most reliable). `text` infers tables from column alignment (for borderless tables, more false positives). `auto` tries lines first and falls back to text when a page has none.",
            "default": "auto"
          },
          "keepLayout": {
            "title": "Keep text layout",
            "type": "boolean",
            "description": "Preserve horizontal positioning with spaces (useful for columns and forms). Off = reading-order text.",
            "default": false
          },
          "ocr": {
            "title": "OCR",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "Scanned pages have no text layer. `auto` runs Tesseract OCR only on pages whose text layer has fewer than `ocrMinChars` characters. OCR pages are billed at the OCR rate.",
            "default": "auto"
          },
          "ocrMinChars": {
            "title": "OCR threshold (chars)",
            "minimum": 0,
            "type": "integer",
            "description": "In `auto` mode, a page with fewer extracted characters than this is treated as scanned and sent to OCR.",
            "default": 25
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "string",
            "description": "Tesseract language codes joined with `+`, e.g. `eng+deu`. Installed: eng, deu, fra, spa, ita, por, nld.",
            "default": "eng"
          },
          "ocrDpi": {
            "title": "OCR resolution (DPI)",
            "minimum": 72,
            "maximum": 400,
            "type": "integer",
            "description": "Render resolution for OCR. 200 is a good default; 300 for small print (slower).",
            "default": 200
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for encrypted PDFs (applied to every file)."
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Files larger than this are skipped with an error row instead of being downloaded.",
            "default": 50
          },
          "downloadTimeoutSecs": {
            "title": "Download timeout (s)",
            "minimum": 5,
            "maximum": 600,
            "type": "integer",
            "description": "Per-file download timeout in seconds.",
            "default": 60
          },
          "concurrency": {
            "title": "Parallel documents",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many PDFs to download and process at once. Raise memory for large files when increasing this.",
            "default": 3
          },
          "includeRaw": {
            "title": "Include raw metadata",
            "type": "boolean",
            "description": "Attach the untouched PDF metadata dictionary to each row.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}