Stealth Scraping API
Stealth Scraping API — scrape heavily protected sites with headless Chrome on stealth residential proxies, with country targeting and browser scripting. $0.03 per call.
Pricing, live playground and use cases: Stealth Scraping API on YepAPI
/v1/scrape/stealthThe Stealth Scraping API loads the page in headless Chrome over stealth residential proxies, built for sites with aggressive anti-bot protection that block both plain fetches and ordinary headless browsers. Pick the proxy country with country to see localized prices and content, and use the same browser options as the JavaScript Scrape API — js_scenario, wait_for_selector, device, and block_ads.
Try the Web Scraping API first: its smart mode already escalates to premium proxies, and it costs less. Switch to stealth when it returns 502 UPSTREAM_ERROR for a site.
Usage
const res = await fetch('https://api.yepapi.com/v1/scrape/stealth', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://protected-site.com/pricing',
country: 'de',
wait_for_selector: '.pricing-table',
}),
});
const { data } = await res.json();
console.log(data.content);curl -X POST https://api.yepapi.com/v1/scrape/stealth \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://protected-site.com/pricing", "country": "de", "wait_for_selector": ".pricing-table"}'import requests
res = requests.post(
"https://api.yepapi.com/v1/scrape/stealth",
headers={"x-api-key": "YOUR_API_KEY"},
json={"url": "https://protected-site.com/pricing", "country": "de", "wait_for_selector": ".pricing-table"},
)
print(res.json()["data"]["content"])Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
url | string | Yes | Full http(s) URL of the page to scrape (max 4096 characters). Localhost and private IPs are rejected | — |
format | string | No | Output format. One of: markdown, html, text | markdown |
selector | string | No | CSS or XPath selector. Returns only the first matching element — its HTML when format is html, otherwise its text (max 500 characters) | — |
country | string | No | 2-letter country code for the proxy location, e.g. us, de, gb | — |
wait_for | number | No | Extra milliseconds to wait after the page loads, max 15000 | — |
wait_for_selector | string | No | CSS selector to wait for before capturing. Returns 400 if it never appears (max 500 characters) | — |
js_scenario | object | No | Browser actions to run before capture: {"instructions": [...]} or the bare array. Same instructions as JS Scrape except infinite_scroll (max 8000 characters) | — |
device | string | No | Browser profile. One of: desktop, mobile | desktop |
block_ads | boolean | No | Block ads and trackers | false |
camelCase aliases are also accepted: waitFor, waitForSelector, jsScenario, blockAds.
infinite_scroll is not available on stealth — sending it returns a 400. Use scroll_y steps with short waits, or use /v1/scrape/js if the site allows it.
Response
{
"ok": true,
"data": {
"url": "https://protected-site.com/pricing",
"statusCode": 200,
"content": "# Pricing\n\n## Starter\n29 € / month\n\n## Pro\n79 € / month\n\n...",
"format": "markdown"
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data.url | string | Final URL after redirects |
data.statusCode | number | HTTP status code the target page returned |
data.content | string | The page (or the selector match) in the requested format. Empty string if selector matched nothing |
data.format | string | The format used: markdown, html, or text |
data.evaluateResults | array | One result per evaluate instruction. Only present when js_scenario has evaluate steps |
data.jsScenarioReport | object | Per-step report of the scenario (total_duration, task_executed, task_success, task_failure, tasks[]). Only present when js_scenario was sent |
Caching
Results are cached for 1 hour per URL and option set (including country). Repeating the same request within that window returns the cached page.
Errors
| Status | Code | When |
|---|---|---|
400 | VALIDATION_ERROR | url is missing, invalid, or private; format / device / country is invalid; wait_for is over 15000; js_scenario is malformed, too long, uses infinite_scroll, or has an invalid instruction; wait_for_selector never matched; or the URL is a Google page (use /v1/serp/google) |
404 | NOT_FOUND | The target page returned 404 Not Found |
429 | RATE_LIMITED_UPSTREAM | Too many scrapes in flight — retry in a few seconds |
502 | UPSTREAM_ERROR | The site blocked the request or failed to load — retry |
503 | UPSTREAM_TIMEOUT | The page took too long to load (about 25 seconds) — retry |
Failed calls are not charged.
Related Endpoints
- Web Scraping API — smart-mode scrape at $0.01, try it first
- JavaScript Scrape API — headless Chrome with
infinite_scrollsupport - AI Extraction API — turn a page into typed JSON with a prompt or schema