{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Text Extractor — Markdown, Tables, OCR & RAG Chunks",
    "description": "Extract text, GFM Markdown, tables (2D arrays + CSV) and heading-aware RAG chunks with page anchors from PDFs. URLs, base64 upload, key-value store, password-protected PDFs, page ranges, OCR fallback (eng/deu/fra/spa) only for pages without a text layer. Failed PDFs are never charged.",
    "version": "0.1",
    "x-build-id": "R3mFokhcW3rc8zaCm"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nanare-sudo~pdf-text-extractor-rag/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nanare-sudo-pdf-text-extractor-rag",
        "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/nanare-sudo~pdf-text-extractor-rag/runs": {
      "post": {
        "operationId": "runs-sync-nanare-sudo-pdf-text-extractor-rag",
        "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/nanare-sudo~pdf-text-extractor-rag/run-sync": {
      "post": {
        "operationId": "run-sync-nanare-sudo-pdf-text-extractor-rag",
        "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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "extract",
              "info",
              "canary"
            ],
            "type": "string",
            "description": "`extract` = full extraction (charged per processed PDF + per OCR page). `info` = free probe: page count, metadata, encryption status, which pages have a text layer and an OCR-cost estimate — run this first on unknown PDFs. `canary` = free health self-test of the whole pipeline (download, parser, tables, OCR engine).",
            "default": "extract"
          },
          "urls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Direct links to PDF files, e.g. `https://arxiv.org/pdf/1706.03762`. Redirects are followed. Combine freely with `base64Files` and `keyValueStoreKeys`.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "base64Files": {
            "title": "Base64 files",
            "type": "array",
            "description": "Inline PDF uploads as objects `{\"name\": \"report.pdf\", \"data\": \"<base64>\"}`. `data` may be a raw base64 string or a `data:application/pdf;base64,...` URI. Ideal for API and AI-agent callers that hold the file in memory.",
            "default": []
          },
          "keyValueStoreKeys": {
            "title": "Key-value store keys",
            "type": "array",
            "description": "Keys of PDF records in this run's default key-value store (upload the file first via the Apify API or console, then pass its key here).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for encrypted PDFs. Applied to every input file that is encrypted; files that fail to decrypt are reported as `failed` and are not charged."
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Pages to extract, 1-based, e.g. `1-5,8,12-` (12- means page 12 to the end). Empty = all pages."
          },
          "maxPdfMb": {
            "title": "Max PDF size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "PDFs larger than this are rejected (status `failed`, not charged).",
            "default": 50
          },
          "maxOcrPages": {
            "title": "Max OCR pages per run",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "Hard cap on OCR-processed pages across the whole run (OCR is the only per-page charge). Set 0 to disable OCR entirely.",
            "default": 100
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Tesseract language packs to use for scanned pages. Available in this actor: `eng`, `deu`, `fra`, `spa`. Multiple languages are combined (e.g. eng+deu).",
            "default": [
              "eng"
            ],
            "items": {
              "type": "string"
            }
          },
          "outputFormats": {
            "title": "Output formats",
            "type": "array",
            "description": "Which representations to include in each result item: `text` (plain text), `markdown` (GitHub-flavored, incl. pipe tables), `tables` (2D arrays + CSV strings + page numbers), `chunks` (heading-aware RAG chunks with headingPath and page anchors). Fewer formats = smaller items, same price.",
            "items": {
              "type": "string",
              "enum": [
                "text",
                "markdown",
                "tables",
                "chunks"
              ],
              "enumTitles": [
                "Plain text",
                "Markdown (GFM)",
                "Tables (2D + CSV)",
                "RAG chunks"
              ]
            },
            "default": [
              "text",
              "markdown",
              "tables",
              "chunks"
            ]
          },
          "chunkTokens": {
            "title": "Chunk size (tokens)",
            "minimum": 100,
            "maximum": 8000,
            "type": "integer",
            "description": "Approximate target size of each RAG chunk in tokens (estimated at ~4 characters per token). Chunks break at headings when possible and always carry `headingPath`, `pageStart`, `pageEnd`.",
            "default": 800
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}