# ScrapeNest API: guide for AI agents
> Use this file to teach an LLM or coding agent how to call the ScrapeNest
> public API. It covers every endpoint, field, error code, credit price and
> limit. A machine-readable spec is at https://scrapenest.dev/openapi.json
> (public, unauthenticated, cacheable for 5 minutes), a short index of every
> docs page is at https://scrapenest.dev/llms.txt, and official client
> libraries are published for Python and Node/TypeScript (see section 6).
Updated: 2026-11-04. API version: v1. SDK version 0.5.2 (Python and Node, package `scrapenest`).
---
## 1. Quick context
ScrapeNest is a paid, metered scraping-as-an-API. One Bearer key gives you:
* A general "fetch any URL" endpoint with optional headless browser and
optional AI extraction.
* Site-specific endpoints that return cleaned JSON (Google Maps reviews,
audio/podcast/YouTube transcripts).
* AI-friendly web search with domain/date/topic filters, deep search
(search + fetch), and RAG-style answer with citations.
* Async job + poll workflow for long-running scrapes, so a single open
HTTP connection isn't a bottleneck.
Every billed response includes `credits_charged` and (where relevant)
`cache_hit` so you can predict cost before you hit production scale. The
free endpoints (`/v1/me`, run polling) and the `202` async-submit body
carry no `credits_charged`. Cache hits are billed at 1 credit. Credits map roughly to $0.0002 USD each on the smallest
plans and trend cheaper at higher tiers.
Base URL: `https://scrapenest.dev`
---
## 2. Authentication
Every `/v1/*` endpoint uses a Bearer token. Sign up at
https://scrapenest.dev/signup and verify the account's email address first:
until it is verified, every call made with the account's keys returns HTTP
403 `email_not_verified`. Google and GitHub sign-ups are verified already,
and https://scrapenest.dev/verify/resend sends a new link. Then mint a key
at https://scrapenest.dev/dashboard/keys. Keys start with `sn_` and are
shown once at creation time.
```bash
curl -X GET https://scrapenest.dev/v1/me \
-H "Authorization: Bearer sn_YOUR_API_KEY"
```
The key is read from the `Authorization` header, or from an `X-API-Key`
header for clients that cannot set `Authorization`. It is never read from
the URL or the JSON body: `?api_key=...` gets a 401 that names the
parameter and says where the key belongs.
If you 401, read `error.message`: it says whether no key was sent, it was
sent in the URL or body, it was cut short, or it matches no live key. Do
not cycle through query parameters or body fields; none are accepted.
If you 402, your credits ran out. Top up at /dashboard/billing. On the Free
plan the error carries `credits_reset_at`, when the monthly credits return.
If you 403 with `email_not_verified`, the account's email address is not
verified yet.
Every response from a billed endpoint carries the balance it leaves in an
`X-Credits-Remaining` header. The account is emailed once when the balance
drops under a fifth of the plan's monthly credits and once if it reaches
zero.
---
## 3. Endpoints
All request bodies are JSON. All responses are JSON. All timestamps are
ISO 8601 UTC unless noted. Most endpoints support a `cache_ttl_seconds`
override on the request (see each endpoint for its accepted range and
default).
Request and response format notes that apply to every endpoint:
* **Null fields are omitted from responses.** Bodies are serialized with
null fields stripped, so a field with no value is absent from the JSON
rather than present as `null`. Read defensively — `body.get("error_code")`
in Python, `body.error_code` in JS — never `body["error_code"]`, which
raises `KeyError`. Every example below shows only the keys that are
actually present. Three places keep their nulls: `/v1/me` returns its
full shape; `proxy_used` on `/v1/scrape/url`, `/v1/scrape/screenshot`
and `/v1/scrape/pdf` is always present (`null` when no proxy was used);
and the free-form objects `extracted`, `structured` and `ai_extract`
carry what the page or the extraction produced, so an `extract_rules`
field that matched nothing is `null` (or `[]` with `"all": true`).
* **Strict booleans on `/v1/scrape/url` and `/v1/scrape/batch`.** On those
two endpoints the bool fields (`force_proxy`, `auto_escalate`,
`block_assets`, `extract`, `include_html`, `return_markdown`,
`block_ads`, `simulate_behavior`, `include_usage`) reject string truthy
values: `"yes"`, `"1"`, `0` will 422. `full_page` on
`/v1/scrape/screenshot` and `landscape` on `/v1/scrape/pdf` are strict
the same way. The other bool fields coerce leniently, but send real JSON
booleans `true` / `false` everywhere instead of relying on that.
* **Cache hits charge `credits_charged: 1`.** When a request matches a
cached response, the response carries `cache_hit: true`, `credits_charged: 1`,
and `usage.breakdown` `{"cache_hit": 1}` regardless of the original
call's cost.
* **CORS (browser clients).** `/v1/*` and `/mcp` share one policy:
no credentials (send the key in `Authorization`, never cookies);
methods GET, HEAD, POST, DELETE, OPTIONS; request headers
`Authorization`, `X-API-Key`, `Content-Type`, `Accept`, `X-Request-Id`,
`X-Client-Integration`, `Mcp-Session-Id`, `MCP-Protocol-Version`,
`Mcp-Method`, `Mcp-Name`, `Last-Event-ID`; exposed response headers
`X-Request-Id`, `Mcp-Session-Id`, `Retry-After`, `X-Credits-Remaining`.
* **Error envelope.** Every 4xx/5xx response is
`{"error": {"code": "...", "message": "..."}}`. Validation errors
also include a structured `details[]` array with `loc / type / msg`
entries describing each invalid field.
### 3.1 GET /v1/me
Returns information about the API key making the request. Free. Accepts GET or
HEAD.
Request:
```bash
curl -X GET https://scrapenest.dev/v1/me \
-H "Authorization: Bearer sn_YOUR_API_KEY"
```
Response:
```json
{
"prefix": "sn_AbCdEfGhi",
"label": "production",
"is_active": true,
"is_internal": false,
"rate_limit_per_minute": 30,
"rate_limit_per_day": 500,
"credit_balance": 842,
"created_at": "2026-05-01T12:00:00Z",
"last_used_at": "2026-05-13T15:24:11Z"
}
```
`rate_limit_*` reflect your current plan (see section 5). Free shown above.
`credit_balance` is your account's remaining credits, and is `null` when the
key has no owning account (typically internal keys).
Credit cost: 0.
---
### 3.2 POST /v1/scrape/url
Fetches a single URL and returns extracted JSON. Use this when no dedicated
endpoint exists for the site.
Required:
* `url`: absolute http(s) URL.
Optional:
* `render`: `"auto"` (default), `"direct"` (plain HTTP through a proxy,
cheap, no JS), `"browser"` (headless browser, slower but bypasses
JS-only pages), or `"stealth"` (maximum anti-bot bypass that defeats
the toughest bot defenses, 40 credits).
* `force_proxy`: `false` by default. Set `true` to force a higher-tier
proxy (use when the site geo-blocks cheaper sources).
* `auto_escalate`: `true` by default. When an `auto` or `browser` fetch is
refused by the target's anti-bot, we automatically retry once in stealth
mode. `render: "direct"` is a hard tier pin and never escalates, and
neither does `render: "stealth"` (already at the top tier). Escalation
also needs at least 20s left on the request budget, so a low
`timeout_seconds` (e.g. 20) disables it in practice. You are only
charged the stealth rate if the retry succeeds; a request that stays
blocked is free. The response sets `escalated: true` when this happened.
The same flag also gates two cheaper fallbacks: a page still refused
after that gets one retry as a plain (non-browser) HTTP client unless
you set your own `User-Agent`, and on `render: "auto"` a page that comes
back as an empty JavaScript shell gets one browser render (billed at the
browser tier only if it delivers content). Set `false` to keep the
original tier and get the block as-is.
* `timeout_seconds`: `~100` by default (accepts 1-120). Hard time budget
for the whole request including any render-slot wait and any
auto-escalation retry. Lower it (e.g. 20, or a few seconds for quick
page reads) to fail fast on hard targets; raise it for slow stealth
solves. On timeout, `success` is `false` and `error_code` is `timeout`.
* `block_assets`: `true` by default. Blocks images/fonts/media during
rendering to save bandwidth and time.
* `extract`: `true` by default. Runs readability + JSON-LD extraction so
you get clean `title`, `description`, `text`, `structured`. Set to
`false` to get raw HTML in `text`.
* `ai_query`: natural-language extraction prompt (up to 2000 chars).
Example: `"return the product name, price, and rating"`. When set, the
response includes an `ai_extract` field with the AI's answer. Adds 5
credits, billed only when the page is delivered and the extraction
runs; a failed extraction sets `ai_extract_error` and adds nothing.
* `ai_extract_schema`: JSON Schema object constraining `ai_extract` to a
typed object. Used together with `ai_query`. Max 10 KB serialized.
Example:
`{"type":"object","properties":{"name":{"type":"string"},"price_usd":{"type":"number"}}}`.
* `include_usage`: `false` by default. When `true`, the response
includes a `usage` block with credit totals and breakdown.
* `include_html`: `false` by default. When `true`, the response includes
a raw `html` field with the page source as received from the target
(before extraction). Use this when you want both cleaned text and the
raw markup in one call. No extra credits.
* `return_markdown`: `false` by default. When `true`, the response
includes a `markdown` field with the page converted to Markdown.
The raw `html` field still needs `include_html`. No extra credits.
* `markdown_mode`: `"main"` by default: the Markdown covers only the main
content (navigation, headers, footers, sidebars, forms and inline
`data:` images dropped; tables kept). It also drops language-selector
link lists anywhere and link-dense lists or control widgets that come
before the first real content block. `"full"` converts the whole page.
Also decides what `ai_query` reads.
* `github_api`: `false` by default. For github.com repository URLs, reads
GitHub's API and raw file host instead of rendering the page. Repo
root: metadata (description, stars, forks, language, topics, license,
default branch, last push, homepage, archived), top-level files and
README. `/tree/{ref}/{path}`: that directory's listing and README.
`/blob/{ref}/{path}`: the raw file (first 1 MB). `/issues/{n}` and
`/pull/{n}`: title, state, author, body and the first 30 comments.
Content is in `text` (and `markdown`), structured fields in
`structured.github`, `method` is `"github_api"` and `final_url` is the
URL you sent. Billed as a plain fetch (1 credit). Other URLs, private or
missing repos and GitHub failures fall back to the normal page fetch;
under GitHub's API rate limit, metadata and listings are omitted while
READMEs and files are still served. Ignored when `include_html`,
`extract_rules` or `ai_query` is set.
* `max_chars`: `null` by default (200-2000000). Bounds `text` and
`markdown`. Longer content comes back as a window. Whenever `text` is
returned the response carries `text_total_chars` (the full length), plus
`next_offset` when more follows (`markdown_total_chars` /
`markdown_next_offset` likewise for `markdown`). Windowing is free and
works on cached pages.
* `offset`: `0` by default. Where the window starts; send back
`next_offset` to read on.
* `focus`: terms, identifiers or a "quoted phrase". When the content
exceeds `max_chars`, returns the best-matching passages in page order,
joined by `[... N chars skipped ...]` markers, instead of the start.
* `extract_rules`: `null` by default. Map of field name to CSS selector
for in-response extraction. Each value can be a selector string
(returns first match's text) or an object
`{"selector": "...", "attr": "href", "all": true}` for attribute
values or lists. Result in the `extracted` field. Implies
`include_html`. Max 50 rules. No extra credits.
* `wait_ms`: `null` by default. Extra wait (0-10000 ms) after load
before reading the DOM. Browser render only.
* `wait_for_selector`: `null` by default. CSS selector to wait for
before returning. Browser render only.
* `wait_for_timeout_ms`: `5000` by default (100-30000). Max ms to
wait for `wait_for_selector`.
* `window_width` / `window_height`: viewport dimensions for the
browser. Defaults 1280x720. Browser render only. `viewport_width` /
`viewport_height` are accepted as aliases.
* `country`: ISO 3166-1 alpha-2 (2 chars; a code that isn't a real
country is rejected with 422). Routes the fetch through a residential
exit in that country and bills at the residential tier (10, or 40 with a
browser render). Which countries are available depends on the
residential exits in the pool when the call runs, so no fixed list is
published and none can be queried. A successful response reports the
exit's country in `exit_country`. There is no fallback to another
country: a code with no residential exit right now is refused with HTTP
422 `country_unavailable` (`retryable: false`, not billed), so trying a
country you are unsure of costs nothing. Omit `country` or pick another.
* `device`: `"desktop"` (default) or `"mobile"`. Mobile sets a
mobile User-Agent and a 390x844 viewport. Browser render only.
* `block_ads`: `false` by default. When `true`, blocks known ad and
tracker domains during the fetch. Browser render only.
* `simulate_behavior`: `false` by default. When `true`, adds
mouse-move + scroll motion before extraction to fool behavioral bot
detectors (PerimeterX, DataDome, Akamai BMP). Adds ~200-600ms.
Browser render only.
* `session_id`: opaque sticky-session id (1-64 chars, `[A-Za-z0-9_.-]`).
Repeated requests with the same id reuse the same exit IP for ~10
minutes. Use for multi-step login flows, shopping carts, or any
workflow that needs IP continuity. Forces a higher-tier proxy and
disables caching. Billed at the proxy tier actually used for the fetch.
The id is private to your account: another account that sends the same
id gets a session of its own, never your exit IP or cookies.
* `cookies`: object `{name: value}` (up to 50 entries). On this
endpoint cookies are a `{name: value}` mapping only. The
`[{name, value}]` list form is rejected here (it is accepted on
`/v1/scrape/screenshot` and `/v1/scrape/pdf`). Cookies are injected
into the browser context before navigation.
* `headers`: object `{name: value}` (up to 30 entries). Extra request
headers: set `User-Agent`, `Referer`, etc. `Host`, `Content-Length`,
`Connection`, `Transfer-Encoding` are stripped.
* Header and cookie names must be HTTP tokens, and values may not
contain CR, LF or other control characters (tab is allowed in header
values; `;` is not allowed in cookie values). Anything else is refused
with `422 validation_error` naming the field. The same rule applies on
screenshot and pdf.
* `cache_ttl_seconds`: `0-86400`. Default is 900 (15 minutes). Only
successful fetches are cached, and any `session_id`, `cookies`,
`headers` or credentials in the URL turn caching off for it.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/scrape/url \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/article","render":"auto"}'
```
Login-flow example (sticky session + cookies). Step 1 logs in with a
`session_id` you choose; step 2 reuses the same id (and therefore the same
exit IP) for ~10 minutes so the target site sees a coherent session:
```bash
curl -X POST https://scrapenest.dev/v1/scrape/url \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/dashboard",
"session_id": "user42_login",
"cookies": {"session": "abc123def456"}
}'
curl -X POST https://scrapenest.dev/v1/scrape/url \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/dashboard/orders",
"session_id": "user42_login"
}'
```
Response:
```json
{
"success": true,
"url": "https://example.com/article",
"final_url": "https://example.com/article",
"status_code": 200,
"method": "fetch",
"proxy_used": "datacenter",
"elapsed_ms": 312,
"title": "Example Article",
"description": "Lead summary...",
"text": "Cleaned article body...",
"structured": {"canonical": "https://example.com/article", "jsonld": [{"@type": "Article", "headline": "Example Article"}]},
"cache_hit": false,
"escalated": false,
"credits_charged": 1
}
```
Response field notes:
* `text` is the readability extraction. When that comes back short (under
1,500 chars) and is a small fraction of the page's detected main content,
the main content is returned instead.
* `title` is the document's `
`, or its first `` when it has
none; it is absent when the page has neither (plain text, JSON,
robots.txt).
* `structured` holds the page metadata: Open Graph tags, `canonical`,
JSON-LD blocks (`jsonld`), links and images, each only when the page has
them.
* `structured.product` appears when the page declares a product (schema.org
Product JSON-LD, microdata, or `og:`/`product:` meta): `name`, `price`,
`currency`, `rating`, `review_count`, `brand`, `availability` as
declared (each only when present), and `source` (`"jsonld"`,
`"microdata"` or `"meta"`).
* `cache_hit: true` also covers a page our fetch service answered from its
own page cache: it is billed at the cache-hit rate (1) and never
escalated, while `method` / `proxy_used` name the tier that originally
fetched it.
* `proxy_used`: the proxy tier that served the request (`"datacenter"`
or `"residential"`), or `null` when no proxy was used. Always present,
on failures too.
* `exit_country`: lowercase country code of the exit, set when `country`
was requested and the fetch succeeded.
* `method: "none"` means nothing was fetched: the host does not resolve in
DNS (`connection_failed`, free). When `error` says the lookup failed
temporarily, retry; otherwise check the hostname.
* Credentials in the URL (`https://user:pass@host/`) are sent to the
target, but `url` and `final_url` come back without them, and such a
request is never answered from or stored in a cache. The same holds on
batch, screenshot, pdf and audio.
IMPORTANT: this endpoint returns HTTP 200 even when the target blocks the
fetch or serves no content. Always branch on the top-level `success`
boolean, not the HTTP status. When `success` is `false`, the content
fields are absent and `error_code` is one of: `anti_bot_block` (anti-bot
refused, including a 200 page that is a captcha, a consent prompt with
nothing behind it, a one-button interstitial or a generic error page;
already retried in stealth unless `auto_escalate:false`; once three
requests in a row to one host have ended this way with every method
tried, the next ones to that host are answered at once, `method: "none"`,
for a few minutes, after which the host is tried again),
`timeout` (exceeded the time budget; raise `timeout_seconds`),
`not_found` (target 404/410), `empty_response` (no usable content),
`rate_limited` (the target answered 429 without an anti-bot challenge;
slow down for that site), `connection_failed` (the host does not resolve
in DNS, or `render: "direct"` could not connect to the target; the latter
is not transient at that tier, so switch to `"auto"` or `"stealth"`
rather than retrying), or `upstream_failed`
(transient fetch error, or the target answered a bare 503; retry). With
`render: "direct"`, a fetch that got no page at all is reported as
`anti_bot_block` (a discarded challenge) or `connection_failed`, with
`method: "fetch"`. Blocked and empty fetches are free. `escalated: true`
means we auto-upgraded to stealth to get past a block, and
`credits_charged` reflects the stealth rate. Two failures come back as a
real error envelope instead: `422 country_unavailable` (no exit for
`country`; not retryable) and `503 upstream_failed` (with `Retry-After`)
when the fetch service itself can't run the request. Neither is billed.
Credit cost:
* Direct + no proxy: 1
* Direct + premium proxy: 10
* Browser (headless) + no proxy: 5
* Browser (headless) + premium proxy: 40
* `render=stealth` (maximum anti-bot bypass): up to 40. It is billed by
the lane that served it, at the rates above: a Cloudflare bypass with
no proxy is 5, residential HTTP 10, a residential browser 40. `method`
and `proxy_used` show which. A request that stays blocked is free.
* `ai_query` adds: 5
* Delivered 404/410 (page reached, not found): 1
* Undeliverable (we couldn't reach the page): 0
* Cache hit (ours or the fetch service's page cache): 1
---
### 3.3 POST /v1/search
AI-friendly multi-engine web search. No fetching, just the SERP.
Required:
* `query`: 1-400 chars.
Optional:
* `num_results`: 1-50, default 10.
* `language`: IETF BCP 47 tag, default `"en"` (e.g. `"en"`, `"pt-BR"`,
`"zh-Hans"`, `"es-419"`, `"sr-Latn-RS"`). Case and `_` are accepted and
deprecated codes (`iw`, `in`, `no`, `tl`) are resolved. A script is
searched in the region the engines know for it (`zh-Hans` as `zh-CN`,
`zh-Hant` as `zh-TW`); an unrecognized language is searched in English
and `note` says so.
* `time_range`: `"day"`, `"week"`, `"month"`, `"year"`.
* `start_date` / `end_date`: `"YYYY-MM-DD"` filters for explicit ranges.
Both date filters are also enforced on the results by publication date:
a dated result outside the window is removed, and a result with no
publication date is kept after the dated ones and counted in `note`.
* `topic`: `"general"`, `"news"`, `"research"`, `"code"`, or omitted.
Omitted searches the whole web and auto-detects news intent: news
results are then ranked together with the web results and hold at most
half of the slots. `general` searches the whole web and never
auto-routes to news; an explicit `engines` list or `categories`, or
`depth: "fast"`, also turns auto-routing off. `news` pins the news
vertical: its results never come from the web engines, and words such
as "news", "breaking" or "latest" are not held against a story that
doesn't repeat them. When the news engines return nothing without a
date range (Bing News does this for queries like "breaking news
today"), the news vertical is searched again for the past month and
`note` says so.
`research` searches academic literature (Crossref, OpenAlex, PubMed)
and returns papers with DOIs rather than web pages. `code` adds
GitHub, Stack Overflow, Hacker News, and MDN to the general web
engines (the results are ranked together, so official documentation
stays in reach). `"finance"` is not supported.
* `depth`: `"fast"`, `"balanced"` (default), `"thorough"`, `"stealth"`.
On `/v1/search` the tier sets the engine mix: `fast` = Bing only
(~0.5s, lowest coverage); `balanced` = Bing + DuckDuckGo + Brave;
`thorough` and `stealth` = Bing + Google + DuckDuckGo + Brave, which
waits up to ~6s for a cold Google render (about 5.4s on the default
budget), within `timeout_seconds` (below); if Google isn't ready by then, `gserp_status` says so and the other
engines' results are returned (repeat queries are cached and fast).
`thorough` and `stealth` are equivalent on `/v1/search`. The tier
matters most on `/v1/search/deep` (see 3.4), where it governs the
per-page fetch budget and anti-bot escalation.
* `timeout_seconds`: `0.1-20`, default `5` (`6` at depth `thorough` and
`stealth`). The total retrieval budget for
the call, shared by the engine lanes and any retry or second pass; work
that doesn't fit is skipped and the call returns what it has (with
`partial` / `gserp_status` explaining any gap). If the budget runs out
before any engine answers, the call still returns 200 with empty
`results`, `partial: true`, `error: "search_deadline_exceeded"`, a
`note`, and 0 credits (allow at least 1s). An engine failure well inside
the budget is a `503 upstream_failed`, also unbilled.
* `page`: 1-based result page, default 1, max 20. `page=2` returns the
next `num_results` results with no repeats from earlier pages. The
engines give at most 50 results for one query, so a page past the last
result comes back empty with a `note` saying so and bills 0. Only
`/v1/search` pages; `/v1/search/deep` and `/v1/search/answer` ignore
`page` and always read the first page.
* `engines`: array picking which engines to query. Valid values:
`"google"`, `"duckduckgo"`, `"bing"`, `"brave"`, `"bing news"`,
`"duckduckgo news"`, `"crossref"`, `"openalex"`, `"pubmed"`,
`"github"`, `"stackoverflow"`, `"hackernews"`, `"mdn"`. Up to 8
entries, must be non-empty. Pass `null` or omit to use the default
mix, which follows `depth`: `fast` = bing; `balanced` = bing +
duckduckgo + brave; `thorough`/`stealth` = bing + google + duckduckgo +
brave. When
`time_range` is set, bing is dropped from the default (its scraper
silently discards the date filter), leaving duckduckgo + brave — or
google + duckduckgo + brave on `thorough`/`stealth`. That swap is silent; it is
not reported in `note`. Bing is the most reliable scraper-friendly
engine; DuckDuckGo honors `site:` filters; Brave is a second
independent index. The news values pull
straight from the news vertical (the same lane `topic="news"` routes
to); `crossref`/`openalex`/`pubmed` are the `research` vertical and
`github`/`stackoverflow`/`hackernews`/`mdn` the `code` one. An explicit
list is honored verbatim: no depth-based mix, no `time_range` swap, no
retry with other engines, and only rows those engines returned. When it
returns fewer results than asked for, `note` names each requested engine
that came back empty or failed (its state is in `engine_status`); omit
`engines` to get the default mix, which tops up thin results.
The same values work on `/v1/search/deep` and `/v1/search/answer`, where
an explicit list also wins over `topic`.
Brave is in the default mixes only while the operator's Brave switch is
on; when it is off the defaults drop Brave silently (an explicit
`"brave"` is still sent).
* `country`: ISO 3166-1 alpha-2 (2 chars, e.g. `"us"`, `"de"`, `"jp"`)
to bias results toward that region.
* `include_domains`: array of up to 15 domains. Results are restricted
to these (e.g. `["nytimes.com","bbc.co.uk"]`). The 15-entry cap is
set by Google/Bing, which reject queries with more `site:` clauses.
* `exclude_domains`: array of up to 15 domains to filter out.
* Query operators: a literal `site:example.com`, `(site:a.com OR
site:b.org)` or `-site:example.com` in `query` is enforced exactly like
`include_domains` / `exclude_domains` (merged with them), and results
whose title, snippet or URL words (host and path) contain a `-word`
(including its plural and possessive forms, or the singular of a
negated plural) or a `-"phrase"` are dropped. If every result matches,
they are all kept, since the engines were already asked to exclude it.
* `include_images`: `false` by default. When `true`, the response also
carries an `images` array with image results.
* `include_image_descriptions`: `false` by default. When `true` and
`include_images` is on, populates each image's `description` field with
alt-text or caption when available.
* `image_sources`: array of sources to query for images. Defaults to
`["bing"]` (fast, 5 credits). Add `"brave"` for a wider catalogue at
+40 credits. Example: `["bing", "brave"]`. Order doesn't matter;
results are merged and deduped on the image URL. Image sources start
together with the web search and run concurrently: Bing within the
request's `timeout_seconds`, Brave (a real-browser render, ~8s) within
its own budget of max(`timeout_seconds`, 12s), so a request asking for
Brave images can take up to ~12s. A source is billed only when it adds
at least one image; one that times out or returns none is named in
`note`, not billed, and a timeout marks the response `partial`.
* `include_usage`: `false` by default. When `true`, the response carries
a `usage` block with credit totals.
* `categories`: comma-separated category filter. Supported values are
`general`, `news`, `science`, `it`, `images`; anything else is
rejected with a 422 rather than silently ignored. Prefer `topic`,
which maps onto these.
* `cache_ttl_seconds`: `0-86400`. When omitted, the TTL is chosen from
query intent rather than a fixed default: time-sensitive queries
(weather, markets, scores, flights, "today"/"latest"/"breaking", news
intent) cache for 1 hour, everything else for 24 hours. Pass `0` to
force fresh data when you're diffing or change-detecting. The same rule
applies to `/v1/search/deep` and `/v1/search/answer`.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/search \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"climate report 2026 ipcc","num_results":10}'
```
Response:
```json
{
"query": "climate report 2026 ipcc",
"results": [
{
"position": 1,
"url": "https://...",
"title": "...",
"snippet": "...",
"engine": "bing",
"engines": ["bing", "brave", "duckduckgo"],
"score": 1.0,
"published_at": "2026-04-12T14:30:00Z"
}
],
"took_ms": 318,
"cache_hit": false,
"credits_charged": 5,
"unresponsive_engines": [],
"engine_status": {
"bing": {"status": "ok", "results": 10},
"duckduckgo": {"status": "ok", "results": 10},
"brave": {"status": "ok", "results": 9}
},
"engine_counts": {"bing": 10, "duckduckgo": 10, "brave": 9},
"partial": false
}
```
Empty optional collections (`images`, `suggestions`, `answers`,
`infoboxes`, `usage`, `note`) are omitted entirely. They appear only
when the upstream actually returned something. Individual result fields
follow the same rule: `published_at` and `thumbnail` are absent, not
`null`, when the engine didn't report them.
Coverage diagnostics, always present: `partial` (bool; true when an engine
lane failed or timed out, when a requested Google render was `pending`,
`busy`, `blocked` or `failed`, or when optional image search ran out of
time — coverage is incomplete. Never set merely because Google is
`unavailable`, a standing "no usable exit" condition reported on every
response while it lasts) and `unresponsive_engines` (`[engine, reason]`
pairs, `[]` when none). When there is something to report: `error`,
`gserp_status` (Google's state on the render tiers: `pending`, `cold`,
`empty`, `blocked`, `failed`, `deadline_exceeded`, `busy`, or
`unavailable`, each also explained in `note`), and `engine_status`
(`{"bing": {"status": "ok", "results": 10}, "duckduckgo": {"status":
"empty", "results": 0, "reason": "no_results"}, ...}` with status `ok`,
`empty`, `pending`, `unavailable` or `failed`, merged across every lane
the search ran), `engine_counts`, `engine_failures` and
`number_of_results`. An empty `results` with `partial: false` means the
engines answered and found nothing; with `partial: true` it means some of
them did not answer.
Caching of degraded responses: a `partial` response is normally not
cached, so an identical retry runs fresh. The exception is a response
that is partial only because Google is `busy` or `unavailable`: that is
the best the other engines can give while it lasts, so it is cached for
at most 10 minutes. Empty responses are never cached.
With `include_images: true` the response adds an `images` array
(`results` keeps the same shape as above):
```json
{
"query": "northern lights iceland",
"results": [],
"images": [
{
"url": "https://.../aurora.jpg",
"thumbnail": "https://.../aurora_thumb.jpg",
"title": "Aurora over Reykjavik",
"source_url": "https://...",
"width": 1920,
"height": 1080
}
],
"took_ms": 318,
"cache_hit": false,
"credits_charged": 10
}
```
Field notes:
* `engine` is the primary search engine that surfaced this URL. `engines`
lists every engine that returned the same URL. When a result is
confirmed by Bing + DuckDuckGo + Google, it's a stronger relevance
signal than a Google-only hit.
* `published_at` is ISO 8601 in UTC (`"2026-10-29T14:03:00Z"`). It is the
engine's own timestamp, or the age the engine shows for the result (a
news engine's "6 hours ago", counted back from when the engine answered,
or the date it shows for older stories), or a date at the start of the
snippet. It is null only when nothing dates the result. Useful for
filtering recent news without a manual regex.
* The query reaches the engines as written. When an engine corrects its
spelling and searches the correction instead (DuckDuckGo turns
"capitol of austrlia" into "capital of australia"), results for the
correction are kept next to those for the query as written and `note`
names it. When an engine only suggests a spelling and almost nothing
matched, the suggestion is searched once on the same engines and
`note` says so.
Credit cost: 5 per call, plus +5 (bing) / +40 (brave) for each image
source that returned images. 0 when no results and no images are
delivered (including a page past the last result, or a
`search_deadline_exceeded` response). Cache hit: 1.
---
### 3.4 POST /v1/search/deep
Search + fetch the top N pages in one round trip. Returns the same SERP
plus the cleaned text of each top result.
One call, not two: `results` here is the same ranked list `/v1/search`
returns for the query. Do not call `/v1/search` and then `/v1/search/deep`
for the same query; that pays for the search twice and adds nothing.
Same params as `/v1/search` (including all the filter, image, engine and
usage flags; `page` is accepted but ignored, deep always reads the first
page), plus:
* `fetch_top`: 1-10, default 5.
* `render`: `"auto"`, `"direct"`, `"browser"`. There is no `"stealth"`
render on deep search — stealth-level anti-bot is reached through
`depth="stealth"` (below), which escalates only the pages that get
blocked instead of forcing the bypass on every fetch. This differs from
`/v1/scrape`, where `render="stealth"` forces the bypass on the one URL.
An explicit `render` is honoured at every depth; left unset, pages are
fetched `direct` on `fast`/`balanced` and `auto` on
`thorough`/`stealth`. A `browser` render gets at least 10s per page,
and when `timeout_seconds` is left unset the call's budget grows to fit
one render round (14s; 18s at depth `stealth`). An explicit
`timeout_seconds` still caps the call. When fewer pages than
`fetch_top` come back, `note` says how many ran out of time, could not
be fetched, or did not match the query's subject.
* `depth`: `"fast"`, `"balanced"` (default), `"thorough"`, or
`"stealth"`. On deep search `depth` governs the per-page fetch
budget and anti-bot effort. `fast` (~2.5s/page) and `balanced`
(~3.5s/page) fetch every page in parallel with no anti-bot escalation
— bot-walled pages fall back to their SERP snippet. `thorough`
(~6s/page) and `stealth` (~12s/page, maximum anti-bot bypass) escalate
blocked pages through the real-browser bypass for higher coverage on
protected sites. `thorough` and `stealth` also wait up to ~4s for a
cold Google render before picking the pages, and only when the budget still
leaves the page fetches their full time.
* `timeout_seconds`: `0.1-20`. Omitted, the whole call (SERP + page
fetches + retries) gets the tier's budget: ~4.5s `fast`, ~10s
`balanced`, ~11s `thorough`, ~18s `stealth`. A value lowers that budget
(it never raises it). If the page-fetch phase fails or runs out of
time, the call falls back to search results only (empty `pages`, a
`note` says so, billed as a plain search) rather than erroring. With
under ~2s of budget left there is no page fetch at all: the call
returns search results only with `partial: true`; if your
`timeout_seconds` leaves too little for even that, it returns 200 with
empty `results`, `partial: true`, `error: "search_deadline_exceeded"`
and 0 credits.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/search/deep \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"how does retrieval-augmented generation work","fetch_top":3}'
```
Response (abbreviated):
```json
{
"query": "how does retrieval-augmented generation work",
"results": [],
"pages": [
{"url":"https://...","final_url":"https://...","status":200,"method":"fetch","title":"...","text":"...","elapsed_ms":640}
],
"took_ms": 8120,
"fetched_count": 3,
"cache_hit": false,
"credits_charged": 20
}
```
The `results` array (omitted above for brevity) carries the same SERP shape
as `/v1/search`, capped at `num_results`. Each page reports `method`
(`fetch`, `browser`, `stealth`, `cf_bypass`, or `unknown`), `status`,
`final_url`, and `elapsed_ms`. A page that couldn't be fetched carries an
`error` string instead of `text`.
Which pages count: a fetched page is counted in `fetched_count` and
billed only when it is on the query's subject and usable, i.e. it has at
least 200 characters of text and is not a bot wall, consent gate, login
redirect or not-found page. An unusable page is returned with its text
removed and `error` set to `blocked`, `not_found` or `no_content`. An
off-subject page is dropped from `pages` and counted in `note`. While the
budget allows, each discarded page is replaced by fetching the next
on-subject result.
Credit cost: `5 + 5 x pages_fetched` (usable, on-subject pages only),
plus the image add-ons (+5 bing, +40 brave) for each image source that
returned images. Pages that fail to fetch or are discarded are not
counted. When the call delivers nothing at all — no SERP results, no
fetched pages, no images — the base 5 is dropped too and the call is free.
Cache hit: 1. A response is cached only when at least one page was
fetched and it is not `partial`. The same coverage diagnostics as
`/v1/search` (`partial`, `gserp_status`, `engine_status`, ...) are
returned.
---
### 3.5 POST /v1/search/answer
RAG-style: searches the web, fetches the top sources, then asks an LLM to
write a cited answer. Returns the answer plus `[1]`-style citations
mapping to the source URLs.
Same search params as `/v1/search` (`page` is accepted but ignored),
plus `render` (`"auto"`, `"direct"`, `"browser"`) and `max_sources` (1-10,
default 5) in place of `fetch_top`. Image flags (`include_images`,
`image_sources`, `include_image_descriptions`) are REJECTED here with 422.
Use `/v1/search` if you need images. Differences from deep search:
* `depth` sets the page-fetch effort for the sources: `fast` ~2.5s/page
with no escalation, `balanced` ~6s/page, `thorough` ~9s/page, `stealth`
~12s/page, each within an overall fetch ceiling of ~6s / 14s / 20s /
28s. Raise it when answers come back grounded in snippets. The answer
model then runs after that. `thorough` and `stealth` also wait up to
~4s for a cold Google render before choosing the sources.
* `render`: an explicit value is honoured at every depth (a `browser`
render gets at least 10s per page and a fetch budget of at least 14s);
left unset, sources are fetched
`direct` on `fast` and `auto` otherwise.
* A bot wall, consent gate, login redirect, not-found page or page under
200 characters is not used as a fetched source: that source falls back
to its search snippet and is neither counted nor billed, and while the
budget allows the next on-subject result is fetched in its place.
* `timeout_seconds` is accepted (0.1-20) but has no effect here.
* No coverage diagnostics are returned; `note` carries the adjustments.
* A response is cached only when at least one source page was fetched.
* When none of the retrieved sources is relevant to the question, the
model is not called: `answer` is the fixed text "No relevant sources
were found for this question: none of the retrieved pages address it,
so no answer was generated.", `citations` is empty, and the call bills
5 with a `note`.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/search/answer \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"is the new gpt-5 multimodal","max_sources":4}'
```
Response (abbreviated):
```json
{
"query": "is the new gpt-5 multimodal",
"answer": "Yes. GPT-5 supports text, image, audio... [1][2]",
"citations": [
{"index":1,"url":"https://openai.com/...","title":"...","snippet":"..."}
],
"took_ms": 7550,
"cache_hit": false,
"credits_charged": 30
}
```
Credit cost: `5 + 5 x sources_fetched + 15` — 5 for the search, 5 per cited
source whose usable page text was fetched, and a 15-credit answer overhead.
A source that falls back to its search snippet is not counted. The call
bills a flat 5 instead when:
* No source page could be fetched at all: the answer is grounded in
search-result snippets rather than full page text, so the overhead is
waived and `note` says so.
* No source is relevant: the fixed "No relevant sources were found..."
answer above, with no model call.
* Non-answer: the answer's first sentence says the sources don't address
the question. Only the first sentence is read, so a real answer that
notes a gap later is billed normally, and a non-answer followed by an
attempted answer is billed as a non-answer. `note` explains why.
Cache hit: 1. Calls that error (`no_sources`, `llm_upstream_failed`,
`upstream_failed`) are not billed.
---
### 3.6 POST /v1/translate
Translates text between languages.
Required:
* `text`: 1-5000 chars.
* `target`: language code (`"es"`, `"ja"`, `"de"`, etc.). Accepts BCP-47
tags: region and script subtags are dropped (`"de-DE"`, `"es-419"`,
`"pt-BR"`), Chinese maps to `zh-hans`/`zh-hant`, and underscore forms
like `"en_US"` work.
Supported: ar, cs, da, de, el, en, es, fi, fr, he, hi, hu, id, it, ja,
ko, nb, nl, pl, pt, ro, ru, sv, th, tr, uk, vi, zh-hans, zh-hant.
Chinese: `zh`, `zh-CN`, `zh-SG` mean Simplified (`"zh-hans"`);
`zh-Hant`, `zh-TW`, `zh-HK`, `zh-MO` mean Traditional and come back as
target `"zh-hant"` (served by the LLM translator; if it is unavailable
the text is machine-translated to Simplified and `target` and `note`
both say `"zh-hans"`, so the metadata always matches the script).
An unsupported target is `422 validation_error` with `details[]` naming
the field; the message lists the supported codes.
Optional:
* `source`: default `"auto"` (auto-detect). Same codes and aliases; an
unsupported source is also a `422 validation_error`. When the
auto-detected language isn't supported the call is
`400 unsupported_detected_source`; pass `source` explicitly.
* `include_usage`: `false` by default. When `true`, response includes
a `usage` block.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/translate \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hello world","target":"ja"}'
```
Response:
```json
{
"translated": "こんにちは世界",
"detected_source": "en",
"target": "ja",
"credits_charged": 1
}
```
Fields:
* `translated`: the translated text.
* `detected_source`: language detected (BCP-47).
* `target`: echoes the requested target.
* `note`: non-null when behaviour was adjusted (source equals target,
alias applied, fallback detector ran).
* `credits_charged`: 1 per call, or 0 when source equals (or
auto-detects to) target, since no translation is performed in that case.
Credit cost: 1 per call. 0 when source equals target.
---
### 3.7 POST /v1/audio/transcript
Timestamped transcript of any audio source. Supports podcast episodes
(Apple Podcasts or Overcast episode pages, or an episode's audio file URL
from an RSS feed; feed URLs are not accepted), YouTube (captions when
available, else audio transcription), X Spaces, SoundCloud, Facebook
video, TikTok, and direct MP3/M4A/WAV/OGG links.
Required:
* `url`: source URL.
Optional:
* `language`: ISO 639-1 hint (`"en"`, `"es"`).
* `cookies`: Netscape-format cookies.txt content as a single string (only
needed for some YouTube fallbacks; use a burner Google account, never
your personal one). Cookies are written to a request-scoped tempfile,
used once, then deleted. Never logged or cached.
* `include_usage`: `false` by default. When `true`, the response
includes a `usage` block with credit totals.
* `cache_ttl_seconds`: 0-2592000, default 30 days. Forced to 0 when
`cookies` is set.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/audio/transcript \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://podcasts.apple.com/us/podcast/.../id..."}'
```
Response (abbreviated):
```json
{
"url": "...",
"audio_url": "https://traffic.megaphone.fm/....mp3",
"canonical_url": "https://podcasts.apple.com/us/podcast/.../id...",
"title": "Episode title",
"channel": "Show name",
"thumbnail": "https://is1-ssl.mzstatic.com/.../artwork.jpg",
"duration_seconds": 3618.2,
"language": "en",
"source": "apple_podcasts",
"chunks": [
{"start": 0.0, "end": 4.2, "text": "Welcome back to the show..."}
],
"text": "Welcome back to the show... [full transcript]",
"took_ms": 41200,
"cache_hit": false,
"credits_charged": 620
}
```
`chunks` is omitted when the underlying resolver returned a transcript
without segment timestamps (some caption sources, plain-text fallback).
If part of a long recording still can't be transcribed after retries,
the response returns the rest with `partial: true` and `missing_ranges`
(`[start, end]` spans in seconds). Only the covered time is billed, and a
partial result is never cached, so a retry runs fresh. Neither field is
set on a complete transcript.
Credit cost: 20 per 2 minutes of audio (rounded up). Minimum 20 per call.
A partial transcript bills only the covered time.
YouTube sign-in gates: age-gated videos, and others YouTube shows only to
a signed-in viewer, return a `login_required` error. When that happens the
error `message` instructs you to pass `cookies` (Netscape cookies.txt
format) in the next request. The resolver writes them to a request-scoped
tempfile, uses them once, then deletes the file before responding. Use a
burner Google account, never your personal one.
A YouTube bot check is not a sign-in gate. It is retried on other routes
first; if every route meets it, the error is `audio_resolve_failed` with a
5xx status, which is safe to retry.
If the source requires downloading and processing the full audio file
(long YouTube videos, full podcast episodes), the synchronous call can
exceed the 100s edge timeout and fail with HTTP 524. Use the async variant
below for anything you expect to take more than ~80 seconds end-to-end.
---
### 3.8 POST /v1/audio/transcript/async
Identical request shape to `/v1/audio/transcript`. Returns `202` with a
`run_id` immediately; poll `GET /v1/scrape/runs/{run_id}` for the
completed transcript.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/audio/transcript/async \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://www.youtube.com/watch?v=...","language":"en"}'
```
Response (202):
```json
{
"run_id": "f0e0c0a0-1234-5678-9abc-def012345678",
"status": "queued",
"status_url": "/v1/scrape/runs/f0e0c0a0-1234-5678-9abc-def012345678",
"created_at": "2026-05-14T16:00:00Z",
"expires_at": "2026-05-21T16:00:00Z"
}
```
Then poll `/v1/scrape/runs/{run_id}` until `status="completed"`; the
synchronous response body lives in `result`. Failed runs are not billed.
Concurrency cap (applies to every `/async` endpoint): your plan limits how
many runs may be `queued` or `running` at once — free 2, starter 5,
growth 15, pro 40, scale 100. Submitting past the cap returns
`429 too_many_active_runs` with `Retry-After: 30`. Wait for a run to
finish instead of retrying immediately; the cap is on in-flight runs, not
on submissions per minute.
Credit cost: same as the sync endpoint (20 per 2 minutes of audio).
---
### 3.9 POST /v1/scrape/google-maps/reviews
Pull Google Maps reviews for any place. Returns up to ~10,000 unique
reviews in the `reviews` array, deduplicated and always sorted
newest-first.
Prefer the async variant (`/v1/scrape/google-maps/reviews/async`, see
3.10) for any pull beyond ~700 reviews so the request isn't bounded by the
request time limit.
Required (one of `place_id` or `place_url`; `place`, the name the MCP tool
uses, is read as `place_id`):
* `place_id`: accepts any of these forms:
- The place's name with its city, e.g. `"Katz's Delicatessen, New York"`.
The server looks the place up. When the name matches more than one
place you get `place_ambiguous` (409) listing up to 5 candidates with
their address, review count and `place_id`; send one of those back.
Not billed.
- Any Google Maps URL of the place (paste the link from the address
bar). `ftid=`, `cid=` and search URLs work too; a URL with only the
place's name in it is looked up by that name.
- A maps.app.goo.gl share link.
- A `ChIJ...` place ID.
- A FID hex pair like `0x47e66e2964e34e2d:0x8ddca9ee380ef7e0`. This
skips an internal resolution step so it's slightly faster.
A URL on another site, or text with no letters or digits, is rejected
up front with a real `422 validation_error`.
Optional:
* `place_url`: a Google Maps URL for the place. Sent alone, it stands in
for `place_id`. Sent with a `place_id`, it is the page loaded directly,
for a place whose FID has been rotated and whose legacy short URL
redirects to a generic location.
* `language`: default `"en"`. Affects place name/address language
only; review text is whatever the reviewer wrote.
* `sort`: accepted values `"newest"` (default), `"most_relevant"`,
`"highest_rating"`, `"lowest_rating"`. Reviews are returned
newest-first regardless of this value. Kept for backward compatibility.
* `max_reviews`: 1-10000. Default 200. Treat as a request CAP, not a
promise. Returns up to ~10,000 unique reviews; the per-request ceiling
lands around 10,000 unique on places with >20K total reviews.
* `cache_ttl_seconds`: default 3600 when `max_reviews` is 2000 or less.
Above 2000 the default is 0 (uncached), because large pulls are rarely
repeated verbatim and holding them wastes cache. Pass an explicit value
to override either way.
* `include_usage`: `false` by default. When `true`, the response includes
a `usage` block with credit totals.
Auto-downgrades to 40 credits when 50 or fewer reviews are returned, so
you pay only for what's available. Before the scrape starts (and before
streaming, so this one is a real status line), a request whose worst
case (`max_reviews` all returned) would push the account past the
5,000-credit overage floor is refused with `402 insufficient_credits`;
lower `max_reviews` or top up.
This endpoint always streams its response, so its HTTP status line is
locked at `200` before the scrape finishes. Every handler error therefore
arrives as an in-body envelope `{"error": {...}, "http_status": 503}`
inside that 200 — including `place_id_format` (400), `place_ambiguous`
(409), `place_not_found` (404), `place_id_unresolvable` (404),
`place_lookup_failed` (503), and `parse_failed` /
`rpc_parse_failed` / `rpc_unexpected_body` (503). Unlike screenshot and
PDF there is no fast path here, so a 4xx never reaches you as a real
status line. Always check `body.get("error")` before reading `reviews`.
The async variant (3.10) reports failures through the run record instead,
which is one more reason to prefer it.
REALISTIC DELIVERY by place size:
| Place review count | Typical delivery |
|--------------------|---------------------|
| < 1,000 | ~100% of available |
| 1,000 – 10,000 | 60–100% |
| 10,000+ | ~10,000 (the per-request cap) |
WHY THE PER-REQUEST CAP, and how some services claim 100K:
Google itself only exposes a limited slice of any place's reviews,
regardless of how many the place actually has. On places with >20K
total reviews the practical ceiling lands around 10,000 unique. We cap at
10,000 because asking for more is misleading: no public scraper delivers
more through any documented method.
DataForSEO publishes its real per-place cap at 4,490. SerpAPI documented
in their own bug tracker that pagination stops where Google's UI scroll
stops. Six-figure "reviews per place" marketing numbers are aspirational
ceilings, not measured deliveries against the largest places (which have
hundreds of thousands of reviews).
Request:
```bash
curl -X POST https://scrapenest.dev/v1/scrape/google-maps/reviews \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"place_id": "Eiffel Tower, Paris",
"max_reviews": 200
}'
```
Response (abbreviated):
```json
{
"place_id": "0x47e66e2964e34e2d:0x8ddca9ee380ef7e0",
"name": "Eiffel Tower",
"address": "Av. Gustave Eiffel, 75007 Paris, France",
"rating": 4.7,
"review_count": 486214,
"google_maps_url": "https://www.google.com/maps/place/...",
"reviews": [
{
"review_id": "ChdDSUhNMG9nS0VJQ0FnSURBNS0z...",
"review_url": "https://www.google.com/maps/contrib/.../reviews?hl=en",
"author_name": "Jane D.",
"author_id": "1234567890",
"author_profile_url": "https://www.google.com/maps/contrib/1234567890/reviews?hl=en",
"author_avatar_url": "https://lh3.googleusercontent.com/...",
"rating": 5,
"text": "Amazing view, worth the wait.",
"language": "en",
"relative_time": "2 weeks ago",
"posted_at": 1778630400,
"posted_at_iso": "2026-05-13T00:00:00Z",
"helpful_count": 4
}
],
"star_histogram": [8214, 5190, 17920, 69450, 385440],
"note": "Returned 200 unique reviews, newest-first.",
"took_ms": 7426,
"cache_hit": false,
"credits_charged": 400
}
```
`star_histogram` is a 5-element list (counts in order
`[1★, 2★, 3★, 4★, 5★]`), omitted entirely if Google didn't ship one.
`name`, `address`, `rating`, `review_count` and `google_maps_url` come
back on every pull, small ones included. They are omitted only when
Google could not be reached for the place's details; the `reviews` array
is the source of truth.
A review's `text` is omitted on a rating-only review (stars with no
written text), and `author_name` and `rating` when Google did not serve
them.
When the whole review list was read (the place has fewer reviews than
`max_reviews`), `review_count` and `star_histogram` are computed from
that full set and are exact. `photos` is omitted from each review when
the reviewer didn't attach any. `owner_reply` is omitted when the business
didn't respond. Reviews recovered through the page-rendering fallback
carry a `posted_at` / `posted_at_iso` approximated from Google's relative
label ("2 weeks ago"), not an exact timestamp.
An unknown `place_id` (a FID that parses but names no place) fails fast,
within seconds, with `place_not_found` (404).
Credit cost:
* 100 credits per 50 reviews returned, rounded up to the next 50.
(Equivalently: 400 credits per 200 reviews.) Hard cap 10,000 reviews.
* When 50 or fewer reviews are returned, auto-billed at the 40-credit
floor.
* When a capture stops short of `max_reviews` because one of our own
paths failed (not because the place has fewer reviews), it bills 2
credits per delivered review whenever that is less than the tier price
above (e.g. 3 reviews of a requested 50 bill 6, not 40).
For the example above, 200 reviews are 4 chunks of 50, billed at
4 x 100 = 400 credits. A pull that size takes a few seconds. Failed runs
are not billed.
Bigger jobs can run for several minutes. Use the async variant (3.10)
for any pull above ~700 reviews so the request isn't tied to a single
open HTTP connection.
---
### 3.10 POST /v1/scrape/google-maps/reviews/async
Identical request shape to the sync endpoint. Returns immediately with a
`run_id`; poll `GET /v1/scrape/runs/{run_id}` for the result. Async runs
share the sync endpoint's cache, so a repeat inside the TTL completes at
once and bills the cache-hit rate.
Response (202):
```json
{
"run_id": "f0e0c0a0-1234-5678-9abc-def012345678",
"status": "queued",
"status_url": "/v1/scrape/runs/f0e0c0a0-1234-5678-9abc-def012345678",
"created_at": "2026-05-13T15:00:00Z",
"expires_at": "2026-05-20T15:00:00Z"
}
```
Then poll:
```bash
curl -X GET https://scrapenest.dev/v1/scrape/runs/f0e0c0a0-... \
-H "Authorization: Bearer sn_YOUR_API_KEY"
```
When complete, `status="completed"` and the synchronous response body is
inside `result`. Credit cost is the same as the synchronous endpoint and
is charged when the job completes. Failed runs are not billed.
The per-plan concurrency cap from 3.8 applies here too: free 2, starter 5,
growth 15, pro 40, scale 100 runs `queued` or `running` at once, and a
submission past the cap returns `429 too_many_active_runs`.
---
### 3.11 GET /v1/scrape/runs/{run_id}
Polls the status of a run created by one of the two async endpoints:
`/v1/scrape/google-maps/reviews/async` (3.10) and
`/v1/audio/transcript/async` (3.8). No other endpoint has an async
variant. Accepts GET or HEAD. Returns one of `queued`, `running`,
`completed`, `failed`, `cancelled`. When `completed`, `result` holds the
final response body. When `failed`, `error_code` and `error_message`
describe the cause: the code the synchronous endpoint would have
returned, or one of `stalled` (time budget used up), `container_restart`,
`shutting_down` or `cancelled` (a restart on our side interrupted it;
resubmit), `overage_cap_reached`, or `internal_error`. Failed runs are
never billed. Free: polling does not consume credits.
```json
{
"run_id": "f0e0c0a0-1234-5678-9abc-def012345678",
"endpoint": "POST /v1/scrape/google-maps/reviews",
"status": "completed",
"created_at": "2026-05-13T15:00:00Z",
"started_at": "2026-05-13T15:00:02Z",
"completed_at": "2026-05-13T15:03:15Z",
"expires_at": "2026-05-20T15:00:00Z",
"credits_charged": 10000,
"result": {"place_id": "0x47e66e2964e34e2d:0x8ddca9ee380ef7e0", "reviews": []}
}
```
Long-running scrapes (Maps reviews) populate an optional
`progress` object: `{"current": int, "target": int, "detail": str}`.
It advances as reviews are collected, through each fetch path the run
tries. Use it for progress bars; absent when the worker hasn't yet
emitted a milestone for this run.
### 3.11a POST /v1/scrape/runs/{run_id}/cancel
Stops a `queued` or `running` run. Runs bill only when they complete, so
a run cancelled before completing is not billed (`credits_charged: 0`).
A run that already completed, failed or was cancelled is returned
unchanged (a completed run stays billed). The response has the same shape
as the GET above:
```bash
curl -X POST https://scrapenest.dev/v1/scrape/runs/f0e0c0a0-1234-5678-9abc-def012345678/cancel \
-H "Authorization: Bearer sn_YOUR_API_KEY"
```
```json
{
"run_id": "f0e0c0a0-1234-5678-9abc-def012345678",
"endpoint": "POST /v1/scrape/google-maps/reviews",
"status": "cancelled",
"created_at": "2026-05-13T15:00:00Z",
"started_at": "2026-05-13T15:00:02Z",
"completed_at": "2026-05-13T15:01:10Z",
"cancelled_at": "2026-05-13T15:01:10Z",
"expires_at": "2026-05-20T15:00:00Z",
"credits_charged": 0,
"progress": {"current": 1200, "target": 5000, "detail": "..."}
}
```
`invalid_run_id` (400), `no_owner` (403) and `run_not_found` (404) apply
exactly as on the GET.
Polling cadence: 2-5 seconds is fine for most scrapes. For maps reviews
runs targeting 5K reviews, 10-15 seconds is more polite. Runs expire
after 7 days.
---
### 3.12 POST /v1/scrape/screenshot
Captures a PNG or JPEG screenshot of any public URL. Returns base64-encoded
image bytes inline. Auto-escalates the capture pipeline when the target
site blocks the default browser engine.
Required:
* `url`: absolute http(s) URL.
Optional:
* `viewport_width`: 320-3840, default 1280.
* `viewport_height`: 240-2160, default 720.
* `device_scale_factor`: 1-3, default 1. The pixel ratio of the image. At
1 the image is exactly `viewport_width` x `viewport_height` pixels (or
the full page at that width); at 2 it is twice that in each dimension.
Billed the same at any value.
* `full_page`: `false` by default. When `true`, captures the entire
scrollable height instead of just the viewport.
* `selector`: CSS selector (up to 300 chars). When set, captures only
the bounding box of the first matching element (e.g. `"#hero"`,
`".product-card:first-child"`). Overrides `full_page`. If the selector
matches nothing, you get a full-viewport capture at the requested tier
and price (it costs one extra render, not a stealth charge) with
`selector_applied: false`; `422 selector_not_found` only when nothing can
be rendered. A stealth capture (`render: "stealth"`, or an escalation)
never crops to the selector: it returns the full viewport with
`selector_applied: false`.
* `render`: `"auto"` (default, picks the right backend), `"browser"`
(forces the standard headless browser), or `"stealth"` (forces the
anti-bot capture backend up front, 35 credits — use when you already
know the target blocks normal browsers).
* `format`: `"png"` (default) or `"jpeg"`.
* `jpeg_quality`: 1-100, default 85. Ignored when format is png.
* `wait_extra_ms`: 0-10000, default 0. Additional wait after page load
for late-loading content (SPAs that fade in, lazy images, charts).
* `cookies`: object `{name: value}` (up to 50 entries). Injected before
navigation; use to screenshot authenticated/logged-in pages. The
`[{name, value}]` list form is also accepted here.
* `headers`: object `{name: value}` (up to 30 entries). Extra request
headers (`User-Agent`, `Referer`, etc.). `Host` / `Content-Length`
are ignored.
* `session_id`: sticky-session id (1-64 chars, `[A-Za-z0-9_.-]`). Reuses
the same exit IP for ~10 min so a screenshot matches a prior
`/v1/scrape/url` session. Disables caching.
* `include_usage`: `false` by default. When `true`, the response includes
a `usage` block with credit totals.
* `cache_ttl_seconds`: 0-86400, default 0 (off). Set non-zero to dedupe
repeat captures made with identical settings. Requests with `cookies`,
`headers` or a `session_id` are never cached.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/scrape/screenshot \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://news.ycombinator.com",
"full_page": true,
"format": "png"
}' \
| jq -r .image_base64 | base64 -d > screenshot.png
```
Response:
```json
{
"url": "https://news.ycombinator.com",
"final_url": "https://news.ycombinator.com/",
"status_code": 200,
"method": "browser",
"escalated": false,
"elapsed_ms": 2470,
"width": 1280,
"height": 1179,
"bytes": 253264,
"format": "png",
"image_base64": "iVBORw0KGgoAAAANSUhEUgAA...",
"cache_hit": false,
"credits_charged": 25
}
```
The `method` field reports `"browser"` or `"stealth"`. `escalated` is
`true` when the requested tier was refused by anti-bot and the capture was
taken in stealth (billed at the stealth rate); a selector miss never
escalates. `selector_applied` is present only when `selector` was set:
`true` when the image is cropped to the matched element, `false` when it is
the full viewport. `width` and `height` are the pixel size of the returned
image.
Credit cost:
* Viewport: 15
* Full page: 25
* Selector-targeted: 15
* Stealth fallback (hostile sites, auto-escalated): 35
* Cache hit: 1
Failures and timeouts don't bill.
Error delivery on this endpoint is two-shaped, and a client must handle
both. If the capture finishes (or fails) within the first ~20 seconds,
the common case, you get a normal HTTP status line: `422`, `503`, and so
on, with the standard `{"error": {...}}` body. Past ~20 seconds the
response has already begun streaming, so the status line is locked at
`200` and the error arrives in-body as
`{"error": {...}, "http_status": 503}`. Branch on `response.status_code`
first; when it is `200`, also check for an `error` key before trusting the
body. Errors you can see either way include `screenshot_failed` (503),
`selector_not_found` (422, nothing renderable matched), `target_error`
(422, the target itself refused, its host does not resolve in DNS, it refused the
connection, or it never answered on its port, which fails at once), and `anti_bot_block` (422, the
page under the image was a captcha, a consent prompt or an error page; a
capture that did not ask for stealth is retried once in stealth first, and it
is not billed). A capture has one overall limit of 75 seconds across every
tier it tries; past it you get `screenshot_failed` with `"http_status": 503`,
not billed.
---
### 3.13 POST /v1/scrape/pdf
Renders any URL to PDF. Returns base64-encoded bytes. Use for archiving
articles, generating invoice/receipt copies, or capturing legal evidence.
Required:
* `url`: absolute http(s) URL.
Optional:
* `format`: paper size. One of `"Letter"` (default), `"Legal"`,
`"Tabloid"`, `"Ledger"`, `"A0"`, `"A1"`, `"A2"`, `"A3"`, `"A4"`,
`"A5"`, `"A6"`.
* `landscape`: `false` by default.
* `viewport_width` / `viewport_height`: render viewport in CSS pixels
(320-3840 / 240-2160, defaults 1280x720).
* `wait_extra_ms`: 0-10000, default 0.
* `cookies`: object `{name: value}`. Use for paywalled or logged-in pages.
The `[{name, value}]` list form is also accepted here.
* `headers`: object `{name: value}`.
* `session_id`: sticky session id (see `/v1/scrape/url`).
* `include_usage`: `false` by default.
* `cache_ttl_seconds`: 0-86400, default 0 (off). Requests with `cookies`,
`headers` or a `session_id` are never cached.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/scrape/pdf \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/article","format":"A4"}' \
| jq -r .pdf_base64 | base64 -d > article.pdf
```
Response:
```json
{
"url": "https://example.com/article",
"final_url": "https://example.com/article",
"status_code": 200,
"elapsed_ms": 2120,
"format": "A4",
"landscape": false,
"bytes": 20925,
"pdf_base64": "JVBERi0xLjQKJdPr6eEKMSAwIG9iago...",
"cache_hit": false,
"credits_charged": 25
}
```
`landscape` echoes back whether the PDF was rendered in landscape
orientation.
Credit cost:
* Per PDF: 25
* Landscape, or a large format (`Tabloid`, `Ledger`, `A0`, `A1`, `A2`): 35
* Cache hit: 1
Failures don't bill. Error delivery works exactly as on
`/v1/scrape/screenshot`: a render that resolves within ~20 seconds returns
a real HTTP status line (`422 target_error`, `503 pdf_failed`, …), while
anything slower has already started streaming and arrives as
`{"error": {...}, "http_status": 503}` inside an HTTP 200. Check the status
code first, then look for an `error` key when it is `200`. The same 75
second limit applies across every tier (`pdf_failed`, `"http_status": 503`).
---
### 3.14 POST /v1/scrape/gas-prices
US gas station prices for a given location, pulled from public
station-finder listings. Returns the cheapest stations within
range, plus state/region rollup stats when they're available.
Required:
* `location`: 2-200 chars, any case. Accepts a 5-digit US ZIP or ZIP+4
(`"37122"`, `"37122-1234"`), `"City, ST"` with or without the comma
(`"Mount Juliet, TN"`, `"mount juliet tn"`), `"City, State"`
(`"Nashville, Tennessee"`), a bare city, or `"lat,lng"` coordinates
(`"36.2001,-86.5186"`). Ambiguous strings resolve to the best match;
check `location.city` / `location.state` in the response. A location
that can't be resolved to a US place, or that is outside the US,
returns `422 validation_error` with `details[].loc` set to
`["body", "location"]` instead of an empty result.
Optional:
* `grade`: fuel grade, case-insensitive. One of `"regular"` (default),
`"midgrade"`, `"premium"`, `"diesel"`, `"e85"`.
* `limit`: 1-50, default 20. Hard cap on returned stations (the
default listing shows ~13).
* `cache_ttl_seconds`: 0-3600, default 600 (10 minutes). Capped at 1 hour
because prices change slowly.
* `include_usage`: `false` by default. When `true`, response includes
a `usage` block.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/scrape/gas-prices \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"location":"37122","grade":"regular","limit":10}'
```
Response:
```json
{
"location": {
"query": "37122",
"zip": "37122",
"city": "Mount Juliet",
"state": "TN"
},
"grade": "regular",
"stations": [
{
"brand": "Kroger",
"sub_brand": "Kroger Fuel Center",
"station_id": "21847",
"address": "401 S Mt Juliet Rd",
"city": "Mount Juliet",
"state": "TN",
"price": 2.79,
"currency": "USD",
"unit": "USD/gallon",
"reporter": "anon_18234",
"updated_relative": "37 minutes ago"
}
],
"region_stats": {
"state": "TN",
"region": "Tennessee",
"region_type": "state",
"lowest_price": 2.69,
"average_price": 2.95
},
"source_url": "https://scrapenest.dev",
"fetched_at": "2026-05-19T17:30:00Z",
"took_ms": 1820,
"cache_hit": false,
"credits_charged": 10
}
```
`region_stats.region_type` is `"state"` when the source returned a state
roll-up and `"city"` when it returned city-level numbers (mainly for
ZIPs that map to a city-only feed). `region_stats` is omitted when
the source doesn't ship a regional summary block. The source's regional
figures cover regular only, so for any other `grade` the stats are
computed from the returned stations of that grade (lowest and average,
labelled with the searched city) and `note` says so; when no prices of
that grade came back, `region_stats` is omitted with a `note`.
Upstream caveat: some listings hide individual per-station prices
(typically the cheapest few stations) behind a free account login.
Stations with no posted price for the grade are left out of
`stations`; on some pulls `note` says how many (for example
`"3 stations had prices hidden"`). A listed station can occasionally
come back without `price`.
Credit cost:
* Per call: 10 (flat). Charged only when at least one station is returned.
* Cache hit: 1
---
### 3.15 POST /v1/scrape/batch
Fetch up to 10 URLs in one call. Each URL is fetched independently, so one
URL failing never fails the rest. Fetches run concurrently five at a time,
so a 10-URL batch completes in roughly two waves rather than in the time of
a single fetch. The render options apply to every URL in the batch.
Required:
* `urls`: array of 1-10 absolute http(s) URLs.
Optional (each applies to every URL):
* `render`: `"auto"` (default), `"direct"`, `"browser"`, or `"stealth"`.
Same tiers as `/v1/scrape/url`, with the same auto-escalation (see
`auto_escalate` below).
* `auto_escalate`: `true` by default (strict bool). As on
`/v1/scrape/url`: a URL refused by anti-bot on `auto`/`browser` is
retried once in stealth and billed at the stealth rate only if that
retry succeeds; the plain-client and empty-shell fallbacks apply too.
`render: "direct"` never escalates. Set `false` to receive blocks
as-is. Each URL's retries get at most 45 s, inside one ~100 s budget
measured from the start of the batch, and a stealth retry only starts
while at least 20 s of that remains, so a URL blocked late in the call
comes back as a failed item instead of escalating. Batch takes no
`timeout_seconds`. Latency: a batch holding a hostile URL can take tens
of seconds up to ~100 s, and longer in the worst case (each URL's first
fetch has its own ~100 s ceiling and only five run at once), which can
cross the ~100 s edge timeout and fail with HTTP 524. Keep hostile URLs
to a few per batch, or fetch them through `/v1/scrape/url` with a
`timeout_seconds` you control.
* `force_proxy`: `false` by default. Force every fetch through a
higher-tier proxy.
* `block_assets`: `true` by default. On browser renders, block
images/fonts/media to save bandwidth.
* `extract`: `true` by default. Run readability extraction so each item
carries clean `title`, `description`, `text`, `structured`.
* `include_html`: `false` by default. Include the raw `html` per URL
alongside the cleaned text. No extra credits.
* `return_markdown`: `false` by default. Add a `markdown` field per URL.
The raw `html` field still needs `include_html`. No extra credits.
* `markdown_mode`: `"main"` (default) or `"full"`, same as on
`/v1/scrape/url`: `main` converts only the main content (navigation,
headers, footers, sidebars, forms and inline `data:` images dropped;
tables kept; language selectors and leading link lists/widgets
dropped), `full` converts the whole page. Only matters with
`return_markdown: true`.
* `block_ads`: `false` by default. On browser renders, block known ad and
tracker domains.
* `country`: ISO 3166-1 alpha-2. Routes every fetch through a
residential exit in that country, billed at the residential tier. Same
availability as `/v1/scrape/url`: it follows the live residential pool,
and a country with no exit fails each item with
`error_code: "country_unavailable"` (0 credits) rather than falling
back. Successful items report `exit_country`.
* `include_usage`: `false` by default. When `true`, the response includes
a `usage` block with the batch's total credits.
This endpoint keeps no response cache of its own and accepts no
`cache_ttl_seconds`. An item can still report `cache_hit: true` when the
fetch service answered it from its page cache (never when `country` is
set); such an item bills the cache-hit rate (1) and is not escalated. Use
`/v1/scrape/url` when you want per-URL response caching.
Request:
```bash
curl -X POST https://scrapenest.dev/v1/scrape/batch \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"urls": [
"https://example.com/a",
"https://example.com/b",
"https://example.com/missing"
],
"render": "auto"
}'
```
Response (abbreviated):
```json
{
"results": [
{"url":"https://example.com/a","final_url":"https://example.com/a","status_code":200,"method":"fetch","proxy_used":"datacenter","elapsed_ms":290,"title":"A","text":"...","cache_hit":false,"escalated":false,"success":true,"ok":true,"credits_charged":1},
{"url":"https://example.com/b","final_url":"https://example.com/b","status_code":200,"method":"browser","proxy_used":"residential","elapsed_ms":1840,"title":"B","text":"...","cache_hit":false,"escalated":false,"success":true,"ok":true,"credits_charged":40},
{"url":"https://example.com/missing","status_code":404,"method":"fetch","proxy_used":"datacenter","elapsed_ms":210,"cache_hit":false,"escalated":false,"success":false,"ok":false,"credits_charged":1,"error":"http_404"}
],
"requested": 3,
"succeeded": 2,
"credits_charged": 42
}
```
Each item carries its own `success`, `status_code`, and `credits_charged`,
so the batch's `credits_charged` is just the sum of the per-URL charges.
Branch on `success`; `ok` is emitted alongside it as a deprecated alias
with the same value. Items also carry `escalated` and `cache_hit`
(booleans, as on `/v1/scrape/url`) and, on success with `country` set,
`exit_country`. `text`, `title` and `structured.product` follow the
`/v1/scrape/url` rules.
Per-item errors: every failed item has an `error` string, but
`error_code` is narrower here than on `/v1/scrape/url`. Batch sets it
only for `anti_bot_block`, `empty_response`, `rate_limited` (target
answered a bare 429), `upstream_failed` (target answered a bare 503),
`connection_failed` (the host does not resolve in DNS, or `render: "direct"`
could not connect),
`country_unavailable` and `bandwidth_cap_exceeded` (free-tier daily cap
hit mid-batch), and omits it for everything else. A timeout, a 404, or an infrastructure failure
therefore arrives with no `error_code`; `error` is then `"http_404"`,
`"fetch_failed"`, `"upstream_failed"`, `"upstream_not_configured"`,
`"redirect_to_unsafe_url"`, `"unsafe_url: ..."`, or the fetch service's
own message. There is no `timeout` code on batch. Do not switch on
`item.error_code` for those cases; use `status_code` and `error`.
Before any fetch, a batch whose worst case (every URL billed at the
highest tier its `render` could reach, stealth included) would push the
account past the 5,000-credit overage floor is refused with
`402 insufficient_credits`.
Credit cost (per URL, then summed):
* Each URL bills the tier it actually used, exactly like `/v1/scrape/url`
(1 direct + no proxy, 5 browser + no proxy, 10 direct + premium proxy,
40 browser/stealth + premium proxy).
* A delivered 404/410 (the page was reached, just not found) bills 1.
* A URL we couldn't reach at all bills 0.
* An item served from the fetch service's page cache bills 1.
When `include_usage` is set, `usage.breakdown` reports the batch total
under a single `{"fetch": }` key rather than itemizing per URL.
---
## 4. Error codes
All errors are JSON with shape:
```json
{"error": {"code": "", "message": ""}}
```
Validation failures (HTTP 422 `validation_error`) include an
extra structured array:
```json
{
"error": {
"code": "validation_error",
"message": "Request validation failed.",
"details": [
{"loc": ["body", "max_reviews"], "type": "less_than_equal", "msg": "Input should be less than or equal to 10000"}
]
}
}
```
Common codes:
| HTTP | Code | Meaning | What to do |
|------|--------------------------|---------------------------------------------------------|---------------------------------------------|
| 400 | unsafe_url | URL is malformed, or points at a private/internal/loopback host | Send a well-formed public http(s) URL |
| 400 | redirect_to_unsafe_url | Target redirected the fetch to a private address | Use a different URL; we won't follow |
| 400 | cookies_invalid | /v1/audio/transcript only: cookies field malformed | Re-export Netscape cookies.txt |
| 400 | invalid_run_id | run_id is not a UUID | Use the run_id from the original 202 body |
| 400 | duplicate_parameter | The same query parameter was sent more than once | Send each query parameter once |
| 400 | place_id_format | place_id format is invalid | Send the place name and city, a Maps URL or a place ID |
| 400 | translation_rejected | /v1/translate: upstream rejected the language pair | Check source/target are translatable |
| 400 | unsupported_detected_source | /v1/translate: the auto-detected source isn't supported | Pass `source` explicitly |
| 400 | audio_resolve_failed | /v1/audio/transcript: couldn't extract audio from the URL, or its host does not resolve in DNS (503 when the failure is upstream) | Confirm the URL is a public audio/video page |
| 400 | invalid_audio_source | /v1/audio/transcript: URL is a podcast feed, not an episode | Pass a single episode URL |
| 401 | unauthorized | No key, key in the URL or body, or a cut-short/revoked/mistyped key; `message` says which | Send `Authorization: Bearer `; check key in /dashboard/keys |
| 401 | login_required | /v1/audio/transcript: source needs auth cookies | Pass `cookies` (Netscape cookies.txt) |
| 402 | insufficient_credits | Out of credits (Free plan: `credits_reset_at` says when they return) | Top up at /dashboard/billing |
| 402 | overage_cap_reached | Hit the negative-balance floor (5,000 credits) | Top up to resume |
| 402 | bandwidth_cap_exceeded | Free-tier daily bandwidth budget exhausted | Upgrade to a paid plan |
| 403 | no_owner | API key has no owning account (revoked or detached) | Generate a new key |
| 403 | email_not_verified | Account email not verified | Click verification link or /verify/resend |
| 403 | account_suspended | Account suspended | Contact support |
| 403 | audio_private | /v1/audio/transcript: audio is private or members-only | Use a public source |
| 402 | team_seat_blocked | Team is over its plan's seat cap | Upgrade the plan or remove members |
| 404 | not_found | Unknown route, or the requested place/resource doesn't exist | Verify path, method, and inputs |
| 404 | run_not_found | run_id doesn't belong to this customer or has expired | Confirm key + check 7-day expiry |
| 404 | place_id_unresolvable | Maps: couldn't resolve the share link, CID or ChIJ ID to a place | Pass the full Maps URL from the address bar |
| 404 | place_not_found | Maps: place_id didn't resolve to a place with a reviews feed, or no place matched the name | Re-check the place_id, or add the city or street to the name |
| 405 | method_not_allowed | Wrong HTTP method on a /v1 route | Use the documented method (check `Allow`) |
| 409 | place_ambiguous | Maps: the name matches several places; the message lists them with their place_id | Send one of the listed place_id values |
| 410 | audio_not_available | /v1/audio/transcript: source is no longer available | The audio was deleted; use another source |
| 413 | audio_too_long | /v1/audio/transcript: recording is longer than 4 hours | Use a shorter recording |
| 413 | audio_too_large | /v1/audio/transcript: audio is larger than 250 MB | Use a smaller file |
| 422 | validation_error | Validation failed on request body | Read `details[]` and fix the field |
| 422 | country_unavailable | /v1/scrape/url: no residential exit for `country` now (not retryable) | Omit `country` or pick another |
| 422 | drm_protected | /v1/audio/transcript: source is DRM-protected | Try the same episode on another platform |
| 422 | audio_is_live | /v1/audio/transcript: live broadcast, or ended with no replay yet (`audio_not_ready`) | Retry once the recording is up |
| 422 | playlist_not_supported | /v1/audio/transcript: playlist with no playable item | Pass a single episode URL |
| 422 | audio_not_found | /v1/audio/transcript: no audio stream that can be transcribed (also `audio_stream_unsupported`) | Try another source for the episode |
| 422 | selector_not_found | /v1/scrape/screenshot: nothing renderable matched `selector` | Loosen the selector, or omit it |
| 422 | target_error | screenshot/pdf: the target itself refused the render, or its host does not resolve in DNS | Retry once, or check the URL |
| 422 | anti_bot_block | screenshot: the page was a captcha, consent or error page | Retry later, or with `render: "stealth"` |
| 429 | rate_limited | Hit per-minute or per-day rate limit | Back off; see `Retry-After` header |
| 429 | concurrency_limit_exceeded | Too many of your calls running at once for your plan | Retry after `Retry-After` (1s) |
| 429 | render_capacity | /v1/scrape/url: all browser-render slots are busy (not billed) | Retry after `Retry-After` (15s) |
| 429 | too_many_active_runs | Too many async runs queued/running for your plan | Wait for one to finish (`Retry-After: 30`) |
| 429 | abuse_throttled | Account throttled by abuse-detection | Wait `retry_after`; contact support if persistent |
| 451 | geo_restricted | /v1/audio/transcript: source is geo-restricted | The source is blocked from our region |
| 500 | server_error | Unexpected server error | Retry once with backoff; report if persistent |
| 500 | internal_error | An endpoint hit an unexpected error | Retry with backoff; report if persistent |
| 503 | upstream_failed | Target site or an upstream service errored | Retry once with backoff |
| 503 | connection_failed | screenshot/pdf/audio: the DNS lookup for the target's host failed temporarily; nothing was fetched | Retry with backoff |
| 503 | pdf_failed | Target could not be rendered to PDF | Retry once or try a different URL |
| 503 | screenshot_failed | Target could not be screenshotted | Retry once or try a different URL |
| 503 | no_sources | /v1/search/answer couldn't find usable sources | Rephrase the query |
| 503 | parse_failed | Maps returned no parseable reviews | Retry once; if persistent, file a bug |
| 503 | rpc_parse_failed | Google Maps returned a malformed response | Retry once; if persistent, file a bug |
| 503 | rpc_unexpected_body | Google Maps returned an unexpected (non-JSON) response | Retry once; often a transient challenge |
| 503 | place_lookup_failed | Maps: the place name couldn't be looked up just now | Retry, or send a Maps URL or place ID |
| 503 | upstream_fetch_failed | /v1/scrape/gas-prices: price source unreachable or errored | Retry once with backoff |
| 503 | llm_upstream_failed | /v1/search/answer: the answer LLM upstream errored | Retry once with backoff |
| 503 | transcribe_parse_failed | /v1/audio/transcript: transcription provider returned an unusable response | Retry once with backoff |
| 503 | transcribe_timeout | /v1/audio/transcript: transcription did not finish in the request's time budget | Use the `/async` variant |
| 503 | audio_resolve_timeout | /v1/audio/transcript: resolving the audio source timed out | Retry, or use the `/async` variant |
| 503 | upstream_not_configured | An upstream we depend on isn't configured server-side | Contact support |
| 503 | llm_not_configured | /v1/search/answer: no answer LLM is configured | Contact support |
| 503 | transcribe_failed | /v1/audio/transcript: download or transcription failed (also `audio_download_failed` and the other `transcribe_*` codes) | Retry once with backoff |
| 503 | transcribe_not_configured | /v1/audio/transcript: transcription (or Spotify, `spotify_not_configured`) unavailable right now | Retry later |
| 524 | (none) | Call ran past the ~100 s edge limit; HTML body, not JSON | Use an /async variant, or keep timeout_seconds under 100 |
The API never answers 502 or 504. Cloudflare, in front of it, replaces an
origin 502 or 504 with its own HTML page, so every server-side failure goes
out as `503` with the JSON envelope above (same `code`, `message` and
`retryable`) and a `Retry-After` header. Streamed endpoints use `503` for
`http_status` too. A `502`, `504` or `520`-`524` with an HTML body comes
from the edge, not from the API: treat it as a retryable 5xx.
Retry logic should be: on 5xx, retry with exponential backoff (1s, 3s, 9s)
up to 3 times. On 429 and 503, honor `Retry-After`. On 4xx, do NOT retry;
fix the request instead.
---
## 5. Rate limits per plan
See `/v1/me` for the exact rate limits applied to your key.
| Plan | $/mo | Credits/mo | Req/min | Req/day | At once |
|----------|------|------------|---------|---------|---------|
| Free | $0 | 1,000 | 30 | 500 | 1 |
| Starter | $29 | 200,000 | 60 | 10,000 | 10 |
| Growth | $99 | 1,500,000 | 120 | 50,000 | 40 |
| Pro | $249 | 4,000,000 | 300 | 200,000 | 100 |
| Scale | $599 | 10,000,000 | 600 | 500,000 | 200 |
When you hit a rate limit you get an HTTP 429 with `Retry-After` (in
seconds). Back off for the indicated duration before retrying.
"At once" is how many billable calls may be running for your account at
the same time, across all of its keys. Past it you get
`429 concurrency_limit_exceeded` with `Retry-After: 1`.
When a balance is nearly used up, fewer calls run at once: one for every
50 credits left, and never fewer than one. The 429 message says so. An
account with auto-reload on keeps its plan's number.
Free accounts holding purchased top-up credits get Starter limits
(60/min, 10,000/day, 10 at once, 5 async runs) while those credits last.
There is a second, separate limit on async work: how many runs may be
`queued` or `running` at the same time.
| Plan | Concurrent async runs |
|----------|-----------------------|
| Free | 2 |
| Starter | 5 |
| Growth | 15 |
| Pro | 40 |
| Scale | 100 |
Exceeding it returns `429 too_many_active_runs` with `Retry-After: 30`.
This is a cap on in-flight jobs, not on request rate, so backing off
doesn't help on its own — wait for a run to complete, or upgrade.
---
## 6. Official SDKs and code examples
Official client libraries are published for Python and Node/TypeScript.
They wrap every endpoint below, handle auth and retries, and return typed
results. Both default to base URL `https://scrapenest.dev`. Prefer these
over hand-rolled HTTP when you can.
### Python SDK
```bash
pip install scrapenest
```
```python
from scrapenest import Client
client = Client("sn_YOUR_API_KEY")
hits = client.search("python web scraping", num_results=5)
for r in hits.results:
print(r.title, r.url)
page = client.scrape_url("https://example.com", render="auto", return_markdown=True)
print(page.title)
answer = client.search_answer("who wrote the odyssey", max_sources=3)
print(answer.answer)
```
The async client exposes the same methods:
```python
import asyncio
from scrapenest import AsyncClient
async def main():
async with AsyncClient("sn_YOUR_API_KEY") as client:
result = await client.search("python web scraping")
print(result.results[0].title)
asyncio.run(main())
```
Large Maps pulls run as async jobs with built-in polling:
```python
run = client.maps_reviews_async("Eiffel Tower, Paris", max_reviews=2000)
final = client.wait_for_run(run.run_id, timeout=1800)
print(len(final.result["reviews"]), "reviews")
```
`wait_for_run` defaults to a 300-second timeout and raises `TimeoutError`
when it lapses — but the run keeps going server-side. A 2,000-review pull
can take far longer than that, so pass a `timeout` matching the job (up to
1800s for the largest Maps pulls) and re-poll with `get_run(run_id)` if you
do time out.
Typed errors: `RateLimitError`, `AuthenticationError`, `PaymentRequiredError`.
### Node / TypeScript SDK
```bash
npm install scrapenest
```
```typescript
import { ScrapeNest } from "scrapenest";
const client = new ScrapeNest({ apiKey: "sn_YOUR_API_KEY" });
const hits = await client.search({ query: "python web scraping", num_results: 5 });
for (const r of hits.results) console.log(r.title, r.url);
const page = await client.scrapeUrl({ url: "https://example.com", render: "auto" });
console.log(page.title);
const run = await client.mapsReviewsAsync({ place_id: "Eiffel Tower, Paris", max_reviews: 2000 });
const final = await client.waitForRun(run.run_id, { timeout: 1_800_000 });
console.log(final.status, final.credits_charged);
```
`waitForRun` defaults to a 300,000 ms timeout and throws when it lapses,
while the run continues server-side. Pass a `timeout` sized to the job for
large Maps pulls, exactly as in the Python example above.
The package ships ESM + CJS builds and full type definitions, and exports
the same typed errors (`RateLimitError`, `AuthenticationError`,
`PaymentRequiredError`). Requires Node.js 18+; the Python SDK requires
Python 3.9+.
### Raw HTTP: Python (httpx + asyncio)
```python
import asyncio
import httpx
API_KEY = "sn_YOUR_API_KEY"
BASE = "https://scrapenest.dev"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
async def fetch_reviews(place_id: str, max_reviews: int = 200) -> dict:
async with httpx.AsyncClient(base_url=BASE, headers=HEADERS, timeout=100.0) as client:
r = await client.post(
"/v1/scrape/google-maps/reviews",
json={"place_id": place_id, "max_reviews": max_reviews},
)
r.raise_for_status()
return r.json()
async def fetch_reviews_async(place_id: str, max_reviews: int = 5000) -> dict:
async with httpx.AsyncClient(base_url=BASE, headers=HEADERS, timeout=30.0) as client:
submit = await client.post(
"/v1/scrape/google-maps/reviews/async",
json={"place_id": place_id, "max_reviews": max_reviews},
)
submit.raise_for_status()
run_id = submit.json()["run_id"]
while True:
await asyncio.sleep(8)
status = await client.get(f"/v1/scrape/runs/{run_id}")
status.raise_for_status()
body = status.json()
if body["status"] in ("completed", "failed", "cancelled"):
return body
print(asyncio.run(fetch_reviews("Eiffel Tower, Paris")))
```
### Raw HTTP: Node (fetch)
```js
const API_KEY = "sn_YOUR_API_KEY";
const BASE = "https://scrapenest.dev";
async function search(query) {
const r = await fetch(`${BASE}/v1/search`, {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query, num_results: 10 }),
});
if (!r.ok) throw new Error(`HTTP ${r.status}: ${await r.text()}`);
return r.json();
}
async function pollRun(runId, { intervalMs = 5000, maxMs = 1_800_000 } = {}) {
const start = Date.now();
while (Date.now() - start < maxMs) {
const r = await fetch(`${BASE}/v1/scrape/runs/${runId}`, {
headers: { "Authorization": `Bearer ${API_KEY}` },
});
const body = await r.json();
if (["completed", "failed", "cancelled"].includes(body.status)) return body;
await new Promise(s => setTimeout(s, intervalMs));
}
throw new Error("run polling timed out");
}
console.log(await search("typescript fetch retry pattern"));
```
### Raw HTTP: curl one-liners
Check your key (free):
```bash
curl -s https://scrapenest.dev/v1/me \
-H "Authorization: Bearer sn_YOUR_API_KEY" | jq
```
Search (cheap):
```bash
curl -s -X POST https://scrapenest.dev/v1/search \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"openai gpt-5 release notes","num_results":5}' | jq
```
Kick off a big maps reviews job and poll (heavy):
```bash
RUN=$(curl -s -X POST https://scrapenest.dev/v1/scrape/google-maps/reviews/async \
-H "Authorization: Bearer sn_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"place_id":"Eiffel Tower, Paris","max_reviews":5000}' \
| jq -r .run_id)
while true; do
STATUS=$(curl -s https://scrapenest.dev/v1/scrape/runs/$RUN \
-H "Authorization: Bearer sn_YOUR_API_KEY")
STATE=$(echo "$STATUS" | jq -r .status)
case "$STATE" in completed|failed|cancelled) echo "$STATUS" | jq; break;; esac
sleep 10
done
```
---
## 7. Common workflows
### 7.1 "Reviews -> sentiment summary" for a place
1. POST `/v1/scrape/google-maps/reviews/async` with `max_reviews=5000`.
2. Poll `/v1/scrape/runs/{id}` every 10s until `status="completed"`.
3. Read `result.reviews[*].text`, batch them in chunks of 50, feed each
chunk to your LLM with a prompt like "Summarize themes and rate
sentiment 1-5 per review." Map results back via `review_id`.
### 7.2 "Topic research" with citations
1. POST `/v1/search/answer` with a clear question and `max_sources=6`.
2. The response gives you a written answer plus `citations[]`.
3. If the answer needs deeper backing, take `citations[*].url`, fan out
to `/v1/scrape/url` (one call per URL, `extract=true`), and feed the
`text` field back into your own LLM prompt.
### 7.3 "Podcast -> show notes"
1. POST `/v1/audio/transcript` with the episode URL.
2. From the response, take `chunks[]` (start/end/text) and ask your LLM:
"Group these into 5-10 topic chapters, each with timestamps from the
chunks." This works because chunks are already time-anchored.
---
## 8. Common mistakes
* **Running large Maps scrapes on the sync endpoint.** For pulls beyond
a few hundred reviews, submit via `/v1/scrape/google-maps/reviews/async`
and poll `/v1/scrape/runs/{run_id}`. The sync endpoint is best for
small places and quick interactive checks. Polling is free.
* **Hunting for the place's FID hex.** You don't need it. Send the
place's name and city, or any Google Maps URL of it. The response's
`place_id` is the FID (`0x47e6...:0x8ddc...`); send that back on later
calls for the same place to skip the name lookup.
* **Assuming `max_reviews=10000` always returns 10K.** Google only
makes a limited slice available, roughly 1.5K-8K reviews on most places
and ~200 on small spots. No scraper can exceed what Google itself
indexes. The practical ceiling lands around 10,000 unique on places
with >20K total reviews. Always check `len(response.reviews)`.
* **Ignoring `cache_hit: true`.** A cached response costs 1 credit and
is identical to the live response. If you're comparing prices or
detecting changes, set `cache_ttl_seconds: 0` to force fresh data.
* **Storing API keys in client-side code.** Bearer keys give full
account access. Keep them in your backend; never ship them in a
browser bundle or mobile app.
* **Putting the key in the URL or the JSON body.** `?api_key=`,
`?token=` and a body `api_key` field are all refused with a 401. The
key goes in `Authorization: Bearer ` (or `X-API-Key`).
* **Searching, then deep-searching the same query.** `/v1/search/deep`
already returns the full ranked `results` list along with the page
text. Calling `/v1/search` first for the same query bills the search
twice.
* **A client timeout shorter than the request's budget.**
`/v1/scrape/url` works for up to `timeout_seconds` (default ~100) on a
hard target. An HTTP client that gives up at 30 s gets a dropped
connection instead of the JSON result, which looks like an outage or
a bad key and is neither. Pass a `timeout_seconds` you can wait for
and set the client's timeout a few seconds above it.
* **Retrying on 4xx.** 4xx errors are caused by your request, so fix it
instead of retrying. Only retry 5xx and 429 (with backoff and
`Retry-After`).
* **Asking for `max_reviews=200` on a place that has fewer.** You'll
be auto-billed at the 40-credit floor, but the wall clock still
reflects however many reviews Google actually returns. Set
`max_reviews` to a realistic target.
* **Hammering `/v1/scrape/runs/{id}` every 100ms.** Polling is free but
it counts against your rate limit. 2-10 seconds is plenty for most
scrapes; 10-15s is fine for big maps runs.
* **Reimplementing polling and retries by hand.** The official Python
and Node SDKs (section 6) wrap auth, async job polling
(`wait_for_run` / `waitForRun`), and typed errors. Reach for them
before writing your own HTTP client.
---
## 9. MCP server (Model Context Protocol)
ScrapeNest is also a hosted MCP server, so AI assistants (Claude Code,
Cursor, VS Code, LM Studio, ChatGPT) can call it as native tools.
* Endpoint: https://scrapenest.dev/mcp (overview:
https://scrapenest.dev/mcp-server)
* Transport: streamable HTTP, stateless, JSON responses
* Auth: `Authorization: Bearer sn_...` header (any dashboard key; no
separate MCP key). ChatGPT connects with OAuth instead: the user signs in
to ScrapeNest and approves access, and the account's email must be
verified first. An `?apiKey=sn_...` query parameter is still accepted,
but a key in a URL leaks into browser history and logs, so prefer the
header or OAuth.
* Default profile, nine tools (thin wrappers over the section-3 endpoints,
same credit cost, output footer shows credits charged, translate_text
included; a failed call returns an MCP result with `isError: true` and
the error text): web_search (/v1/search), ask_web (/v1/search/answer),
deep_search (/v1/search/deep), scrape_url (/v1/scrape/url),
translate_text (/v1/translate), maps_reviews
(/v1/scrape/google-maps/reviews/async), audio_transcript
(/v1/audio/transcript/async), poll_run (/v1/scrape/runs/{run_id}),
scrapenest_account (/v1/me).
* maps_reviews and audio_transcript are long jobs: they submit to the
async endpoints and wait ~1 minute inline. If the job is still going
they hand back a run_id for poll_run, which the assistant calls until
the result is ready. Polling is free; the job bills once on completion.
maps_reviews takes a place name and city, a Google Maps URL or a place
ID, and `max_reviews` 1-2000 (default 50); larger pulls need the REST
endpoint.
* The `topic` argument on web_search, ask_web and deep_search follows
`/v1/search`: omit it to auto-detect news intent; `"general"` turns that
auto-routing off; `"news"`, `"research"` and `"code"` pick the vertical.
* web_search accepts `depth` `fast`, `balanced` (default) or `thorough`
(no `stealth`); deep_search defaults to `fetch_top` 3.
* `?profile=chatgpt` serves two tools instead of nine: `search` (web
results as JSON, each with an `id`, `title`, `text` and `url`; via
/v1/search, 5 credits) and `fetch` (the full text of one result by its
`id`; via /v1/scrape/url, 1-40 credits). That is the search/fetch shape
ChatGPT's company knowledge works with: it only includes connectors that
offer search and fetch. Use the default profile for everything else.
* ChatGPT setup, following OpenAI's current help: custom MCP servers need
ChatGPT on the web with a Business, Enterprise or Edu workspace (on
Business only admins and owners can add one). Open Plugins, select +,
then Add custom MCP server; enter https://scrapenest.dev/mcp under
Connection; choose OAuth for authentication; tick "I understand and want
to continue"; select Create as a plugin; sign in to ScrapeNest and
approve access. In a new chat, type @ and pick the plugin.
* Claude Code one-liner (keep `--header` after the URL; the flag takes
every value that follows it):
claude mcp add --transport http scrapenest https://scrapenest.dev/mcp --header "Authorization: Bearer $SCRAPENEST_API_KEY"
* Cursor (`~/.cursor/mcp.json`) and LM Studio (`mcp.json`, from the
Program tab: Install, then Edit mcp.json) use
`{"mcpServers": {"scrapenest": {"url": "https://scrapenest.dev/mcp", "headers": {"Authorization": "Bearer sn_..."}}}}`.
VS Code (`.vscode/mcp.json`) uses `{"servers": {"scrapenest": {"type":
"http", "url": "https://scrapenest.dev/mcp", "headers":
{"Authorization": "Bearer ${input:scrapenest-key}"}}}}` with a matching
`promptString` entry in `inputs`.
* Tool calls are capped at ~90s; a call cancelled for exceeding the budget
is not billed. scrape_url passes `timeout_seconds` 80 unless you set a
lower one (max 80). For longer stealth scrapes call /v1 directly with a
higher timeout_seconds.
* Full setup guide: https://scrapenest.dev/docs#mcp
---
## Where to next
* Short index of every docs page: https://scrapenest.dev/llms.txt
* OpenAPI spec (machine-readable): https://scrapenest.dev/openapi.json
* Interactive API reference: https://scrapenest.dev/reference
* Human docs: https://scrapenest.dev/docs
* Endpoint catalog: https://scrapenest.dev/catalog (each page also as
Markdown at https://scrapenest.dev/catalog/.md)
* Pricing, plans and credit costs: https://scrapenest.dev/pricing
* Python SDK: `pip install scrapenest` (https://pypi.org/project/scrapenest/)
* Node/TypeScript SDK: `npm install scrapenest` (https://www.npmjs.com/package/scrapenest)
* MCP server (Claude Code, Cursor, VS Code, ChatGPT): https://scrapenest.dev/mcp-server,
setup at https://scrapenest.dev/docs#mcp
* Dashboard + key management: https://scrapenest.dev/dashboard
* Changelog: https://scrapenest.dev/changelog (Atom feed: https://scrapenest.dev/changelog.xml)
* Status: https://status.scrapenest.dev/
* Security disclosures: https://scrapenest.dev/.well-known/security.txt
* Terms of service: https://scrapenest.dev/terms
* Privacy policy: https://scrapenest.dev/privacy
* Acceptable use policy: https://scrapenest.dev/acceptable-use