{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown OCR Converter (Tesseract): Scanned PDF & Images",
    "description": "PDF to Markdown OCR API and converter for LLMs, RAG and AI agents. Scanned PDF to text, images (PNG, JPG, WEBP, TIFF) to Markdown. Reads invoices and forms, keeps tables. 23 languages: Arabic, Hindi, Greek, Chinese. Tesseract OCR inside, no outside API. Free trial. Scans $0.006/page, digital free.",
    "version": "0.1",
    "x-build-id": "pXN3IKof7dgYeHitj"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/brasspage~pdf-ocr-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-brasspage-pdf-ocr-to-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/brasspage~pdf-ocr-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-brasspage-pdf-ocr-to-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/brasspage~pdf-ocr-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-brasspage-pdf-ocr-to-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": {
          "documentUrls": {
            "title": "Document URLs",
            "type": "array",
            "description": "Direct links to PDF, PNG, JPEG, WEBP, TIFF, HEIC, AVIF, GIF, BMP or JPEG 2000 files, up to 100 MB each. Scanned and digital PDFs both work. Apify key-value store record URLs also work. For a private store, use the record's signed URL (with ?signature=).",
            "items": {
              "type": "string"
            }
          },
          "documentFile": {
            "title": "Upload a file",
            "type": "string",
            "description": "Upload one PDF or image (PNG, JPEG, WEBP, TIFF, HEIC, AVIF, GIF, BMP or JPEG 2000) from your computer. You can use it together with Document URLs."
          },
          "pdfPassword": {
            "title": "PDF password",
            "type": "string",
            "description": "Optional. The open password of a password-protected PDF, such as a bank statement. Used for every PDF in the run. A PDF with no open password ignores it. The password is stored encrypted, and the Actor never logs it or puts it in the output."
          },
          "pages": {
            "title": "Pages",
            "pattern": "^[0-9,\\- ]*$",
            "type": "string",
            "description": "Optional. Pages to convert in each document, for example 1-3, 5, 10- (10- means page 10 to the end). Leave empty for all pages. An image is page 1."
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "markdown",
              "text"
            ],
            "type": "string",
            "description": "Markdown keeps headings, lists and tables. Plain text has no Markdown formatting.",
            "default": "markdown"
          },
          "markdownTables": {
            "title": "Tables as Markdown tables",
            "type": "boolean",
            "description": "On: tables become Markdown pipe tables (also in plain text output). Off: one table row per line, cells separated by tabs.",
            "default": true
          },
          "language": {
            "title": "Language",
            "enum": [
              "eng",
              "spa",
              "fra",
              "deu",
              "por",
              "ita",
              "rus",
              "ara",
              "hin",
              "chi_sim",
              "jpn",
              "vie",
              "tur",
              "ell",
              "ukr",
              "ces",
              "pol",
              "heb",
              "sin",
              "amh",
              "nep",
              "khm",
              "mya"
            ],
            "type": "string",
            "description": "The language of scanned pages. English also reads most Latin-alphabet text, but accents come out better with the right language. Pages with a text layer are read as they are, in any language. Also, with Sinhala, Nepali, Khmer or Hindi selected, a PDF page whose own text is mostly in that script is read by OCR and costs $0.006, because that text often splits words or drops letters. If OCR is unsure, the page keeps the PDF's own text and is free.",
            "default": "eng"
          },
          "secondReader": {
            "title": "Second reader for handwriting",
            "type": "boolean",
            "description": "On: an English page that Tesseract reads badly, like handwriting, is also read by RapidOCR, a free reader that runs inside the Actor. Its text is used when it finds more, and the page says so in `reader`. Needs 1 GB of memory or more. Off: Tesseract only.",
            "default": true
          },
          "removeHeadersFooters": {
            "title": "Remove running headers, footers and page numbers",
            "type": "boolean",
            "description": "On: running heads, running footers and page numbers are left out of the text. A running head or footer is a line that repeats at the top or bottom of 2 or more pages, like a book title or a company footer. A page number must be alone on its line at the top or bottom of the page. Table rows stay, and so does a head printed on only one page. Good for text to speech, search and LLMs. Off (default): every line stays.",
            "default": false
          },
          "maxPagesPerRun": {
            "title": "Max pages per run",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Safety limit. The run stops after this many pages in total, and the last dataset row says so. On the Apify free plan, runs are a free trial of up to 20 pages per run and 50 pages per month; upgrade to a paid Apify plan to convert more.",
            "default": 1000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}