{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Tables to JSON: Extract Tables, Text and RAG Chunks (OCR)",
    "description": "Use to extract tables from a PDF as JSON (rows, page, cell coordinates), convert a PDF to text chunks for a RAG pipeline with page citations, or OCR a scanned PDF and return the text. Input: pdfUrls. $0.003 per page, +$0.01 per OCR page. Not for Word/Excel files or audio.",
    "version": "0.1",
    "x-build-id": "gjBk47ZCbou7WxV9z"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/landoz~pdf-to-json-tables/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-landoz-pdf-to-json-tables",
        "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/landoz~pdf-to-json-tables/runs": {
      "post": {
        "operationId": "runs-sync-landoz-pdf-to-json-tables",
        "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/landoz~pdf-to-json-tables/run-sync": {
      "post": {
        "operationId": "run-sync-landoz-pdf-to-json-tables",
        "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",
            "uniqueItems": true,
            "type": "array",
            "description": "Public http(s) links to the PDF files to convert, one per line. Each must point at the PDF itself (not an HTML viewer page). Up to 100 URLs per run; files are fetched once, parsed and deleted when the run ends. Example: https://example.com/annual-report.pdf.",
            "default": [
              "https://www.federalreserve.gov/releases/h41/current/h41.pdf"
            ],
            "items": {
              "type": "string"
            }
          },
          "pdfUrl": {
            "title": "Single PDF URL (optional shortcut)",
            "type": "string",
            "description": "Convenience field for agents that pass one URL: it is merged into pdfUrls. Example: https://example.com/annual-report.pdf."
          },
          "pages": {
            "title": "Pages",
            "type": "string",
            "description": "Which pages to process, 1-based, like \"1-5,8\" or \"3-\" (3 to the end). Empty means all pages up to maxPagesPerPdf. Each processed page is one page-processed event. Example: 1-3, 7, 10-12."
          },
          "maxPagesPerPdf": {
            "title": "Max pages per PDF",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Safety cap on pages processed (and charged) per file. Default 50, maximum 1000. Pages beyond the cap are skipped; pageCount in the output still shows the real total. Example: 50.",
            "default": 50
          },
          "outputMode": {
            "title": "Output mode",
            "enum": [
              "pages",
              "documents",
              "rows"
            ],
            "type": "string",
            "description": "pages: one dataset item per page (best for RAG and for streaming long reports). documents: one item per PDF with all text joined by form feeds, every table and chunk carrying its page number, plus PDF metadata (title, author, creator, producer, creationDate). rows: one flat record per table row, with the table's header cells as column names (Console exports it as a spreadsheet); no text or chunks, scanned pages are not supported. pages and documents charge per processed page; rows charges only for pages that produced rows. Example: rows.",
            "default": "pages"
          },
          "extractTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Detect tables and return them as rows of cells with header, row and column counts, a bounding box [x0, top, x1, bottom] in PDF points and a GitHub Markdown rendering. Ruled tables are found by their lines; tables without lines are found by text alignment with quality filters. Example: true.",
            "default": true
          },
          "extractText": {
            "title": "Extract text",
            "type": "boolean",
            "description": "Return the plain text of each page (reading order, line breaks kept) and build chunks from it. Turn off if you only need tables. Example: true.",
            "default": true
          },
          "markdown": {
            "title": "Markdown",
            "type": "boolean",
            "description": "Also return each page as Markdown: headings detected from font size (20 percent above the page's body text), paragraphs joined, tables rendered as Markdown tables in place. Example: true.",
            "default": true
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 0,
            "maximum": 20000,
            "type": "integer",
            "description": "Target size of RAG chunks in characters. Chunks end at sentence boundaries when possible and each carries page, chunkIndex, charStart and charEnd (offsets into that page's text) plus a citation object, the same chunk schema as the transcribe-to-json-chunks Actor. 0 disables chunking. Default 1200 (about 300 tokens). Example: 1200.",
            "default": 1200
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "How many characters consecutive chunks share, so sentences cut at a boundary appear whole in one of them. Capped at half the chunk size. Default 150. Example: 150.",
            "default": 150
          },
          "ocr": {
            "title": "OCR",
            "enum": [
              "off",
              "auto",
              "always"
            ],
            "type": "string",
            "description": "off: text layer only, fastest and cheapest (default). auto: OCR only pages whose text layer has fewer than 20 characters (scanned pages inside otherwise normal PDFs). always: OCR every page, for fully scanned documents. OCR renders the page at 200 dpi and runs Tesseract; each OCR page adds one ocr-page event and takes a few seconds. Example: auto.",
            "default": "off"
          },
          "ocrLanguage": {
            "title": "OCR language",
            "type": "string",
            "description": "Tesseract language code for OCR. Only \"eng\" (English) is installed in this build; other codes return an OCR warning on each page. Default eng. Example: eng.",
            "default": "eng"
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "PDFs larger than this are skipped with an error item instead of being downloaded. Default 50, maximum 200. Example: 50.",
            "default": 50
          },
          "includeWordBoxes": {
            "title": "Include word boxes",
            "type": "boolean",
            "description": "Add wordBoxes to every page: each word with x0, top, x1, bottom in PDF points (and OCR confidence for OCR pages). Useful for highlighting and layout work; makes items several times larger. Example: false.",
            "default": false
          },
          "includeCellBoxes": {
            "title": "Include table cell boxes",
            "type": "boolean",
            "description": "Add cells to every table: one entry per cell with row, col, text and its own bbox. Tables already carry a table-level bbox; turn this on when you need per-cell coordinates (for example to link a value back to its spot on the page). Example: false.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}