{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Table, Invoice & Statement Extractor (XLSX/CSV + MCP)",
    "description": "Extract geometric multi-page PDF tables to JSON, Markdown, CSV, and formula-safe XLSX plus deterministic invoice and bank statement fields with arithmetic reconciliation and Standby MCP.",
    "version": "1.0",
    "x-build-id": "LKvr9gYqMVKXpJZGh"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/forgekit~pdf-table-invoice-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-forgekit-pdf-table-invoice-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/forgekit~pdf-table-invoice-extractor/runs": {
      "post": {
        "operationId": "runs-sync-forgekit-pdf-table-invoice-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/forgekit~pdf-table-invoice-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-forgekit-pdf-table-invoice-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": {
          "urls": {
            "title": "PDF URLs",
            "maxItems": 200,
            "type": "array",
            "description": "Public PDF URLs (SSRF-protected). Automatically rewrites Google Drive, Dropbox, and OneDrive share links when normalizeCloudPdfUrl is enabled.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "normalizeCloudPdfUrl": {
            "title": "Normalize Cloud Share PDF URLs",
            "type": "boolean",
            "description": "Automatically rewrite public Google Drive, Dropbox (dl=0 to dl=1), and OneDrive share URLs into direct PDF download links.",
            "default": true
          },
          "base64Pdfs": {
            "title": "Inline Base64 PDFs",
            "maxItems": 50,
            "type": "array",
            "description": "Inline PDFs as [{ \"filename\": \"invoice.pdf\", \"dataBase64\": \"JVBERi0x...\" }].",
            "default": []
          },
          "kvsKeys": {
            "title": "Key-Value Store Keys",
            "maxItems": 200,
            "type": "array",
            "description": "Binary PDF keys stored in the default or source Key-Value Store.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "sourceStoreId": {
            "title": "Source Storage ID",
            "maxLength": 128,
            "type": "string",
            "description": "Optional Apify Key-Value Store ID to read kvsKeys from.",
            "default": ""
          },
          "inputDatasetId": {
            "title": "Input Dataset ID",
            "maxLength": 128,
            "type": "string",
            "description": "Optional upstream Apify Dataset ID containing PDF URLs.",
            "default": ""
          },
          "datasetUrlField": {
            "title": "Dataset URL Field",
            "maxLength": 128,
            "type": "string",
            "description": "Field name containing the PDF URL in inputDatasetId.",
            "default": "url"
          },
          "mode": {
            "title": "Extraction Mode",
            "enum": [
              "tables-only",
              "invoice-statement",
              "both"
            ],
            "type": "string",
            "description": "Choose whether to extract geometric tables, structured invoice/statement fields, or both.",
            "default": "both"
          },
          "pageRange": {
            "title": "Page Range",
            "maxLength": 128,
            "type": "string",
            "description": "Optional 1-indexed page subset such as \"1-10\" or \"1,3-5\".",
            "default": ""
          },
          "maxPages": {
            "title": "Max Pages Per PDF",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Safety cap on pages parsed per PDF.",
            "default": 100
          },
          "password": {
            "title": "PDF Password",
            "type": "string",
            "description": "Optional password for encrypted PDFs."
          },
          "rowTolerancePt": {
            "title": "Row Y-Tolerance (Points)",
            "minimum": 1,
            "maximum": 20,
            "type": "number",
            "description": "Vertical Y-coordinate clustering tolerance in PDF points for grouping text spans into rows.",
            "default": 3.5
          },
          "columnGapThresholdPt": {
            "title": "Column Horizontal Gap Threshold (Points)",
            "minimum": 3,
            "maximum": 100,
            "type": "number",
            "description": "Minimum horizontal gap in PDF points separating adjacent table columns.",
            "default": 12
          },
          "minTableRows": {
            "title": "Minimum Table Rows",
            "minimum": 2,
            "maximum": 50,
            "type": "integer",
            "description": "Minimum number of rows required to accept a detected block as a table.",
            "default": 2
          },
          "minTableColumns": {
            "title": "Minimum Table Columns",
            "minimum": 2,
            "maximum": 30,
            "type": "integer",
            "description": "Minimum number of columns required to accept a detected block as a table.",
            "default": 2
          },
          "mergeContinuedTables": {
            "title": "Merge Multi-Page Continued Tables",
            "type": "boolean",
            "description": "Automatically stitch tables continuing across consecutive pages with matching column signatures.",
            "default": true
          },
          "exportTablesToXlsx": {
            "title": "Export Tables to XLSX (KV Store)",
            "type": "boolean",
            "description": "Save a multi-sheet formula-safe .xlsx workbook (1 sheet per table) to Key-Value Store.",
            "default": true
          },
          "exportTablesToCsv": {
            "title": "Export Tables to CSV (KV Store)",
            "type": "boolean",
            "description": "Save each extracted table as a formula-safe .csv file in Key-Value Store.",
            "default": false
          },
          "maxConcurrency": {
            "title": "Max Concurrency",
            "minimum": 1,
            "maximum": 15,
            "type": "integer",
            "description": "Maximum number of PDFs processed in parallel.",
            "default": 4
          },
          "maxPdfSizeMb": {
            "title": "Max PDF Size (MB)",
            "minimum": 1,
            "maximum": 150,
            "type": "number",
            "description": "Maximum allowed file size per PDF in megabytes.",
            "default": 30
          },
          "timeoutSecs": {
            "title": "Timeout (Seconds)",
            "minimum": 5,
            "maximum": 180,
            "type": "integer",
            "description": "Per-PDF download and parse timeout in seconds.",
            "default": 30
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}