Start a crawl
Discover and scrape a whole site as one asynchronous job. Returns a crawl id immediately; poll it or register a webhook. One credit per page scraped.
curl --request POST \
--url https://api.hydrafetch.com/v1/web/crawl \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"url": "https://example.com",
"limit": 100,
"maxDepth": 2,
"includePaths": [
"^/blog/.*"
],
"excludePaths": [
"^/tag/.*"
],
"allowSubdomains": false,
"allowExternalLinks": false,
"ignoreQueryParameters": false,
"sitemap": "include",
"scrapeOptions": {
"formats": [
"markdown"
],
"onlyMainContent": true,
"includeTags": [
"<string>"
],
"excludeTags": [
"<string>"
],
"removeBase64Images": true,
"blockAds": true,
"includeLinks": true,
"renderJs": true,
"waitFor": 15000,
"timeout": 60500,
"location": {
"country": "us",
"languages": [
"en-US",
"en"
]
},
"headers": {},
"preferStructure": true,
"maxAge": 302400000
}
}
'import requests
url = "https://api.hydrafetch.com/v1/web/crawl"
payload = {
"url": "https://example.com",
"limit": 100,
"maxDepth": 2,
"includePaths": ["^/blog/.*"],
"excludePaths": ["^/tag/.*"],
"allowSubdomains": False,
"allowExternalLinks": False,
"ignoreQueryParameters": False,
"sitemap": "include",
"scrapeOptions": {
"formats": ["markdown"],
"onlyMainContent": True,
"includeTags": ["<string>"],
"excludeTags": ["<string>"],
"removeBase64Images": True,
"blockAds": True,
"includeLinks": True,
"renderJs": True,
"waitFor": 15000,
"timeout": 60500,
"location": {
"country": "us",
"languages": ["en-US", "en"]
},
"headers": {},
"preferStructure": True,
"maxAge": 302400000
}
}
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',
limit: 100,
maxDepth: 2,
includePaths: ['^/blog/.*'],
excludePaths: ['^/tag/.*'],
allowSubdomains: false,
allowExternalLinks: false,
ignoreQueryParameters: false,
sitemap: 'include',
scrapeOptions: {
formats: ['markdown'],
onlyMainContent: true,
includeTags: ['<string>'],
excludeTags: ['<string>'],
removeBase64Images: true,
blockAds: true,
includeLinks: true,
renderJs: true,
waitFor: 15000,
timeout: 60500,
location: {country: 'us', languages: ['en-US', 'en']},
headers: {},
preferStructure: true,
maxAge: 302400000
}
})
};
fetch('https://api.hydrafetch.com/v1/web/crawl', 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/crawl",
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',
'limit' => 100,
'maxDepth' => 2,
'includePaths' => [
'^/blog/.*'
],
'excludePaths' => [
'^/tag/.*'
],
'allowSubdomains' => false,
'allowExternalLinks' => false,
'ignoreQueryParameters' => false,
'sitemap' => 'include',
'scrapeOptions' => [
'formats' => [
'markdown'
],
'onlyMainContent' => true,
'includeTags' => [
'<string>'
],
'excludeTags' => [
'<string>'
],
'removeBase64Images' => true,
'blockAds' => true,
'includeLinks' => true,
'renderJs' => true,
'waitFor' => 15000,
'timeout' => 60500,
'location' => [
'country' => 'us',
'languages' => [
'en-US',
'en'
]
],
'headers' => [
],
'preferStructure' => true,
'maxAge' => 302400000
]
]),
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/crawl"
payload := strings.NewReader("{\n \"url\": \"https://example.com\",\n \"limit\": 100,\n \"maxDepth\": 2,\n \"includePaths\": [\n \"^/blog/.*\"\n ],\n \"excludePaths\": [\n \"^/tag/.*\"\n ],\n \"allowSubdomains\": false,\n \"allowExternalLinks\": false,\n \"ignoreQueryParameters\": false,\n \"sitemap\": \"include\",\n \"scrapeOptions\": {\n \"formats\": [\n \"markdown\"\n ],\n \"onlyMainContent\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"removeBase64Images\": true,\n \"blockAds\": true,\n \"includeLinks\": true,\n \"renderJs\": true,\n \"waitFor\": 15000,\n \"timeout\": 60500,\n \"location\": {\n \"country\": \"us\",\n \"languages\": [\n \"en-US\",\n \"en\"\n ]\n },\n \"headers\": {},\n \"preferStructure\": true,\n \"maxAge\": 302400000\n }\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/crawl")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com\",\n \"limit\": 100,\n \"maxDepth\": 2,\n \"includePaths\": [\n \"^/blog/.*\"\n ],\n \"excludePaths\": [\n \"^/tag/.*\"\n ],\n \"allowSubdomains\": false,\n \"allowExternalLinks\": false,\n \"ignoreQueryParameters\": false,\n \"sitemap\": \"include\",\n \"scrapeOptions\": {\n \"formats\": [\n \"markdown\"\n ],\n \"onlyMainContent\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"removeBase64Images\": true,\n \"blockAds\": true,\n \"includeLinks\": true,\n \"renderJs\": true,\n \"waitFor\": 15000,\n \"timeout\": 60500,\n \"location\": {\n \"country\": \"us\",\n \"languages\": [\n \"en-US\",\n \"en\"\n ]\n },\n \"headers\": {},\n \"preferStructure\": true,\n \"maxAge\": 302400000\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hydrafetch.com/v1/web/crawl")
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 \"limit\": 100,\n \"maxDepth\": 2,\n \"includePaths\": [\n \"^/blog/.*\"\n ],\n \"excludePaths\": [\n \"^/tag/.*\"\n ],\n \"allowSubdomains\": false,\n \"allowExternalLinks\": false,\n \"ignoreQueryParameters\": false,\n \"sitemap\": \"include\",\n \"scrapeOptions\": {\n \"formats\": [\n \"markdown\"\n ],\n \"onlyMainContent\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"removeBase64Images\": true,\n \"blockAds\": true,\n \"includeLinks\": true,\n \"renderJs\": true,\n \"waitFor\": 15000,\n \"timeout\": 60500,\n \"location\": {\n \"country\": \"us\",\n \"languages\": [\n \"en-US\",\n \"en\"\n ]\n },\n \"headers\": {},\n \"preferStructure\": true,\n \"maxAge\": 302400000\n }\n}"
response = http.request(request)
puts response.read_body{
"crawlId": "019f3c09-6fae-740f-9257-10c2b6af7f43",
"status": "queued"
}Authorizations
Body
The site to start from. Must be http(s).
"https://example.com"
Maximum number of pages to scrape.
1 <= x <= 5000100
How many links deep from the starting page to follow.
0 <= x <= 102
Only follow URLs whose path matches every one of these patterns.
50["^/blog/.*"]
Skip URLs whose path matches any of these patterns.
50["^/tag/.*"]
Also follow links into subdomains of the starting site. Default off.
false
Also follow links that lead off the starting site. Default off.
false
Treat URLs that differ only by query string as the same page. Default off.
false
Whether to seed discovery from the site's published page list. Default includes it.
skip, include "include"
Register a callback to be notified as the crawl progresses instead of polling.
Show child attributes
Show child attributes
How to scrape each page. Same options as a single scrape.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.hydrafetch.com/v1/web/crawl \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"url": "https://example.com",
"limit": 100,
"maxDepth": 2,
"includePaths": [
"^/blog/.*"
],
"excludePaths": [
"^/tag/.*"
],
"allowSubdomains": false,
"allowExternalLinks": false,
"ignoreQueryParameters": false,
"sitemap": "include",
"scrapeOptions": {
"formats": [
"markdown"
],
"onlyMainContent": true,
"includeTags": [
"<string>"
],
"excludeTags": [
"<string>"
],
"removeBase64Images": true,
"blockAds": true,
"includeLinks": true,
"renderJs": true,
"waitFor": 15000,
"timeout": 60500,
"location": {
"country": "us",
"languages": [
"en-US",
"en"
]
},
"headers": {},
"preferStructure": true,
"maxAge": 302400000
}
}
'import requests
url = "https://api.hydrafetch.com/v1/web/crawl"
payload = {
"url": "https://example.com",
"limit": 100,
"maxDepth": 2,
"includePaths": ["^/blog/.*"],
"excludePaths": ["^/tag/.*"],
"allowSubdomains": False,
"allowExternalLinks": False,
"ignoreQueryParameters": False,
"sitemap": "include",
"scrapeOptions": {
"formats": ["markdown"],
"onlyMainContent": True,
"includeTags": ["<string>"],
"excludeTags": ["<string>"],
"removeBase64Images": True,
"blockAds": True,
"includeLinks": True,
"renderJs": True,
"waitFor": 15000,
"timeout": 60500,
"location": {
"country": "us",
"languages": ["en-US", "en"]
},
"headers": {},
"preferStructure": True,
"maxAge": 302400000
}
}
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',
limit: 100,
maxDepth: 2,
includePaths: ['^/blog/.*'],
excludePaths: ['^/tag/.*'],
allowSubdomains: false,
allowExternalLinks: false,
ignoreQueryParameters: false,
sitemap: 'include',
scrapeOptions: {
formats: ['markdown'],
onlyMainContent: true,
includeTags: ['<string>'],
excludeTags: ['<string>'],
removeBase64Images: true,
blockAds: true,
includeLinks: true,
renderJs: true,
waitFor: 15000,
timeout: 60500,
location: {country: 'us', languages: ['en-US', 'en']},
headers: {},
preferStructure: true,
maxAge: 302400000
}
})
};
fetch('https://api.hydrafetch.com/v1/web/crawl', 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/crawl",
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',
'limit' => 100,
'maxDepth' => 2,
'includePaths' => [
'^/blog/.*'
],
'excludePaths' => [
'^/tag/.*'
],
'allowSubdomains' => false,
'allowExternalLinks' => false,
'ignoreQueryParameters' => false,
'sitemap' => 'include',
'scrapeOptions' => [
'formats' => [
'markdown'
],
'onlyMainContent' => true,
'includeTags' => [
'<string>'
],
'excludeTags' => [
'<string>'
],
'removeBase64Images' => true,
'blockAds' => true,
'includeLinks' => true,
'renderJs' => true,
'waitFor' => 15000,
'timeout' => 60500,
'location' => [
'country' => 'us',
'languages' => [
'en-US',
'en'
]
],
'headers' => [
],
'preferStructure' => true,
'maxAge' => 302400000
]
]),
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/crawl"
payload := strings.NewReader("{\n \"url\": \"https://example.com\",\n \"limit\": 100,\n \"maxDepth\": 2,\n \"includePaths\": [\n \"^/blog/.*\"\n ],\n \"excludePaths\": [\n \"^/tag/.*\"\n ],\n \"allowSubdomains\": false,\n \"allowExternalLinks\": false,\n \"ignoreQueryParameters\": false,\n \"sitemap\": \"include\",\n \"scrapeOptions\": {\n \"formats\": [\n \"markdown\"\n ],\n \"onlyMainContent\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"removeBase64Images\": true,\n \"blockAds\": true,\n \"includeLinks\": true,\n \"renderJs\": true,\n \"waitFor\": 15000,\n \"timeout\": 60500,\n \"location\": {\n \"country\": \"us\",\n \"languages\": [\n \"en-US\",\n \"en\"\n ]\n },\n \"headers\": {},\n \"preferStructure\": true,\n \"maxAge\": 302400000\n }\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/crawl")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com\",\n \"limit\": 100,\n \"maxDepth\": 2,\n \"includePaths\": [\n \"^/blog/.*\"\n ],\n \"excludePaths\": [\n \"^/tag/.*\"\n ],\n \"allowSubdomains\": false,\n \"allowExternalLinks\": false,\n \"ignoreQueryParameters\": false,\n \"sitemap\": \"include\",\n \"scrapeOptions\": {\n \"formats\": [\n \"markdown\"\n ],\n \"onlyMainContent\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"removeBase64Images\": true,\n \"blockAds\": true,\n \"includeLinks\": true,\n \"renderJs\": true,\n \"waitFor\": 15000,\n \"timeout\": 60500,\n \"location\": {\n \"country\": \"us\",\n \"languages\": [\n \"en-US\",\n \"en\"\n ]\n },\n \"headers\": {},\n \"preferStructure\": true,\n \"maxAge\": 302400000\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hydrafetch.com/v1/web/crawl")
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 \"limit\": 100,\n \"maxDepth\": 2,\n \"includePaths\": [\n \"^/blog/.*\"\n ],\n \"excludePaths\": [\n \"^/tag/.*\"\n ],\n \"allowSubdomains\": false,\n \"allowExternalLinks\": false,\n \"ignoreQueryParameters\": false,\n \"sitemap\": \"include\",\n \"scrapeOptions\": {\n \"formats\": [\n \"markdown\"\n ],\n \"onlyMainContent\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"removeBase64Images\": true,\n \"blockAds\": true,\n \"includeLinks\": true,\n \"renderJs\": true,\n \"waitFor\": 15000,\n \"timeout\": 60500,\n \"location\": {\n \"country\": \"us\",\n \"languages\": [\n \"en-US\",\n \"en\"\n ]\n },\n \"headers\": {},\n \"preferStructure\": true,\n \"maxAge\": 302400000\n }\n}"
response = http.request(request)
puts response.read_body{
"crawlId": "019f3c09-6fae-740f-9257-10c2b6af7f43",
"status": "queued"
}