Get an API key Your API keys

Parameter reference

All 83 parameters of POST /v1/requests and POST /v1/jobs in one table. Dotted names are fields inside an object: retry.times is "retry": {"times": 2}, extract.*.type is the type of any field in extract.

Build a request

Choose an endpoint and the most common options, then copy the code in your language, open the request in the Playground or copy a cost estimate. Nothing is sent from this page; the key stays the placeholder $VP_KEY.

Endpoint
Options

Copies a cURL call to POST /v1/estimate with this body: it checks the request and returns the least and the most it can cost, without running it.

curl https://api.virginproxy.com/v1/requests \
  -H "Authorization: Bearer $VP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://httpbin.org/ip"
  }'
import os, requests

r = requests.post(
    "https://api.virginproxy.com/v1/requests",
    headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
    json={"url": "https://httpbin.org/ip"},
    timeout=180,
)
data = r.json()
if not r.ok:
    raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["status"], data["cost"]["credits"])
const res = await fetch("https://api.virginproxy.com/v1/requests", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ url: "https://httpbin.org/ip" }),
  signal: AbortSignal.timeout(180_000),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error.code + ": " + data.error.message);
console.log(data.status, data.cost.credits);
from virginproxy import VirginProxy  # docs.virginproxy.com/sdk/virginproxy.py

vp = VirginProxy()  # reads VP_KEY
data = vp.request({"url": "https://httpbin.org/ip"})
print(data)
import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs

const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.request({ url: "https://httpbin.org/ip" });
console.log(data);
<?php
$ch = curl_init("https://api.virginproxy.com/v1/requests");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 180,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("VP_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode(["url" => "https://httpbin.org/ip"], 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["status"], " ", $data["cost"]["credits"], PHP_EOL;
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"os"
	"time"
)

func main() {
	payload := []byte(`{
  "url": "https://httpbin.org/ip"
}`)
	req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/requests", 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: 180 * 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["status"], data["cost"].(map[string]any)["credits"])
}
require "json"
require "net/http"

