Docs📄 DocumentsHTML to Markdown
POST/api/markdown$0.001

📄 HTML to Markdown

Convert any webpage to clean, readable Markdown. Intelligently strips navigation menus, ads, footers, and boilerplate to extract just the main content. Ideal for AI pipelines that need clean text from web pages.

Request Body

ParameterTypeRequiredDescriptionDefault
urlstringrequiredURL of the webpage to convert

Response Fields

FieldTypeDescription
markdownstringWebpage content as clean Markdown
titlestringPage title
word_countnumberWord count of extracted content

Code Examples

cURL
bash
curl -X POST https://sparkforge.sh/api/markdown \
  -H "Content-Type: application/json" \
  -H "X-PAYMENT: <x402-payment-token>" \
  -d '{"url": "https://en.wikipedia.org/wiki/Bitcoin"}'
Python
python
import requests

response = requests.post(
    "https://sparkforge.sh/api/markdown",
    headers={"Content-Type": "application/json", "X-PAYMENT": "<token>"},
    json={"url": "https://en.wikipedia.org/wiki/Bitcoin"}
)

data = response.json()
print(data["title"])
print(data["markdown"][:1000])
TypeScript / Node.js
typescript
const res = await fetch402("https://sparkforge.sh/api/markdown", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ url: "https://en.wikipedia.org/wiki/Bitcoin" }),
});

const { markdown, title, word_count } = await res.json();

Example Response

json
{
  "markdown": "# Bitcoin\n\nBitcoin is a decentralized digital currency...",
  "title": "Bitcoin - Wikipedia",
  "word_count": 12450
}

💳 Payment via x402

This endpoint costs $0.001 per call, paid in USDC on Base, Polygon, or Solana. Use the @x402/fetch library to handle payments automatically, or implement the x402 handshake manually.

bash
# Free demo mode (no payment)
curl https://sparkforge.sh/api/markdown?demo=true

# Or try via MCP (Claude Desktop, Cursor, Windsurf)
# Add to mcp config: { "url": "https://sparkforge.sh/api/mcp" }
Previous
PDF to Markdown
Next
Text Summarizer