{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Text Extractor — PDF to Text & Markdown API | $3/1k PDFs",
    "description": "Extract text and Markdown from PDF URLs in bulk, with document info (title, dates, page count, producer) and per-page text. Pure JavaScript, no OCR, no API key. Broken links, non-PDFs and scanned files are free rows. $3 per 1,000 PDFs.",
    "version": "0.1",
    "x-build-id": "2PUWyoPxwQ3D0Xmch"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/glasswing~pdf-text-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-glasswing-pdf-text-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/glasswing~pdf-text-extractor/runs": {
      "post": {
        "operationId": "runs-sync-glasswing-pdf-text-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/glasswing~pdf-text-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-glasswing-pdf-text-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": {
          "startUrls": {
            "title": "PDF URLs",
            "uniqueItems": true,
            "type": "array",
            "description": "Direct links to PDF files, one per line. Google Drive, Dropbox and GitHub share links and arXiv abstract pages are turned into their download links automatically. A link that does not return a PDF gives a free row with the reason.",
            "default": [
              "https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.29.pdf",
              "https://www.irs.gov/pub/irs-pdf/p1.pdf"
            ],
            "items": {
              "type": "string"
            }
          },
          "fileUploads": {
            "title": "Upload PDFs or key-value store records",
            "type": "array",
            "description": "Upload PDF files from your computer, or give records already in an Apify key-value store: the record's API URL or `storeId/key` (`username~store-name/key`). Records are read with your run's own token, so private stores work. Each file is one row (or chunk rows), billed like a URL."
          },
          "base64Files": {
            "title": "PDFs as base64 (API)",
            "type": "array",
            "description": "For API calls and automations: PDFs sent inside the input, each a base64 string (a `data:application/pdf;base64,...` URL works too) or an object `{ \"fileName\": \"invoice.pdf\", \"base64\": \"JVBERi0...\", \"password\": \"optional\" }`. The whole input must stay under Apify's input size limit; for bigger files use a key-value store record above."
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Opens password-protected PDFs: tried on every file that needs a password (a password in a base64Files entry wins for that file). Stored encrypted, never logged or written to the dataset. A wrong password gives a free `wrong_password` row."
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "both",
              "text",
              "markdown"
            ],
            "type": "string",
            "description": "Plain text keeps the PDF's lines; Markdown rebuilds headings, lists and paragraphs (and tables with 'Extract tables'), good for LLMs and RAG. Both is the default.",
            "default": "both"
          },
          "ragChunks": {
            "title": "RAG chunks (one row per chunk)",
            "type": "boolean",
            "description": "For vector databases and RAG: write one row per token-sized chunk with `text`, page numbers (`pageStart`, `pageEnd`, `pageNumbers`), the section heading above it, an estimated `tokenCount`, a stable `chunkId` and overlap with the previous chunk. Chunks are Markdown unless Output format is plain text. Billing: one result per PDF per started 50 chunks (up to 50 chunks costs the same as one PDF).",
            "default": false
          },
          "chunkSizeTokens": {
            "title": "Chunk size",
            "minimum": 100,
            "maximum": 2000,
            "type": "integer",
            "description": "Target chunk size in estimated tokens (about 4 characters of English text per token; 1 per CJK character). Chunks break at paragraphs, then sentences, then words, and never exceed this size.",
            "default": 500
          },
          "chunkOverlapTokens": {
            "title": "Chunk overlap",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Tokens repeated from the end of one chunk at the start of the next, so a sentence cut at a boundary is still found. At most half the chunk size.",
            "default": 50
          },
          "extractTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Find tables in the PDF's text layer (columns separated by white space; no OCR) and return them as rows of cells in a `tables` array, and as Markdown tables in `markdown` and in RAG chunks. Tables that are images, or drawn column by column, stay as plain text lines.",
            "default": false
          },
          "splitByPage": {
            "title": "One row per page",
            "type": "boolean",
            "description": "Write one row per page instead of one row per PDF. Each page row with text is one billed result, so a 20-page PDF costs 20 results. For page-level text at the per-PDF price, leave this off and turn on 'Include per-page text' instead.",
            "default": false
          },
          "includePageText": {
            "title": "Include per-page text",
            "type": "boolean",
            "description": "Add a `pages` array to each PDF row with the text (and Markdown) of every page, so you can cite page numbers. Still one result per PDF.",
            "default": false
          },
          "pageRange": {
            "title": "Page range",
            "pattern": "^\\s*$|^\\s*(\\d+\\s*(-\\s*\\d*)?|-\\s*\\d+)(\\s*[,;]\\s*(\\d+\\s*(-\\s*\\d*)?|-\\s*\\d+))*\\s*$",
            "type": "string",
            "description": "Read only these pages of every PDF, e.g. `1-5, 8, 12-` (`12-` = page 12 to the end, `-3` = the first 3 pages). Leave empty for all pages (up to Max pages)."
          },
          "maxPages": {
            "title": "Max pages per PDF",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Stop after this many pages of each PDF; the row then says `truncated: true` and how far it got. Up to 1,000.",
            "default": 100
          },
          "includeMetadata": {
            "title": "Include document info",
            "type": "boolean",
            "description": "Add the PDF's own document info: title, subject, keywords, creator and producer software, creation and modification dates, PDF version, language, whether it has form fields or is encrypted. The author field is never returned (it usually holds a person's name).",
            "default": true
          },
          "maxFileSizeMb": {
            "title": "Max file size",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Larger PDFs are skipped with a free `error` row (checked from the Content-Length header before downloading, and again after). Up to 100 MB.",
            "default": 50
          },
          "timeoutSecs": {
            "title": "Timeout per PDF",
            "minimum": 10,
            "maximum": 600,
            "type": "integer",
            "description": "Maximum time for downloading one PDF, and again for reading it. A PDF that runs out of time while being read returns the pages read so far with `truncated: true`.",
            "default": 120
          },
          "maxItems": {
            "title": "Maximum rows",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Safety cap on rows written: PDFs, or pages with 'One row per page'. Rows with status `ok` are the billable results; `not_found` and `error` rows are free.",
            "default": 1000
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. Downloads go direct, which works for nearly every file host. Enable Apify Proxy (datacenter) only if a host blocks direct downloads.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}