Skip to content
Menu
Structure · Selectors · POST /v2/scrape · selectors

Typed fields from a page by CSS, XPath, regex or JSONPath — no LLM

When you know where the data sits, name the fields and the selectors that find them. The same JSON comes back every time, in milliseconds, for 1 credit a page — no model, no tokens, no guessing.

Endpoint
POST /v2/scrape · selectors
Mode
Synchronous (a scrape format) · also in crawl and batch jobs
Credits
1 per page — no LLM credits
Also
formats: [{type: "selectors"}] on POST /v1/scrape · crawl and batch scrapeOptions · MCP tool engine_scrape (selectors)

What it's for

Listings and catalogues

Name, price and rating of every product on a listing page: one item selector, a few fields, a typed list back.

Embedded JSON and APIs

JSON-LD, Next.js __NEXT_DATA__ or a JSON endpoint read directly with JMESPath — no HTML parsing at all.

The same fields across a whole site

Put the format in a crawl's scrapeOptions and every page answers in the same shape, 1 credit a page.

From a query to selectors

Add "exportPlan": true to a query format: data.queryPlan is the learned plan as a selectors format — run it from then on without an LLM.

How it works

  1. Fetch

    The page is fetched exactly as for a scrape (the same engines, cache and limits).

  2. Select

    Without item you get one object; with item one object per match, each field read relative to it. Per field: a CSS or XPath selector, then an optional regex on the selected text, then an optional JMESPath on JSON — in that order.

  3. Process

    A fixed list of processors shapes the values (number, url, date, map …). No user code, eval or lambda runs anywhere; regular expressions run under a time limit.

  4. Answer

    data.selectors holds the values. An empty field is named in the warning (field_empty:price, or field_partial:price:3/20 in item mode) — never a silent null; a cap that was hit is named too (items_capped).

  5. Export

    A crawl or batch job with a selectors format exports as CSV, JSONL or XML: GET /v2/crawl/{id}/export?format=csv&explode=selectors writes one row per item, with the fields as columns.

Selectors, query or json?

You know…UseCredits per page
where the data sits (a CSS class, an XPath, a JSON path)the selectors format1 — no LLM
what you want, not where it isthe query format — the LLM finds the selectors once, then they are cached5, then 2
a free-form record from one pagethe json format5

Measured on the books.toscrape.com front page: 20 of 20 books matched exactly, extraction took 9.5 ms (median) — 0 LLM calls, 1 credit.

Request parameters

Full docs →
FieldType DefaultDescription
formats[] · selectorsrequiredobject—{"type": "selectors", "fields": {…}, "item": {…}}.
fieldsrequiredobject—Field name → {css | xpath | regex | jsonpath, extract, all, process, source}, up to 200 fields; a field can hold nested fields (up to 6 levels).
itemobject—{css | xpath | jsonpath} — one object per match (up to 500); without it, one object for the page.
cssstring—CSS with ::text and ::attr(name) (parsel), up to 500 characters.
xpathstring—XPath 1.0. Prefixed extension functions (re:test …) are refused — use regex.
regexstring—On the selected text (after css/xpath) or on the raw source; the first group, else the whole match. Up to 300 characters, time-limited per field.
jsonpathstring—JMESPath (a leading $. is accepted) on source: auto (a JSON body, else __NEXT_DATA__, else the JSON-LD blocks), body, next_data or json_ld.
extractstring"text"For element matches: text, own_text, html, inner_html, href, src (both made absolute) or attr:<name>.
allbooleanfalseEvery match as a list (otherwise the first non-empty value).
processarray—Up to 10 of: strip, clean_ws, lower, upper, first, last, join, number, int, url, date, {"default": …}, {"map": {…}}.

Inside the selectors format a typo is an error, not a warning: an unknown key or processor, or an invalid selector, answers 400 with the field's path (fields.price.css: invalid CSS selector …) before any page is fetched.

Example request

