{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Text & Metadata Extractor (pay per PDF)",
    "description": "Give a list of PDF URLs, get per-page text, page count, document metadata and table-like line grouping. Failed URLs return an error item and are not charged.",
    "version": "0.1",
    "x-build-id": "qgIIv05kLVPbGzpEN"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/pennydata~pdf-text-extractor-pay-per-pdf/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-pennydata-pdf-text-extractor-pay-per-pdf",
        "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/pennydata~pdf-text-extractor-pay-per-pdf/runs": {
      "post": {
        "operationId": "runs-sync-pennydata-pdf-text-extractor-pay-per-pdf",
        "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/pennydata~pdf-text-extractor-pay-per-pdf/run-sync": {
      "post": {
        "operationId": "run-sync-pennydata-pdf-text-extractor-pay-per-pdf",
        "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",
            "type": "array",
            "description": "Public http(s) URLs of PDF files. Each successfully processed PDF is one billable event; failed URLs yield an error item and are free. Also accepted as aliases: pdfUrls, startUrls, sources, url, urlsText (see Switching from another PDF extractor in the README). Also accepted as aliases: pdfUrls, startUrls, sources, url, urlsText (see Switching from another PDF extractor in the README).",
            "default": [
              {
                "url": "https://www.w3.org/WAI/WCAG21/working-examples/pdf-table/table.pdf"
              }
            ],
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "maxFileSizeMB": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "PDFs larger than this are skipped with an error item (checked via Content-Length and while downloading).",
            "default": 25
          },
          "maxPages": {
            "title": "Max pages per PDF",
            "minimum": 0,
            "type": "integer",
            "description": "Only extract the first N pages. 0 means all pages. Page count in the output always reflects the full document.",
            "default": 0
          },
          "includeLines": {
            "title": "Include line grouping",
            "type": "boolean",
            "description": "Add per-page 'lines' with text grouped by visual row and split into cells where wide horizontal gaps occur (rows with 3+ cells are flagged tableLike). Turn off for smaller output.",
            "default": true
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "text",
              "markdown"
            ],
            "type": "string",
            "description": "'text' (default) keeps the plain text output. 'markdown' converts a PDF to Markdown: headings from font size, bullet lists and pipe tables, in 'text' and each page's 'markdown' field. Use markdown for LLM prompts and RAG.",
            "default": "text"
          },
          "chunkSize": {
            "title": "RAG chunk size (tokens)",
            "minimum": 0,
            "maximum": 8000,
            "type": "integer",
            "description": "0 (default) returns one item per PDF. A value above 0 returns one dataset item per RAG chunk of about this many tokens (4 characters per token), split on paragraph boundaries, each with pageStart, pageEnd, pages and chunkIndex, ready for a vector database. Still billed once per PDF. Try 500 to 1000.",
            "default": 0
          },
          "chunkOverlap": {
            "title": "Chunk overlap (tokens)",
            "minimum": 0,
            "maximum": 4000,
            "type": "integer",
            "description": "Tokens of trailing text repeated at the start of the next chunk so context is not lost at boundaries (only used when chunkSize is above 0). Capped at half the chunk size.",
            "default": 0
          },
          "timeoutSecs": {
            "title": "Download timeout (seconds)",
            "minimum": 5,
            "maximum": 600,
            "type": "integer",
            "description": "Maximum time to wait for each PDF download before giving up with an error item.",
            "default": 60
          },
          "maxPdfs": {
            "title": "Max PDFs per run",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Process at most this many URLs per run (cost guard).",
            "default": 100
          },
          "url": {
            "title": "Single PDF URL (alias)",
            "type": "string",
            "description": "Compatibility alias: one PDF URL, merged with urls."
          },
          "urlsText": {
            "title": "PDF URLs, one per line (alias)",
            "type": "string",
            "description": "Compatibility alias: PDF URLs pasted one per line, merged with urls."
          },
          "pdfUrls": {
            "title": "pdfUrls (alias)",
            "type": "array",
            "description": "Compatibility alias for urls (strings or {url} objects)."
          },
          "startUrls": {
            "title": "startUrls (alias)",
            "type": "array",
            "description": "Compatibility alias for urls (strings or {url} objects)."
          },
          "sources": {
            "title": "sources (alias)",
            "type": "array",
            "description": "Compatibility alias for urls (strings or {url} objects)."
          },
          "timeoutPerPdfSecs": {
            "title": "Timeout per PDF (alias)",
            "minimum": 1,
            "type": "integer",
            "description": "Compatibility alias for timeoutSecs."
          },
          "maxPdfMb": {
            "title": "Max PDF size MB (alias)",
            "minimum": 1,
            "type": "integer",
            "description": "Compatibility alias for maxFileSizeMB."
          },
          "endPage": {
            "title": "End page (alias)",
            "minimum": 1,
            "type": "integer",
            "description": "Compatibility alias: extract the first N pages (same as maxPages)."
          },
          "includePages": {
            "title": "Include per-page text (alias)",
            "type": "boolean",
            "description": "Compatibility: false drops the pages[] array from each item (text is kept)."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}