{
  "openapi": "3.0.1",
  "info": {
    "title": "Government PDF Table Extractor – PDF to JSON",
    "description": "PDF table extractor for government reports and annual accounts: extract tables from PDF to JSON with headers, typed records, page and position, confidence and sum checks. Joins multi-page tables, handles merged headers and Dutch number formats; Claude can read scanned pages, validated in code.",
    "version": "0.1",
    "x-build-id": "9hxFahbRaeXY0c0Wp"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/lwsdjfls~govt-pdf-table-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-lwsdjfls-govt-pdf-table-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/lwsdjfls~govt-pdf-table-extractor/runs": {
      "post": {
        "operationId": "runs-sync-lwsdjfls-govt-pdf-table-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/lwsdjfls~govt-pdf-table-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-lwsdjfls-govt-pdf-table-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": {
          "pdfUrls": {
            "title": "PDF URLs",
            "maxItems": 500,
            "type": "array",
            "description": "Direct http(s) links to PDF files (one per line, each up to 2,048 characters). Links to key-value store records work too. The same link listed twice is read once.",
            "items": {
              "type": "string",
              "maxLength": 2048
            },
            "default": []
          },
          "pdfFiles": {
            "title": "PDF files (base64)",
            "maxItems": 100,
            "type": "array",
            "description": "For API callers: [{ \"fileName\": \"report.pdf\", \"data\": \"<base64>\" }]. Up to 100 files; the total input must stay under Apify's 9 MB input limit, so use URLs for large files.",
            "items": {
              "type": "object",
              "properties": {
                "fileName": {
                  "title": "File name",
                  "type": "string",
                  "editor": "textfield",
                  "description": "The name this document is reported under, for example report.pdf.",
                  "minLength": 1,
                  "maxLength": 200
                },
                "data": {
                  "title": "File contents (base64)",
                  "type": "string",
                  "editor": "textarea",
                  "description": "The PDF itself, base64 encoded, without a data: prefix.",
                  "minLength": 1
                }
              },
              "required": [
                "fileName",
                "data"
              ]
            },
            "default": []
          },
          "pages": {
            "title": "Pages",
            "pattern": "^\\s*(\\d+\\s*(-\\s*(\\d+\\s*)?)?|-\\s*(\\d+\\s*)?)(,\\s*(\\d+\\s*(-\\s*(\\d+\\s*)?)?|-\\s*(\\d+\\s*)?))*$",
            "maxLength": 1000,
            "type": "string",
            "description": "Page numbers and ranges to read, for every document: 1-5,8 or 14-17 (up to 1,000 characters). Empty means all pages (up to the per-document cap)."
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "fast",
              "llm-fallback",
              "llm"
            ],
            "type": "string",
            "description": "fast: deterministic only (text-layer PDFs, cheapest). llm-fallback: deterministic, plus Claude for pages without a text layer (scans) and pages whose tables came out with low confidence. llm: Claude reads every page.",
            "default": "fast"
          },
          "llmModel": {
            "title": "LLM model",
            "enum": [
              "haiku",
              "sonnet"
            ],
            "type": "string",
            "description": "Claude Haiku 4.5 reads most pages well and is the cheaper event; Claude Sonnet 5 for dense or hard layouts.",
            "default": "haiku"
          },
          "flavor": {
            "title": "Detection",
            "enum": [
              "auto",
              "stream",
              "lattice"
            ],
            "type": "string",
            "description": "auto tries whitespace-aligned and ruled-line detection and keeps the best reading per table. stream: whitespace only (reports, statistics). lattice: ruled lines only (forms, invoices).",
            "default": "auto"
          },
          "expectedColumns": {
            "title": "Expected columns",
            "maxItems": 100,
            "type": "array",
            "description": "Optional. The column names you expect, in order. Tables with that many columns get these names as record keys; others are flagged in checks.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "default": []
          },
          "minRows": {
            "title": "Minimum rows",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Tables with fewer body rows are ignored (layout boxes, legends).",
            "default": 2
          },
          "minColumns": {
            "title": "Minimum columns",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Tables with fewer columns are ignored.",
            "default": 2
          },
          "mergeAcrossPages": {
            "title": "Join tables that continue on the next page",
            "type": "boolean",
            "description": "A table with the same columns that continues on the next page (with or without a repeated header) is delivered once, with all its rows and pages.",
            "default": true
          },
          "includeCells": {
            "title": "Include cell coordinates",
            "type": "boolean",
            "description": "Adds every cell with its page and bounding box (PDF points, origin top-left) to each table. Makes records larger.",
            "default": false
          },
          "maxPagesPerDocument": {
            "title": "Maximum pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Pages beyond this are not read (or charged).",
            "default": 200
          },
          "maxFileMb": {
            "title": "Maximum file size (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Larger files are reported as failed and cost nothing. At most 100 MB.",
            "default": 50
          },
          "maxLlmPagesPerRun": {
            "title": "Maximum LLM pages per run",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Caps the pages sent to Claude in one run; the rest is delivered from the deterministic pass.",
            "default": 200
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Only for downloading PDFs from sites that block data-centre addresses.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}