{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Table to JSON + MCP: Merged Cells & Multi-Page Tables",
    "description": "Deterministic zero-LLM PDF table extractor reconstructing colspan/rowspan merged cells, stitching multi-page continuation tables, and outputting structured JSON, Markdown, and CSV via Batch or warm MCP Server.",
    "version": "1.0",
    "x-build-id": "Wf18NMcshYATD5HRx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/hgreene624~pdf-table-json/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-hgreene624-pdf-table-json",
        "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/hgreene624~pdf-table-json/runs": {
      "post": {
        "operationId": "runs-sync-hgreene624-pdf-table-json",
        "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/hgreene624~pdf-table-json/run-sync": {
      "post": {
        "operationId": "run-sync-hgreene624-pdf-table-json",
        "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": "PDF URLs",
            "type": "array",
            "description": "Direct public http(s) PDF URLs to extract (max 250 paid / 5 Free plan preview cap). Protected against SSRF and private IP ranges.",
            "items": {
              "type": "string"
            }
          },
          "base64Pdfs": {
            "title": "Base64 PDFs (Private Files)",
            "type": "array",
            "description": "Private PDF files supplied as base64 strings or {\"fileName\": \"invoice.pdf\", \"data\": \"...\"} objects (zero external URL hosting needed)."
          },
          "useBundledSample": {
            "title": "Use Bundled Sample PDF (Console/QA Demo Only)",
            "type": "boolean",
            "description": "When urls and base64Pdfs are both empty, setting this explicitly to true runs the built-in 2-page quarterly financial sample (with merged cells and a multi-page stitched table). Defaults to false so API/agent calls with missing URLs fail cleanly instead of returning demo data.",
            "default": false
          },
          "pdfPassword": {
            "title": "PDF Password",
            "type": "string",
            "description": "Optional password for encrypted PDFs (never logged or echoed in output)."
          },
          "pageRange": {
            "title": "Page Range",
            "type": "string",
            "description": "Optional 1-indexed pages or ranges, e.g. '1-5,10,12-15'. Leave empty to extract all pages up to maxPagesPerPdf.",
            "default": ""
          },
          "tableStrategy": {
            "title": "Table Detection Strategy",
            "enum": [
              "auto",
              "lattice",
              "stream",
              "hybrid"
            ],
            "type": "string",
            "description": "auto (recommended default: detects both bordered and borderless tables), lattice (bordered/ruled tables only), stream (borderless whitespace-aligned tables only), or hybrid (alias for auto running both bordered and borderless detection).",
            "default": "auto"
          },
          "stitchMultipageTables": {
            "title": "Stitch Multi-Page Continuation Tables",
            "type": "boolean",
            "description": "Automatically stitch tables continuing across consecutive pages, deduplicate repeated headers, and emit unified page_range.",
            "default": true
          },
          "fillMergedCells": {
            "title": "Merged-Cell Detection Scope",
            "enum": [
              "lattice_only",
              "never",
              "aggressive"
            ],
            "type": "string",
            "description": "Controls WHICH merged spans are detected: lattice_only (recommended: expand only cells with explicit ruled borders), never (skip vertical body-cell span expansion), or aggressive (also infer grouped labels in the leftmost text column, stopping at total rows).",
            "default": "lattice_only"
          },
          "mergedCellMode": {
            "title": "How Merged Cells Appear in rows[]",
            "enum": [
              "repeat",
              "first_only"
            ],
            "type": "string",
            "description": "Controls HOW detected merged cells are written into rows[] and records[]: 'repeat' copies the label into every covered cell (best for CSV/Sheets/SQL); 'first_only' places the label only in the top-left cell and leaves covered cells empty.",
            "default": "repeat"
          },
          "headerSeparator": {
            "title": "Multi-Row Header Separator",
            "type": "string",
            "description": "Separator used when flattening multi-row spanning headers (e.g. 'FY 2026 > Q1').",
            "default": " > "
          },
          "parseNumbers": {
            "title": "Locale-Aware Numeric Parsing (Opt-In)",
            "type": "boolean",
            "description": "Opt-in column-level Decimal parser returning {value, raw, unit, locale} objects while preserving leading zeros, >2^53 IDs, dates, and % units.",
            "default": false
          },
          "minConfidence": {
            "title": "Minimum Table Confidence",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "Minimum confidence threshold (0.0-1.0) required to accept a detected table.",
            "default": 0.35
          },
          "includeMarkdown": {
            "title": "Include Reading-Order Markdown",
            "type": "boolean",
            "description": "Include full reading-order document Markdown with inline tables.",
            "default": true
          },
          "includeSections": {
            "title": "Include RAG Sections",
            "type": "boolean",
            "description": "Include heading-grouped sections[] for downstream RAG chunking.",
            "default": true
          },
          "markdownTableFormat": {
            "title": "Markdown Table Format",
            "enum": [
              "gfm",
              "html",
              "auto_html_on_merge"
            ],
            "type": "string",
            "description": "gfm (GitHub-Flavored Markdown pipe tables), html (lossless colspan/rowspan <table>), or auto_html_on_merge.",
            "default": "gfm"
          },
          "includeCsv": {
            "title": "Include CSV Per Table (Opt-In)",
            "type": "boolean",
            "description": "Include RFC-4180 formula-sanitized CSV string on each table object.",
            "default": false
          },
          "sanitizeCsvFormulas": {
            "title": "Sanitize CSV Spreadsheet Formulas",
            "type": "boolean",
            "description": "Neutralize leading formula injection triggers (=, +, -, @, |, %) line-by-line in CSV outputs.",
            "default": true
          },
          "includeRawGrid": {
            "title": "Also Attach Raw Unmodified Cell Grid (Opt-In)",
            "type": "boolean",
            "description": "Optional extra field: attach raw_grid alongside rows[] with null in covered merged-cell slots (for custom post-processing). Off by default to keep payloads smaller.",
            "default": false
          },
          "stripRunningHeadersFooters": {
            "title": "Strip Repeating Running Headers & Footers",
            "type": "boolean",
            "description": "Strip repeating top/bottom 8% running headers and footers (e.g. 'Page 2 of 10') on >=3-page documents.",
            "default": true
          },
          "normalizeUnicode": {
            "title": "Text & Ligature Cleanup",
            "enum": [
              "ligatures_only",
              "nfkc"
            ],
            "type": "string",
            "description": "ligatures_only (recommended default: fixes PDF typographic ligatures like 'fi' and 'fl' without altering superscripts or fractions) or nfkc (full Unicode compatibility normalization).",
            "default": "ligatures_only"
          },
          "maxPagesPerPdf": {
            "title": "Max Pages Per PDF",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum pages extracted per PDF (paid hard cap 500; Free plan preview cap 25 total pages per run).",
            "default": 100
          },
          "maxFileSizeMb": {
            "title": "Max File Size (MB)",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Maximum PDF file size in MB. Console prefill is 10 MB to match the Apify Free plan cap; paid plans support up to 50 MB (API default: 25 MB).",
            "default": 25
          },
          "timeoutPerPdfSecs": {
            "title": "Per-PDF Timeout (Seconds)",
            "minimum": 5,
            "maximum": 180,
            "type": "integer",
            "description": "Wall-clock timeout per isolated PDF worker process (5-180s).",
            "default": 60
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}