For the complete documentation index, see llms.txt. This page is also available as Markdown.

/scrape

Learn how to use Oxylabs Web API /scrape endpoint to fetch and parse any web page in the format you want.

The /v1/scrape endpoint fetches web pages by URL, automatically handling headless rendering, proxy rotation, access challenges, and localization. It returns structured page data in Markdown, HTML, JSON, or as PNG screenshots.

Request sample

The endpoint accepts a JSON payload defining the target URL, requested output formats, rendering options, and geo-location context.

curl https://webapi.oxylabs.io/v1/scrape \
  -H "Authorization: Bearer $OXYLABS_WEB_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
      "url": "https://artificialintelligenceact.eu/implementation-timeline/",
      "output": ["markdown"]
  }'

Request parameters

Parameter
Description
Type

url

Absolute http / https target URL.

string

output

Response format: markdown, html, json, screenshot. Supports multiple values. Default: html

array of strings

json

When output: ["json"], can be used for custom AI parsing through prompt or schema. See AI Parsing.

object

location

Two-letter ISO 3166-1 alpha-2 country code (e.g., "US", "DE", "JP").

string

device

User-agent and viewport emulation: "desktop" (default) or "mobile".

string

run_js

Enables JavaScript rendering when set to true. Default: false.

boolean

– mandatory parameter.

output

The output array allows fetching multiple output formats in a single request execution. Below is an example of combined output request:

markdown

Converts the DOM tree into clean, structured Markdown, stripping navigation scripts and styling formatting. Optimized for ingestion into LLM context windows to minimize token usage.

html

The raw page markup. Use it when you need the markup itself (attributes, embedded JSON-LD, inline data). Not recommended for page content collection.

screenshot

Base64-encoded PNG image of the fully rendered page. run_js: true is required, otherwise the request is rejected.

json

Structured extraction in the same request as the retrieval (no selectors to write or maintain). Uses a dedicated parser (for supported targets) or AI parsing by you describing the fields in a prompt, or pin their exact shape with a schema.

Exception: video output format is available only for /scrape/media dedicated scrapers.

run_js

Executes the page's own JavaScript before the content is captured.

Dropping run_js defaults to the optimal execution path for the given source path. Explicitly setting "run_js": true uses a headless browser instance to execute client-side scripts, dynamic XHR requests, and Single Page Application (SPA) rendering.

  • Latency impact: Headless browser rendering increases request duration significantly. Set client HTTP timeouts to at least 150 seconds. When high volume is required, async delivery is recommended.

  • Resource optimization: Always try fetching content without it. For static pages or RSS/atom feeds, pass "run_js": false to maximize request throughput and minimize latency. Choose rendering only when necessary.

location

Geo-targeting routes requests through localized proxy exit nodes. This ensures localized pricing, language variations, and region-exclusive content are served correctly.

When using Dedicated Scrapers, some localization parameters may be named differently.

Output sample

A successful request returns an HTTP 200 OK status with a standard envelope. Fields inside results[] with unrequested output formats return null.

results[] field with unrequested output formats return null. For example, asking for ["markdown"] populates markdown and leaves html, screenshot and json as null. Any dedicated scraper puts its structured fields under json.

Output dictionary

Field
Description
Type

status

HTTP status code, 200 on success. See Error codes.

integer

results

One entry for the requested URL.

array

results[].markdown

Page as Markdown, if requested. null otherwise.

string

results[].html

Raw result markup, if requested. null otherwise.

string

results[].json

Parsed fields from a dedicated scraper or AI parser, if requested null otherwise.

object

results[].screenshot

Base64-encoded image string, if requested. null otherwise.

string

results[].metadata.url

Fetched URL for scraping after redirects.

string

params

All parameters use for the requests with applied defaults.

object

metadata.timestamp

Unix timestamp in seconds.

integer

metadata.request_id

Identifier for this request. Include it in support tickets.

string

Latency and concurrency

A scrape renders a real page with budget in seconds, not milliseconds. We recommend a couple of of safe practices to build around that:

Client timeout

150 seconds is a safe default, while a 10-second timeout may fail on pages that would have succeeded. For higher volume (e.g. media, large SERP runs, etc.) with a risk of client timeout, run the same scrapers with async delivery instead of blocking the request. See Delivery Modes.

Concurrency limit

Scraping ten search results in parallel multiplies cost and latency for pages you won't read. Scrape the two or three that plausibly answer the question and only increase concurrency gradually until 429 error is reached.

Dedicated scrapers

Beyond generic URL scraping, target-specific scrapers can be used with POST /v1/scrape/{target}/{collection}. They accept target-specific parameters (e.g., ASINs, browse nodes, store zip codes) and return structured fields under results[].json:

See Dedicated scrapers for target overviews (Google, Amazon, YouTube, Bing, AI & LLMs, Commerce, etc.).

Last updated

Was this helpful?