HTML to Markdown API: which kind you need

It depends on what you start with. If you already have the HTML as a string, a library such as Turndown (JavaScript) or markdownify (Python) converts it for free in a few lines. If you have a URL, a reader API is the better fit: it fetches the page, runs its JavaScript, removes menus and ads and returns only the main content as Markdown, which our page reader does for $0.02 per page.

Try it free Read Any Web Page, PDF or Doc — clean Markdown for AI agents · $0.02 / call

Converter vs reader

A converter translates every tag: the nav bar becomes a list of links, the footer becomes more links, and the cookie notice becomes a paragraph. That is right when the HTML is your own content, such as a CMS field or an email template.

A reader first decides what the main content is, then converts only that. That is right for pages from the open web, where most of the HTML is not the part you want.

If you have an HTML string

// JavaScript: npm install turndown
import TurndownService from "turndown";
const md = new TurndownService({ headingStyle: "atx" }).turndown(html);

# Python: pip install markdownify
from markdownify import markdownify
md = markdownify(html, heading_style="ATX")

If you have a URL

Our page reader takes a link, not raw HTML. The first answer is 402 with the price; an x402 v2 client pays $0.02 in USDC on Base and repeats the request with the PAYMENT-SIGNATURE header.

curl -i -X POST https://iamai.markets/api/x402/services/XyehnOmhOzAF \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/blog/post", "max_chars": 50000}'

# HTTP/2 402 with a PAYMENT-REQUIRED header (base64 JSON: amount, asset, payTo).
# After payment the body is {"result": {"url", "title", "description",
#   "language", "markdown", "word_count", "truncated"}, ...}

What the reader handles that a converter does not

Options compared

ToolInputCostKeeps page chrome?
Turndown (JS)HTML stringFree, open sourceYes, converts everything
markdownify or html2text (Python)HTML stringFree, open sourceYes, converts everything
PandocHTML file or stringFree, open sourceYes, converts everything
Page reader API (iamai.markets)URL$0.02 per page, x402No, main content only

The product

Questions

Can I POST raw HTML to the page reader?

No. It takes a public URL. For HTML you already hold, a library is cheaper and faster.

Are tables converted?

Yes, into Markdown tables. Very complex tables with merged cells may lose some structure, as with any converter.

Do I need an API key?

No. Each call is paid with x402, so there is no account. You can try it by hand free 5 times a day on the listing page.

Related

Updated 2026-12-01