{
  "openapi": "3.0.1",
  "info": {
    "title": "URL and PDF to Markdown for LLMs and RAG",
    "description": "Convert web pages, PDF, Word, PowerPoint and Excel files to clean Markdown for LLMs and RAG: tables kept, headings, metadata, token counts and chunks. OCR for scanned PDFs, Arabic kept in order. Failed sources are free.",
    "version": "0.1",
    "x-build-id": "aHHuh3Ua825dWHyvl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/magicfingers~document-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-magicfingers-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/magicfingers~document-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-magicfingers-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/magicfingers~document-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-magicfingers-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": {
          "urls": {
            "title": "URLs of pages and documents",
            "maxItems": 10000,
            "type": "array",
            "description": "Web pages or direct links to documents, one per line (count: up to 10,000 sources per run, together with files and the dataset). Supported: HTML pages, PDF, Word (.docx), PowerPoint (.pptx) and Excel (.xlsx). Only public http and https links; pages behind a log-in show only what a visitor sees.",
            "items": {
              "type": "string"
            }
          },
          "files": {
            "title": "Upload documents",
            "maxItems": 1000,
            "type": "array",
            "description": "Optional: upload PDF, DOCX, PPTX, XLSX or HTML files (or give links to files). Uploaded files are stored in a key-value store of your choice and read from there by this run."
          },
          "datasetId": {
            "title": "Dataset with URLs",
            "type": "string",
            "description": "Optional: also read URLs from this dataset (ID or name), for example the output of a crawler run. The Actor only reads it, 1,000 rows at a time."
          },
          "urlField": {
            "title": "URL field in the dataset",
            "maxLength": 200,
            "type": "string",
            "description": "Field of each dataset row that holds the URL, as a dot path such as url or page.url (text: a field name). Arrays are expanded, so a list of links gives one source per link.",
            "default": "url"
          },
          "documentMode": {
            "title": "Document mode",
            "enum": [
              "fast",
              "accurate"
            ],
            "type": "string",
            "description": "fast: the PDF text layer and simple tables, no OCR (scanned pages are skipped and listed in warnings). accurate: a layout model for complex tables and multi-column pages, plus OCR in English and Arabic for scanned pages; slower and priced per PDF page. Word, PowerPoint, Excel and HTML are always converted the fast way.",
            "default": "fast"
          },
          "renderJs": {
            "title": "Render JavaScript",
            "enum": [
              "never",
              "auto",
              "always"
            ],
            "type": "string",
            "description": "Open web pages in a headless browser. auto: only when the plain HTML has almost no text (under 200 characters), for example single-page apps. never: plain HTML only (fastest). always: every web page in the browser.",
            "default": "auto"
          },
          "includeLinks": {
            "title": "Keep hyperlinks",
            "type": "boolean",
            "description": "Keep links in the Markdown as [text](url). Off: link text only, which saves tokens.",
            "default": false
          },
          "includeStructure": {
            "title": "Add the document structure (JSON)",
            "type": "boolean",
            "description": "Add a structure array to each row: every heading, paragraph, list item, table (with its cells) and code block in order, with its page number.",
            "default": false
          },
          "pageRange": {
            "title": "Pages to convert",
            "maxLength": 200,
            "type": "string",
            "description": "Optional pages of PDFs, slides of PowerPoint files and sheets of Excel files to convert (text: pages and ranges such as 1-5, 8, 10-). Empty: all pages. Word files have no fixed pages and are always converted whole."
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Stop a document after this many pages (unit: pages, slides or sheets). The row then has a warning. Word files are cut at the same share of their text.",
            "default": 200
          },
          "chunkTokens": {
            "title": "Chunk size",
            "minimum": 0,
            "maximum": 8000,
            "type": "integer",
            "description": "Split each result into chunks of about this many tokens (cl100k_base tokenizer), cut at headings first, then paragraphs, then sentences. 0: no chunks. Otherwise at least 50 (unit: tokens).",
            "default": 0
          },
          "chunkOverlap": {
            "title": "Chunk overlap",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Tokens repeated from the end of one chunk at the start of the next (unit: tokens). At most half of the chunk size is used.",
            "default": 100
          },
          "maxFileSizeMb": {
            "title": "Max file size",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Skip files larger than this (unit: MB, 1 MB = 1,048,576 bytes). The download stops as soon as a file passes the limit. Web pages are limited to 10 MB.",
            "default": 50
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Sources downloaded and converted at the same time (unit: sources). Conversions also share the run's memory: the Actor runs one converter process per GB.",
            "default": 5
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}