POST /v1/crawl/web-scraping-api
Web scraping API: fetch any public URL, with proxies and JS rendering
Send a public url and get the final URL, status, content type, headers and body back, with JSON bodies parsed. Add extract to map fields to dot-paths in the JSON, geo to pin the session and type of the proxy exit, and spoof to render the page in a browser, wait for a CSS selector or set headers and locale. Send method: "POST" with form and cookies to submit a form, and read the cookie jar back in data.cookies. An egress we cannot serve answers 400 and is not billed.
- Price
- $0.0005 per call
- Batch
- Yes, through /v1/batch
- Failed calls
- Not charged
Example request
curl -X POST 'https://api.virev.ai/v1/crawl/web-scraping-api' \
-H "Authorization: Bearer $VIREV_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"url":"https://hacker-news.firebaseio.com/v0/item/1.json","extract":{"author":"by","title":"title"}}'import os
import requests
response = requests.request(
"POST",
"https://api.virev.ai/v1/crawl/web-scraping-api",
json={
"url": "https://hacker-news.firebaseio.com/v0/item/1.json",
"extract": {
"author": "by",
"title": "title",
},
},
headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
timeout=60,
)
response.raise_for_status()
print(response.json())Request body
{
"url": "https://hacker-news.firebaseio.com/v0/item/1.json",
"extract": {
"author": "by",
"title": "title"
}
}Example response
The example response of the API reference.
{
"data": {
"final_url": "https://hacker-news.firebaseio.com/v0/item/1.json",
"status": 200,
"content_type": "application/json; charset=utf-8",
"payload_kind": "json",
"response_headers": {
"content-type": "application/json; charset=utf-8",
"cache-control": "no-cache"
},
"body": {
"by": "pg",
"descendants": 3,
"id": 1,
"kids": [
15,
487171
],
"score": 57,
"time": 1160418111,
"title": "Y Combinator",
"type": "story",
"url": "http://ycombinator.com"
}
},
"meta": {
"cost": "$0.0005",
"balance": "$3.0795",
"request_id": "req_35145924f648947eb50334cc25a0dca7"
}
}How it works
Fetch any public url and get the document back. Every call leaves through our paid proxy pool, never from our own servers: a call with no geo takes an exit the pool picks, and a geo target picks the session and type of the exit. Optional extract maps output fields to dot-paths in the parsed JSON. Optional geo targets the egress: session (8 lowercase alphanumerics — reuse the same value across calls to keep one exit IP), lifetime (minutes, 3–1440, requires session), and type (residential/mobile/datacenter). A geo target is either honoured or refused, never silently substituted — an egress we cannot serve returns 400 and is not charged. Optional spoof decides how the request PRESENTS itself: render executes the target page JavaScript in a real de-automated browser (for surfaces that serve no content to a plain HTTP client), warm_url establishes the target cookies first in the same browser context, wait_for is a CSS selector proving the page produced its content (echoed back as wait_matched), plus headers, user_agent, locale, accept_consent, timeout_ms, and the settle fields that end a rendered read once its text stops growing. The /v1/search/* SERP endpoints are exactly this door with a search-engine URL and a spoof block.
To submit a form, send method: "POST" with form (fields sent URL-encoded as UTF-8) or body (a raw string whose content type you set in spoof.headers), never both. cookies maps cookie names to values and goes only to the URL's host. Every plain answer returns data.cookies, the cookie jar after the read. A form flow is two calls on one geo.session: GET the form page, read its token from body and keep its cookies, then POST the token in form with those cookies. A POST is sent to the site once and never retried, because a form token can be single-use. A rendered fetch (spoof.render) only GETs and takes no cookies.
Only public destinations; redirects, size, and time are bounded.
Errors
| Status | When |
|---|---|
400 | The request parameters are invalid. |
401 | Missing, malformed, or revoked API key. |
402 | Balance is too low for this request. |
429 | Over the per-minute limit. The limit belongs to your organization and all its API keys share it: 100 requests per minute unless an increase was granted. Wait for the Retry-After seconds, then retry. On a live read, code rate_limited means the platform itself rate-limited this read; retry after the Retry-After seconds. You are not charged. |
502 | The upstream fetch failed. You are not charged. |
503 | Billing could not be confirmed, so no upstream data was returned. |
504 | The upstream request timed out. You are not charged. |