curl --request POST \
--url https://api.hydrafetch.com/v1/web/screenshot \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"url": "https://example.com",
"fullPage": true,
"waitFor": 15000,
"timeout": 50500,
"maxAge": 1,
"viewport": "desktop",
"viewportWidth": 2080,
"viewportHeight": 1200
}
'import requests
url = "https://api.hydrafetch.com/v1/web/screenshot"
payload = {
"url": "https://example.com",
"fullPage": True,
"waitFor": 15000,
"timeout": 50500,
"maxAge": 1,
"viewport": "desktop",
"viewportWidth": 2080,
"viewportHeight": 1200
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com',
fullPage: true,
waitFor: 15000,
timeout: 50500,
maxAge: 1,
viewport: 'desktop',
viewportWidth: 2080,
viewportHeight: 1200
})
};
fetch('https://api.hydrafetch.com/v1/web/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.hydrafetch.com/v1/web/screenshot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://example.com',
'fullPage' => true,
'waitFor' => 15000,
'timeout' => 50500,
'maxAge' => 1,
'viewport' => 'desktop',
'viewportWidth' => 2080,
'viewportHeight' => 1200
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hydrafetch.com/v1/web/screenshot"
payload := strings.NewReader("{\n \"url\": \"https://example.com\",\n \"fullPage\": true,\n \"waitFor\": 15000,\n \"timeout\": 50500,\n \"maxAge\": 1,\n \"viewport\": \"desktop\",\n \"viewportWidth\": 2080,\n \"viewportHeight\": 1200\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hydrafetch.com/v1/web/screenshot")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com\",\n \"fullPage\": true,\n \"waitFor\": 15000,\n \"timeout\": 50500,\n \"maxAge\": 1,\n \"viewport\": \"desktop\",\n \"viewportWidth\": 2080,\n \"viewportHeight\": 1200\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hydrafetch.com/v1/web/screenshot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com\",\n \"fullPage\": true,\n \"waitFor\": 15000,\n \"timeout\": 50500,\n \"maxAge\": 1,\n \"viewport\": \"desktop\",\n \"viewportWidth\": 2080,\n \"viewportHeight\": 1200\n}"
response = http.request(request)
puts response.read_body{
"data": {
"url": "https://example.com",
"finalUrl": "https://example.com/",
"status": 200,
"screenshot": "https://media.hydrafetch.com/screenshots/a1/a1b2c3.png",
"screenshotType": "viewport",
"width": 1920,
"height": 1080,
"cached": false
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "url must be a valid URL"
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Missing X-API-Key header. Agents: https://hydrafetch.com/auth.md"
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "INSUFFICIENT_CREDITS",
"message": "Insufficient credits"
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "WORKSPACE_BANNED",
"message": "This workspace has been suspended and cannot make API requests."
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Job not found"
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "UPSTREAM_UNREACHABLE",
"message": "The origin did not respond to any attempt we made."
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "TOO_MANY_REQUESTS",
"message": "Rate limit exceeded for this workspace and plan."
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error"
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "SERVICE_UNAVAILABLE",
"message": "The summary and json formats are not available."
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}Screenshot a page
Capture a full-page PNG screenshot of a rendered page.
curl --request POST \
--url https://api.hydrafetch.com/v1/web/screenshot \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"url": "https://example.com",
"fullPage": true,
"waitFor": 15000,
"timeout": 50500,
"maxAge": 1,
"viewport": "desktop",
"viewportWidth": 2080,
"viewportHeight": 1200
}
'import requests
url = "https://api.hydrafetch.com/v1/web/screenshot"
payload = {
"url": "https://example.com",
"fullPage": True,
"waitFor": 15000,
"timeout": 50500,
"maxAge": 1,
"viewport": "desktop",
"viewportWidth": 2080,
"viewportHeight": 1200
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com',
fullPage: true,
waitFor: 15000,
timeout: 50500,
maxAge: 1,
viewport: 'desktop',
viewportWidth: 2080,
viewportHeight: 1200
})
};
fetch('https://api.hydrafetch.com/v1/web/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.hydrafetch.com/v1/web/screenshot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://example.com',
'fullPage' => true,
'waitFor' => 15000,
'timeout' => 50500,
'maxAge' => 1,
'viewport' => 'desktop',
'viewportWidth' => 2080,
'viewportHeight' => 1200
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hydrafetch.com/v1/web/screenshot"
payload := strings.NewReader("{\n \"url\": \"https://example.com\",\n \"fullPage\": true,\n \"waitFor\": 15000,\n \"timeout\": 50500,\n \"maxAge\": 1,\n \"viewport\": \"desktop\",\n \"viewportWidth\": 2080,\n \"viewportHeight\": 1200\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hydrafetch.com/v1/web/screenshot")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com\",\n \"fullPage\": true,\n \"waitFor\": 15000,\n \"timeout\": 50500,\n \"maxAge\": 1,\n \"viewport\": \"desktop\",\n \"viewportWidth\": 2080,\n \"viewportHeight\": 1200\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hydrafetch.com/v1/web/screenshot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com\",\n \"fullPage\": true,\n \"waitFor\": 15000,\n \"timeout\": 50500,\n \"maxAge\": 1,\n \"viewport\": \"desktop\",\n \"viewportWidth\": 2080,\n \"viewportHeight\": 1200\n}"
response = http.request(request)
puts response.read_body{
"data": {
"url": "https://example.com",
"finalUrl": "https://example.com/",
"status": 200,
"screenshot": "https://media.hydrafetch.com/screenshots/a1/a1b2c3.png",
"screenshotType": "viewport",
"width": 1920,
"height": 1080,
"cached": false
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "url must be a valid URL"
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Missing X-API-Key header. Agents: https://hydrafetch.com/auth.md"
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "INSUFFICIENT_CREDITS",
"message": "Insufficient credits"
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "WORKSPACE_BANNED",
"message": "This workspace has been suspended and cannot make API requests."
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Job not found"
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "UPSTREAM_UNREACHABLE",
"message": "The origin did not respond to any attempt we made."
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "TOO_MANY_REQUESTS",
"message": "Rate limit exceeded for this workspace and plan."
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error"
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}{
"success": false,
"error": {
"code": "SERVICE_UNAVAILABLE",
"message": "The summary and json formats are not available."
},
"meta": {
"requestId": "019e8a3c-9f0b-7c12-88ab-1d2e3f4a5b6c"
}
}Authorizations
Body
The URL to screenshot. Must be http(s).
"https://example.com"
Capture the entire scrollable page instead of just the viewport. Default off.
true
Extra milliseconds to let the page settle before capture.
0 <= x <= 30000Overall time budget for the request, in milliseconds.
1000 <= x <= 100000Reuse a stored screenshot if it is younger than this many milliseconds. Defaults to 7 days, so a repeated request returns the stored PNG with cached: true without re-rendering — which also means it returns immediately and does not apply waitFor. Pass 0 to force a fresh capture.
x >= 0Screen size to render at. Defaults to desktop (1920x1080). Ignored when width/height are given explicitly.
desktop, laptop, tablet, mobile "desktop"
Exact viewport width in pixels. Overrides viewport.
320 <= x <= 3840Exact viewport height in pixels. Overrides viewport. With fullPage the capture still extends to the full page height.
240 <= x <= 2160Response
Show child attributes
Show child attributes
Was this page helpful?