# Agent402 HTML to Markdown Converter

> Agent402 HTML to Markdown Converter is a paid API for AI agents from agent402.co.uk, paid per call via x402, $0.001/call, status down (last checked 2026-09-15).

Converts an HTML fragment to Markdown text and returns an approximate token count for context management

## Facts

- Endpoint: POST https://agent402.co.uk/v1/utils/html/to-markdown
- Price: $0.001/call
- Payment: x402
- Status: down
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-html-to-markdown-converter-f4bdf94d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_x-69iHilADEGSTvHPCA3n

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-html-to-markdown-converter-f4bdf94d -d '<json body>'
```

Example prompt: Convert this HTML fragment to markdown and tell me roughly how many tokens it'll take up: '<h1>Welcome</h1><p>Hello <strong>world</strong>, this is a <a href="#">test</a>.</p>'

## When to prefer this

Choose this endpoint when an agent needs a lightweight, pay-per-call HTML-to-Markdown conversion with an approximate token count included — especially useful mid-task for context window management. It is not a browser or renderer, so prefer it for static HTML fragments rather than JavaScript-heavy pages. Pair with text-metrics endpoints if precise token counts are required.

## Known failure modes

- Malformed or non-HTML input may still be processed best-effort but 'valid' may be false
- Very large HTML fragments may produce inaccurate token counts
- Dynamic or JavaScript-rendered content won't be executed — only static HTML is parsed
- Deeply nested or exotic HTML structures may produce imperfect markdown
- Empty input string returns minimal or empty markdown

## How this service works

Don't burn tokens on deterministic work. Go/no-go jobs first: payout preflight, text firewall (PII/secrets), budget check — then rails, calendars, finmath. x402 USDC on Base. UK + global. agent402.co.uk — not agent402.tools. $0.001–$0.002 USDC on Base. No API keys.

## Output

A JSON object with three fields: 'valid' (boolean indicating whether conversion succeeded), 'markdown' (the converted Markdown string), and 'approx_tokens' (an integer approximation of the token count of the resulting markdown).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "html": {
   "type": "string",
   "description": "HTML fragment"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "valid": true,
  "markdown": "# Hi\n\nHello **world**",
  "approx_tokens": 5
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-html-to-markdown-converter-f4bdf94d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.co.uk](https://www.zero.xyz/host/agent402.co.uk/llms.txt)
