{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown & Text for LLM/RAG (OCR, Tables, Chunks)",
    "description": "Convert PDFs (URLs or uploaded files) to clean Markdown and text with GitHub tables, per-page metadata and token-sized chunks for RAG and AI agents. Optional Tesseract OCR for scanned pages (English, Spanish and more) and a Mexican CFDI invoice mode. Pay per page. By IntegriApps.",
    "version": "0.1",
    "x-build-id": "cmIiLeGjjslVvD0Ue"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/integriapps~pdf-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-integriapps-pdf-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/integriapps~pdf-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-integriapps-pdf-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/integriapps~pdf-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-integriapps-pdf-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": {
          "pdfUrls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Direct links to PDF files (http/https). Only these files are downloaded; nothing is crawled. If all inputs are empty, a bundled sample PDF is converted for free as a demo.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "files": {
            "title": "Upload PDF files",
            "type": "array",
            "description": "Upload PDFs from your computer (they are stored in an Apify key-value store) or paste file URLs."
          },
          "keyValueStoreId": {
            "title": "Key-value store with PDFs (bulk)",
            "type": "string",
            "description": "Optional. Pick one of your key-value stores: every PDF record in it is processed (e.g. files uploaded by another Actor or via the API). Read-only access is requested only for this store."
          },
          "keyPrefix": {
            "title": "Key prefix filter",
            "type": "string",
            "description": "Optional. With a key-value store, only records whose key starts with this prefix are processed."
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "off",
              "always"
            ],
            "type": "string",
            "description": "'auto' runs Tesseract OCR only on pages without a text layer (scanned/image pages). 'always' OCRs every page (ignores the text layer). 'off' never OCRs. OCR pages are charged as 'ocr-page' instead of 'page-extracted'.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages for Tesseract OCR. Fewer languages = faster and more accurate.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "spa",
                "por",
                "fra",
                "deu",
                "ita",
                "hin"
              ],
              "enumTitles": [
                "English",
                "Spanish",
                "Portuguese",
                "French",
                "German",
                "Italian",
                "Hindi"
              ]
            },
            "default": [
              "eng",
              "spa"
            ]
          },
          "ocrDpi": {
            "title": "OCR resolution (DPI)",
            "minimum": 100,
            "maximum": 400,
            "type": "integer",
            "description": "Rendering resolution for OCR (100–400). 300 is a good balance; 200 is faster for large clean scans.",
            "default": 300
          },
          "cfdiMode": {
            "title": "CFDI invoice mode (Mexico)",
            "type": "boolean",
            "description": "Detect key fields of Mexican CFDI invoice PDFs (UUID/folio fiscal, RFC emisor and receptor, subtotal, total, dates, currency, series/folio, payment method). Heuristic: verify against the XML when it matters. No extra charge.",
            "default": false
          },
          "extractTables": {
            "title": "Extract tables as Markdown",
            "type": "boolean",
            "description": "Detect ruled tables and output them as GitHub-flavored Markdown tables.",
            "default": true
          },
          "chunkSize": {
            "title": "Chunk size (tokens)",
            "minimum": 0,
            "maximum": 32000,
            "type": "integer",
            "description": "Split each PDF into chunks of about this many tokens (1 token ≈ 4 characters) for RAG/embeddings, with page numbers. 0 = no chunks.",
            "default": 800
          },
          "chunkOverlap": {
            "title": "Chunk overlap (tokens)",
            "minimum": 0,
            "maximum": 4000,
            "type": "integer",
            "description": "Tokens repeated between consecutive chunks to keep context.",
            "default": 100
          },
          "pageMarkers": {
            "title": "Page markers in Markdown",
            "type": "boolean",
            "description": "Insert <!-- page N --> comments between pages in the Markdown.",
            "default": true
          },
          "includePlainText": {
            "title": "Include plain text",
            "type": "boolean",
            "description": "Also return a 'text' field without page markers.",
            "default": false
          },
          "maxPagesPerPdf": {
            "title": "Max pages per PDF",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Only the first N pages of each PDF are processed (and charged). 0 = all pages (up to 5,000).",
            "default": 500
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger files are skipped and not charged (1–200).",
            "default": 50
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Optional password for encrypted PDFs (applies to all files). Stored encrypted."
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 4,
            "type": "integer",
            "description": "PDFs processed in parallel (1–4).",
            "default": 2
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}