{
  "openapi": "3.0.1",
  "info": {
    "title": "URL to Markdown for LLMs & RAG: Pages, PDFs & Sitemaps",
    "description": "Convert web pages and PDFs into clean, LLM-ready Markdown, text or HTML with metadata. Small crawls via links or sitemap, CSS selectors, JS fallback, RAG chunks, respects robots.txt. Pay only per converted page.",
    "version": "0.1",
    "x-build-id": "bX8fIKzY5CEMpOggW"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/cleandata-labs~url-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-cleandata-labs-url-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/cleandata-labs~url-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-cleandata-labs-url-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/cleandata-labs~url-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-cleandata-labs-url-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": "URLs",
            "type": "array",
            "description": "Public web pages or PDF links to convert, e.g. [\"https://example.com/blog/post\"]. 'https://' is added if missing. One converted page costs one result. Always pass your own URLs: the default list is only a demo.",
            "default": [
              "https://en.wikipedia.org/wiki/Large_language_model",
              "https://docs.apify.com/platform/actors"
            ],
            "items": {
              "type": "string"
            }
          },
          "maxCrawlDepth": {
            "title": "Crawl depth",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "How far to follow links on the same host, 0-10. 0 (default) = convert only the given URLs. 1 = also the pages they link to, 2 = one level more. Combine with maxPagesPerStartUrl to cap cost.",
            "default": 0
          },
          "useSitemap": {
            "title": "Use sitemap",
            "type": "boolean",
            "description": "true = also find pages from the site's sitemap (robots.txt Sitemap entries or /sitemap.xml). Good for a whole docs site or blog. Cap it with maxPagesPerStartUrl. Default false.",
            "default": false
          },
          "maxPagesPerStartUrl": {
            "title": "Max pages per start URL (crawl)",
            "minimum": 0,
            "type": "integer",
            "description": "Max pages per start URL when crawling or using the sitemap, 0 = no limit. Default 50. Each page is charged, so keep it low (e.g. 5-20) for quick agent tasks.",
            "default": 50
          },
          "includeUrlGlobs": {
            "title": "Include URL patterns",
            "type": "array",
            "description": "Only crawl URLs that match one of these glob patterns, e.g. [\"https://docs.example.com/guide/*\"]. Used only when maxCrawlDepth > 0 or useSitemap is true.",
            "items": {
              "type": "string"
            }
          },
          "excludeUrlGlobs": {
            "title": "Exclude URL patterns",
            "type": "array",
            "description": "Skip URLs that match any of these glob patterns, e.g. [\"*/tag/*\", \"*/page/*\"].",
            "items": {
              "type": "string"
            }
          },
          "extractionMode": {
            "title": "Extraction mode",
            "enum": [
              "auto",
              "article",
              "full"
            ],
            "type": "string",
            "description": "How much of each page to keep: \"auto\" (default) = main content, falling back to the full page if too little text is found; \"article\" = main content only; \"full\" = whole page including navigation, header and footer.",
            "default": "auto"
          },
          "outputFormats": {
            "title": "Output formats",
            "type": "array",
            "description": "One or more of \"markdown\" (default), \"text\" (plain text) and \"html\" (cleaned HTML of the main content). Ask only for what you need: every extra format makes the output larger.",
            "items": {
              "type": "string",
              "enum": [
                "markdown",
                "text",
                "html"
              ]
            },
            "default": [
              "markdown"
            ]
          },
          "removeElementsCssSelector": {
            "title": "Remove elements (CSS selector)",
            "type": "string",
            "description": "Optional CSS selector of elements to delete before extraction, e.g. \".newsletter, .related-posts, #comments\"."
          },
          "keepElementsCssSelector": {
            "title": "Keep only elements (CSS selector)",
            "type": "string",
            "description": "Optional CSS selector: if set, only these elements are converted, e.g. \"article\" or \".docs-content\"."
          },
          "includeLinkList": {
            "title": "Return list of links",
            "type": "boolean",
            "description": "true = also return lists of internal and external links found on each page. Default false.",
            "default": false
          },
          "maxPdfPages": {
            "title": "Max PDF pages",
            "minimum": 0,
            "type": "integer",
            "description": "PDF links are converted to text automatically. Max pages read per PDF, 0 = all. Default 50.",
            "default": 50
          },
          "renderJs": {
            "title": "JavaScript rendering",
            "enum": [
              "auto",
              "never",
              "always"
            ],
            "type": "string",
            "description": "When to use a headless browser: \"auto\" (default) = only when the plain HTTP result is too thin; \"never\" = fastest; \"always\" = for JavaScript-heavy single-page apps.",
            "default": "auto"
          },
          "waitForSelector": {
            "title": "Wait for selector (browser)",
            "type": "string",
            "description": "Optional CSS selector to wait for before reading the page when the browser is used, e.g. \"main article\"."
          },
          "dynamicContentWaitSecs": {
            "title": "Extra wait for dynamic content (browser, seconds)",
            "minimum": 0,
            "maximum": 30,
            "type": "integer",
            "description": "Extra seconds to wait after page load when the browser is used, 0-30. Default 0.",
            "default": 0
          },
          "includeLinks": {
            "title": "Keep links",
            "type": "boolean",
            "description": "true (default) = keep hyperlinks as Markdown links with absolute URLs. false = plain text only, which saves tokens.",
            "default": true
          },
          "includeImages": {
            "title": "Keep images",
            "type": "boolean",
            "description": "true = keep images as Markdown image tags. Default false.",
            "default": false
          },
          "includeTables": {
            "title": "Keep tables",
            "type": "boolean",
            "description": "true (default) = convert HTML tables to Markdown tables.",
            "default": true
          },
          "chunkSizeTokens": {
            "title": "Chunk size (approx. tokens)",
            "minimum": 0,
            "maximum": 32000,
            "type": "integer",
            "description": "If > 0, also return 'chunks' split on paragraph boundaries for RAG, about this many tokens each (1 token ~ 4 characters), max 32000. Default 0 = no chunks.",
            "default": 0
          },
          "chunkOverlapTokens": {
            "title": "Chunk overlap (approx. tokens)",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "Overlap between consecutive chunks in tokens, 0-2000. Default 50. Used only when chunkSizeTokens > 0.",
            "default": 50
          },
          "maxCharacters": {
            "title": "Max characters per page",
            "minimum": 0,
            "type": "integer",
            "description": "Cut each page's Markdown to this many characters, 0 = no limit (default). For AI agents a value such as 20000 (~5k tokens) keeps results small enough to read in one step.",
            "default": 0
          },
          "respectRobotsTxt": {
            "title": "Respect robots.txt",
            "type": "boolean",
            "description": "true (default) = skip URLs that the site's robots.txt disallows. Skipped URLs are reported and not charged.",
            "default": true
          },
          "minContentCharsBeforeBrowserFallback": {
            "title": "Browser fallback threshold (chars)",
            "type": "integer",
            "description": "In renderJs=auto, use the browser if plain HTTP extraction returns fewer characters than this. Default 400.",
            "default": 400
          },
          "requestTimeoutSecs": {
            "title": "Request timeout (s)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Timeout per attempt in seconds, 5-120. Default 30.",
            "default": 30
          },
          "maxRetries": {
            "title": "Max retries per URL",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Retries per URL on network errors, HTTP 429 and 5xx, 0-5. Default 2.",
            "default": 2
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Parallel HTTP requests, 1-20. Default 8.",
            "default": 8
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional proxy for sites that block datacenter IPs, e.g. {\"useApifyProxy\": true}. Default: no proxy.",
            "default": {
              "useApifyProxy": false
            }
          },
          "userAgent": {
            "title": "Custom User-Agent",
            "type": "string",
            "description": "Optional custom User-Agent header. By default the Actor uses an identifiable bot User-Agent."
          },
          "customHttpHeaders": {
            "title": "Custom HTTP headers",
            "type": "object",
            "description": "Optional extra HTTP headers, e.g. {\"Accept-Language\": \"de-DE\"}. Do not put credentials for sites you are not authorized to access."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}