KhaBot

HTML to Markdown

POST /api/v1/html-to-markdown — turn one web page into clean Markdown, ready to feed a model or render in your own app.

Request

{
  "url": "https://en.wikipedia.org/wiki/Markdown",
  "low_cost": true,
  "fresh": false
}
FieldDefaultNotes
urlRequired. An http or https URL, up to 2048 characters.
low_costtrueRefuse rather than spend the higher conversion cost. Send false to allow it.
freshfalseBypass the cache and fetch the page live. Slower.

Response

200 with the conversion and its metadata:

{
  "url": "https://en.wikipedia.org/wiki/Markdown",
  "markdown": "**Markdown** is a lightweight markup language…",
  "metadata": {
    "title": "Markdown - Wikipedia",
    "description": "…", "author": "…", "published": "2026-02-11T09:00:00Z",
    "siteName": "Wikipedia", "language": "en",
    "sourceURL": "https://en.wikipedia.org/wiki/Markdown"
  },
  "words": 2708,
  "cost": 1,
  "tookMs": 1238
}

metadata is best-effort — only title and sourceURL are guaranteed, so read the rest defensively. A conversion served from cache also carries "cached": true.

Pricing

Two published prices apply (both shown with your plan):

Because low_cost defaults to true, you are never charged the higher rate unless you ask for it: a page that would cost 2 comes back as 422 cost_limit instead. Retry with "low_cost": false if the page is worth it.

Example

curl https://khabot.com/api/v1/html-to-markdown \
  -H "Authorization: Bearer kb_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://en.wikipedia.org/wiki/Markdown"}'

Errors

A refusal is a fact about the page, so it keeps its meaning. The six page-level codes below bill one failed unit; anything that never reached a page — including our own faults — is free.

HTTPcodeChargeMeaningWhat to do
422cost_limit1 failed unitNeeds the higher cost; details.required_cost says what.Retry with low_cost:false if the page is worth it.
422page_blocked1 failed unitThe site refuses automated access.Don't retry — use another source.
422page_thin1 failed unitReachable but no article to extract; details.words.Don't retry — index, landing or login page.
422page_unsupported1 failed unitNot an HTML page; details.content_type.Don't retry.
404page_not_found1 failed unitThe page no longer exists.Don't retry — the URL is dead.
503page_fetch_failed1 failed unitThe page could not be retrieved.Safe to retry once shortly.
400bad_requestfreeurl missing, malformed, not http(s) or too long — or low_cost/fresh aren't booleans.Fix the request.
503upstream_unavailablefreeOur backend is unavailable — nothing to do with your URL.Retry shortly.
503service_not_configuredfreeThe service isn't switched on.Contact support.

The usual account-level codes apply too — see Errors.