Data Extraction API
Extract structured data from any page using CSS or XPath selectors. Get clean JSON from product pages, listings, and tables from $0.01/call.
Define extraction rules using CSS selectors or XPath expressions and get back structured JSON data. Perfect for scraping product listings, tables, directories, and any page with repeating elements.
Try it live
Fill in the fields and hit Run to see a real response.
{
"ok": true,
"data": {
"url": "https://news.ycombinator.com",
"extracted": {
"titles": [
"Show HN: Open-source AI code editor",
"The State of WebAssembly 2026",
"PostgreSQL 18 Released"
]
}
}
}Features
Define extraction rules using either CSS selectors or XPath expressions, whichever fits the page best. Mix and match across fields to target elements precisely on any HTML structure.
Build rules that mirror nested page layouts, extracting child fields within parent containers. Capture structured records — like a product with its name, price, and rating — in a single pass.
Set a rule's type to `list` to pull every matching element into an array, ideal for product grids, search results, and directory cards. One selector returns the whole repeating set.
Pull attribute values like `@href`, `@src`, or custom `data-*` attributes, not just visible text. Grab link targets, image URLs, and embedded data directly into your JSON.
The response is structured JSON whose shape mirrors the rules you defined — your field names become the keys. No HTML parsing on your end; the output is ready to store or process.
Use cases
Product Catalog Scraping
Extract product names, prices, images, and descriptions from e-commerce pages into structured JSON.
Directory Scraping
Pull business listings, contact info, and reviews from directory sites with repeating card layouts.
Table Data Extraction
Convert HTML tables into structured arrays for data analysis, spreadsheets, or database imports.
Job Board Scraping
Extract job titles, companies, locations, and salary data from job listing pages at scale.
Real Estate Data
Pull property listings with prices, addresses, and features from real estate platforms.
Quick start
Copy this snippet and start making calls.
const res = await fetch('https://api.yepapi.com/v1/scrape/extract', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"url": "https://news.ycombinator.com",
"extractRules": {
"titles": {
"selector": ".titleline > a",
"type": "list"
}
}
}),
});
const data = await res.json();
console.log(data);Data Extraction API with CSS and XPath selectors
The YepAPI Data Extraction API turns a webpage into structured JSON using extraction rules you define with CSS selectors or XPath. Instead of scraping the whole page and parsing the HTML yourself, you specify exactly which fields you want and how to find them, and the API returns clean JSON shaped to match. Your rule keys become the response keys.
This is the precision tool for pages with predictable, repeating structure — product listings, tables, directories, and job boards. When a site's markup is stable, selectors give you fast, deterministic results at the lowest price point. If selectors break too often or you'd rather describe the data in plain English, the AI Scraping API handles unstructured pages without any selectors at all.
What is a data extraction API?
A data extraction API takes a webpage and a set of rules and returns only the specific data points you asked for, as structured JSON. You define each field with a CSS selector or XPath expression — for example, mapping `.title` to a `title` field and `.price` to a `price` field — and the API parses the page server-side and fills in the values. It handles fetching, parsing, and shaping the output, so you skip writing and maintaining HTML-parsing code. Data extraction APIs are ideal when you know a page's structure and want clean, typed records rather than a raw HTML dump, especially across many similar pages with repeating layouts.
Build your own structured scraper
Write one set of rules and reuse it across every page that shares a layout. Extract product names, prices, and image URLs from a catalog; pull business names and contact details from a directory; turn HTML tables into clean arrays for a spreadsheet or database import. List extraction grabs every repeating card in a single call, nested rules capture parent-child records, and attribute extraction pulls link targets and image sources directly. The result is a maintainable scraper where your data shape lives in a small JSON rules object instead of scattered parsing code.
Data Extraction API pricing — from $0.01 per call
Selector-based extraction costs just $0.01 per call with no monthly minimum and no subscription. ScrapingBee gates extraction behind a $49/month minimum and Apify behind a $49/month plan. With YepAPI you pay per request only, so extracting from one page or one million costs exactly proportional to your usage — making selector-based scraping the most economical way to collect structured data at scale.
Selectors versus AI extraction
Selector-based extraction is fast, cheap, and deterministic — the same rules return the same fields every time — which makes it perfect for stable, well-structured pages. The trade-off is that rules break when a site changes its markup, and you maintain a separate rule set per layout. If you're scraping many different sites or pages that change often, the AI Scraping API extracts by natural-language description instead, trading a higher per-call price for zero selector maintenance.
Try the Data Extraction API free
Sign up for $5 in free credit, no credit card required — enough for 500 extraction calls. Test your CSS and XPath rules against real target pages and refine your JSON output before spending a cent.
Start making API calls in 30 seconds
$5 free credit on signup. No credit card required. Pay per call.
What developers say
“Switched from SerpAPI and cut our SERP costs by 80%. Same data quality, way simpler billing.”
“One API key for AI models, SERP data, and web scraping. Saved us from managing 4 separate providers.”
“The $5 free credit let us prototype our entire rank tracking feature before committing. No other API does that.”
Frequently asked questions
Define extraction rules using CSS selectors or XPath expressions and get back structured JSON data. Perfect for scraping product listings, tables, directories, and any page with repeating elements.
Each API call costs $0.01. No monthly minimums or subscriptions — you only pay for what you use.
Sign up for a free API key, then send a POST request to /v1/scrape/extract. Check the code example above for a ready-to-use snippet in JavaScript, cURL, or Python.
YepAPI bundles SEO, AI, and web scraping APIs under one key with no monthly minimums. You get lower per-call pricing, a unified dashboard, and one billing account instead of managing multiple providers.
Ready to integrate?
Get your API key and start making calls in 30 seconds. $5 free credit on signup — no credit card required.
More web scraping endpoints
Scrape
$0.01Scrape any URL and get clean markdown, HTML, or plain text. Fast lightweight scraping for blogs, docs, and static pages from $0.01/call.
JS Scrape
$0.02Scrape JavaScript-rendered pages with a headless browser. Handle React, Vue, and Angular SPAs with full DOM rendering from $0.02/call.
Stealth Scrape
$0.03Scrape protected sites with residential proxies and anti-bot bypass. Handle Cloudflare, Akamai, and rate limiters from $0.03/call.