ToolsXpo

Networking

Web Scraper (CSS selectors) API

GET request to /v1/web-scraper, returning json in the standard envelope.

GET/v1/web-scraper40 credits / call Paid

Authentication

Send your API key as a bearer token. Create one free in the dashboard.

Authorization: Bearer $TOOLSXPO_KEY

Parameters

Sent as query-string parameters. The values below are the examples used throughout this page.

NameExample value
urlhttps://example.com
selectorsh1

Example request

curl "https://api.toolsxpo.com/v1/web-scraper?url=https%3A%2F%2Fexample.com&selectors=h1" \
  -H "Authorization: Bearer $TOOLSXPO_KEY"

Response

Every endpoint answers with the same envelope. The result is in data (json); meta.credits reports what the call cost.

{
  "ok": true,
  "data": { /* json */ },
  "meta": { "credits": 40 }
}

Errors

Failures use the same envelope with ok: false and a machine-readable code.

StatusCodeMeaning
400invalid_inputA parameter failed validation. `details` lists which.
401unauthorizedMissing or invalid API key.
402quota_exceededOut of credits on this workspace.
404not_foundNo such tool.
429rate_limitedToo many requests. Retry after `Retry-After` seconds.
503service_unavailableTemporarily disabled by an administrator.

How to use the Web Scraper API

Extract structured data from a page by CSS selector. A real browser renders the page (so JS-built content is included), then returns the matches for each selector you asked for.

Passing selectors

Send a comma-separated list in selectors (up to 20):

Bash
curl "https://api.toolsxpo.com/v1/web-scraper?url=https://example.com&selectors=h1,.price,a.cta" \
  -H "Authorization: Bearer $TOOLSXPO_KEY"

Response shape

data.elements is one entry per selector, each with a count and a matches array of { text, html, attributes }:

JSON
{
  "elements": [
    { "selector": "h1", "count": 1, "matches": [{ "text": "Example Domain" }] },
    { "selector": ".price", "count": 3, "matches": [{ "text": "$9" }, { "text": "$19" }] }
  ]
}

Tips & gotchas

  • Prefer stable, specific selectors ([data-testid], semantic classes) over deep positional ones that break when the page changes.
  • Reach for url-to-markdown instead when you want the whole article, not specific fields.
  • Respect each site's terms and robots policy — scrape only what you're allowed to.