HTML data extractor API

Extract data from a web page or raw HTML with CSS selectors into JSON — lists, attributes, number / date filters, pagination — or turn a page into RSS.

GETPOSThttps://apibox.io.vn/v1/html-extract

Send a public url (or html) and a fields map. A value is a CSS selector with an optional attribute and filters: "h1", "a.more@href" (links and image sources become absolute URLs), ".price | number". A name ending in [] returns every match; an object {"selector": ".product", "fields": {...}} returns a list of records, with selectors relative to each item. Filters: trim, lower, upper, oneline, number (150.000 ₫ → 150000), int, date (dd/mm/yyyy → ISO), url, remove_accents, regex:… (first group), replace:a=>b, split:,, default:….

next (a selector for the "next page" link) with max_pages (up to 3 on Free, 5 on paid plans) follows pagination on the same site and concatenates the lists. format=rss or json_feed turns a page without a feed into one: feed = {"item": "article", "title": "h2", "link": "a@href", "date": "time@datetime", "summary": "p", "image": "img@src"}.

Fair use: pages are fetched with our bot identity (APIBoxBot), robots.txt is respected (disallowed paths are refused), JavaScript is not executed, no cookies or logins, and sites whose terms forbid automated extraction or that sit behind captchas (search engines, social networks, large marketplaces, tax / business-registry portals, gold / fuel price and power-outage pages) are blocked. Pages up to 2 MB.

Markdown · OpenAPI · Postman · llms.txt

Parameters

NameInTypeRequiredDefault
urlbody|querystringnoPublic page to fetch (or send html).
htmlbodystringnoRaw HTML instead of a URL (with optional base_url).
fieldsbody|queryobjectyesMap of name → selector[@attr] | filter or {selector, fields}.
nextbody|querystringnoSelector of the next-page link (pagination).
max_pagesbody|querynumberno1Pages to follow with next (Free 3, paid 5).
formatbody|querystringnojsonjson, rss or json_feed.
feedbody|queryobjectnoFeed mode selectors: item, title, link, date, summary, image, author.
limitbody|querynumberno500Maximum matches per list (1-2,000).

Example

curl -X POST "https://apibox.io.vn/v1/html-extract" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Cửa hàng</h1><div class=\"sp\"><a href=\"/p/1\">Áo thun</a><span class=\"gia\">150.000 ₫</span></div><div class=\"sp\"><a href=\"/p/2\">Quần jean</a><span class=\"gia\">1.250.000 ₫</span></div>","base_url":"https://shop.example.vn/","fields":{"tieu_de":"h1","san_pham":{"selector":".sp","fields":{"ten":"a","url":"a@href","gia":".gia | number"}}}}'

Response

{
  "url": null,
  "title": null,
  "pages": 1,
  "counts": {
    "san_pham": 2
  },
  "data": {
    "tieu_de": "Cửa hàng",
    "san_pham": [
      {
        "ten": "Áo thun",
        "url": "https://shop.example.vn/p/1",
        "gia": 150000
      },
      {
        "ten": "Quần jean",
        "url": "https://shop.example.vn/p/2",
        "gia": 1250000
      }
    ]
  }
}

Use cases

  • Pull product names and prices from your own shop pages into a sheet
  • Make an RSS feed for a news or notice page that has none
  • Collect event, job or tender listings from public pages for n8n / Make
  • Parse HTML you already downloaded with the same selector rules

FAQ

Why is a site refused?

Either its robots.txt disallows our bot on that path, or it is on our list of sites that forbid automated extraction or use captchas / logins. We do not bypass either.

Does it run JavaScript?

No. Content that a page loads with JavaScript after it opens is not visible; look for the site’s API or feed instead.

How is this different from page-watch?

html-extract returns structured data on each call; page-watch stores a snapshot and alerts you when it changes.

Related APIs

Start with 1,000 free requests every month. Get free API key →