{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown and Text Extractor for LLM and RAG",
    "description": "Turn PDFs into clean text and Markdown for LLM and RAG pipelines. Headings from font size and weight, paragraphs reflowed, columns in reading order, repeated headers removed. Optional per-page text and embedding-sized chunks with page range and heading path. Flags scanned PDFs; no OCR.",
    "version": "0.1",
    "x-build-id": "doSrNN6WTcDdQ9nUr"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/antsonahill~pdf-to-markdown-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-antsonahill-pdf-to-markdown-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/antsonahill~pdf-to-markdown-extractor/runs": {
      "post": {
        "operationId": "runs-sync-antsonahill-pdf-to-markdown-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/antsonahill~pdf-to-markdown-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-antsonahill-pdf-to-markdown-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",
            "type": "array",
            "description": "Direct links to PDF files, one per line. Redirects are followed. Links to an arXiv abstract page or a GitHub file page are pointed at the PDF itself. A link that returns a web page instead of a PDF is reported and not charged.",
            "items": {
              "type": "string"
            }
          },
          "pdfFiles": {
            "title": "Upload PDF files",
            "type": "array",
            "description": "Upload PDFs from your computer instead of, or in addition to, giving URLs. Each file can be up to 100 MB."
          },
          "keyValueStoreId": {
            "title": "Key-value store with PDFs",
            "type": "string",
            "description": "Read PDFs that another Actor or your own code saved as records in a key-value store, for example files downloaded by a crawler. By default every record whose key ends in .pdf is read."
          },
          "recordKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Keys of the records to read from the key-value store. Leave empty to read every record whose key ends in .pdf.",
            "items": {
              "type": "string"
            }
          },
          "pageRange": {
            "title": "Pages",
            "type": "string",
            "description": "Pages to read from every PDF, for example 1-5, 8, 12- (12 to the end). Pages are numbered from 1. Leave empty for all pages."
          },
          "maxPagesPerDocument": {
            "title": "Maximum pages per PDF",
            "minimum": 1,
            "type": "integer",
            "description": "Stop reading a PDF after this many pages. A PDF is charged once per started 100 pages, so this also caps what one long file can cost. Leave empty for no limit."
          },
          "password": {
            "title": "Password",
            "type": "string",
            "description": "Password for PDFs that need one to open. It is tried on every protected PDF in the run. PDFs that only restrict printing or copying open without it."
          },
          "removeHeadersFooters": {
            "title": "Remove repeated headers, footers and page numbers",
            "type": "boolean",
            "description": "Drop lines that repeat in the top or bottom margin of three or more pages close together, such as running titles and page numbers. Lines that do not repeat are always kept. The removed lines are listed in the output.",
            "default": true
          },
          "includePages": {
            "title": "Include text per page",
            "type": "boolean",
            "description": "Add a pages array with the plain text of each page, for page-level citations. This roughly doubles the size of the result.",
            "default": false
          },
          "includeChunks": {
            "title": "Split into chunks",
            "type": "boolean",
            "description": "Add a chunks array ready for embedding. A chunk never crosses a heading and breaks between paragraphs where it can. Each chunk carries its page range and the headings it sits under.",
            "default": false
          },
          "chunkSize": {
            "title": "Chunk size",
            "minimum": 50,
            "maximum": 100000,
            "type": "integer",
            "description": "Largest size of a chunk, in the unit chosen below. 1000 characters is about 250 tokens.",
            "default": 1000
          },
          "chunkOverlap": {
            "title": "Chunk overlap",
            "minimum": 0,
            "maximum": 50000,
            "type": "integer",
            "description": "How much of the end of a chunk is repeated at the start of the next one when a long section is split, in the unit chosen below. At most half the chunk size. Chunks that start at a heading have no overlap.",
            "default": 100
          },
          "chunkUnit": {
            "title": "Chunk unit",
            "enum": [
              "characters",
              "tokens"
            ],
            "type": "string",
            "description": "Whether chunk size and overlap are counted in characters or in tokens. Tokens are estimated at four characters each, which is close for English and rougher for code and other languages.",
            "default": "characters"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}