Skip to main content
GET
Scrape a page
Fetches one URL and returns it in the formats you ask for. POST /scrape takes the same options as a JSON body, which is easier for json_schema and headers. 1 credit, +3 for summary, json or check_prompt_injection. Failed requests are never charged.

Guide: Scrape

Formats, main content, JSON extraction, PDFs, the prompt-injection check and examples.

Authorizations

X-API-Key
string
header
required

Your Prefetch API key. Obtain one from the dashboard.

Query Parameters

url
string
required

The website URL to process. https:// is prepended automatically if no protocol is provided.

Example:

"https://stripe.com"

formats
string
default:markdown

Comma-separated list of output formats: markdown, summary, html, raw_html, links, images, json, screenshot. Each requested format appears as its own object on data; formats you do not request are absent, not null.

Example:

"markdown,links"

only_main_content
boolean
default:true

Strip navigation, sidebars, footers, and cookie banners before rendering markdown, html, summary, and json. links and images always come from the full document.

Keep hyperlinks in the markdown and html output. When false, link text is kept and the target is dropped.

include_images
boolean
default:true

Keep images in the markdown and html output.

include_base64_images
boolean
default:false

Keep inline data: images. Off by default because base64 payloads are large and carry no meaning as text.

include_selectors
string

Comma-separated CSS selectors to keep. Overrides main-content detection entirely.

Example:

"article,.post-body"

exclude_selectors
string

Comma-separated CSS selectors to remove before rendering.

Example:

".cookie-bar,#promo"

json_prompt
string

What to extract, in plain language. Required for the json format unless json_schema is given.

Example:

"product name, price and availability"

json_schema
string

A JSON Schema, passed as a JSON string, describing the object the json format should return.

summary_max_words
integer
default:120

Word budget for the summary format.

Required range: 20 <= x <= 400
screenshot_full_page
boolean
default:false

For the screenshot format: capture the whole scrollable page.

screenshot_format
enum<string>
default:jpeg

For the screenshot format: image type.

Available options:
jpeg,
png,
webp
wait_for
integer
default:0

Milliseconds to wait after the page loads, for content that arrives late. Renders in a browser.

Required range: 0 <= x <= 30000
wait_for_selector
string

Wait (up to 10 s) for this CSS selector before reading the page. Best effort: if it never appears, the page is returned with a warning.

Example:

"#pricing-table"

headers
string

Request headers to send to the target, as a JSON object string. Up to 20; hop-by-hop and proxy headers are refused. Requests with headers are never cached. Easier as an object in POST /scrape.

Example:

"{\"Accept-Language\":\"de-DE\"}"

mobile
boolean
default:false

Render the page as a phone (viewport, touch and user agent).

timeout
integer
default:50000

Give up after this many milliseconds.

Required range: 5000 <= x <= 50000
max_age
integer
default:0

Accept a stored copy of the page fetched at most this many milliseconds ago instead of fetching it again (up to 30 days). Any mix of formats is served from one stored fetch; metadata.cache_state says which happened. 0 always fetches.

Required range: 0 <= x <= 2592000000
store_in_cache
boolean
default:true

Store this fetch for later max_age requests.

check_prompt_injection
boolean
default:false

Check the page's text for prompt injection — text written to make an AI model reading the page ignore its instructions, leak data or take actions — and report it in prompt_injection. The page is still returned: the check warns, it does not block. Costs the same 3-credit surcharge as summary and json (once per page, however many of the three you ask for).

Response

Page scraped.

success
enum<boolean>
required
Available options:
true
data
object
required

The page content fields. Which of them are present depends on the formats requested.

meta
object
required