HTML to text
Try it interactively →POST /api/html-to-textConvert HTML to plain text. Block-level elements become paragraph breaks; lists become indented bullets; links keep their text. Configurable line wrapping.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| html* | string | — | HTML source. |
| wordwrap | number (0…1000) | 80 | Hard-wrap column (0 = disabled). |
| preserveLinks | boolean | true | Append href URLs inline next to link text. |
| preserveAltText | boolean | true | Replace `<img>` with their alt text. |
Response
Modes: json, text. Cache: yes (24h TTL).
Code samples
Built from the article example.
curl -X POST https://api.xtract.bot/api/html-to-text \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
-H "X-Api-Key: $XTRACT_API_KEY" \
-d '{
"html": "<h1>Hello</h1><p>Visit <a href=\"https://example.com\">our site</a>.</p><ul><li>One</li><li>Two</li></ul>"
}'