bash
curl -X POST https://crawl.echolotnews.com/v2/scrape \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://books.toscrape.com/",
  "formats": [
    {
      "type": "selectors",
      "item": {
        "css": "article.product_pod"
      },
      "fields": {
        "title": {
          "css": "h3 a::attr(title)"
        },
        "price": {
          "css": ".price_color::text",
          "process": [
            "strip",
            "number"
          ]
        },
        "rating": {
          "css": "p.star-rating::attr(class)",
          "process": [
            {
              "map": {
                "One": 1,
                "Two": 2,
                "Three": 3,
                "Four": 4,
                "Five": 5
              }
            }
          ]
        }
      }
    }
  ]
}'
python · requests
import requests

API = "https://crawl.echolotnews.com"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

resp = requests.post(f"{API}/v2/scrape", headers=HEADERS, json={
    "url": "https://books.toscrape.com/",
    "formats": [
        {
            "type": "selectors",
            "item": {
                "css": "article.product_pod",
            },
            "fields": {
                "title": {
                    "css": "h3 a::attr(title)",
                },
                "price": {
                    "css": ".price_color::text",
                    "process": ["strip", "number"],
                },
                "rating": {
                    "css": "p.star-rating::attr(class)",
                    "process": [
                        {
                            "map": {
                                "One": 1,
                                "Two": 2,
                                "Three": 3,
                                "Four": 4,
                                "Five": 5,
                            },
                        },
                    ],
                },
            },
        },
    ],
}, timeout=120)
resp.raise_for_status()
for b in resp.json()["data"]["selectors"]:
    print(b["title"], b["price"], b["rating"])
javascript · fetch
const API = "https://crawl.echolotnews.com";
const headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" };

const res = await fetch(`${API}/v2/scrape`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    "url": "https://books.toscrape.com/",
    "formats": [
      {
        "type": "selectors",
        "item": {
          "css": "article.product_pod"
        },
        "fields": {
          "title": {
            "css": "h3 a::attr(title)"
          },
          "price": {
            "css": ".price_color::text",
            "process": [
              "strip",
              "number"
            ]
          },
          "rating": {
            "css": "p.star-rating::attr(class)",
            "process": [
              {
                "map": {
                  "One": 1,
                  "Two": 2,
                  "Three": 3,
                  "Four": 4,
                  "Five": 5
                }
              }
            ]
          }
        }
      }
    ]
  }),
});
const json = await res.json();
json.data.selectors.forEach((b) => console.log(b.title, b.price, b.rating));
mcp
# 1. Connect once (Claude Code)
claude mcp add --transport http echolot https://crawl.echolotnews.com/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"

# 2. Ask in plain words — the agent calls engine_scrape, e.g.
#    "List title, price and star rating of the books on books.toscrape.com — no LLM"
# Tool call it makes:
{
  "name": "engine_scrape",
  "arguments": {
    "url": "https://books.toscrape.com/",
    "selectors": {
      "item": {
        "css": "article.product_pod"
      },
      "fields": {
        "title": {
          "css": "h3 a::attr(title)"
        },
        "price": {
          "css": ".price_color::text",
          "process": [
            "strip",
            "number"
          ]
        },
        "rating": {
          "css": "p.star-rating::attr(class)",
          "process": [
            {
              "map": {
                "One": 1,
                "Two": 2,
                "Three": 3,
                "Four": 4,
                "Five": 5
              }
            }
          ]
        }
      }
    }
  }
}

Example response

json · trimmed
{
  "success": true,
  "data": {
    "selectors": [
      { "title": "A Light in the Attic", "price": 51.77, "rating": 3 },
      { "title": "Tipping the Velvet", "price": 53.74, "rating": 1 }
    ],
    "metadata": { "title": "All products | Books to Scrape - Sandbox", "statusCode": 200,
                  "creditsUsed": 1 }
  }
}

Response fields

FieldTypeMeaning
data.selectorsobject | arrayOne value per field — a list of objects with item.
warningstringfield_empty:<field>, field_partial:<field>:n/m, selector_error:<field>:<reason>, items_capped — what did not match, by name.
WhatCredits
A page with the selectors format (any number of fields)1
LLM0 — none is called
Each page of a crawl or batch job1

Start with 500 free credits

No card required. Every endpoint, REST and MCP.