apyhub
DATA EXTRACTION · DEVELOPER TOOLS

Extract Text from HTML API

What it does

HTML Text Extractor turns raw HTML into clean, readable text. Send it an html string, optionally add a canonical url, and get back extracted text plus its length.

Use it when you need the main content from a page without navigation, boilerplate, or layout markup. It is useful for content indexing, search previews, ingestion pipelines, and downstream NLP workflows where HTML noise gets in the way.

The response is intentionally simple: plain text for the extracted content and an integer length for quick checks, logging, or batching. If you already know the source page URL, include it to help extraction quality on pages with ambiguous structure.

This service fits cleanly into scraping, article processing, and content analysis systems that need readable text rather than rendered HTML.

POST
Extract clean readable text from HTML, stripping navigation and boilerplate
http://localhost:8080/dosvak/extract-html-text
QUICKSTARTGUIDE

Quickstart

Send the raw HTML to extract its text content.

curl -X POST "http://localhost:8080/dosvak/extract-html-text" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"html":"<html><body><p>Hello world</p></body></html>"}'

What you'll get back

Returns a JSON object with a text string containing the extracted text and a length integer with its character count.

{
  "text": "Hello world",
  "length": 11
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Optional canonical URL to improve extraction quality
Raw HTML string

About this endpoint

What it does

Extracts the readable text from an HTML document, returning the cleaned text content and its character length. You can optionally provide a canonical URL to help improve extraction quality.

Request Body

ParameterTypeMandatoryDescription
urlStringNoOptional canonical URL to improve extraction quality.
htmlStringYesRaw HTML string.

Response

Returns a JSON object with a text string field and a length integer field.

ParameterTypeMandatoryDescription
textStringNoThe extracted clean readable text.
lengthIntegerNoThe length of the extracted text.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.