# HTML to Text (`text.html_to_text`)

Strip an HTML document to its visible text, one block per line, without scripts, styles or markup.

- **Route:** `POST /v1/run/text.html_to_text`
- **Price:** $0.0002 per request ($0.20 per 1,000) · `cost_usd` on every response
- **Source:** GetAllAPIs compute (`compute`) · failover: no
- **Measured latency:** p50 3 ms · p95 3 ms · p99 3 ms (1 calls, 30d)
- **Heavy response:** no

## Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `html` | string | yes |  | HTML document or fragment |
| `main_only` | boolean | no | false | Keep only <main>/<article> and drop page chrome |

## Output (`output` in the run envelope)

| Field | Meaning |
|---|---|
| `text` | Visible text, one block per line. |
| `characters` | Length of the text. |
| `words` | Word count. |

## Example

```bash
curl -s -X POST https://getallapis.com/v1/run/text.html_to_text \
  -H "Authorization: Bearer $GETALLAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"html":"<html><body><main><h1>Pricing</h1><p>Pay <strong>per request</strong>. See the <a href=\"/docs\">docs</a>.</p><ul><li>One key</li><li>One wallet</li></ul></main></body></html>"}'
```

```python
from getallapis_client import Client
client = Client()  # reads GETALLAPIS_API_KEY
result = client.run('text.html_to_text', {'html': '<html><body><main><h1>Pricing</h1><p>Pay <strong>per request</strong>. See the <a href="/docs">docs</a>.</p><ul><li>One key</li><li>One wallet</li></ul></main></body></html>'})
print(result['cost_usd'], result['output'])
```

```bash
getallapis run text.html_to_text '{"html":"<html><body><main><h1>Pricing</h1><p>Pay <strong>per request</strong>. See the <a href=\"/docs\">docs</a>.</p><ul><li>One key</li><li>One wallet</li></ul></main></body></html>"}'
```

Quote first (free, validates input): `POST /v1/quote/text.html_to_text` with the same body.
