Web Scraping
Screenshot a page
Capture a full-page PNG screenshot of a rendered page.
POST
/
v1
/
web
/
screenshot
Screenshot a 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": 60500
}
'import requests
url = "https://api.hydrafetch.com/v1/web/screenshot"
payload = {
"url": "https://example.com",
"fullPage": True,
"waitFor": 15000,
"timeout": 60500
}
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: 60500})
};
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' => 60500
]),
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\": 60500\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\": 60500\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\": 60500\n}"
response = http.request(request)
puts response.read_body{
"data": {
"url": "https://example.com",
"finalUrl": "https://example.com/",
"status": 200,
"image": "<string>"
}
}Authorizations
Body
application/json
The URL to screenshot. Must be http(s).
Example:
"https://example.com"
Capture the entire scrollable page instead of just the viewport. Default off.
Example:
true
Extra milliseconds to let the page settle before capture.
Required range:
0 <= x <= 30000Overall time budget for the request, in milliseconds.
Required range:
1000 <= x <= 120000Response
200 - application/json
Show child attributes
Show child attributes
⌘I
Screenshot a 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": 60500
}
'import requests
url = "https://api.hydrafetch.com/v1/web/screenshot"
payload = {
"url": "https://example.com",
"fullPage": True,
"waitFor": 15000,
"timeout": 60500
}
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: 60500})
};
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' => 60500
]),
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\": 60500\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\": 60500\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\": 60500\n}"
response = http.request(request)
puts response.read_body{
"data": {
"url": "https://example.com",
"finalUrl": "https://example.com/",
"status": 200,
"image": "<string>"
}
}