# HTML to Markdown API
> Convert HTML into clean GitHub-Flavored Markdown. Pass an HTML string, or a live page URL to fetch and convert, and get back tidy Markdown — headings, bold/italic, links, images, lists, blockquotes, code blocks, plus GFM tables, strikethrough and task lists. Script, style and head elements are stripped automatically. Tune the output: ATX or setext headings, the bullet marker, fenced or indented code blocks, inline or referenced links, and the emphasis/strong delimiters; toggle GFM on or off. The inverse of a Markdown-to-HTML renderer. Pure local conversion (the optional URL fetch aside) — no key, no third-party service, instant. Live. 3 endpoints. Built for content migration, web clipping and "save as Markdown", scraping cleanup, CMS import and documentation pipelines.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/htmltomarkdown-api/..."
```

## Pricing
- **Free** (Free) — 1,440 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 25,000 calls/Mo, 8 req/s
- **Pro** ($26/Mo) — 176,000 calls/Mo, 20 req/s
- **Mega** ($62/Mo) — 900,000 calls/Mo, 50 req/s

## Endpoints

### Convert

#### `GET /v1/convert` — HTML string to Markdown

**Parameters:**
- `html` (query, required, string) — HTML to convert Example: `<h1>Title</h1><p>Hello <b>world</b></p>`
- `heading_style` (query, optional, string) — atx|setext
- `bullet` (query, optional, string) — -|*|+
- `gfm` (query, optional, string) — true|false (tables, strikethrough)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/htmltomarkdown-api/v1/convert?html=%3Ch1%3ETitle%3C%2Fh1%3E%3Cp%3EHello+%3Cb%3Eworld%3C%2Fb%3E%3C%2Fp%3E"
```

**Response:**
```json
{
    "data": {
        "length": 24,
        "markdown": "# Title\n\nHello **world**"
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:57.866Z",
        "request_id": "ab43f6ed-3e05-4f25-b050-1ebc7535bf29"
    },
    "status": "ok",
    "message": "HTML string to Markdown",
    "success": true
}
```

#### `GET /v1/from-url` — Fetch a URL and convert to Markdown

**Parameters:**
- `url` (query, required, string) — Web page URL Example: `https://example.com`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/htmltomarkdown-api/v1/from-url?url=https%3A%2F%2Fexample.com"
```

**Response:**
```json
{
    "data": {
        "url": "https://example.com/",
        "length": 167,
        "markdown": "# Example Domain\n\nThis domain is for use in documentation examples without needing permission. Avoid use in operations.\n\n[Learn more](https://iana.org/domains/example)"
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:58.018Z",
        "request_id": "b281d36e-d61b-461c-a05f-64691ab9d612"
    },
    "status": "ok",
    "message": "Fetch a URL and convert to Markdown",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/htmltomarkdown-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "auth": "none upstream; this gateway requires x-api-key",
        "name": "HTML to Markdown API",
        "note": "Convert HTML to GitHub-Flavored Markdown. /v1/convert?html=... for a string, /v1/from-url?url=... to fetch and convert a live page. Options: heading_style (atx|setext), bullet (-|*|+), code_block (fenced|indented), link_style (inlined|referenced), em/strong delimiters, gfm=true|false (tables, strikethrough, task lists). script/style/head are stripped. Instant, nothing stored.",
        "source": "Local conversion (turndown + GFM) — no key, no upstream",
        "endpoints": 3
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:58.109Z",
        "request_id": "12c4048b-01dc-4f66-82d8-ed404f626538"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/htmltomarkdown-api
OpenAPI spec: https://www.oanor.com/api/htmltomarkdown-api/openapi.json
