# Clean Web-to-Markdown Scraper API [API-01]
> Extract clean, semantic, token-optimized Markdown from any URL in sub-30ms. Zero headless Chrome, zero LLM token burn, strict anti-SSRF defense.

## Specifications
- Canonical Documentation: https://topaigateway.com/api/web-to-markdown
- Production Endpoint: https://topaigateway.com/v1/api/01-web-to-markdown
- Method: POST
- Category: FinOps & Token Optimization
- Subscription Pack: Pack 1 - DevEx & FinOps (14 € / month (10,000 req included))
- Latency Target: < 30 ms
- Free Tier: 100 free requests/month (no credit card required)

## Quickstart (cURL)
```bash
curl -X POST https://topaigateway.com/v1/api/01-web-to-markdown \
  -H "Content-Type: application/json" \
  -d '{"url": "https://news.ycombinator.com", "include_links": true}'
```

## Sample Request
```json
{
  "url": "https://news.ycombinator.com",
  "include_links": true
}
```

## Sample Response
```json
{
  "success": true,
  "api": "[API-01] Clean Web-to-Markdown",
  "url": "https://news.ycombinator.com",
  "markdown_length": 3240,
  "tokens_saved_estimate": 6499,
  "latency_ms": 28.4
}
```

## SDK Code Samples
### TypeScript / Node.js
```typescript
const res = await fetch("https://topaigateway.com/v1/api/01-web-to-markdown", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ url: "https://news.ycombinator.com", include_links: true })
});
const data = await res.json();
console.log(data.markdown);
```

### Python
```python
import requests

resp = requests.post(
    "https://topaigateway.com/v1/api/01-web-to-markdown",
    json={"url": "https://news.ycombinator.com", "include_links": True}
)
print(resp.json()["markdown"])
```

## Performance Benchmarks
- Latency: 28.4 ms
- Token Saving: -65% vs Raw HTML
- Memory Footprint: < 2.4 MB
- SSRF Defense: Built-in (RFC 1918)

## Compliance & Governance
- European Union DORA (UE) 2022/2554 Article 30 Compliant
- Zero-Retention & Zero-PII Policy: Prompts are executed on memory-only V8 isolates
- 1-Click Upgrade Portal: https://topaigateway.com/#pricing
