# AI Web Scraper API

> Turn any web page into clean JSON: name your fields, get one object or every item of a list.

Name the data you want; the AI reads the page and fills it in. No CSS selectors, no maintenance when the layout changes.

- Host: `ai-web-scraper-extract-structured-data-to-json.p.rapidapi.com`
- Base URL: `https://ai-web-scraper-extract-structured-data-to-json.p.rapidapi.com/v1/scraper`
- Auth: headers `X-RapidAPI-Key` and `X-RapidAPI-Host`
- OpenAPI: https://helenis-api.com/docs/scraper/openapi.json

## Endpoints

### Extraction

Your fields, extracted from any page and checked against it.

#### Extract Structured Data

`POST /v1/scraper/extract`

Extract structured data from a web page with AI. Extract the fields you name from a web page URL as clean JSON; `multiple=true` returns every repeated item (product lists, job boards). 10 credits per page (20 above 10,000 characters of text), +5 per 5 items with `multiple=true`. Pages that need JavaScript are refused, not billed.

| Parameter | In | Type | Required | Description | Example |
|---|---|---|---|---|---|
| `url` | body | `string` | yes |  | `https://books.toscrape.com/` |
| `fields` | body | `object[]` | yes |  | `[{"name": "title", "type": "string"}, {"description": "price in GBP", "name":...` |
| `multiple` | body | `boolean` | no | false: one object for the page's main entity; true: every repeated item (products, jobs, articles...) in `items`. Default `False`. | `true` |
| `max_items` | body | `integer` | no | With multiple=true. Default `25`. | `10` |

```bash
curl -X POST "https://ai-web-scraper-extract-structured-data-to-json.p.rapidapi.com/v1/scraper/extract" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: ai-web-scraper-extract-structured-data-to-json.p.rapidapi.com" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://books.toscrape.com/",
    "multiple": true,
    "max_items": 20,
    "fields": [
      {
        "name": "title",
        "type": "string",
        "description": "full book title"
      },
      {
        "name": "price",
        "type": "number",
        "description": "price in GBP"
      },
      {
        "name": "in_stock",
        "type": "boolean"
      },
      {
        "name": "link",
        "type": "url",
        "description": "book page"
      }
    ]
  }'
```

### Markdown

Any page as clean Markdown, no AI.

#### Convert Page to Markdown

`GET /v1/scraper/markdown`

Convert a web page to clean Markdown. LLM-ready Markdown of a page: headings, lists, tables and absolute links, without navigation, scripts or footers; plus its JSON-LD. No AI. 1 credit.

| Parameter | In | Type | Required | Description | Example |
|---|---|---|---|---|---|
| `url` | query | `string` | yes | Web page to convert. | `https://books.toscrape.com/` |

```bash
curl -G "https://ai-web-scraper-extract-structured-data-to-json.p.rapidapi.com/v1/scraper/markdown" \
  --data-urlencode "url=https://books.toscrape.com/" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: ai-web-scraper-extract-structured-data-to-json.p.rapidapi.com"
```

## Sample call

Extract Structured Data: `POST /v1/scraper/extract`.

```bash
curl -X POST "https://ai-web-scraper-extract-structured-data-to-json.p.rapidapi.com/v1/scraper/extract" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: ai-web-scraper-extract-structured-data-to-json.p.rapidapi.com" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://books.toscrape.com/",
    "multiple": true,
    "max_items": 20,
    "fields": [
      {
        "name": "title",
        "type": "string",
        "description": "full book title"
      },
      {
        "name": "price",
        "type": "number",
        "description": "price in GBP"
      },
      {
        "name": "in_stock",
        "type": "boolean"
      },
      {
        "name": "link",
        "type": "url",
        "description": "book page"
      }
    ]
  }'
```

## Response

