{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF & Image to Text: Bulk, Markdown, Tables, OCR",
    "description": "Turn PDFs and images into Markdown or text in bulk: headings, lists, PDF metadata and ruled tables (borderless tables stay as text). Scanned pages and images are read with OCR. Paste URLs or enrich any dataset of document links. One row per document or per page.",
    "version": "0.0",
    "x-build-id": "kCZ56fYV2yXnKp5tJ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/charlesmarkette~pdf-image-to-text-markdown-ocr/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-charlesmarkette-pdf-image-to-text-markdown-ocr",
        "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/charlesmarkette~pdf-image-to-text-markdown-ocr/runs": {
      "post": {
        "operationId": "runs-sync-charlesmarkette-pdf-image-to-text-markdown-ocr",
        "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/charlesmarkette~pdf-image-to-text-markdown-ocr/run-sync": {
      "post": {
        "operationId": "run-sync-charlesmarkette-pdf-image-to-text-markdown-ocr",
        "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 or image URLs",
            "type": "array",
            "description": "One per line. Links to PDF files or images (PNG, JPEG, TIFF, WEBP, BMP, GIF). The file type is detected from the file's content, so links without a .pdf extension work too.",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Dataset to enrich",
            "type": "string",
            "description": "Optional. A dataset from another run that has document links (scraped PDFs, invoice links, report URLs…). For each item, the first field below that holds a URL is processed and the text columns are added next to the item's fields. Use {{resource.defaultDatasetId}} in an integration."
          },
          "urlFields": {
            "title": "URL fields",
            "type": "array",
            "description": "Item fields to take the document URL from, in order of preference. Dotted paths work (files.pdf). Default: url, pdfUrl, fileUrl, link.",
            "items": {
              "type": "string"
            }
          },
          "keepItemFields": {
            "title": "Keep the item's original fields",
            "type": "boolean",
            "description": "On: each output row is the original item plus the text columns (text columns win if a name clashes). Off: only the text columns.",
            "default": true
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "markdown",
              "text"
            ],
            "type": "string",
            "description": "Markdown: headings (from font size), bullet and numbered lists, and tables as Markdown tables; the best input for LLMs and RAG. Text: plain text in reading order, with table rows tab-separated.",
            "default": "markdown"
          },
          "extractTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Detect tables drawn with ruling lines and return them in a `tables` array (rows of cells, with the page number), and as Markdown tables in the text. Borderless tables come out as tab-separated lines instead.",
            "default": true
          },
          "outputPerPage": {
            "title": "One row per page",
            "type": "boolean",
            "description": "Off: one row per document with the whole text. On: one row per page (with a `page` number), handy for chunking and citations. Pricing is per document either way.",
            "default": false
          },
          "ocr": {
            "title": "OCR",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "Auto: OCR only PDF pages without a usable text layer (scanned pages: fewer than 20 readable characters, plus an image or drawing). Blank pages are never OCR'd or charged. Always: OCR every PDF page (for PDFs whose text layer is garbled). Never: text layer only, so scanned pages come back empty and images are skipped. Images are always read with OCR unless this is Never.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages in the scanned documents. Picking only the languages you need is faster and more accurate.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "deu",
                "fra",
                "spa",
                "ita",
                "por",
                "nld"
              ],
              "enumTitles": [
                "English",
                "German",
                "French",
                "Spanish",
                "Italian",
                "Portuguese",
                "Dutch"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "ocrDpi": {
            "title": "OCR resolution (DPI)",
            "minimum": 72,
            "maximum": 300,
            "type": "integer",
            "description": "Resolution PDF pages are rendered at for OCR. 200 suits most scans; 300 helps with small print but is slower and needs more memory.",
            "default": 200
          },
          "pages": {
            "title": "Pages",
            "type": "string",
            "description": "Optional. Which pages to process, e.g. 1-5,8 or 10- (from page 10 to the end). Empty: all pages, up to the maximum below. For multi-page TIFFs these are the TIFF's pages."
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Process at most this many pages of each document (after the Pages filter). Longer documents get a warning.",
            "default": 200
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger files are skipped with an error row (free).",
            "default": 50
          },
          "maxResults": {
            "title": "Max output rows",
            "minimum": 1,
            "type": "integer",
            "description": "Optional. Stop after this many rows (documents, or pages with One row per page)."
          },
          "concurrency": {
            "title": "Documents in parallel",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "How many documents are downloaded and processed at once. OCR is CPU-heavy: with more parallel documents, give the run more memory (about 512 MB per parallel OCR document).",
            "default": 2
          },
          "dedupe": {
            "title": "Process each URL once",
            "type": "boolean",
            "description": "Skip repeats of the same URL (and don't charge for them twice).",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}