{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown & RAG Chunks Extractor",
    "description": "Turn PDF links into clean text, LLM-ready Markdown and token-counted RAG chunks with page numbers. Reads one PDF or a whole dataset, with document metadata. No browser, no OCR. Not affiliated with any PDF vendor.",
    "version": "1.0",
    "x-build-id": "r84soPyZyzf3XtGtn"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/mmdincer~pdf-rag-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-mmdincer-pdf-rag-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/mmdincer~pdf-rag-extractor/runs": {
      "post": {
        "operationId": "runs-sync-mmdincer-pdf-rag-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/mmdincer~pdf-rag-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-mmdincer-pdf-rag-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": {
          "urls": {
            "title": "PDF URLs",
            "maxItems": 100,
            "type": "array",
            "description": "Direct links to PDF files, one per line. Up to 100 per run. The link must return the file itself (an <code>https://…/report.pdf</code> link), not a page that shows a PDF viewer.",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Read PDF links from a dataset",
            "type": "string",
            "description": "Optional. Pick an Apify dataset whose items contain PDF links. The Actor looks for <code>pdfUrl</code>, <code>fileUrl</code>, <code>documentUrl</code>, <code>url</code>, <code>link</code> and similar fields, which is how you chain it after a crawler without copying links by hand. The dataset is opened read-only."
          },
          "mode": {
            "title": "What to return",
            "enum": [
              "both",
              "chunks",
              "document"
            ],
            "type": "string",
            "description": "<b>Document and chunks</b> writes one document row plus its chunk rows. <b>Chunks only</b> skips the document row, so the dataset is exactly what an embedding job wants. <b>Document only</b> returns the text, Markdown and metadata without chunking.",
            "default": "both"
          },
          "chunkSize": {
            "title": "Chunk size (tokens)",
            "minimum": 64,
            "maximum": 4096,
            "type": "integer",
            "description": "Token budget per chunk, counted with the cl100k_base tokenizer that OpenAI embedding and chat models use. 512 is a good default for retrieval; use 256 for narrow facts and 1024 or more for long arguments.",
            "default": 512
          },
          "chunkOverlap": {
            "title": "Chunk overlap (tokens)",
            "minimum": 0,
            "maximum": 2048,
            "type": "integer",
            "description": "How much text from the end of one chunk is repeated at the start of the next, so an answer that straddles a boundary is still findable. 64 is the default (an eighth of the chunk size). At most half the chunk size.",
            "default": 64
          },
          "startPage": {
            "title": "First page",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Start reading at this page (1-based). Useful when the first pages are a cover and a table of contents you do not want to pay for.",
            "default": 1
          },
          "maxPages": {
            "title": "Maximum pages per PDF",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "Stop after this many pages. <code>0</code> means the whole document. A 400-page manual you need three pages from costs three pages this way.",
            "default": 0
          },
          "includeMarkdown": {
            "title": "Include Markdown",
            "type": "boolean",
            "description": "Add the <code>markdown</code> field to the document row: headings, paragraphs and lists rebuilt from the page layout. Turn it off if you only want the chunks.",
            "default": true
          },
          "includePages": {
            "title": "Include per-page text",
            "type": "boolean",
            "description": "Add a <code>pages</code> array with the text of every page. Off by default because the Markdown field already covers the content; turn it on when you need to quote a single page.",
            "default": false
          },
          "maxDocuments": {
            "title": "Maximum PDFs per run",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Upper bound on how many PDF links are processed in one run, applied after the list and the dataset are merged. A low number is a simple way to cap the cost of a first run.",
            "default": 100
          },
          "maxFileSizeMb": {
            "title": "Maximum file size (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Skip a PDF larger than this instead of downloading it. Larger files are usually scans or image-heavy reports that this Actor reads badly anyway.",
            "default": 100
          },
          "maxChunksPerDocument": {
            "title": "Maximum chunks per PDF",
            "minimum": 10,
            "maximum": 2000,
            "type": "integer",
            "description": "Safety cap on chunk rows for one document. A very small chunk size on a very long document would otherwise write tens of thousands of rows; the cap keeps the run predictable. Leave it at the default unless you know you need more.",
            "default": 2000
          },
          "requestsPerSecond": {
            "title": "Requests per second",
            "minimum": 0.2,
            "maximum": 10,
            "type": "number",
            "description": "How fast PDFs are downloaded. 2 is a polite default; lower it to 1 when all files come from one small server.",
            "default": 2
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. The Actor downloads public PDF links directly, which works for most sites; use Apify Proxy when the files sit behind a CDN that blocks datacenter IPs."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}