{
  "openapi": "3.0.1",
  "info": {
    "title": "Documents to Markdown/JSON for RAG (PDF, Office, OCR)",
    "version": "0.1",
    "x-build-id": "9em6LrOklnJOrIYKl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/bravona~docs-to-markdown-rag/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-bravona-docs-to-markdown-rag",
        "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/bravona~docs-to-markdown-rag/runs": {
      "post": {
        "operationId": "runs-sync-bravona-docs-to-markdown-rag",
        "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/bravona~docs-to-markdown-rag/run-sync": {
      "post": {
        "operationId": "run-sync-bravona-docs-to-markdown-rag",
        "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": "Document URLs",
            "type": "array",
            "description": "Public, logged-out links to PDF, DOCX, PPTX, XLSX, CSV, HTML, plain-text or image files. The format is detected from the file itself. robots.txt is respected and each host is fetched at most once per second; pages behind a login, paywall or captcha are reported as errors, never bypassed.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "keyValueStoreId": {
            "title": "Key-value store with files (optional)",
            "type": "string",
            "description": "Convert files you uploaded to one of your Apify key-value stores. Every record in the store is converted unless you list keys below."
          },
          "keyValueStoreKeys": {
            "title": "Keys to convert",
            "type": "array",
            "description": "Record keys in the store above. Leave empty to convert every record (except INPUT).",
            "items": {
              "type": "string"
            }
          },
          "ocrMode": {
            "title": "OCR",
            "enum": [
              "auto",
              "off",
              "force"
            ],
            "type": "string",
            "description": "auto: OCR only pages that have no text layer (scans, photos). off: never OCR (such pages come back empty and are not charged). force: OCR every page, even ones with text.",
            "default": "auto"
          },
          "ocrLanguage": {
            "title": "OCR language",
            "type": "string",
            "description": "Tesseract language code(s): eng, deu, fra, spa, ita, por, nld. Combine with +, e.g. eng+deu.",
            "default": "eng"
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Larger files are not downloaded; they get an error record and are not charged. Maximum 100.",
            "default": 25
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "PDF pages, slides, or 3,000-character blocks for formats without pages. Maximum 1,000.",
            "default": 200
          },
          "onPageLimit": {
            "title": "When a document is over the page cap",
            "enum": [
              "truncate",
              "fail"
            ],
            "type": "string",
            "description": "truncate: convert and charge only the first pages up to the cap. fail: skip the document with an error record (not charged).",
            "default": "truncate"
          },
          "maxOcrPagesPerDocument": {
            "title": "Max OCR pages per document",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Pages past this that need OCR are returned empty, flagged ocrSkipped, and not charged. 0 disables OCR. Maximum 500.",
            "default": 50
          },
          "maxDocuments": {
            "title": "Max documents per run",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Documents after this are not processed. Maximum 2,000.",
            "default": 100
          },
          "maxConcurrency": {
            "title": "Documents in parallel",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "How many documents are converted at once. More needs more memory (OCR uses about 300 MB per document in flight).",
            "default": 2
          },
          "requestTimeoutSecs": {
            "title": "Download timeout (seconds)",
            "minimum": 10,
            "maximum": 300,
            "type": "integer",
            "description": "How long to wait for one file to download before giving up on it (error record <code>TIMEOUT</code>, not charged).",
            "default": 60
          },
          "includeMarkdown": {
            "title": "Include full Markdown",
            "type": "boolean",
            "description": "The whole document as one Markdown string.",
            "default": true
          },
          "includePages": {
            "title": "Include per-page Markdown",
            "type": "boolean",
            "description": "One entry per page with its page number, text and OCR flags.",
            "default": true
          },
          "includeChunks": {
            "title": "Include RAG chunks",
            "type": "boolean",
            "description": "Heading-aware chunks with pageStart/pageEnd and the heading path, ready to embed.",
            "default": true
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 8000,
            "type": "integer",
            "description": "Target maximum characters per chunk. Chunks break at headings, paragraphs and table rows; split tables repeat their header row.",
            "default": 1500
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Text repeated from the end of the previous chunk; at most half the chunk size.",
            "default": 150
          },
          "includeSpeakerNotes": {
            "title": "Include PPTX speaker notes",
            "type": "boolean",
            "description": "For PowerPoint files, add each slide's speaker notes under the slide text.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}