Take a screenshot
curl --request GET \
--url https://api.prefetch.io/screenshot \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.prefetch.io/screenshot"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.prefetch.io/screenshot', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.prefetch.io/screenshot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.prefetch.io/screenshot"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.prefetch.io/screenshot")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prefetch.io/screenshot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"url": "https://stripe.com",
"screenshot_url": "https://assets.prefetch.io/screenshots/stripe-1440x900.jpg",
"viewport": {
"width": 1440,
"height": 900
},
"format": "jpeg",
"full_page": false,
"captured_at": "2026-05-14T10:00:00.000Z"
},
"meta": {
"requestId": "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
"durationMs": 2540
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}Endpoints
GET /screenshot
Capture a webpage screenshot and get a public URL to the image. Costs 2 credits.
GET
/
screenshot
Take a screenshot
curl --request GET \
--url https://api.prefetch.io/screenshot \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.prefetch.io/screenshot"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.prefetch.io/screenshot', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.prefetch.io/screenshot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.prefetch.io/screenshot"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.prefetch.io/screenshot")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prefetch.io/screenshot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"url": "https://stripe.com",
"screenshot_url": "https://assets.prefetch.io/screenshots/stripe-1440x900.jpg",
"viewport": {
"width": 1440,
"height": 900
},
"format": "jpeg",
"full_page": false,
"captured_at": "2026-05-14T10:00:00.000Z"
},
"meta": {
"requestId": "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
"durationMs": 2540
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"success": false,
"error": "Credit limit exceeded",
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}Overview
/screenshot opens a URL in a headless Chrome browser and captures a screenshot. The image is stored in cloud storage and a public URL is returned. You can configure:
- Viewport size — width and height of the browser window
- Full page — capture the entire scrollable content instead of just the viewport
- Format — JPEG (smaller), PNG (lossless), or WebP (best compression)
Example requests
curl "https://api.prefetch.io/screenshot?url=https://stripe.com" \
-H "X-API-Key: $PREFETCH_API_KEY"
curl "https://api.prefetch.io/screenshot?url=https://stripe.com&width=390&height=844" \
-H "X-API-Key: $PREFETCH_API_KEY"
curl "https://api.prefetch.io/screenshot?url=https://stripe.com&full_page=true&format=png" \
-H "X-API-Key: $PREFETCH_API_KEY"
const params = new URLSearchParams({
url: "https://stripe.com",
width: "1280",
height: "800",
format: "webp",
full_page: "false",
});
const res = await fetch(
`https://api.prefetch.io/screenshot?${params}`,
{ headers: { "X-API-Key": process.env.PREFETCH_API_KEY } }
);
const { data } = await res.json();
console.log(data.screenshot_url);
Example response
{
"success": true,
"data": {
"url": "https://stripe.com",
"screenshot_url": "https://assets.prefetch.io/screenshots/stripe-1440x900-abc123.jpg",
"viewport": {
"width": 1440,
"height": 900
},
"format": "jpeg",
"full_page": false,
"captured_at": "2026-03-19T14:22:05.000Z"
},
"meta": {
"requestId": "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
"durationMs": 2540
}
}
Format comparison
| Format | Best for | Notes |
|---|---|---|
jpeg | General use, thumbnails | Smallest file size, lossy compression |
png | Logos, UI elements, transparency | Lossless, larger files |
webp | Web display | Best compression-to-quality ratio |
Parameter limits
| Parameter | Default | Min | Max |
|---|---|---|---|
width | 1440 | 320 | 5000 |
height | 900 | 320 | 5000 |
format | jpeg | — | — |
full_page | false | — | — |
Authorizations
Your Prefetch API key. Obtain one from the dashboard.
Query Parameters
The website URL to process. https:// is prepended automatically if no protocol is provided.
Example:
"https://stripe.com"
Viewport width in pixels. Range: 320–2560. Default: 1440.
Required range:
320 <= x <= 2560Viewport height in pixels. Range: 240–5000. Default: 900.
Required range:
240 <= x <= 5000Image format. Default: jpeg.
Available options:
jpeg, png, webp Capture full scrollable page height. Default: false.