{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Text and Markdown: Per-Page Text for RAG",
    "description": "Give it PDF links, or files from Drive, Dropbox or ZIP archives, and get one JSON row per PDF: metadata, full text, Markdown and a per-page list. Scanned pages are flagged, or read with the optional OCR. $4 per 1,000 PDFs; failed files are free.",
    "version": "0.1",
    "x-build-id": "NJRZ0M4KgUwez2PDx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/cyrus_1~pdf-to-text-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-cyrus_1-pdf-to-text-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/cyrus_1~pdf-to-text-markdown/runs": {
      "post": {
        "operationId": "runs-sync-cyrus_1-pdf-to-text-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/cyrus_1~pdf-to-text-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-cyrus_1-pdf-to-text-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": {
          "urls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Public http or https links to PDF files, or to ZIP archives of PDFs. Google Drive and Dropbox share links work. Links are one way to give files; the other ways are below. If you give no file at all, a public IRS form is read as an example.",
            "items": {
              "type": "string"
            }
          },
          "base64Files": {
            "title": "Files as base64",
            "type": "array",
            "description": "Files sent as base64 text, for callers that have the bytes but no link (n8n, Make, your own code). Each entry is the base64 string or a data: URI, or an object like {\"name\": \"invoice.pdf\", \"data\": \"<base64>\"}. The data is never copied into the output. A ZIP sent this way is expanded."
          },
          "keyValueStoreId": {
            "title": "Key-value store",
            "type": "string",
            "description": "The key-value store that holds your files (pick one of yours). Leave empty to read from this run's own default store. Used with Record keys below."
          },
          "keyValueStoreKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Keys of the records to read from the key-value store. Each record must be a file stored with its own content type, for example application/pdf, not JSON or text. A ZIP record is expanded. Keys may contain letters, digits and !-_.'() only.",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Dataset with links",
            "type": "string",
            "description": "A dataset of yours whose items hold a link to a file, for example the output of another actor. Pick it here, then name the field below."
          },
          "datasetField": {
            "title": "Dataset field",
            "type": "string",
            "description": "The field of each dataset item that holds the link, for example pdfUrl or media.url (a dot goes one level deeper). The value can be one link, a list of links, or an object with a url. Required with Dataset with links."
          },
          "datasetLimit": {
            "title": "Max dataset items",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Read at most this many items from the dataset.",
            "default": 1000
          },
          "urlListUrls": {
            "title": "Links to a CSV or TXT list of links",
            "type": "array",
            "description": "Links to text files that list links to read: a TXT file with one link per line, or a CSV file. For a CSV the column is found by its header (url, link, pdf, file, ...) or by the first column that holds links, or you name it below. Up to 5,000 links per list.",
            "items": {
              "type": "string"
            }
          },
          "urlListColumn": {
            "title": "CSV column name",
            "type": "string",
            "description": "The header of the CSV column that holds the links, when it is not named url, link or similar. Leave empty to find it automatically."
          },
          "followPdfLinks": {
            "title": "Follow PDF links on web pages",
            "type": "boolean",
            "description": "When a link returns a web page, read the page for links to PDF files (links ending in .pdf, citation_pdf_url and alternate PDF links) and read those PDFs, one level deep. Without this a web page gives a free error row.",
            "default": false
          },
          "maxLinksPerPage": {
            "title": "Max PDF links per web page",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "No more than this many PDF links are followed from one web page.",
            "default": 20
          },
          "maxFilesPerZip": {
            "title": "Max files per ZIP",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "No more than this many readable files are taken from one ZIP archive. Other entries are left out.",
            "default": 200
          },
          "maxZipUncompressedMb": {
            "title": "Max ZIP size when unpacked (MB)",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "A ZIP whose files add up to more than this when unpacked is stopped (protection against zip bombs). Files are unpacked in memory, one at a time, never written to disk.",
            "default": 500
          },
          "includeMarkdown": {
            "title": "Include Markdown",
            "type": "boolean",
            "description": "Add a Markdown version (headings, lists, paragraphs) of every page and of the whole document.",
            "default": true
          },
          "includePages": {
            "title": "Include per-page output",
            "type": "boolean",
            "description": "Add a pages list with text, Markdown, a needsOcr flag and an ocr flag for each page. Turn off for smaller rows.",
            "default": true
          },
          "ocrScannedPages": {
            "title": "OCR scanned pages",
            "type": "boolean",
            "description": "Read pages that have no text layer (scans, photos) with OCR in the same run. Off by default, so scans stay free and flagged with needsOcr. Each page where OCR finds text is charged as ocr-page ($0.004). A PDF with no text-layer page is charged only for its OCR pages. Needs at least 1024 MB of memory.",
            "default": false
          },
          "ocrLanguage": {
            "title": "OCR language",
            "enum": [
              "en",
              "ch",
              "korean",
              "arabic",
              "cyrillic",
              "devanagari",
              "th",
              "el",
              "ta",
              "te"
            ],
            "type": "string",
            "description": "Which recogniser reads the scanned pages. English also reads French, German, Spanish and other Latin-script languages. Used only when OCR scanned pages is on. For Japanese, use the Image OCR actor.",
            "default": "en"
          },
          "ocrMaxPagesPerPdf": {
            "title": "Max OCR pages per PDF",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "At most this many scanned pages of one PDF are read by OCR (the first ones). The rest stay flagged in needsOcrPages. This caps what one file can cost.",
            "default": 20
          },
          "maxPagesPerPdf": {
            "title": "Max pages per PDF",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Pages beyond this number are not read; the row says truncated. Pages past 20 are charged as extra pages.",
            "default": 500
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Larger files are skipped with an error row and are not charged.",
            "default": 50
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}