Skip to main content
Language models read text, not markup. Most of a page’s HTML is scripts, styles and layout that a model pays for in tokens and never uses. Pass markdown=true to /getPageSource and you get the rendered page as clean Markdown instead: headings, paragraphs, lists, tables, links and images with alt text - without scripts, styles, navigation or footer. The page is fetched exactly like an HTML call: JavaScript-rendered, behind Cloudflare, DataDome, PerimeterX or Akamai, from the country you choose. Only the output changes, and it costs the same as an HTML call.
A Wikipedia article that is 230 KB of HTML comes back as about 50 KB of Markdown. A GitHub repository page shrinks from 317 KB to 10 KB.

Request

The SDKs have a dedicated method: get_markdown() in Python and Ruby, getMarkdown() in Node.js and PHP.

Response

The body is Markdown, Content-Type: text/markdown; charset=utf-8. For https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html:
What you get:
  • Text structure: headings, paragraphs, bulleted and numbered lists (nested lists kept), block quotes and code blocks with their language.
  • Tables as Markdown tables. Key/value lists (<dl>, common on spec sheets) become - **Weight**: 300 g lines.
  • Absolute links: every link and image URL is resolved against the page, so an agent can follow it. mailto: and tel: links are kept.
  • Images with alt text as ![alt](url). Images without alt text are decoration or tracking pixels and are left out.
What is removed: scripts, styles, <svg>, iframes and embeds, buttons and form controls, dialogs, and hidden elements (hidden, aria-hidden="true").

Main content only

By default (main_content_only=true) you get the page’s main content:
  • If the page has a <main> element holding at least 30% of the page’s text, that element is used, without the menus inside it.
  • Otherwise the whole page is used, without navigation, the site header, the footer and sidebars (<nav>, <header>, <footer>, <aside> and their ARIA roles). An article’s own <header> is kept.
If that leaves nothing, the whole page is returned rather than an empty answer. Set main_content_only=false to keep the whole page, for example when you need the footer’s contact details or the site’s navigation links.

Combining with other parameters

  • proxy_country works as usual: the page is fetched from that country, then converted.
  • steps run first: click “load more”, type into a search box or wait for a selector, then the resulting page is converted. See browser steps.
  • parsed_data, get_cookies and list_elements each return their own format, so they cannot be combined with markdown=true. Such a request answers 422 and is not billed.

Errors and billing

A Markdown call is billed like an HTML call: only when the page is delivered. Errors are the same as for HTML (see page source) and keep their plain-text body. When the target itself answers 404, 410 or a 5xx error page, that page comes back as Markdown with the target’s status in the X-Origin-Status header, as described in handling failures.

Markdown or parsed data?

Using an AI assistant? The MCP server has a fetch_markdown tool, and search_and_read searches Google and returns the top results as Markdown in one call.