{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown and Text Converter with OCR",
    "description": "PDF to Markdown and text converter. Turns PDF files into Markdown with headings, plain text and tables as rows. Scanned pages use Tesseract OCR, Arabic included. Returns title, page count, metadata and optional RAG chunks for embeddings.",
    "version": "0.1",
    "x-build-id": "KFdDzzkaEnPaKQ8MP"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/maliksaid~pdf-to-text-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-maliksaid-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/maliksaid~pdf-to-text-markdown/runs": {
      "post": {
        "operationId": "runs-sync-maliksaid-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/maliksaid~pdf-to-text-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-maliksaid-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": {
          "startUrls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Links to the PDF files you want to convert. Each link must point straight to a PDF file. The Actor checks robots.txt before it downloads a file and skips files that robots.txt blocks.",
            "default": [
              {
                "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
              }
            ],
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "pdfPassword": {
            "title": "PDF password",
            "type": "string",
            "description": "Optional. Opens password-protected PDFs. The same password is tried on every PDF in the run. PDFs without a password open as usual. The password is never saved in the output or the log."
          },
          "keyValueStores": {
            "title": "PDFs in your Apify key-value stores",
            "type": "array",
            "description": "Pick key-value stores that hold your PDF files. The run gets read access to these stores only. Use this for files you uploaded to Apify or saved from another Actor."
          },
          "keyValueStoreKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Keys of the PDF records to read from the chosen stores, for example report-2025.pdf. Leave empty to read every PDF record in the stores.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "ocrMode": {
            "title": "OCR for scanned pages",
            "enum": [
              "auto",
              "off"
            ],
            "type": "string",
            "description": "Auto reads scanned pages with Tesseract OCR. A page counts as scanned when it has almost no text layer and holds a large image. Off skips OCR, so scanned pages come back empty.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages for OCR. English and Arabic ship with the Actor. Other languages are downloaded once per run. Add every language that appears in the scans; each extra language makes OCR slower.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "ara",
                "fra",
                "deu",
                "spa",
                "por",
                "ita",
                "nld",
                "tur",
                "rus",
                "fas",
                "urd",
                "hin",
                "chi_sim",
                "jpn"
              ],
              "enumTitles": [
                "English",
                "Arabic",
                "French",
                "German",
                "Spanish",
                "Portuguese",
                "Italian",
                "Dutch",
                "Turkish",
                "Russian",
                "Persian",
                "Urdu",
                "Hindi",
                "Chinese (simplified)",
                "Japanese"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "extractTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Find simple tables (rows of cells that line up in columns) and return them as rows and as Markdown tables. Tables on OCR pages are returned as text.",
            "default": true
          },
          "removeHeadersFooters": {
            "title": "Remove running headers and footers",
            "type": "boolean",
            "description": "Drop lines that repeat at the top or bottom of at least half of the pages, such as page numbers and running titles. Needs 3 pages or more.",
            "default": true
          },
          "includeText": {
            "title": "Include plain text",
            "type": "boolean",
            "description": "Return the full plain text. Cells of a table row are separated by tabs.",
            "default": true
          },
          "includeMarkdown": {
            "title": "Include Markdown",
            "type": "boolean",
            "description": "Return Markdown with headings, paragraphs, bullet lists and tables.",
            "default": true
          },
          "includePages": {
            "title": "Include each page separately",
            "type": "boolean",
            "description": "Also return a list with the text and Markdown of each page.",
            "default": false
          },
          "chunkSize": {
            "title": "Chunk size for embeddings (characters)",
            "minimum": 0,
            "maximum": 20000,
            "type": "integer",
            "description": "Split the Markdown into chunks of about this many characters for RAG and vector databases. Chunks break between paragraphs and keep their page numbers and section heading. 0 turns chunks off. 1,000 to 2,000 suits most embedding models.",
            "default": 0
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Each chunk starts with this many characters from the end of the chunk before it. Used only when chunks are on.",
            "default": 150
          },
          "maxItems": {
            "title": "Maximum PDFs",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many PDFs. The default keeps test runs short and cheap. Set 0 for no limit.",
            "default": 100
          },
          "maxPagesPerPdf": {
            "title": "Maximum pages per PDF",
            "minimum": 0,
            "type": "integer",
            "description": "Read at most this many pages of each PDF, from the first page. The output says when a PDF was cut short. Set 0 for no limit.",
            "default": 500
          },
          "maxPagesPerRun": {
            "title": "Maximum pages per run",
            "minimum": 0,
            "type": "integer",
            "description": "Stop the run after this many pages in total. Set 0 for no limit.",
            "default": 5000
          },
          "maxOcrPagesPerRun": {
            "title": "Maximum OCR pages per run",
            "minimum": 0,
            "type": "integer",
            "description": "OCR at most this many scanned pages in the run. One dense scanned page took about 35 seconds on the platform at 512 MB. It should take about half that at the default 1,024 MB. Further scanned pages are listed as skipped and are not charged. OCR also stops 2 minutes before the run timeout. Set 0 for no limit.",
            "default": 50
          },
          "maxFileSizeMb": {
            "title": "Maximum file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Skip files larger than this. Larger files need more memory.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}