{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Text and Markdown: Clean Text for RAG",
    "description": "PDF to text and PDF to Markdown for RAG and LLM input: extract text from PDF files (URLs or stored keys) in reading order for one- and two-column pages, running headers, footers and page numbers removed, split words rejoined. Not for scanned PDFs (no OCR). USD 0.30 per 1,000 pages.",
    "version": "0.1",
    "x-build-id": "EPNBAV52F8qqV98eM"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/bardach_technologies~pdf-to-clean-text-and-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-bardach_technologies-pdf-to-clean-text-and-markdown",
        "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/bardach_technologies~pdf-to-clean-text-and-markdown/runs": {
      "post": {
        "operationId": "runs-sync-bardach_technologies-pdf-to-clean-text-and-markdown",
        "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/bardach_technologies~pdf-to-clean-text-and-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-bardach_technologies-pdf-to-clean-text-and-markdown",
        "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": {
          "samplePdf": {
            "title": "Read the built-in sample PDF",
            "type": "boolean",
            "description": "Reads the 3-page sample PDF that ships with this Actor (made by us, invented text, with a running header, a footer with page numbers, a two-column page and a word split at a line end). It needs no website. Default off; the form prefills it on. Switch it off and fill in your own PDFs.",
            "default": false
          },
          "pdfUrls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Public http or https URLs of PDF files, one per line. Only the URLs you list are requested (and redirects from them). Each host is resolved and checked first (addresses on private, loopback, link-local, multicast, reserved or cloud-metadata networks are refused), then the URL is checked against the site's robots.txt; a URL it does not allow is skipped with a reason and not charged. At most one request per second per host. Up to 50 PDFs per run in all (URLs, keys and the sample together), each URL at most 2,000 characters, each listed once, each file at most 50 MB. Default: none.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "pdfKeys": {
            "title": "PDF keys in a key-value store",
            "type": "array",
            "description": "Keys of PDF files stored in a key-value store (content type application/pdf), one per line, read in the store picked below (or this run's own default store). Keys of this Actor's own records (INPUT, OUTPUT, STATE, SUMMARY, text-*) are refused. Each file at most 50 MB. Default: none.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keyValueStoreId": {
            "title": "Key-value store (optional)",
            "type": "string",
            "description": "Pick the key-value store in your account that holds the PDFs listed under 'PDF keys' (or pass its ID through the API). The Actor only reads this store; the text files it writes always go to this run's own store. Leave empty (default) to use this run's own store."
          },
          "pages": {
            "title": "Pages (optional)",
            "type": "string",
            "description": "Which pages to read, for example 1-3,5,8- (pages count from 1; 8- means page 8 to the end). Empty (default) reads all pages, up to the page limit below.",
            "default": ""
          },
          "maxPagesPerPdf": {
            "title": "Page limit per PDF",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "At most this many pages of each PDF are read: 1 to 500 pages, default 500. A PDF with more selected pages is read up to the limit and its document row says pageLimitReached.",
            "default": 500
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "both",
              "text",
              "markdown"
            ],
            "type": "string",
            "description": "both (default): every row has `text` (plain text) and `markdown` (headings as #, list items as -). text: plain text only. markdown: Markdown only.",
            "default": "both"
          },
          "includePageRows": {
            "title": "One row per page",
            "type": "boolean",
            "description": "On (default): one dataset row per page (page number, its text, the lines removed from it) before each PDF's document row, ready to use as chunks for RAG. Off: only the document row per PDF. The charge is the same either way (per page with text).",
            "default": true
          },
          "stripRepeatedLines": {
            "title": "Remove headers, footers and page numbers",
            "type": "boolean",
            "description": "On (default): running headers, footers and page numbers are removed and listed in removedLines with the reason. A line counts only when it stands apart from the page's text block (a clear gap to the text, near the top or bottom edge of the page) and repeats across pages (or alternates on odd and even pages, or repeats on a stretch of pages in the slot the heads use), or is a page number that follows the page order. A repeated line attached to the text at its normal line spacing (a table's column header, a last line 'Confidential') is kept. Off: every line is kept.",
            "default": true
          },
          "minRepeatPercent": {
            "title": "Repeat threshold (% of pages)",
            "minimum": 30,
            "maximum": 100,
            "type": "integer",
            "description": "A header or footer line counts as repeated when it is on at least this share of the pages with text (or of the odd or the even pages), and on at least 3 pages; a running head that changes per chapter or part counts when it is on at least this share of the pages from its first to its last page: 30 to 100 percent, default 60. Lower finds more running heads and risks removing a real line that recurs; higher removes less.",
            "default": 60
          },
          "joinHyphenation": {
            "title": "Join words split at a line end",
            "type": "boolean",
            "description": "On (default): infor- + mation becomes information; a hyphen that belongs to the word is kept: before a capital or a digit (COVID-19), when the document writes the word that way (well-known), or when the next part holds a hyphen itself (state-of-the-art). A suspended hyphen before und, oder, and, or, nor, bzw., sowie or & keeps hyphen and space (Post- und Fernmeldewesen). Off: lines are joined with the hyphen kept.",
            "default": true
          },
          "timeoutSecPerPdf": {
            "title": "Time limit per PDF (seconds)",
            "minimum": 10,
            "maximum": 900,
            "type": "integer",
            "description": "Reading one PDF is stopped after this many seconds: 10 to 900 seconds, default 300. The pages read before the stop are written (status partial) and charged; nothing after them. Downloading a URL has its own limit of 60 seconds. Set the run's own timeout on Apify above what you need.",
            "default": 300
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}