uri = URI("https://api.virginproxy.com/v1/requests")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer " + ENV.fetch("VP_KEY")
req["Content-Type"] = "application/json"
req.body = JSON.generate({ "url" => "https://httpbin.org/ip" })

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 180) { |http| http.request(req) }
data = JSON.parse(res.body)
abort(data["error"]["code"] + ": " + data["error"]["message"]) unless res.is_a?(Net::HTTPSuccess)
puts [data["status"], data["cost"]["credits"]].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://httpbin.org/ip"
            }
            """;
        HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.virginproxy.com/v1/requests"))
            .header("Authorization", "Bearer " + System.getenv("VP_KEY"))
            .header("Content-Type", "application/json")
            .timeout(Duration.ofSeconds(180))
            .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(180) };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("VP_KEY"));
var payload = """
    {
      "url": "https://httpbin.org/ip"
    }
    """;
var req = new HttpRequestMessage(HttpMethod.Post, "https://api.virginproxy.com/v1/requests");
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("status") + " " + data.RootElement.GetProperty("cost").GetProperty("credits"));

All parameters

83 parameters

ParameterTypeDefaultDescription
Target and method
urlstringrequiredAbsolute http or https URL, up to 8,000 characters. Credentials inside the URL are rejected.
methodstring"GET"GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS. With render only GET.
paramsobject–Query parameters added to the URL. Values are strings, numbers, booleans or lists of them. At most 500 values.
Browser and language
browserstring"chrome"Which browser the request looks like: chrome, chrome_mac, chrome_android, edge, firefox, safari, safari_ios or none. With render the default is chrome_android.
localestring"de-DE"Language of the visitor. Sets Accept-Language, and the browser language when rendering.
headersobject–Headers for the target, at most 100. They replace the browser's headers of the same name; an empty value leaves that header out.
Cookies and body
cookiesobject | list–{"name": "value"} or a list of {"name", "value", "domain"?, "path"?}. At most 200.
jsonany JSON–Body sent as JSON. Sets Content-Type: application/json unless you send your own.
formobject–Body sent as an HTML form (application/x-www-form-urlencoded).
bodystring–Body sent exactly as given, up to 5 MB. Set your own Content-Type.
body_encodingstring"utf8""base64" when body is base64-encoded binary data.
IP and session
sessionstring–A name of your choice. Requests with the same name leave through the same IP for up to 10 minutes and share their cookies.
fresh_ipbooleanfalseGet a new IP address before the request. 5 extra credits. Not with session.
ip_versionstring"4""4", "6" or "auto".
Redirects, time and retries
follow_redirectsbooleantrueFollow redirects. false returns the redirect response itself.
max_redirectsinteger50 to 10. More redirects end with too_many_redirects.
timeout_msintegerplan timeoutHow long one attempt may take, at least 1000, at most your plan's timeout (30 to 120 seconds).
retryobject–Try again before answering when the target refuses or fails. {} uses all defaults.
retry.timesinteger1How many more attempts at most: 0 to 3.
retry.onlist[403, 429, 503, "timeout", "connection_failed"]Statuses 300–599 and the errors timeout, connection_failed, target_unreachable, tls_error, text_match, selector_missing. At most 20.
retry.fresh_ipbooleanfalseA new IP before each further attempt (5 credits each).
retry.if_textlist–Up to 10 texts (each up to 200 characters, case ignored). An answer whose body contains one of them is tried again.
retry.if_missingstring–A CSS selector. An HTML answer in which it finds nothing is tried again.
Rendering
renderboolean | object | "auto"falseLoad the page in a real browser and return it after its scripts ran. 9 extra credits. "auto": first without a browser, with it only when the page needs it – the browser part is charged only then.
render_optionsobject–Only with "render": "auto": the browser settings for the second try (the options of render, without screenshot, PDF, steps, capture).
render.wait_untilstring"load"load, domcontentloaded or networkidle.
render.wait_forstring–CSS selector to wait for until it is visible.
render.wait_msinteger00 to 15,000 milliseconds to wait at the end.
render.scrollinteger0Scroll to the bottom 0 to 20 times.
render.screenshotboolean | objectfalseScreenshot of the visible area, the full page or one element; PNG, JPEG or WebP.
render.pdfbooleanfalseAlso return the page as a PDF.
render.blocklist["image", "media", "font"]Resource types the browser does not load: image, media, font, stylesheet.
render.block_urlslist[]Up to 50 address patterns the browser does not load.
render.capturelist[]Up to 10 address patterns; matching background requests come back in captured.
render.actionslist[]Up to 30 steps: click, type, press, hover, select, scroll, wait, evaluate, goto.
render.timezonestring"Europe/Berlin"IANA time zone the page sees.
render.geolocationobject–{"latitude", "longitude", "accuracy"} reported by navigator.geolocation.
render.viewportobjectby browser{"width", "height", "scale"}: screen size and pixel density.
render.color_schemestring"light""light" or "dark" for prefers-color-scheme.
render.reduced_motionbooleanfalseReport prefers-reduced-motion: reduce.
render.cpu_coresintegerby browser1 to 64: navigator.hardwareConcurrency.
render.memory_gbnumberby browser0.25 to 8: navigator.deviceMemory.
render.javascriptbooleantruefalse loads the page without running its scripts.
render.local_storageobject–Up to 100 entries put into localStorage before the page's scripts run.
render.session_storageobject–The same for sessionStorage.
render.tracebooleanfalseA small picture after every step and at the end, with the page's console messages, in trace: to see where a sequence of steps went wrong.
Output
formatstring"raw"raw, markdown, text or clean_html. Converts an HTML answer before it is returned.
main_contentbooleanfalseKeep only the main content of the page (without navigation, header, footer, sidebars and forms) before converting.
format_optionsobject–With format: include_selector (keep only this part), exclude_selector (leave this out), images and links (false drops them), max_pages (documents, 1–500, default 100).
redactlist | true–Black out personal data in the text you get: email, phone, iban, card, ip; true for all. Counted in redacted.
auto_extractstring–Read a standard record without selectors: product, article, job, review_list, recipe, event, organization. Result in auto_extracted.
parselist | true–Standard records product, article, organization, breadcrumbs come from the page's structured data. Read out metadata, links, images, headings, emails, phones, tables, json_ld; true for all. Result in parsed.
extractobject–Up to 50 named fields read from the answer with CSS, XPath or JSON paths. Result in extracted.
extract.*.selectorstring–CSS selector, up to 500 characters. Exactly one of selector, xpath, json.
extract.*.xpathstring–XPath expression, up to 500 characters.
extract.*.jsonstring–Path into a JSON answer such as data.items[*].name.
extract.*.attrstring"text"text, html, outer_html or an attribute name such as href.
extract.*.allbooleanfalseA list of all matches (up to 1,000) instead of the first.
extract.*.typestring"string"string, number, integer or boolean.
extract.*.regexstring–Regular expression applied to the value; the first group, otherwise the whole match.
extract.*.defaultanynullReturned when nothing matched.
extract.*.fieldsobject–Sub-fields read relative to each match: objects, or a list of objects with all. Up to 3 levels.
Connection
http_versionstring"auto""auto" or "1.1". Only without render.
insecurebooleanfalseAccept invalid TLS certificates of the target.
Cost and tracking
max_creditsinteger–1 to 1,000. The request never costs more; the answer is cut to fit.
tagstring–1 to 64 characters A–Z a–z 0–9 _ . : / -. Stored with the request, returned in the answer, filterable.
echoany JSON–Up to 2 KB of your own data, returned unchanged as echo. Useful to match results to your records.
Reuse and watch
cachetrue | object–Keep the answer and give it again to the same request within max_age_s (60 to 604,800 seconds; true = one hour): free, at once, marked "cached": true. Off unless you send it.
track_changestrue | object–Compare with your last request of the same page: change.status is new, same or changed. {"on": "extracted"} compares what was read, {"diff": true} names the changed lines.
presetstring–Use the options saved under this name (POST /v1/presets); options you send win.
Jobs (POST /v1/jobs)
requestslist–The requests of the job: 1 to your plan's limit (10, 100, 500 or 1,000). Each is a request body as for POST /v1/requests.
requestobject–A single request instead of requests.
urlslist–Addresses instead of requests; each is sent with the options in defaults.
defaultsobject–With urls: the options for every address (as for POST /v1/requests, without url).
max_creditsinteger–Cost cap of the whole job: once it used that many credits, requests not started end as job_budget_reached.
webhookobject–{"url", "events"}: where to send the results.
webhook.urlstring–A public https:// address.
webhook.eventslist["done"]item (each finished request), item.succeeded, item.failed, item.changed (only pages that changed, with track_changes) and/or done (the whole job).
webhook.include_bodybooleantruefalse: item events carry the figures and id, not the page – fetch it from the results.
webhook.metadataobject–Up to 1 KB of your own data, sent back in every webhook call of the job.
deliveryobject–Write the results into your own storage when the job ends: {"destination": "dst_…", "format": "ndjson"|"json"|"csv", "path": "{date}/{job_id}.ndjson"}.
Idempotency-Keyheader–The same key within 24 hours returns the same job instead of creating a second one.

Note

A dotted name is never sent as a key with a dot. Write the object: {"retry": {"if_text": ["Please try again"]}}. The { } button next to a name copies it in that form, with its default value.

Was this page helpful?

Last updated