{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown for AI & RAG: Tables, OCR, Chunks",
    "description": "PDF to Markdown for LLMs and RAG: give PDF URLs, get clean Markdown with headings, lists, tables, 2-column papers in reading order, headers/footers removed, page-cited chunks, metadata and links. OCR for scans at $0.005/page. $2 per 1,000 PDFs (100 pages included), no start fee, failures free.",
    "version": "1.0",
    "x-build-id": "D5OaBMXnSNhg6bZGl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/xsi~pdf-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-xsi-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/xsi~pdf-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-xsi-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/xsi~pdf-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-xsi-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",
        "required": [
          "urls"
        ],
        "properties": {
          "urls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Direct PDF links, or pages that point to a PDF (arXiv, journals with citation_pdf_url), Google Drive / Dropbox share links (public files) and GitHub file pages. Up to 1,000 per run.",
            "items": {
              "type": "string"
            }
          },
          "pages": {
            "title": "Pages (optional)",
            "type": "string",
            "description": "Only convert these pages, e.g. \"1-5, 8, 10-\". Empty = all pages (up to \"Max pages per PDF\")."
          },
          "ocr": {
            "title": "OCR for scanned pages",
            "enum": [
              "auto",
              "off",
              "always"
            ],
            "type": "string",
            "description": "auto = only pages without a text layer (scans) are read with OCR ($0.005/page on the Free plan). off = never. always = OCR every page (for PDFs with a broken text layer).",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Up to 3 of: eng, fra, deu, spa, ita, nld, por.",
            "default": [
              "eng"
            ],
            "items": {
              "type": "string"
            }
          },
          "chunkSizeTokens": {
            "title": "RAG chunk size (tokens)",
            "minimum": 0,
            "maximum": 8000,
            "type": "integer",
            "description": "Approximate size of each chunk in \"chunks\" (1 token ≈ 4 characters). A new chunk starts at each heading; tables are never split. 0 = no chunks.",
            "default": 800
          },
          "chunkOverlapTokens": {
            "title": "Chunk overlap (tokens)",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "Text repeated from the end of the previous chunk (same section only).",
            "default": 100
          },
          "includePages": {
            "title": "Per-page Markdown",
            "type": "boolean",
            "description": "Also return each page separately (page number, Markdown, OCR flag, links).",
            "default": true
          },
          "includeText": {
            "title": "Plain text too",
            "type": "boolean",
            "description": "Also return a plain-text version without Markdown symbols.",
            "default": false
          },
          "includeLinks": {
            "title": "Links",
            "type": "boolean",
            "description": "Return the web links found in the PDF.",
            "default": true
          },
          "maxPagesPerPdf": {
            "title": "Max pages per PDF",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Longer documents are cut here (cost control). The first 100 pages are included in the per-PDF price; each further started block of 100 pages costs $0.002.",
            "default": 500
          },
          "maxOcrPagesPerPdf": {
            "title": "Max OCR pages per PDF",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "Upper limit of scanned pages read per PDF (cost control).",
            "default": 50
          },
          "password": {
            "title": "PDF password (optional)",
            "type": "string",
            "description": "For password-protected PDFs you are allowed to open. Used only to open the file in this run."
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Bigger files are skipped for free. Bigger files need more memory: give the run 2-4 GB for files over 50 MB.",
            "default": 50
          },
          "maxConcurrency": {
            "title": "Parallel PDFs",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many PDFs are processed at the same time. Each PDF in parallel needs ~300 MB: keep 2 at 1 GB memory, raise memory before raising this.",
            "default": 2
          },
          "requestTimeoutSecs": {
            "title": "Download timeout (seconds)",
            "minimum": 10,
            "maximum": 600,
            "type": "integer",
            "description": "Give up on a download after this many seconds (free).",
            "default": 120
          },
          "maxSecondsPerPdf": {
            "title": "Time limit per PDF (seconds)",
            "minimum": 30,
            "maximum": 3600,
            "type": "integer",
            "description": "Very long or heavy PDFs stop here and return the pages done so far (with a note).",
            "default": 600
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}