# Markdown API
> A fast, fully-local Markdown toolkit: render GitHub-flavored Markdown to HTML that is sanitized by default (scripts, style/iframe tags, inline event handlers and javascript: URLs are stripped), strip Markdown down to clean plain text, and extract a heading table of contents with levels, text and URL slugs. Every endpoint accepts input via the query string or the request body (up to 1 MB). Pure server-side compute, no third-party upstream, so responses are instant and always available. Ideal for CMS and documentation tools, comment systems, static-site pipelines and content rendering.

## 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/markdown-api/..."
```

## Pricing
- **Free** (Free) — 13,000 calls/Mo, 2 req/s
- **Basic** ($4/Mo) — 220,000 calls/Mo, 12 req/s
- **Pro** ($14/Mo) — 1,300,000 calls/Mo, 40 req/s
- **Mega** ($37/Mo) — 6,500,000 calls/Mo, 120 req/s

## Endpoints

### Markdown

#### `GET /v1/render` — Render Markdown to sanitized HTML

**Parameters:**
- `markdown` (query, required, string) — Markdown text Example: `# Hello

**world**`
- `sanitize` (query, optional, string) — Sanitize HTML (default true) Example: `true`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/markdown-api/v1/render?markdown=%23+Hello%0A%0A%2A%2Aworld%2A%2A&sanitize=true"
```

**Response:**
```json
{
    "data": {
        "html": "<h1 id=\"hello\">Hello</h1>\n<p><strong>world</strong></p>\n",
        "length": 56,
        "sanitized": true
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:23.835Z",
        "request_id": "998add67-e4ac-49de-94cd-70281ba338bb"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```

#### `GET /v1/strip` — Strip Markdown to plain text

**Parameters:**
- `markdown` (query, required, string) — Markdown text Example: `# Title

Hello **world**.`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/markdown-api/v1/strip?markdown=%23+Title%0A%0AHello+%2A%2Aworld%2A%2A."
```

**Response:**
```json
{
    "data": {
        "text": "Title\n\nHello world.",
        "length": 19
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:23.902Z",
        "request_id": "e61e41a1-373b-4eb5-893d-a4275c18adb8"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```

#### `GET /v1/toc` — Extract a table of contents

**Parameters:**
- `markdown` (query, required, string) — Markdown text Example: `# A
## B
### C`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/markdown-api/v1/toc?markdown=%23+A%0A%23%23+B%0A%23%23%23+C"
```

**Response:**
```json
{
    "data": {
        "toc": [
            {
                "slug": "a",
                "text": "A",
                "level": 1
            },
            {
                "slug": "b",
                "text": "B",
                "level": 2
            },
            {
                "slug": "c",
                "text": "C",
                "level": 3
            }
        ],
        "count": 3
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:23.955Z",
        "request_id": "c98711e8-676a-4288-8b04-591af98f8ea6"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```


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