```json
{
  "url": "https://books.toscrape.com/",
  "final_url": "https://books.toscrape.com/",
  "title": "All products | Books to Scrape - Sandbox",
  "items": [
    {
      "title": "A Light in the Attic",
      "price": 51.77,
      "in_stock": true,
      "link": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html"
    },
    {
      "title": "Tipping the Velvet",
      "price": 53.74,
      "in_stock": true,
      "link": "https://books.toscrape.com/catalogue/tipping-the-velvet_999/index.html"
    }
  ],
  "item_count": 20,
  "page_truncated": false,
  "credits": 30
}
```

*From a real response (2 of 20 items shown).* With `multiple: false` (default) you get `data: {...}` for the page's main subject.

## Good to know

- **Descriptions say where to look** ("price in GBP, without the symbol"). They are not prompts: asking to summarise, translate or answer questions returns `null`.
- **No JavaScript rendering:** pages that only show content in the browser return `page_empty`, not billed.
- **Long pages:** the first ~30,000 characters of content are read; `page_truncated` says so.
- **Free BASIC plan:** up to 15 items per page with `multiple=true` (paid plans: up to 100).

## Errors

| Status | `code` | Meaning |
|---|---|---|
| 400 | `invalid_request` | Bad field name or type, duplicate names, more than 30 fields. |
| 400 | `invalid_url`, `site_unreachable`, `site_blocked`, `not_html` | The page could not be fetched, or is not a web page. Not billed. |
| 400 | `page_empty` | No readable content without JavaScript. Not billed. |
| 429 | `daily_limit_reached` | Daily safety limit of your plan; resets at 00:00 UTC. |
| 503 | `ai_error`, `capacity_exhausted` | AI failure; retry. Not billed. |

## Pricing

Extract: 10 credits per page (20 over 10,000 characters of text), +5 per 5 items. Markdown: 1 credit. Failed calls are never billed.

| Plan | Price | Credits included | Above the quota |
|---|---|---|---|
| BASIC | Free | 30 / day | resets every day |
| PRO | $4.99/month | 10,000 / month | $0.005 per credit |
| ULTRA | $14.99/month | 30,000 / month | $0.005 per credit |
| MEGA | $49.99/month | 100,000 / month | $0.005 per credit |

Apify actor **AI Web Scraper - Any Website to JSON & Markdown**: billed per event; free-plan users get 10 pages per run.

| Event | Charged for | Price |
|---|---|---|
| `page-extraction` | each page read by the AI | $0.01 |
| `item` | each item of a list | $0.0003 |
| `markdown-page` | each page converted to Markdown | $0.0006 |

## Links

- API reference (HTML): https://helenis-api.com/docs/scraper
- OpenAPI: https://helenis-api.com/docs/scraper/openapi.json
- Overview and pricing: https://helenis-api.com/apis/scraper/
- RapidAPI listing: https://rapidapi.com/helenis-api-helenis-api-data/api/ai-web-scraper-extract-structured-data-to-json?utm_source=helenis&utm_medium=site&utm_campaign=scraper&utm_content=markdown
- Apify actor: https://apify.com/helenisapi/ai-web-scraper-json-markdown?utm_source=helenis&utm_medium=site&utm_campaign=scraper&utm_content=markdown
- MCP server (Apify): https://mcp.apify.com?tools=helenisapi/ai-web-scraper-json-markdown

MCP: Works in Claude, Cursor, VS Code and any MCP client; billed per event through Apify (your Apify token).

## Conventions (every Helenis API)

- Auth: two headers on every call, `X-RapidAPI-Key` (your key) and `X-RapidAPI-Host` (the API's host). One RapidAPI key works for every API you subscribe to.
- Billing in credits: one for a simple call, more for heavier work (a minute of audio, a page read by AI). Each API states its rule.
- Failed calls are never billed: a `4xx` bills zero credits and a `5xx` is never counted.
- Errors share one envelope: `{"error": {"status", "code", "message"}}` with a stable machine-readable `code`.
- `400`: fix the input (validation errors are always 400, never 422); not billed.
- `429`: rate limit; wait for `Retry-After`. `503`: temporary upstream or AI failure (`ai_error`, `upstream_timeout`); retry later, not billed.
- Values the source does not give come back as `null`, never invented.
