{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown & RAG Chunks: Tables to CSV, OCR",
    "description": "Convert PDFs into clean Markdown and RAG-ready chunks with page numbers and heading paths. Tables export to CSV and JSON, and offline OCR reads scanned pages. Failed files are never charged.",
    "version": "1.0",
    "x-build-id": "3p9BAFK9E3xmqWC26"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/bongo-seakhoa~pdf-to-markdown-rag-chunks/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-bongo-seakhoa-pdf-to-markdown-rag-chunks",
        "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/bongo-seakhoa~pdf-to-markdown-rag-chunks/runs": {
      "post": {
        "operationId": "runs-sync-bongo-seakhoa-pdf-to-markdown-rag-chunks",
        "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/bongo-seakhoa~pdf-to-markdown-rag-chunks/run-sync": {
      "post": {
        "operationId": "run-sync-bongo-seakhoa-pdf-to-markdown-rag-chunks",
        "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": {
          "sources": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Direct links to PDF files (http or https). Redirects are followed, and Dropbox '?dl=0' links are turned into downloads. Pages that only show a PDF viewer or a login form cannot be downloaded.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keyValueStoreId": {
            "title": "Key-value store with PDFs (optional)",
            "type": "string",
            "description": "Pick a key-value store that holds PDF files. Without record keys below, every record whose key ends in '.pdf' is converted (up to 1,000)."
          },
          "keyValueStoreKeys": {
            "title": "Record keys (optional)",
            "type": "array",
            "description": "Keys of PDF records in the store picked above. Leave empty to use every record whose key ends in .pdf.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "useBundledSample": {
            "title": "Also convert the bundled sample PDF",
            "type": "boolean",
            "description": "Adds a 3-page synthetic sample (a text page, a table page and a scanned page) to the run. None of this Actor's events are charged for it. The sample is used automatically when no sources are given.",
            "default": false
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "convert",
              "estimate"
            ],
            "type": "string",
            "description": "'convert' produces Markdown, chunks and tables. 'estimate' only counts pages, tells which pages would need OCR and shows the projected price. It charges none of this Actor's events (Apify's standard Actor start fee still applies).",
            "default": "convert"
          },
          "outputs": {
            "title": "Outputs",
            "type": "array",
            "description": "Which outputs to produce. Markdown goes to the document row and to a .md file; chunks and tables become their own rows; tables are also saved as CSV and JSON files.",
            "items": {
              "type": "string",
              "enum": [
                "markdown",
                "chunks",
                "tables"
              ],
              "enumTitles": [
                "Markdown",
                "RAG chunks",
                "Tables (CSV/JSON)"
              ]
            },
            "default": [
              "markdown",
              "chunks",
              "tables"
            ]
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 100,
            "maximum": 100000,
            "type": "integer",
            "description": "Target maximum length of each chunk in characters (about 4 characters per token). Chunks break at headings, paragraphs and sentences, and tables stay whole when they fit.",
            "default": 1500
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 50000,
            "type": "integer",
            "description": "Characters repeated between consecutive chunks. At most half the chunk size.",
            "default": 150
          },
          "includePageMarkers": {
            "title": "Add page markers to the Markdown",
            "type": "boolean",
            "description": "Insert '<!-- page N -->' before the first block that starts on each page. Blank pages, and pages whose text only continues a paragraph or table from the page before, get no marker.",
            "default": false
          },
          "csvFormulaGuard": {
            "title": "Protect CSV files against spreadsheet formulas",
            "type": "boolean",
            "description": "In the table CSV files, put a single quote before any cell that starts with =, +, -, @, a tab or a carriage return (also after leading spaces or invisible characters, or in full-width form), so a spreadsheet shows it as text instead of running it as a formula. Signed numbers such as -12.5, +3 or -45%, and cells holding only dashes or plus signs (a nil placeholder such as -), are left as they are. JSON rows, the Markdown and the dataset always keep the raw cell text. Turn this off only if you need the raw text in the CSV too.",
            "default": true
          },
          "ocrMode": {
            "title": "OCR",
            "enum": [
              "auto",
              "force",
              "off"
            ],
            "type": "string",
            "description": "'auto' runs OCR only on pages without a usable text layer (scans, including scans whose text layer is just a scanner stamp or Bates number). 'force' runs OCR on every page, and every page is then charged at the OCR price. 'off' never runs OCR; scanned pages then produce nothing and are not charged.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages for OCR (Tesseract). Choose only the languages in your documents; each extra language slows OCR down.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "deu",
                "fra",
                "spa",
                "ita",
                "por",
                "nld",
                "hun"
              ],
              "enumTitles": [
                "English",
                "German",
                "French",
                "Spanish",
                "Italian",
                "Portuguese",
                "Dutch",
                "Hungarian"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Pages to convert, 1-based, for example '1-5,8,10-'. Empty means all pages (up to the page limit)."
          },
          "maxPages": {
            "title": "Maximum pages per document",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Pages after this limit are not converted (the document is then marked 'partial') and not charged.",
            "default": 200
          },
          "maxFileSizeMb": {
            "title": "Maximum file size",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Larger files are not downloaded and are reported as failed (not charged). The limit is also capped at a quarter of the run's memory: 128 MB at 512 MB, 256 MB at the default 1 GB, 500 MB at 2 GB.",
            "default": 50
          },
          "perDocumentTimeoutSecs": {
            "title": "Time limit per document",
            "minimum": 30,
            "maximum": 7200,
            "type": "integer",
            "description": "When a document takes longer, the pages finished so far are returned as a 'partial' result; only those pages are charged.",
            "default": 900
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for encrypted PDFs. It is used for every document in the run and is never logged or stored in the output."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}