ForHosting KIT · Web Scraping & Monitoring

Scrape to a schema

You supply a JSON Schema describing exactly the shape you need — required fields, types, enums, nested objects — and the page gets read against that contract instead of a loose wish-list. It's built for the moment scraped data stops being a one-off pull and starts feeding a database column, an API response or a downstream system that will reject anything malformed.

● StablePer request + per URL$0.046
Use it from WebAPIEmailApp soonTelegram soon

Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.

For data that has to be right, not just present

A field coming back as a string when your database expects an integer, or missing entirely when your code assumes it exists, is the kind of bug that surfaces three deployments later at 2am. This endpoint is for teams who have already been burned by that and want the extraction step itself to enforce the contract, catching a malformed result before it ever reaches their system rather than after.

How the schema shapes the extraction

You call POST /web/scrape-schema with a URL and a JSON Schema object — the standard kind, with types, required arrays, enum constraints and nested properties — and the task_id returns immediately. Internally, the page is fetched and read, and the extraction is driven to fill exactly the structure your schema defines; the result is validated against that same schema before it's ever delivered, so what lands in your webhook is guaranteed to match the contract you wrote, not merely close to it.

JSON Schema: a spec built for exactly this handshake

JSON Schema has been the de facto way to describe and validate the shape of JSON since the mid-2010s, adopted across API tooling, form generators and validators precisely because it lets two systems that have never met agree on a contract without either one guessing. Using it here means the schema you already maintain for your database or API can be reused as-is to drive extraction, instead of writing a second, informal description of the same fields.

What a validated result looks like, and what happens on a mismatch

A successful task returns data that satisfies your schema outright — correct types, all required fields present, enum values honored. If the source page truly cannot supply a required field, extraction is retried automatically up to three times against fresh reads before the task returns a clear error explaining what couldn't be satisfied, and a task that never validates is never billed.

Fitting a strict contract into a larger system

This endpoint pairs naturally with pipelines where the extracted JSON is inserted straight into a typed database table, forwarded to another API with its own validation, or consumed by strongly-typed application code — anywhere a loosely-shaped result would either crash downstream or need a manual cleanup pass. Compared to describing fields in plain language, writing the schema once up front trades a little setup time for extraction results you can trust without a second look.

Populating a typed database table

Define a schema matching your products table's columns exactly, and insert the validated JSON without a transformation step in between.

Feeding a downstream API with its own validation

Extract data pre-shaped to match a partner API's required payload, avoiding rejected requests caused by type mismatches.

Enforcing enums on categorical fields

Constrain a status field to a fixed set of values like in_stock, low_stock or out_of_stock so the extraction can never return an unexpected string.

Extracting nested, multi-level data

Pull a product with a nested array of variants, each with its own price and size, in one call that returns the whole tree already validated.

What is JSON Schema and why does this endpoint need it?

JSON Schema is a standard way to describe the shape, types and constraints of JSON data; supplying one here lets the extraction be validated against it before delivery instead of trusting a loose guess.

How much does web.scrape_schema cost?

$0.046 per request plus $0.0145 per URL, billed only when the task returns data that actually validates against your schema.

What happens if the page can't satisfy a required field?

Extraction retries automatically up to three times, and if it still can't satisfy the schema you get a clear error instead of a partial or malformed result, with no charge for that task.

Can I reuse the same schema I use for my database or API?

Yes, any standard JSON Schema works, so the contract you already maintain elsewhere can be reused directly to drive extraction.

Is there a free version of the structured web scraping api?

There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.

Does it support nested objects and arrays in the schema?

Yes, nested objects, arrays and enum constraints are all supported, which is where this endpoint outperforms a flat selector map.

How is this different from scrape_ai?

scrape_ai accepts a plain-language description of fields; scrape_schema requires and enforces a formal JSON Schema, guaranteeing types and required fields rather than approximating them.

How do I get the results?

By signed webhook when the task completes, or via a signed link valid for 24 hours if you'd rather retrieve it yourself.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/web/scrape-schema

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.

curl -X POST https://api.kit.forhosting.com/web/scrape-schema \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://ejemplo.com"}'
{
  "url": "https://ejemplo.com"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "web.scrape_schema",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.046
Per URL$0.0145

Published price — no tokens, no invented credits. A failed task is never charged.

timeout_sec30
max_crawl_pages25
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.
422task_failedThe task failed after 3 retries. You are never charged for it.

Read the full KIT documentation →