{
  "openapi": "3.0.1",
  "info": {
    "title": "Document to Markdown (PDF, Office, OCR) for AI agents",
    "description": "Turn PDF, Word, PowerPoint, Excel, CSV, HTML, EPUB, image, legacy DOC/PPT, RTF and OpenDocument links into clean Markdown for LLMs and RAG: tables, headings, metadata, per-page text, OCR and ready-made chunks. Priced per document plus per OCR page; failed files are free.",
    "version": "1.1",
    "x-build-id": "lDtKr3HKNn8XaP9EZ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sapphire_studio~document-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sapphire_studio-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/sapphire_studio~document-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-sapphire_studio-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/sapphire_studio~document-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-sapphire_studio-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",
        "required": [
          "urls"
        ],
        "properties": {
          "urls": {
            "title": "Document URLs",
            "type": "array",
            "description": "Public links to the documents to convert: PDF, DOCX, PPTX, legacy DOC and PPT, RTF, ODT, ODP, XLSX/XLS/ODS, CSV/TSV, HTML pages, EPUB, Markdown/text/JSON, or images (PNG, JPG, TIFF, BMP, GIF, WebP). Google Drive, Google Docs, Dropbox and GitHub share links are turned into direct downloads automatically. Files uploaded to an Apify key-value store work too (use the record URL). Up to 1000 URLs per run.",
            "items": {
              "type": "string"
            }
          },
          "ocr": {
            "title": "OCR (text recognition)",
            "enum": [
              "auto",
              "always",
              "off"
            ],
            "type": "string",
            "description": "Automatic: OCR only PDF pages that have no text layer (scanned pages) and images. Always: OCR every PDF page, useful when the text layer is broken. Off: never OCR (faster; scanned pages come back empty and images fail). Every OCRed page is charged as one OCR page event.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages of the text in scanned pages and images. Pick every language that appears; more languages are a little slower.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "deu",
                "fra",
                "spa",
                "ita",
                "por",
                "nld"
              ],
              "enumTitles": [
                "English",
                "German",
                "French",
                "Spanish",
                "Italian",
                "Portuguese",
                "Dutch"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "outputPages": {
            "title": "Include per-page Markdown",
            "type": "boolean",
            "description": "Add a pages list with the Markdown of every page (PDF pages, slides, sheets or EPUB chapters) next to the full document Markdown.",
            "default": false
          },
          "chunking": {
            "title": "Split into chunks for RAG",
            "type": "boolean",
            "description": "Add a chunks list: the Markdown split at headings and paragraphs into pieces of about the chosen size, each with its heading, character range and page range, ready for embedding.",
            "default": false
          },
          "chunkSize": {
            "title": "Chunk size (tokens)",
            "minimum": 100,
            "maximum": 8000,
            "type": "integer",
            "description": "Target size of each chunk in tokens (about 4 characters per token).",
            "default": 800
          },
          "chunkOverlap": {
            "title": "Chunk overlap (tokens)",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "How much text from the end of one chunk is repeated at the start of the next (at most half the chunk size).",
            "default": 80
          },
          "maxPagesPerDocument": {
            "title": "Maximum pages per document",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Only the first pages (or slides, sheets, chapters) up to this number are converted. The row says when a document was cut.",
            "default": 300
          },
          "maxOcrPagesPerDocument": {
            "title": "Maximum OCR pages per document",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "OCR takes several seconds of compute per page, and each OCRed page is charged as one OCR page event on top of the document. Scanned pages beyond this number are skipped (the row lists a warning). Raise it for long scanned documents.",
            "default": 10
          },
          "maxFileSizeMb": {
            "title": "Maximum file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger files are not downloaded and are reported as invalid_input.",
            "default": 50
          },
          "maxConcurrency": {
            "title": "Parallel documents",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many documents are downloaded and converted at the same time. Raise the run memory too when you raise this for large or scanned files.",
            "default": 3
          },
          "debug": {
            "title": "Debug",
            "type": "boolean",
            "description": "Save a short diagnostic record per document to the key-value store.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}