{
  "openapi": "3.0.1",
  "info": {
    "title": "HTML to Markdown Converter — Clean RAG Output",
    "description": "HTML to Markdown converter and cleaner for LLM/RAG pipelines. Convert static or JavaScript pages, preserve headings, tables, links and images, remove noisy selectors, output clean text, and create overlap-aware chunks with stable IDs, SHA-256 fingerprints, word counts and token estimates.",
    "version": "0.1",
    "x-build-id": "Cr8PY2T3U7jLgUO3Z"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/zenomastro~html-to-markdown-cleaner/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-zenomastro-html-to-markdown-cleaner",
        "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/zenomastro~html-to-markdown-cleaner/runs": {
      "post": {
        "operationId": "runs-sync-zenomastro-html-to-markdown-cleaner",
        "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/zenomastro~html-to-markdown-cleaner/run-sync": {
      "post": {
        "operationId": "run-sync-zenomastro-html-to-markdown-cleaner",
        "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": "Page URLs",
            "minItems": 0,
            "maxItems": 500,
            "type": "array",
            "description": "Public HTTP/HTTPS page URLs to fetch and convert.",
            "default": [
              "https://example.com"
            ],
            "items": {
              "type": "string"
            }
          },
          "contentSelector": {
            "title": "Optional CSS content selector",
            "type": "string",
            "description": "When provided, only the first matching element is converted.",
            "default": ""
          },
          "maxMarkdownChars": {
            "title": "Maximum Markdown characters per page",
            "minimum": 1000,
            "maximum": 5000000,
            "type": "integer",
            "description": "Maximum Markdown characters retained for each converted page.",
            "default": 500000
          },
          "includeCleanHtml": {
            "title": "Include cleaned HTML",
            "type": "boolean",
            "description": "Include cleaned HTML alongside the Markdown result.",
            "default": false
          },
          "requestTimeoutSecs": {
            "title": "Request timeout",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Maximum seconds allowed for each network request.",
            "default": 20
          },
          "userAgent": {
            "title": "User agent",
            "type": "string",
            "description": "HTTP User-Agent header sent to target websites.",
            "default": "Mozilla/5.0 (compatible; ApifyHtmlMarkdown/1.0)"
          },
          "htmlDocuments": {
            "title": "Raw HTML documents",
            "maxItems": 200,
            "type": "array",
            "description": "Optional objects with html, baseUrl and id. Convert raw HTML without fetching a URL.",
            "items": {
              "type": "object",
              "properties": {
                "html": {
                  "type": "string",
                  "title": "HTML",
                  "description": "Raw HTML source to convert.",
                  "editor": "textarea"
                },
                "baseUrl": {
                  "type": "string",
                  "title": "Base URL",
                  "description": "Optional public base URL used to resolve relative links and images.",
                  "editor": "textfield"
                },
                "id": {
                  "type": "string",
                  "title": "Document ID",
                  "description": "Optional caller-supplied identifier copied to the output.",
                  "editor": "textfield"
                }
              },
              "required": [
                "html"
              ]
            },
            "default": []
          },
          "removeSelectors": {
            "title": "Extra selectors to remove",
            "maxItems": 50,
            "type": "array",
            "description": "Optional CSS selectors for ads, menus, widgets or other page noise.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "includeLinks": {
            "title": "Extract links",
            "type": "boolean",
            "description": "Return deduplicated absolute links with anchor text and rel metadata.",
            "default": true
          },
          "includeImages": {
            "title": "Extract images",
            "type": "boolean",
            "description": "Return image URLs, alt text, title and dimensions.",
            "default": true
          },
          "includePlainText": {
            "title": "Include plain text",
            "type": "boolean",
            "description": "Add a cleaned plain-text representation alongside Markdown.",
            "default": true
          },
          "includeChunks": {
            "title": "Create RAG chunks",
            "type": "boolean",
            "description": "Split Markdown into overlapping chunks ready for embeddings or LLM retrieval.",
            "default": false
          },
          "chunkSizeChars": {
            "title": "RAG chunk size",
            "minimum": 500,
            "maximum": 50000,
            "type": "integer",
            "description": "Approximate maximum characters per Markdown chunk.",
            "default": 6000
          },
          "chunkOverlapChars": {
            "title": "Chunk overlap",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Characters overlapped between consecutive chunks.",
            "default": 500
          },
          "renderMode": {
            "title": "Rendering mode",
            "enum": [
              "http",
              "browser",
              "auto"
            ],
            "type": "string",
            "description": "HTTP is fastest. Browser renders client-side JavaScript. Auto starts with HTTP and falls back to browser for failures or very thin scripted pages.",
            "default": "http"
          },
          "minStaticTextChars": {
            "title": "Auto fallback text threshold",
            "minimum": 0,
            "maximum": 20000,
            "type": "integer",
            "description": "In auto mode, browser rendering is used when static body text is below this size and scripts are present.",
            "default": 300
          },
          "browserWaitUntil": {
            "title": "Browser wait strategy",
            "enum": [
              "domcontentloaded",
              "load",
              "networkidle"
            ],
            "type": "string",
            "description": "Readiness strategy for browser-rendered pages.",
            "default": "domcontentloaded"
          },
          "browserDelayMs": {
            "title": "Browser extra delay",
            "minimum": 0,
            "maximum": 30000,
            "type": "integer",
            "description": "Extra milliseconds after browser navigation before converting HTML.",
            "default": 500
          },
          "browserWaitForSelector": {
            "title": "Browser wait for selector",
            "type": "string",
            "description": "Optional CSS selector that must become visible before browser HTML is captured.",
            "default": ""
          },
          "proxyConfiguration": {
            "title": "Browser proxy configuration",
            "type": "object",
            "description": "Optional Apify/custom proxy for browser rendering. Fast HTTP mode remains direct.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}