{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown & Document to Text for LLM/RAG, with OCR",
    "description": "Convert PDF, Word, PowerPoint, Excel, CSV, HTML, EPUB and images to clean Markdown or text, with tables, OCR for scans and RAG-ready chunks. Links or uploaded files, one row per document.",
    "version": "0.1",
    "x-build-id": "536XhmcFGarAzwpzw"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tinlark~document-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tinlark-document-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/tinlark~document-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-tinlark-document-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/tinlark~document-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-tinlark-document-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": {
          "sources": {
            "title": "Document links",
            "type": "array",
            "description": "Links (http or https) to PDF, Word (.docx), PowerPoint (.pptx), Excel (.xlsx), CSV, HTML, text, Markdown, EPUB or image files (PNG, JPEG, TIFF). The Actor detects the type from the file itself, so links without a file extension work. Links must be public and reachable from the internet.",
            "items": {
              "type": "string"
            }
          },
          "files": {
            "title": "Uploaded files",
            "type": "array",
            "description": "Upload files from your computer. They are stored in a key-value store of your account and read from there. Use this together with, or instead of, document links."
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "markdown",
              "text",
              "both"
            ],
            "type": "string",
            "description": "markdown keeps headings, lists and tables. text is plain text without markup. both adds both fields to every row.",
            "default": "markdown"
          },
          "ocr": {
            "title": "OCR (scanned pages and images)",
            "enum": [
              "auto",
              "off",
              "force"
            ],
            "type": "string",
            "description": "auto: read only the pages that have no text layer (scans, photos) with OCR. off: never run OCR (scanned pages stay empty and images fail). force: OCR every page, even when the PDF has text. OCR pages are slower and are priced higher from 1 November 2026.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages of the scanned text. Pick all that appear in the documents: more languages make OCR a little slower.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "deu",
                "fra",
                "spa",
                "ita",
                "por",
                "nld",
                "rus",
                "chi_sim",
                "jpn"
              ],
              "enumTitles": [
                "English",
                "German",
                "French",
                "Spanish",
                "Italian",
                "Portuguese",
                "Dutch",
                "Russian",
                "Chinese (simplified)",
                "Japanese"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Converts at most this many pages (PDF pages, slides, sheets or EPUB chapters) of each document. Longer documents get a warning in their row.",
            "default": 50
          },
          "pageRange": {
            "title": "Page range (optional)",
            "type": "string",
            "description": "Only these pages, for example 1-5, 8, 12- (12 to the end). Applies to PDF pages, PowerPoint slides, Excel sheets and TIFF frames. Leave empty for all pages up to the limit above."
          },
          "includeTables": {
            "title": "Tables as Markdown tables",
            "type": "boolean",
            "description": "Detect tables in PDFs and write them as Markdown tables. Word, PowerPoint, Excel and HTML tables are always kept; when off they become plain lines.",
            "default": true
          },
          "includeMetadata": {
            "title": "Include document metadata",
            "type": "boolean",
            "description": "Add the metadata object (author, creation date, subject and similar properties stored in the file).",
            "default": true
          },
          "chunking": {
            "title": "Chunking for RAG",
            "enum": [
              "off",
              "by-headings",
              "by-size"
            ],
            "type": "string",
            "description": "off: one row per document. by-headings: one row per section, split under each Markdown heading. by-size: rows of about the chunk size, cut at paragraph ends. Each chunk row has its heading path and page numbers. Sections longer than the chunk size are cut further.",
            "default": "off"
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "Target maximum length of a chunk in characters. 2,000 characters are about 500 tokens of English text.",
            "default": 2000
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "With by-size chunking, each chunk starts with the end of the previous one, up to this many characters. At most half of the chunk size.",
            "default": 200
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger files are skipped with an error row.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}