Crawl a website
POST /v1/crawl starts at one page and follows the links of the same site, breadth first, until it reaches max_depth or max_pages. It runs in the background as a job: you get its id at once and fetch the pages as they are done – or let a webhook bring them.
Start a crawl
curl https://api.virginproxy.com/v1/crawl \
-H "Authorization: Bearer $VP_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://docs.virginproxy.com/",
"max_pages": 4,
"max_depth": 1,
"request": {
"format": "markdown",
"main_content": true
},
"tag": "docs-crawl"
}'import os, requests
r = requests.post(
"https://api.virginproxy.com/v1/crawl",
headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
json={
"url": "https://docs.virginproxy.com/",
"max_pages": 4,
"max_depth": 1,
"request": {"format": "markdown", "main_content": True},
"tag": "docs-crawl",
},
timeout=30,
)
data = r.json()
if not r.ok:
raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["id"], data["status"])const res = await fetch("https://api.virginproxy.com/v1/crawl", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
url: "https://docs.virginproxy.com/",
max_pages: 4,
max_depth: 1,
request: { format: "markdown", main_content: true },
tag: "docs-crawl",
}),
signal: AbortSignal.timeout(30_000),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error.code + ": " + data.error.message);
console.log(data.id, data.status);from virginproxy import VirginProxy # docs.virginproxy.com/sdk/virginproxy.py
vp = VirginProxy() # reads VP_KEY
data = vp.call("POST", "/v1/crawl", {
"url": "https://docs.virginproxy.com/",
"max_pages": 4,
"max_depth": 1,
"request": {"format": "markdown", "main_content": True},
"tag": "docs-crawl",
})
print(data)import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs
const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.crawl({
url: "https://docs.virginproxy.com/",
max_pages: 4,
max_depth: 1,
request: { format: "markdown", main_content: true },
tag: "docs-crawl",
});
console.log(data);<?php
$ch = curl_init("https://api.virginproxy.com/v1/crawl");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("VP_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"url" => "https://docs.virginproxy.com/",
"max_pages" => 4,
"max_depth" => 1,
"request" => ["format" => "markdown", "main_content" => true],
"tag" => "docs-crawl",
], JSON_UNESCAPED_SLASHES),
]);
$data = json_decode(curl_exec($ch), true);
if (isset($data["error"])) {
exit($data["error"]["code"] . ": " . $data["error"]["message"] . PHP_EOL);
}
echo $data["id"], " ", $data["status"], PHP_EOL;package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"time"
)
func main() {
payload := []byte(`{
"url": "https://docs.virginproxy.com/",
"max_pages": 4,
"max_depth": 1,
"request": {
"format": "markdown",
"main_content": true
},
"tag": "docs-crawl"
}`)
req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/crawl", bytes.NewReader(payload))
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("VP_KEY"))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 30 * time.Second}
res, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var data map[string]any
if err := json.NewDecoder(res.Body).Decode(&data); err != nil {
log.Fatal(err)
}
if res.StatusCode >= 300 {
e := data["error"].(map[string]any)
log.Fatalf("%v: %v", e["code"], e["message"])
}
fmt.Println(data["id"], data["status"])
}require "json"
require "net/http"
uri = URI("https://api.virginproxy.com/v1/crawl")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer " + ENV.fetch("VP_KEY")
req["Content-Type"] = "application/json"
req.body = JSON.generate({
"url" => "https://docs.virginproxy.com/",
"max_pages" => 4,
"max_depth" => 1,
"request" => { "format" => "markdown", "main_content" => true },
"tag" => "docs-crawl",
})
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 30) { |http| http.request(req) }
data = JSON.parse(res.body)
abort(data["error"]["code"] + ": " + data["error"]["message"]) unless res.is_a?(Net::HTTPSuccess)
puts [data["id"], data["status"]].join(" ")import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"url": "https://docs.virginproxy.com/",
"max_pages": 4,
"max_depth": 1,
"request": {
"format": "markdown",
"main_content": true
},
"tag": "docs-crawl"
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.virginproxy.com/v1/crawl"))
.header("Authorization", "Bearer " + System.getenv("VP_KEY"))
.header("Content-Type", "application/json")
.timeout(Duration.ofSeconds(30))
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
if (res.statusCode() >= 300) {
System.err.println(res.statusCode() + " " + res.body()); // the error object: code, message
System.exit(1);
}
System.out.println(res.body()); // JSON: read it with the JSON library of your choice
}
}using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("VP_KEY"));
var payload = """
{
"url": "https://docs.virginproxy.com/",
"max_pages": 4,
"max_depth": 1,
"request": {
"format": "markdown",
"main_content": true
},
"tag": "docs-crawl"
}
""";
var req = new HttpRequestMessage(HttpMethod.Post, "https://api.virginproxy.com/v1/crawl");
req.Content = new StringContent(payload, Encoding.UTF8, "application/json");
var res = await http.SendAsync(req);
using var data = JsonDocument.Parse(await res.Content.ReadAsStringAsync());
if (!res.IsSuccessStatusCode)
{
var e = data.RootElement.GetProperty("error");
Console.Error.WriteLine(e.GetProperty("code") + ": " + e.GetProperty("message"));
Environment.Exit(1);
}
Console.WriteLine(data.RootElement.GetProperty("id") + " " + data.RootElement.GetProperty("status"));/v1/crawlHTTP/2 202
{
"id": "job_RZ0SqikbW5KDPAbikfrL",
"status": "queued",
"total": 1,
"succeeded": 0,
"failed": 0,
"canceled": 0,
"pending": 1,
"credits": 0,
"tag": "docs-crawl",
"webhook": null,
"created_at": "2026-11-21T23:36:51.501Z",
"started_at": null,
"finished_at": null,
"expires_at": null,
"last_progress_at": null,
"kind": "crawl",
"crawl": {
"url": "https://docs.virginproxy.com/",
"max_pages": 4,
"max_depth": 1,
"include_paths": [],
"exclude_paths": [],
"include_subdomains": false,
"ignore_query": false
}
}total grows while the crawl finds pages. Everything else works as for every job: progress with GET /v1/jobs/{id}, cancel with DELETE, Idempotency-Key, the limit of open jobs.
Get the pages
curl https://api.virginproxy.com/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results \
-H "Authorization: Bearer $VP_KEY"import os, requests
r = requests.get(
"https://api.virginproxy.com/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results",
headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
timeout=30,
)
data = r.json()
if not r.ok:
raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["job"]["status"])
print(data["next_offset"])const res = await fetch("https://api.virginproxy.com/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results", {
headers: { Authorization: "Bearer " + process.env.VP_KEY },
signal: AbortSignal.timeout(30_000),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error.code + ": " + data.error.message);
console.log(data.job.status);
console.log(data.next_offset);from virginproxy import VirginProxy # docs.virginproxy.com/sdk/virginproxy.py
vp = VirginProxy() # reads VP_KEY
data = vp.call("GET", "/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results")
print(data)import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs
const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.call("GET", "/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results");
console.log(data);<?php
$ch = curl_init("https://api.virginproxy.com/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("VP_KEY"),
],
]);
$data = json_decode(curl_exec($ch), true);
if (isset($data["error"])) {
exit($data["error"]["code"] . ": " . $data["error"]["message"] . PHP_EOL);
}
echo $data["job"]["status"], PHP_EOL;
echo $data["next_offset"], PHP_EOL;package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"time"
)
func main() {
req, err := http.NewRequest("GET", "https://api.virginproxy.com/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("VP_KEY"))
client := &http.Client{Timeout: 30 * time.Second}
res, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var data map[string]any
if err := json.NewDecoder(res.Body).Decode(&data); err != nil {
log.Fatal(err)
}
if res.StatusCode >= 300 {
e := data["error"].(map[string]any)
log.Fatalf("%v: %v", e["code"], e["message"])
}
fmt.Println(data["job"].(map[string]any)["status"])
fmt.Println(data["next_offset"])
}require "json"
require "net/http"
uri = URI("https://api.virginproxy.com/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer " + ENV.fetch("VP_KEY")
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 30) { |http| http.request(req) }
data = JSON.parse(res.body)
abort(data["error"]["code"] + ": " + data["error"]["message"]) unless res.is_a?(Net::HTTPSuccess)
puts data["job"]["status"]
puts data["next_offset"]import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.virginproxy.com/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results"))
.header("Authorization", "Bearer " + System.getenv("VP_KEY"))
.timeout(Duration.ofSeconds(30))
.GET()
.build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
if (res.statusCode() >= 300) {
System.err.println(res.statusCode() + " " + res.body()); // the error object: code, message
System.exit(1);
}
System.out.println(res.body()); // JSON: read it with the JSON library of your choice
}
}using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("VP_KEY"));
var req = new HttpRequestMessage(HttpMethod.Get, "https://api.virginproxy.com/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results");
var res = await http.SendAsync(req);
using var data = JsonDocument.Parse(await res.Content.ReadAsStringAsync());
if (!res.IsSuccessStatusCode)
{
var e = data.RootElement.GetProperty("error");
Console.Error.WriteLine(e.GetProperty("code") + ": " + e.GetProperty("message"));
Environment.Exit(1);
}
Console.WriteLine(data.RootElement.GetProperty("job").GetProperty("status"));
Console.WriteLine(data.RootElement.GetProperty("next_offset"));/v1/jobs/job_RZ0SqikbW5KDPAbikfrL/results{
"job": { "id": "job_RZ0SqikbW5KDPAbikfrL", "status": "done", "total": 4, "succeeded": 4, "credits": 4, "kind": "crawl" },
"items": [
{ "index": 0, "status": "succeeded", "url": "https://docs.virginproxy.com/", "depth": 0, "credits": 1,
"response": { "status": 200, "format": "markdown", "body": "# Fetch any page from a clean IP …" } },
{ "index": 1, "status": "succeeded", "url": "https://docs.virginproxy.com/requests/", "depth": 1, "credits": 1,
"response": { "status": 200, "format": "markdown", "body": "# Make a request …" } }
],
"next_offset": null
}Each item has the url it read, its depth (links away from the start page) and the response exactly as POST /v1/requests would give it. Results are kept 24 hours after the crawl ends; page through them with offset.
Options
| Field | Default | Meaning |
|---|---|---|
max_credits | – | Cost cap of the whole crawl: once it used that many credits, pages not started end as job_budget_reached (not charged). |
robots | "ignore" | "respect": pages the site's robots.txt disallows are not read. Reading robots.txt costs 1 credit. |
url | required | The start page. |
max_pages | 100 or the plan limit | Pages at most, start page included: up to your plan's crawl limit (10, 100, 500, 1,000 on Free, Starter, Growth, Scale). |
max_depth | 2 | Links away from the start page, 0 to 10. 0 reads only the start page. |
include_paths | [] | Follow only paths that match one of these patterns (up to 20). |
exclude_paths | [] | Never follow paths that match one of these patterns (up to 20). |
include_subdomains | false | Also follow links to subdomains of the start host. |
ignore_query | false | Treat /list?page=2 and /list?page=3 as the same page. |
request | {} | Options for every page, as for POST /v1/requests – format, render, extract, parse, max_credits … – without url, method and body. |
webhook | – | Where to send results, as for jobs. |
tag | – | Tag for the crawl and every page in it. |
delivery | – | Write the pages into your own storage when the crawl ends, see Delivery. |
only_changed | false | Only pages that changed since they were last read (see below). |
Path patterns
Patterns match the whole path of an address, without host and query. * matches any characters except /, ** matches anything.
| Pattern | Matches | Does not match |
|---|---|---|
/blog/** | /blog/, /blog/2026/post | /blogroll |
/p/* | /p/123 | /p/123/reviews |
/**/reviews | /p/123/reviews | /reviews/all |
The start page is always read. Links to files that are not pages (images, PDFs, archives, scripts, stylesheets, feeds) are not followed.
Links and parse
The crawl reads the links of every page it may go deeper from. They are in the result only if you ask for them with "parse": ["links"] in request – otherwise parsed stays as you asked.
Only what changed: only_changed
"only_changed": true reads every page as usual but compares it with the last time that page was read (track_changes): pages whose content is the same are left out of the results, the export, the stream, deliveries and item webhooks. Made for crawls that run on a schedule: each run hands on only what is new or different. Every page is still read and charged.
What it costs
Every page is one ordinary request with the options in request: 1 credit per started MB, 10 or more with render. A crawl of 100 plain pages costs about 100 credits. Pages that do not answer are not charged. Check the worst case beforehand with POST /v1/estimate, and set max_credits in request to bound each page.
Note
A crawl follows what the pages link to. Respect the site's terms and keep the load reasonable: max_pages and your plan's parallel requests set the pace, exclude_paths keeps it away from pages you do not need.
Was this page helpful?
Last updated