A documentação da API está disponível em inglês.

Screenshot

Take a screenshot of a web page.

GET/api/v1/web/screenshot

Alpha: this endpoint is new and its response fields may still change.

Costs 1 credit per request; failed requests are refunded. Authentication, the search_metadata envelope and error codes are the same as for every endpoint (see the API reference). Try it in the playground.

Parameters

Screenshot

Capture a PNG and receive its authenticated download URL.

ParameterTypeDescription
urlrequiredstringPublic HTTP(S) URL to capture, 1-8,192 characters. Include http:// or https://; bare domains are rejected. The host must be public, on port 80 or 443, without embedded credentials.Up to 8,192 characters.
full_pagebooleanCapture the full page when true. The default, false, captures the viewport.Default: false.

Browser

For custom cookies, viewport dimensions and scripts, send a POST request with a JSON body. See the Screenshot API reference.

ParameterTypeDescription
remove_overlaybooleanRemove modal and cookie-banner overlays from the page.
detach_invisiblesbooleanDrop display:none elements from the page.
wait_for_selectorstringCSS selector to wait for after navigation, 1-2,048 characters. POST also accepts a list of 1-16 selectors.Up to 2,048 characters.
user_agentstringUser-Agent for the page request, 1-1,024 characters without control characters. Defaults to the browser's own.Up to 1,024 characters.
page_timeoutintegerSeconds from 1 through 180 for page loading and browser operations. Cannot extend the total request budget set by timeout.Range: 1 to 180.
localestringBrowser locale as a language tag, 2-64 characters. Defaults to the browser's own.Up to 64 characters.
refererstringHTTP(S) URL sent as the Referer.Up to 8,192 characters.
assert_status_codeintegerExpected origin HTTP status, 100-599. A different status is rejected; otherwise a rendered error page is a successful capture.Range: 100 to 599.
robots_txtstringUser agent, 1-256 characters, to check against the site's robots.txt; disallowed URLs are rejected.Up to 256 characters.
respond_timing"html" | "visible-content" | "mutation-idle" | "resource-idle" | "media-idle" | "network-idle"Page readiness condition to reach before responding.

Response

A JSON object with search_metadata (request id, credits used and remaining) and the result groups the page returns. Groups and fields depend on the content of each page, so treat every field as optional.

Examples

cURL
curl "https://serpfast.com/api/v1/web/screenshot?url=https%3A%2F%2Fexample.com&full_page=false" \
  -H "Authorization: Bearer $SERPFAST_KEY"
Node.js 18+
const params = new URLSearchParams({
  "url": "https://example.com",
  "full_page": false
});
const res = await fetch(`https://serpfast.com/api/v1/web/screenshot?${params}`, {
  headers: { Authorization: `Bearer ${process.env.SERPFAST_KEY}` },
});
const data = await res.json();
console.log(data);
Python
import os, requests

params = {
  "url": "https://example.com",
  "full_page": False
}
res = requests.get(
    "https://serpfast.com/api/v1/web/screenshot",
    params=params,
    headers={"Authorization": f"Bearer {os.environ['SERPFAST_KEY']}"},
    timeout=120,
)
print(res.json())