# PDF Structured Tables & Report-Change Watch (JSON) (`structmint/pdf-structured-tables-watch`) Actor

Extract structured JSON/CSV tables & page-cited RAG Markdown from text-based PDFs and track edition-to-edition table cell changes.

- **URL**: https://apify.com/structmint/pdf-structured-tables-watch.md
- **Developed by:** [StructMint](https://apify.com/structmint) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 extracted pdf documents

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## PDF Structured Tables & Report-Change Watch (JSON)

Extract **structured tables** (`headers`, `rows`, `records`, `csv`, `markdownTable`) and **page-cited RAG Markdown chunks** from text-based PDFs, and optionally run **Report-Change Watch Mode** (`ETag` / `Last-Modified` / `SHA-256`) to trigger downstream n8n, Make, or AI agent workflows **only when a recurring PDF actually changes**.

Designed for lightweight, deterministic execution at **512 MB RAM** under `LIMITED_PERMISSIONS` — no monthly SaaS subscriptions, no LLM token hallucination on numeric tables, and no proxy fees.

### Why builders use this instead of plain text extractors

- **Structured cell grids, not flattened text lines:** Every detected table is returned as deduplicated `headers[]`, 2D `rows[][]`, database-ready key-value `records[]`, RFC-4180 `csv`, GFM `markdownTable`, bounding box (`bbox`), and a deterministic `tableFingerprint`.
- **Report-Change Watch Mode (`watchMode: true`):** Checks conditional `If-None-Match` (`ETag`), `If-Modified-Since`, and `SHA-256` binary digests against a baseline stored in your own user-scoped Named Key-Value Store (`structmint-pdf-watch-v1`, 90-day retention). When `onlyChanged: true` and nothing changed, the run emits **0 dataset items** and triggers zero noisy alerts.
- **Complete-scan baseline integrity:** If a PDF exceeds `maxPagesPerPdf` (page-truncated run), the Actor explicitly sets `extractionComplete: false`, suppresses false deletion counts, and **never overwrites** a complete watch baseline.
- **Transparent handling of image-only pages:** v1 is strictly **text-first** (512 MB container). Any page with fewer than 25 embedded text characters is transparently reported in `scannedOnlyPages[]` and `hasScannedOnlyPages: true` so pipelines never silently miss image-only pages.

### Pricing (Pay-Per-Event)

All usage is billed exclusively through Apify Pay-Per-Event with a single clear primary unit (**1 emitted PDF document = 1 dataset item**):

| Event | FREE | BRONZE | SILVER | GOLD | PLATINUM | DIAMOND |
| :--- | ---: | ---: | ---: | ---: | ---: | ---: |
| `apify-actor-start` *(one-time per run)* | `$0.00005` | `$0.00005` | `$0.00005` | `$0.00005` | `$0.00005` | `$0.00005` |
| `apify-default-dataset-item` *(per extracted PDF)* | `$0.0060` | `$0.0050` | `$0.0045` | `$0.0040` | `$0.0040` | `$0.0040` |

- **Minimum configurable max charge (`minimalMaxTotalChargeUsd`):** `$0.01`.
- **Unchanged Watch runs:** When `watchMode: true` and `onlyChanged: true` find no change, **0 dataset items** are emitted (only `$0.00005` start applies).
- **Tier safety limits:** Free accounts process up to `3` PDFs/run (`<= 25` pages/PDF, `<= 10 MB`/PDF); paid accounts process up to `25` PDFs/run (`<= 150` pages/PDF, `<= 30 MB`/PDF).

### Privacy & Data Handling

- Public HTTP/HTTPS URLs only; localhost, link-local, and private network IPs are rejected across initial URLs and redirects.
- **Default privacy mode (`storeCellValuesForDiff: false`):** Watch baselines persist **only SHA-256 digests** in your own user-scoped Named Key-Value Store — zero document text is retained.
- **Optional exact cell-value diffs (`storeCellValuesForDiff: true`):** Enable only for **public, non-confidential reports** when you want literal `previousValue -> currentValue` cell diffs in `reportDiff.cellChanges[]`.

### Example Input

```json
{
  "pdfUrls": [
    "https://raw.githubusercontent.com/stqnbapxao-source/structmint-b2b-automation-kit/main/samples/public-cloud-fee-schedule-q4-2026.pdf"
  ],
  "watchMode": true,
  "onlyChanged": true,
  "watchStateKey": "cloud-fee-schedule-watch",
  "storeCellValuesForDiff": false,
  "tableStrategy": "auto",
  "includeMarkdown": true,
  "includeRagChunks": true
}
```

### Example Output Item (Abbreviated)

```json
{
  "documentId": "9f8c2a1d4b7e3a10",
  "sourceUrl": "https://raw.githubusercontent.com/stqnbapxao-source/structmint-b2b-automation-kit/main/samples/public-cloud-fee-schedule-q4-2026.pdf",
  "watchStatus": "NEW",
  "pageCount": 2,
  "processedPagesCount": 2,
  "extractionComplete": true,
  "hasScannedOnlyPages": false,
  "tablesCount": 2,
  "totalTableRows": 9,
  "tables": [
    {
      "tableIndex": 0,
      "pageNumber": 1,
      "headers": ["Tier", "Included Credits", "Overage Rate", "SLA Uptime"],
      "records": [
        {
          "Tier": "Starter",
          "Included Credits": "10,000 units",
          "Overage Rate": "$0.0040 / unit",
          "SLA Uptime": "99.5%"
        }
      ],
      "csv": "Tier,Included Credits,Overage Rate,SLA Uptime\nStarter,\"10,000 units\",$0.0040 / unit,99.5%",
      "markdownTable": "| Tier | Included Credits | Overage Rate | SLA Uptime |\n| --- | --- | --- | --- |\n| Starter | 10,000 units | $0.0040 / unit | 99.5% |"
    }
  ],
  "reportDiff": {
    "hasPreviousBaseline": false,
    "baselineMode": "hash_only",
    "tablesAdded": 0,
    "tablesRemoved": 0,
    "tablesChanged": 0,
    "cellChanges": []
  }
}
```

### n8n & Make Quickstart

Use the synchronous endpoint in an n8n HTTP Request or Make HTTP module with your Apify token stored in credentials:

```text
POST https://api.apify.com/v2/actors/structmint~pdf-structured-tables-watch/run-sync-get-dataset-items?maxTotalChargeUsd=0.05
```

When `watchMode: true` and `onlyChanged: true`, an unchanged report returns an empty JSON array `[]` so an IF / Filter node stops cleanly before notifying Slack, Sheets, or Postgres.

# Actor input Schema

## `pdfUrls` (type: `array`):

List of public HTTP/HTTPS URLs pointing to text-based PDF files (fee schedules, catalogs, regulatory bulletins, financial tables). Private/localhost IP addresses are blocked. Free tier processes up to 3 PDFs/run; paid tiers up to 25 PDFs/run.

## `watchMode` (type: `boolean`):

When enabled, tracks ETag, Last-Modified, and SHA-256 content fingerprints in a user-scoped Named Key-Value Store (90-day retention) and computes edition-to-edition table diffs.

## `onlyChanged` (type: `boolean`):

Used with watchMode=true. Skips emitting dataset items (0 item charges) when the remote PDF has not changed since the previous complete run.

## `watchStateKey` (type: `string`):

Stable namespace key isolating saved baselines for a specific recurring schedule (e.g. 'cloud-fee-schedule-monthly').

## `storeCellValuesForDiff` (type: `boolean`):

Default false stores only SHA-256 hashes in Named Key-Value Store (zero document text retained). Enable true only on public, non-PII reports to include literal previousValue -> currentValue cell diffs.

## `tableStrategy` (type: `string`):

'auto' detects ruled/bordered tables first and falls back to whitespace-aligned columns; 'lines' detects bordered tables only; 'text' detects borderless aligned tables.

## `includeMarkdown` (type: `boolean`):

Include clean document Markdown with rendered Markdown tables in each output item.

## `includeRagChunks` (type: `boolean`):

Split extracted text and tables into bounded Markdown chunks with pageStart/pageEnd citations for LLM/RAG pipelines.

## `ragChunkMaxChars` (type: `integer`):

Soft character ceiling per RAG chunk (300 to 8000).

## `maxPagesPerPdf` (type: `integer`):

Maximum number of pages parsed per PDF (Free tier capped at 25 pages; paid tiers up to 150 pages). Partial scans never overwrite a complete watch baseline.

## `maxFileSizeMb` (type: `integer`):

Maximum allowed PDF download size in megabytes (Free tier capped at 10 MB; paid tiers up to 30 MB).

## Actor input object example

```json
{
  "pdfUrls": [
    "https://raw.githubusercontent.com/stqnbapxao-source/structmint-b2b-automation-kit/main/samples/public-cloud-fee-schedule-q4-2026.pdf"
  ],
  "watchMode": false,
  "onlyChanged": true,
  "watchStateKey": "default-pdf-watch",
  "storeCellValuesForDiff": false,
  "tableStrategy": "auto",
  "includeMarkdown": true,
  "includeRagChunks": true,
  "ragChunkMaxChars": 1800,
  "maxPagesPerPdf": 100,
  "maxFileSizeMb": 25
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "pdfUrls": [
        "https://raw.githubusercontent.com/stqnbapxao-source/structmint-b2b-automation-kit/main/samples/public-cloud-fee-schedule-q4-2026.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("structmint/pdf-structured-tables-watch").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "pdfUrls": ["https://raw.githubusercontent.com/stqnbapxao-source/structmint-b2b-automation-kit/main/samples/public-cloud-fee-schedule-q4-2026.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("structmint/pdf-structured-tables-watch").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "pdfUrls": [
    "https://raw.githubusercontent.com/stqnbapxao-source/structmint-b2b-automation-kit/main/samples/public-cloud-fee-schedule-q4-2026.pdf"
  ]
}' |
apify call structmint/pdf-structured-tables-watch --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,structmint/pdf-structured-tables-watch"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/DCkQiVeERzDAvz1VC/builds/b0R5NM0O0JnsMp817/openapi.json
